From 871fede7161bea2b07bdebbc8babbdfa2ee6461f Mon Sep 17 00:00:00 2001 From: HeXiaodong Date: Tue, 21 Nov 2023 11:07:52 +0800 Subject: [PATCH] feat: DTK Changed-ToolBar and fix some bugs DTK Changed-ToolBar and fix some bugs. --- src/plugins/codeeditor/codeeditor.cpp | 1 + .../mainframe/naveditmainwindow.cpp | 33 ++- .../codeeditor/mainframe/naveditmainwindow.h | 5 +- .../transceiver/codeeditorreceiver.cpp | 1 - src/plugins/collaborators/collaborators.cpp | 10 +- src/plugins/core/core.qrc | 6 +- src/plugins/core/mainframe/aboutdialog.cpp | 1 - src/plugins/core/mainframe/plugindialog.cpp | 1 - src/plugins/core/mainframe/windowkeeper.cpp | 223 +++++++++--------- src/plugins/core/mainframe/windowkeeper.h | 8 +- src/plugins/template/wizard/maindialog.cpp | 1 - src/services/window/windowelement.h | 12 +- src/services/window/windowservice.h | 4 +- 13 files changed, 155 insertions(+), 151 deletions(-) diff --git a/src/plugins/codeeditor/codeeditor.cpp b/src/plugins/codeeditor/codeeditor.cpp index 21e40b847..37ac0b270 100644 --- a/src/plugins/codeeditor/codeeditor.cpp +++ b/src/plugins/codeeditor/codeeditor.cpp @@ -63,6 +63,7 @@ bool CodeEditor::start() if (windowService) { NavEditMainWindow *navEditWindow = NavEditMainWindow::instance(); navEditWindow->setWidgetEdit(new AbstractCentral(editManager)); + windowService->setTopToolBarWidget(new AbstractWidget(navEditWindow->getTopToolBarWidget())); windowService->addCentralNavigation(MWNA_EDIT, new AbstractCentral(navEditWindow)); if (!windowService->addWidgetWorkspace) { diff --git a/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp b/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp index 0629dabcc..713ddb0f3 100644 --- a/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp +++ b/src/plugins/codeeditor/mainframe/naveditmainwindow.cpp @@ -64,10 +64,6 @@ NavEditMainWindow::NavEditMainWindow(QWidget *parent, Qt::WindowFlags flags) windowService->setToolBarItemDisable = std::bind(&NavEditMainWindow::setToolBarItemDisable, this, _1, _2); } - if (!windowService->getEditToolBar) { - windowService->getEditToolBar = std::bind(&NavEditMainWindow::getEditToolBar, this); - } - QObject::connect(EditorCallProxy::instance(), &EditorCallProxy::toSwitchContext, this, &NavEditMainWindow::switchWidgetContext); @@ -83,6 +79,10 @@ NavEditMainWindow::NavEditMainWindow(QWidget *parent, Qt::WindowFlags flags) mainToolBar = new ToolBarManager(tr("toolbar")); titlebar()->setFixedHeight(0); + + topToolBarWidget = new DWidget(); + QHBoxLayout *toolBarLayout = new QHBoxLayout(topToolBarWidget); + toolBarLayout->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); } NavEditMainWindow::~NavEditMainWindow() @@ -286,6 +286,9 @@ void NavEditMainWindow::showValgrindBar() bool NavEditMainWindow::addToolBarActionItem(const QString &id, QAction *action, const QString &group) { QMutexLocker locker(&mutex); + + setToolBarButton(action); + if (!mainToolBar) return false; @@ -298,7 +301,22 @@ bool NavEditMainWindow::addToolBarWidgetItem(const QString &id, AbstractWidget * if (!mainToolBar) return false; - return mainToolBar->addWidgetItem(id, static_cast(widget->qWidget()), group); + return mainToolBar->addWidgetItem(id, static_cast(widget->qWidget()), group); +} + +void NavEditMainWindow::setToolBarButton(QAction *action) +{ + if (!action) + return; + DIconButton *iconBtn = new DIconButton(); + iconBtn->setIcon(action->icon()); + iconBtn->setMinimumSize(QSize(36, 36)); + iconBtn->setIconSize(QSize(20, 20)); + connect(iconBtn, &DIconButton::clicked, action, &QAction::triggered); + + QHBoxLayout *toolBarLayout = static_cast(topToolBarWidget->layout()); + toolBarLayout->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); + toolBarLayout->addWidget(iconBtn); } void NavEditMainWindow::removeToolBarItem(const QString &id) @@ -324,8 +342,7 @@ void NavEditMainWindow::adjustWorkspaceItemOrder() } } -DWidget *NavEditMainWindow::getEditToolBar() +DWidget *NavEditMainWindow::getTopToolBarWidget() { - DWidget *toolBar = static_cast(mainToolBar->getToolBar()); - return toolBar; + return topToolBarWidget; } diff --git a/src/plugins/codeeditor/mainframe/naveditmainwindow.h b/src/plugins/codeeditor/mainframe/naveditmainwindow.h index 52db04f15..61e9bd15e 100644 --- a/src/plugins/codeeditor/mainframe/naveditmainwindow.h +++ b/src/plugins/codeeditor/mainframe/naveditmainwindow.h @@ -39,6 +39,8 @@ class NavEditMainWindow : public DMainWindow ToolBarManager *mainToolBar{nullptr}; QList contextList; QMutex mutex; + + DWidget *topToolBarWidget{nullptr}; public: static NavEditMainWindow *instance(); explicit NavEditMainWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); @@ -60,11 +62,12 @@ class NavEditMainWindow : public DMainWindow void addValgrindBar(AbstractWidget *valgrindbar); void showValgrindBar(); bool addToolBarActionItem(const QString &id, QAction *action, const QString &group); + void setToolBarButton(QAction *action); bool addToolBarWidgetItem(const QString &id, AbstractWidget *widget, const QString &group); void removeToolBarItem(const QString &id); void setToolBarItemDisable(const QString &id, bool disable); - DWidget *getEditToolBar(); + DWidget *getTopToolBarWidget(); private: void adjustWorkspaceItemOrder(); }; diff --git a/src/plugins/codeeditor/transceiver/codeeditorreceiver.cpp b/src/plugins/codeeditor/transceiver/codeeditorreceiver.cpp index 980965446..546d465f3 100644 --- a/src/plugins/codeeditor/transceiver/codeeditorreceiver.cpp +++ b/src/plugins/codeeditor/transceiver/codeeditorreceiver.cpp @@ -41,7 +41,6 @@ void CodeEditorReceiver::eventProcess(const dpf::Event &event) }else if (event.data() == editor.cleanRunning.name) { return EditorCallProxy::instance()->toRunClean(); } else if (event.data() == editor.openFile.name) { - navigation.doSwitch(dpfservice::MWNA_EDIT); using namespace support_file; QString filePath = event.property(editor.openFile.pKeys[0]).toString(); QString language = Language::idAlias(Language::id(filePath)); diff --git a/src/plugins/collaborators/collaborators.cpp b/src/plugins/collaborators/collaborators.cpp index 37dc62b93..90847b3b5 100644 --- a/src/plugins/collaborators/collaborators.cpp +++ b/src/plugins/collaborators/collaborators.cpp @@ -20,14 +20,14 @@ bool Collaborators::start() auto &ctx = dpfInstance.serviceContext(); WindowService *windowService = ctx.service(WindowService::name()); if (windowService) { - if (windowService->addActionNavigation) { - windowService->addActionNavigation("Git", new AbstractAction(new QAction(QIcon::fromTheme("git"), QAction::tr("Git")))); - windowService->addActionNavigation("Svn", new AbstractAction(new QAction(QIcon::fromTheme("svn"), QAction::tr("Svn")))); + if (windowService->addNavigation) { + windowService->addNavigation(MWNA_GIT, "git"); + windowService->addNavigation(MWNA_SVN, "svn"); } if (windowService->addCentralNavigation) { - windowService->addCentralNavigation("Git", + windowService->addCentralNavigation(MWNA_GIT, new AbstractCentral(CVSkeeper::instance()->gitMainWidget())); - windowService->addCentralNavigation("Svn", + windowService->addCentralNavigation(MWNA_SVN, new AbstractCentral(CVSkeeper::instance()->svnMainWidget())); } } diff --git a/src/plugins/core/core.qrc b/src/plugins/core/core.qrc index 37e9a1573..54c942f0e 100644 --- a/src/plugins/core/core.qrc +++ b/src/plugins/core/core.qrc @@ -68,11 +68,7 @@ images/open_file.png images/open_project.png images/reverse.png - images/down_arrow.png - images/recent.svg - images/svn.svg - images/edit.svg - images/git.svg + images/down_arrow.png builtin/actions/recent_20px.svg diff --git a/src/plugins/core/mainframe/aboutdialog.cpp b/src/plugins/core/mainframe/aboutdialog.cpp index 2726a70d6..8855e6a8d 100644 --- a/src/plugins/core/mainframe/aboutdialog.cpp +++ b/src/plugins/core/mainframe/aboutdialog.cpp @@ -34,7 +34,6 @@ AboutDialog::~AboutDialog() void AboutDialog::setupUi() { DTitlebar *titleBar = new DTitlebar(); - titleBar = new DTitlebar(); titleBar->setMenuVisible(false); titleBar->setTitle(QString(tr("About Deepin Union Code"))); diff --git a/src/plugins/core/mainframe/plugindialog.cpp b/src/plugins/core/mainframe/plugindialog.cpp index 3e24a2fa2..ef4f62253 100644 --- a/src/plugins/core/mainframe/plugindialog.cpp +++ b/src/plugins/core/mainframe/plugindialog.cpp @@ -24,7 +24,6 @@ PluginDialog::PluginDialog(QWidget *parent) resize(1000, 600); DTitlebar *titleBar = new DTitlebar(); - titleBar = new DTitlebar(); titleBar->setMenuVisible(false); titleBar->setTitle(QString(tr("Installed Plugins"))); diff --git a/src/plugins/core/mainframe/windowkeeper.cpp b/src/plugins/core/mainframe/windowkeeper.cpp index c6cdbaa77..8be75295e 100644 --- a/src/plugins/core/mainframe/windowkeeper.cpp +++ b/src/plugins/core/mainframe/windowkeeper.cpp @@ -17,9 +17,10 @@ #include #include #include -#include #include #include +#include + #include #include #include @@ -38,9 +39,14 @@ class WindowKeeperPrivate QHash centrals{}; DMainWindow *window{nullptr}; QActionGroup *navActionGroup{nullptr}; - DToolBar *toolbar{nullptr}; DMenu *mainMenu{nullptr}; - DToolBar *editToolBar{nullptr}; + + DWidget *centralWidget{nullptr}; + DFrame *leftToolBar{nullptr}; + QHash leftToolBtns; + DWidget *topToolBar{nullptr}; + + QString lastNavName; friend class WindowKeeper; }; @@ -139,38 +145,28 @@ void WindowKeeper::createStatusBar(DMainWindow *window) window->setStatusBar(statusBar); } -void WindowKeeper::createNavRecent(DToolBar *toolbar) +void WindowKeeper::createNavIconBtn(const QString &navName, const QString &iconName) { qInfo() << __FUNCTION__; - if (!toolbar) - return; - QAction* navRecent = new QAction(QIcon::fromTheme("recent"), MWNA_RECENT, toolbar); - navRecent->setCheckable(true); - d->navActionGroup->addAction(navRecent); - QAction::connect(navRecent, &QAction::triggered, [=](){ - WindowKeeper::switchWidgetNavigation(MWNA_RECENT); - }); + DToolButton *toolBtn = new DToolButton; + toolBtn->setCheckable(true); + toolBtn->setChecked(true); - toolbar->addAction(navRecent); - toolbar->widgetForAction(navRecent)->setObjectName("Recent"); -} + toolBtn->setIcon(QIcon::fromTheme(iconName)); -void WindowKeeper::createNavEdit(DToolBar *toolbar) -{ - qInfo() << __FUNCTION__; - if (!toolbar) - return; + toolBtn->setMinimumSize(QSize(48, 48)); + toolBtn->setIconSize(QSize(20, 20)); - QAction* navEdit = new QAction(QIcon::fromTheme("edit"), MWNA_EDIT, toolbar); - navEdit->setCheckable(true); - d->navActionGroup->addAction(navEdit); - QAction::connect(navEdit, &QAction::triggered, [=](){ - WindowKeeper::switchWidgetNavigation(MWNA_EDIT); + d->leftToolBtns.insert(navName, toolBtn); + + connect(toolBtn, &DIconButton::clicked, [=](){ + WindowKeeper::switchWidgetNavigation(navName); }); - toolbar->addAction(navEdit); - toolbar->widgetForAction(navEdit)->setObjectName("Edit"); + QVBoxLayout *toolbarLayout = static_cast(d->leftToolBar->layout()); + toolbarLayout->addSpacing(5); + toolbarLayout->addWidget(toolBtn); } void WindowKeeper::createMainMenu(DMenu *menu) @@ -189,44 +185,29 @@ void WindowKeeper::createMainMenu(DMenu *menu) createHelpActions(menu); } +void WindowKeeper::initLeftToolBar() +{ + if (!d->leftToolBar) + return; + + d->leftToolBar->setLineWidth(0); + d->leftToolBar->setFixedWidth(58); + DStyle::setFrameRadius(d->leftToolBar, 0); + + QVBoxLayout *layout = new QVBoxLayout(); + layout->setAlignment(Qt::AlignTop | Qt::AlignHCenter); + d->leftToolBar->setLayout(layout); + d->centralWidget->layout()->addWidget(d->leftToolBar); +} + void WindowKeeper::layoutWindow(DMainWindow *window) { qInfo() << __FUNCTION__; if (!d->navActionGroup) d->navActionGroup = new QActionGroup(window); - d->toolbar = new DToolBar(DToolBar::tr("Navigation")); - d->toolbar->setMovable(false); - d->toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly); - d->toolbar->setIconSize(QSize(20, 20)); - - DPalette palette = d->toolbar->palette(); - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType) { - palette.setColor(DPalette::Button, QColor("#FFFFFF")); - d->toolbar->setPalette(palette); - } else { - palette.setColor(DPalette::Button, QColor("#262626")); - d->toolbar->setPalette(palette); - } - - QObject::connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, - this, [=](){ - DPalette palette = d->toolbar->palette(); - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType) { - palette.setColor(DPalette::Button, QColor("#FFFFFF")); - d->toolbar->setPalette(palette); - } else { - palette.setColor(DPalette::Button, QColor("#262626")); - d->toolbar->setPalette(palette); - } - }); - - DWidget *titleWiget = new DWidget(); - titleWiget->setFixedSize(58, 29); - d->toolbar->addWidget(titleWiget); - - createNavRecent(d->toolbar); - createNavEdit(d->toolbar); + createNavIconBtn(MWNA_RECENT, "recent"); + createNavIconBtn(MWNA_EDIT, "edit"); createMainMenu(d->mainMenu); @@ -234,7 +215,6 @@ void WindowKeeper::layoutWindow(DMainWindow *window) window->setWindowTitle("Deepin Union Code"); window->setWindowIcon(QIcon(":/core/images/unioncode@128.png")); - window->addToolBar(Qt::LeftToolBarArea, d->toolbar); window->setMinimumSize(QSize(MW_MIN_WIDTH,MW_MIN_HEIGHT)); window->setAttribute(Qt::WA_DeleteOnClose); @@ -262,6 +242,16 @@ WindowKeeper::WindowKeeper(QObject *parent) if (!d->window) { d->window = new DMainWindow(); + d->centralWidget = new DWidget(); + QHBoxLayout *cantralLayout = new QHBoxLayout(d->centralWidget); + cantralLayout->setContentsMargins(0, 0, 0, 0); + cantralLayout->setSpacing(2); + + if (!d->leftToolBar) { + d->leftToolBar = new DFrame(); + initLeftToolBar(); + } + if (!d->mainMenu) { d->mainMenu = new DMenu(d->window->titlebar()); } @@ -297,8 +287,8 @@ WindowKeeper::WindowKeeper(QObject *parent) windowService->addCentralNavigation = std::bind(&WindowKeeper::addCentralNavigation, this, _1, _2); } - if (!windowService->addActionNavigation) { - windowService->addActionNavigation = std::bind(&WindowKeeper::addActionNavigation, this, _1, _2); + if (!windowService->addNavigation) { + windowService->addNavigation = std::bind(&WindowKeeper::addNavigation, this, _1, _2); } if (!windowService->addAction) { @@ -308,6 +298,10 @@ WindowKeeper::WindowKeeper(QObject *parent) if (!windowService->removeActions) { windowService->removeActions = std::bind(&WindowKeeper::removeActions, this, _1); } + + if (!windowService->setTopToolBarWidget) { + windowService->setTopToolBarWidget = std::bind(&WindowKeeper::setTopToolBarWidget, this, _1); + } } WindowKeeper::~WindowKeeper() @@ -322,39 +316,31 @@ QStringList WindowKeeper::navActionTexts() const return d->centrals.keys(); } -void WindowKeeper::addActionNavigation(const QString &id, AbstractAction *action) +void WindowKeeper::addNavigation(const QString &navName, const QString &iconName) { - if (!action || !action->qAction() || !d->toolbar || !d->navActionGroup) - return; - - auto qAction = (QAction*)action->qAction(); - qAction->setCheckable(true); - d->navActionGroup->addAction(qAction); - d->toolbar->addAction(qAction); - d->toolbar->widgetForAction(qAction)->setObjectName(id); - QObject::connect(qAction, &QAction::triggered,[=](){ - switchWidgetNavigation(qAction->text()); - }); + createNavIconBtn(navName, iconName); } void WindowKeeper::addCentralNavigation(const QString &navName, AbstractCentral *central) { qInfo() << __FUNCTION__; - auto &ctx = dpfInstance.serviceContext(); - WindowService *windowService = ctx.service(WindowService::name()); - - if (navName == MWNA_EDIT) { - d->editToolBar = static_cast(windowService->getEditToolBar()); - } - DWidget* inputWidget = static_cast(central->qWidget()); + if(!central || !inputWidget || navName.isEmpty()) return; if (d->centrals.values().contains(inputWidget)) return; - inputWidget->setParent(d->window); + if (navName == MWNA_EDIT) { + QHBoxLayout *titleBarLayout = static_cast(d->window->titlebar()->layout()); + titleBarLayout->insertWidget(1, d->topToolBar, Qt::AlignLeft); + titleBarLayout->insertSpacing(titleBarLayout->indexOf(d->topToolBar), 20); + d->topToolBar->setVisible(false); + d->window->titlebar()->setTitle(QString()); + } + inputWidget->hide(); + d->centralWidget->layout()->addWidget(inputWidget); d->centrals.insert(navName, inputWidget); } @@ -411,7 +397,7 @@ void WindowKeeper::addAction(const QString &menuName, AbstractAction *action) if (menuName == MWMFA_NEW_FILE_OR_PROJECT) { for (QAction *qAction : d->mainMenu->actions()) { - if (qAction->text() == MWM_BUILD) { + if (qAction->text() == MWM_BUILD) { d->mainMenu->insertAction(qAction, inputAction); d->mainMenu->insertSeparator(qAction); return; @@ -465,7 +451,6 @@ void WindowKeeper::removeActions(const QString &menuName) foreach (QAction *action, qAction->menu()->actions()) { qAction->menu()->removeAction(action); } - break; } } @@ -497,53 +482,47 @@ void WindowKeeper::addOpenProjectAction(const QString &name, AbstractAction *act void WindowKeeper::initUserWidget() { qApp->processEvents(); - if (!d->toolbar) + if (!d->leftToolBar) return; - if (d->toolbar->actions().size() > 0) { - d->toolbar->actions().at(0)->trigger(); - } +// if (d->toolbar->actions().size() > 0) { +// d->toolbar->actions().at(0)->trigger(); +// } } void WindowKeeper::switchWidgetNavigation(const QString &navName) { - auto beforWidget = d->window->takeCentralWidget(); - if (beforWidget) - beforWidget->hide(); + if (d->centrals.isEmpty() || !d->window) + return; + + if (d->lastNavName == navName) { + setNavActionChecked(navName, true); + return; + } - d->editToolBar->hide(); + auto widget = d->centrals[navName]; + if (!widget) + return; + + if (!d->lastNavName.isNull()) + d->centrals[d->lastNavName]->hide(); + d->centrals[navName]->show(); + + d->topToolBar->hide(); d->window->titlebar()->setTitle(QString(tr("Deepin Union Code"))); if (navName == MWNA_EDIT) { - DPalette palette = d->window->palette(); - palette.setColor(DPalette::Button, palette.color(DPalette::Base)); - d->editToolBar->setPalette(palette); - - QObject::connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, - this, [=](){ - DPalette palette = d->window->palette(); - palette.setColor(DPalette::Button, palette.color(DPalette::Base)); - d->editToolBar->setPalette(palette); - }); - - QHBoxLayout *titleBarLayout = static_cast(d->window->titlebar()->layout()); - titleBarLayout->insertWidget(1, d->editToolBar, Qt::AlignLeft); + d->topToolBar->show(); d->window->titlebar()->setTitle(QString()); - titleBarLayout->insertSpacing(1, 12); - d->editToolBar->show(); } setNavActionChecked(navName, true); - if (d->centrals.isEmpty() || !d->window) - return; - - auto widget = d->centrals[navName]; - if (!widget) - return; + d->window->setCentralWidget(d->centralWidget); + widget->setFocus(); + widget->show(); - d->window->setCentralWidget(widget); - d->window->centralWidget()->show(); + d->lastNavName = navName; } void WindowKeeper::setNavActionChecked(const QString &actionName, bool checked) @@ -551,9 +530,10 @@ void WindowKeeper::setNavActionChecked(const QString &actionName, bool checked) if (!d->navActionGroup) return; - for (auto action : d->navActionGroup->actions()) { - if (action->text() == actionName) { - action->setChecked(checked); + for (auto it = d->leftToolBtns.begin(); it != d->leftToolBtns.end(); it++) { + it.value()->setChecked(false); + if (it.key() == actionName) { + it.value()->setChecked(checked); } } } @@ -569,3 +549,10 @@ void WindowKeeper::showAboutPlugins() PluginDialog dialog; dialog.exec(); } + +void WindowKeeper::setTopToolBarWidget(AbstractWidget *widget) +{ + if (!widget->qWidget()) + return; + d->topToolBar = static_cast(widget->qWidget()); +} diff --git a/src/plugins/core/mainframe/windowkeeper.h b/src/plugins/core/mainframe/windowkeeper.h index 5425ad151..2eed9ca49 100644 --- a/src/plugins/core/mainframe/windowkeeper.h +++ b/src/plugins/core/mainframe/windowkeeper.h @@ -46,7 +46,7 @@ class WindowKeeper final :public QObject QStringList navActionTexts() const; public slots: - void addActionNavigation(const QString &id, AbstractAction *action); + void addNavigation(const QString &navName, const QString &iconName); void addCentralNavigation(const QString &navName, AbstractCentral *central); void addMenu(AbstractMenu *menu); void insertAction(const QString &menuName, const QString &beforActionName, @@ -57,12 +57,12 @@ public slots: void initUserWidget(); void switchWidgetNavigation(const QString &navName); + void setTopToolBarWidget(AbstractWidget *widget); + private : void showAboutDlg(); void showAboutPlugins(); void layoutWindow(DMainWindow *window); - void createNavEdit(DToolBar *toolbar); - void createNavRecent(DToolBar *toolbar); void createStatusBar(DMainWindow *window); void createHelpActions(DMenu *menu); @@ -74,6 +74,8 @@ private : void setNavActionChecked(const QString &actionName, bool checked); void createMainMenu(DMenu *mainMenu); + void initLeftToolBar(); + void createNavIconBtn(const QString &navName, const QString &iconName); }; #endif // WINDOWKEEPER_H diff --git a/src/plugins/template/wizard/maindialog.cpp b/src/plugins/template/wizard/maindialog.cpp index fe879b721..3f76cc02b 100644 --- a/src/plugins/template/wizard/maindialog.cpp +++ b/src/plugins/template/wizard/maindialog.cpp @@ -54,7 +54,6 @@ MainDialog::~MainDialog() void MainDialog::setupUI(TemplateVector &templateVec) { DTitlebar *titleBar = new DTitlebar(); - titleBar = new DTitlebar(); titleBar->setMenuVisible(false); titleBar->setTitle(QString(tr("New File or Project"))); diff --git a/src/services/window/windowelement.h b/src/services/window/windowelement.h index e60817956..f341fba56 100644 --- a/src/services/window/windowelement.h +++ b/src/services/window/windowelement.h @@ -14,13 +14,15 @@ // MW = MainWindow namespace dpfservice { -inline const int MW_MIN_WIDTH { 1286 }; +inline const int MW_MIN_WIDTH { 1280 }; inline const int MW_MIN_HEIGHT { 860 }; -inline const QString MWNA_RECENT { QAction::tr("Recent") }; -inline const QString MWNA_EDIT { QAction::tr("Edit") }; -inline const QString MWNA_DEBUG { QAction::tr("Debug") }; -inline const QString MWNA_RUNTIME { QAction::tr("Runtime") }; +inline const QString MWNA_RECENT { QObject::tr("Recent") }; +inline const QString MWNA_EDIT { QObject::tr("Edit") }; +inline const QString MWNA_DEBUG { QObject::tr("Debug") }; +inline const QString MWNA_GIT { QObject::tr("Git") }; +inline const QString MWNA_SVN { QObject::tr("Svn") }; +inline const QString MWNA_RUNTIME { QObject::tr("Runtime") }; inline const QString MWM_FILE { QMenu::tr("&File") }; inline const QString MWMFA_CXX { "C/C++" }; diff --git a/src/services/window/windowservice.h b/src/services/window/windowservice.h index 645847060..fd89a7a04 100644 --- a/src/services/window/windowservice.h +++ b/src/services/window/windowservice.h @@ -40,7 +40,7 @@ class WindowService final : public dpf::PluginService, dpf::AutoServiceRegister< * \brief addActionNavigation 添加导航栏action * \param action 实例对象 */ - DPF_INTERFACE(void, addActionNavigation, const QString &id, AbstractAction *action); + DPF_INTERFACE(void, addNavigation, const QString &navName, const QString &iconName); /*! * \brief addMenu 添加菜单项 @@ -179,7 +179,7 @@ class WindowService final : public dpf::PluginService, dpf::AutoServiceRegister< */ DPF_INTERFACE(void, setToolBarItemDisable, const QString &id, bool disable); - DPF_INTERFACE(QWidget*, getEditToolBar); + DPF_INTERFACE(void, setTopToolBarWidget, AbstractWidget *widget); signals: