From 37ff32e93447035553e0732f90683b1ee9e70f6c Mon Sep 17 00:00:00 2001 From: Lu Zhen Date: Tue, 16 Jan 2024 14:36:30 +0800 Subject: [PATCH] refactor: clean service interface Log: Change-Id: I445e699fc87a953c822e9436cc97e73730efe190 --- .../mainframe/naveditmainwindow.cpp | 1 - src/plugins/core/mainframe/windowkeeper.cpp | 9 ++++- .../recent/mainframe/recentdisplay.cpp | 2 +- src/plugins/symbol/symbol.cpp | 1 - src/services/CMakeLists.txt | 1 - src/services/symbol/symbolservice.h | 39 ------------------- src/services/window/windowelement.h | 26 +++++-------- 7 files changed, 18 insertions(+), 61 deletions(-) delete mode 100644 src/services/symbol/symbolservice.h diff --git a/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp b/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp index 0d8dea077..dec33be8e 100644 --- a/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp +++ b/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp @@ -6,7 +6,6 @@ #include "base/abstractwidget.h" #include "services/window/windowservice.h" #include "services/project/projectservice.h" -#include "services/symbol/symbolservice.h" #include "transceiver/codeeditorreceiver.h" #include "common/common.h" diff --git a/src/plugins/core/mainframe/windowkeeper.cpp b/src/plugins/core/mainframe/windowkeeper.cpp index 7cd5d6b61..42ebe3e8e 100644 --- a/src/plugins/core/mainframe/windowkeeper.cpp +++ b/src/plugins/core/mainframe/windowkeeper.cpp @@ -33,6 +33,13 @@ #include #include +// MW = MainWindow +inline constexpr int MW_WIDTH { 1280 }; +inline constexpr int MW_HEIGHT { 860 }; + +inline constexpr int MW_MIN_WIDTH { 1280 }; +inline constexpr int MW_MIN_HEIGHT { 600 }; + static WindowKeeper *ins { nullptr }; using namespace dpfservice; class WindowKeeperPrivate @@ -616,7 +623,7 @@ void WindowKeeper::addTopToolBar(const QString &name, QAction *action, const QSt void WindowKeeper::openFileDialog() { QString dir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); - QString filePath = DFileDialog::getOpenFileName(nullptr, DIALOG_OPEN_DOCUMENT_TITLE, dir); + QString filePath = DFileDialog::getOpenFileName(nullptr, tr("Open Document"), dir); if (filePath.isEmpty() && !QFileInfo(filePath).exists()) return; recent.saveOpenedFile(filePath); diff --git a/src/plugins/recent/mainframe/recentdisplay.cpp b/src/plugins/recent/mainframe/recentdisplay.cpp index a536d4cbf..f27267bc6 100644 --- a/src/plugins/recent/mainframe/recentdisplay.cpp +++ b/src/plugins/recent/mainframe/recentdisplay.cpp @@ -276,7 +276,7 @@ void RecentDisplay::doDoubleCliekedDocument(const QModelIndex &index) void RecentDisplay::btnOpenFileClicked() { QString dir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); - QString filePath = DFileDialog::getOpenFileName(nullptr, dpfservice::DIALOG_OPEN_DOCUMENT_TITLE, dir); + QString filePath = DFileDialog::getOpenFileName(nullptr, tr("Open Document"), dir); if (filePath.isEmpty() && !QFileInfo(filePath).exists()) return; recent.saveOpenedFile(filePath); diff --git a/src/plugins/symbol/symbol.cpp b/src/plugins/symbol/symbol.cpp index aeeec7af8..0385ccbd5 100644 --- a/src/plugins/symbol/symbol.cpp +++ b/src/plugins/symbol/symbol.cpp @@ -10,7 +10,6 @@ #include "base/abstractaction.h" #include "base/abstractwidget.h" #include "services/window/windowservice.h" -#include "services/symbol/symbolservice.h" #include #include diff --git a/src/services/CMakeLists.txt b/src/services/CMakeLists.txt index ba47e4fb4..0cadb136d 100644 --- a/src/services/CMakeLists.txt +++ b/src/services/CMakeLists.txt @@ -35,7 +35,6 @@ set(CXX_H builder/ioutputparser.cpp language/languagegenerator.h language/languageservice.h - symbol/symbolservice.h editor/editorservice.h terminal/terminalservice.h ) diff --git a/src/services/symbol/symbolservice.h b/src/services/symbol/symbolservice.h deleted file mode 100644 index e7e279491..000000000 --- a/src/services/symbol/symbolservice.h +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. -// -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef SYMBOLSERVICE_H -#define SYMBOLSERVICE_H - -#include - -#include - -namespace dpfservice { - -class SymbolService final : public dpf::PluginService, - dpf::AutoServiceRegister -{ - Q_OBJECT - Q_DISABLE_COPY(SymbolService) -public: - static QString name() - { - return "org.deepin.service.SymbolService"; - } - - explicit SymbolService(QObject *parent = nullptr) - : dpf::PluginService (parent) - { - - } -}; - -/* MainWindow codeediter workspace title, - * use in window service swtich workspace - */ -inline const QString MWCWT_SYMBOL {QTabWidget::tr("Symbol")}; - -} //namespace dpfservice - -#endif // SYMBOLSERVICE_H diff --git a/src/services/window/windowelement.h b/src/services/window/windowelement.h index 51745c4b1..3eac5cba0 100644 --- a/src/services/window/windowelement.h +++ b/src/services/window/windowelement.h @@ -11,15 +11,9 @@ #include // window display elements -// MW = MainWindow namespace dpfservice { -inline const int MW_WIDTH { 1280 }; -inline const int MW_HEIGHT { 860 }; - -inline const int MW_MIN_WIDTH { 1280 }; -inline const int MW_MIN_HEIGHT { 600 }; - +// MWNA = MainWindow Navigation inline const QString MWNA_RECENT { QObject::tr("Recent") }; inline const QString MWNA_EDIT { QObject::tr("Edit") }; inline const QString MWNA_DEBUG { QObject::tr("Debug") }; @@ -28,6 +22,8 @@ inline const QString MWNA_SVN { QObject::tr("Svn") }; inline const QString MWNA_RUNTIME { QObject::tr("Runtime") }; inline const QString MWNA_CODEGEEX { QObject::tr("CodeGeeX") }; +// MWM = MW menu +// MWMFA = MWM File Action inline const QString MWM_FILE { QMenu::tr("&File") }; inline const QString MWMFA_CXX { "C/C++" }; inline const QString MWMFA_JAVA { "Java" }; @@ -42,12 +38,14 @@ inline const QString MWMFA_OPEN_RECENT_FOLDER { QAction::tr("Open Recent Folders inline const QString MWMFA_NEW_FILE_OR_PROJECT { QAction::tr("New File or Project") }; inline const QString MWMFA_QUIT { QAction::tr("Quit") }; +// MWMBA = MWM Build Action inline const QString MWM_BUILD { QMenu::tr("&Build") }; inline const QString MWMBA_BUILD { QAction::tr("Build") }; inline const QString MWMBA_REBUILD { QAction::tr("Rebuild") }; inline const QString MWMBA_CLEAN { QAction::tr("Clean") }; inline const QString MWMBA_CANCEL { QAction::tr("Cancel") }; +// MWMDA = MWM Debug Action inline const QString MWM_DEBUG { QMenu::tr("&Debug") }; inline const QString MWMDA_START_DEBUG { QAction::tr("Start Debugging") }; inline const QString MWMDA_RUNNING { QAction::tr("Running") }; @@ -59,18 +57,10 @@ inline const QString MWMDA_STEP_OVER { QAction::tr("Step Over") }; inline const QString MWMDA_STEP_IN { QAction::tr("Step In") }; inline const QString MWMDA_STEP_OUT { QAction::tr("Step Out") }; +// MWMTA = MWM Tool Action inline const QString MWM_TOOLS { QMenu::tr("&Tools") }; inline const QString MWMTA_SEARCH { QAction::tr("Search") }; -inline const QString MWMTA_PACKAGE_TOOLS { QAction::tr("Package Tools") }; -inline const QString MWMTA_VERSION_TOOLS { QAction::tr("Version Tools") }; -inline const QString MWMTA_CODE_FORMATTING { QAction::tr("Code Formatting") }; -inline const QString MWMTA_RUNTIME_ANALYSIS { QAction::tr("Runtime Analysis") }; -inline const QString MWMTA_TEST { QAction::tr("Test") }; -inline const QString MWMTA_PLUGINS { QAction::tr("Plugins") }; inline const QString MWMTA_OPTIONS { QAction::tr("Options") }; -inline const QString MWMTM_SWITCH_LANGUAGE { QMenu::tr("Switch language") }; -inline const QString MWMTA_ENGLISH { QAction::tr("English") }; -inline const QString MWMTA_CHINESE { QAction::tr("Chinese") }; inline const QString MWMTA_USR_ACTION_ANALYZE { QAction::tr("User Action Analyse")}; inline const QString MWMTA_BINARY_TOOLS { QAction::tr("Binary Tools")}; inline const QString MWMTA_VALGRIND_MEMCHECK { QAction::tr("Valgrind Memcheck")}; @@ -81,8 +71,10 @@ inline const QString MWM_REPORT_BUG { QAction::tr("Report Bug") }; inline const QString MWM_HELP_DOCUMENTS { QAction::tr("Help Documents") }; inline const QString MWM_ABOUT_PLUGINS { QAction::tr("About Plugins")}; -inline const QString DIALOG_OPEN_DOCUMENT_TITLE { QDialog::tr("Open Document") }; +// Others inline const QString CONSOLE_TAB_TEXT { QTabWidget::tr("&Console") }; +// MWCWT = MW CodeEditor Window Title +inline const QString MWCWT_SYMBOL {QTabWidget::tr("Symbol")}; } // namespace dpfservice