Skip to content

Commit

Permalink
refactor: clean service interface
Browse files Browse the repository at this point in the history
Log:
Change-Id: I445e699fc87a953c822e9436cc97e73730efe190
  • Loading branch information
deepin-mozart committed Jan 16, 2024
1 parent 54da5b7 commit 37ff32e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 61 deletions.
1 change: 0 additions & 1 deletion src/plugins/codeeditor/mainframe/naveditmainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
9 changes: 8 additions & 1 deletion src/plugins/core/mainframe/windowkeeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
#include <QStandardPaths>
#include <QShortcut>

// 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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/recent/mainframe/recentdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/plugins/symbol/symbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "base/abstractaction.h"
#include "base/abstractwidget.h"
#include "services/window/windowservice.h"
#include "services/symbol/symbolservice.h"
#include <DTreeView>

#include <QProcess>
Expand Down
1 change: 0 additions & 1 deletion src/services/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
39 changes: 0 additions & 39 deletions src/services/symbol/symbolservice.h

This file was deleted.

26 changes: 9 additions & 17 deletions src/services/window/windowelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@
#include <QTabWidget>

// 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") };
Expand All @@ -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" };
Expand All @@ -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") };
Expand All @@ -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")};
Expand All @@ -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

Expand Down

0 comments on commit 37ff32e

Please sign in to comment.