From a0b5258346a215058c1f3d47e672b67dd1f50792 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 15 Feb 2017 03:39:51 +0100 Subject: [PATCH] refs #883, launcher can be started from the applications and navigator --- src/blackgui/components/navigatordialog.cpp | 21 ++++++++++++++------- src/blackgui/components/navigatordialog.h | 6 +++--- src/blackgui/guiapplication.cpp | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/blackgui/components/navigatordialog.cpp b/src/blackgui/components/navigatordialog.cpp index 9f1e2df3d..4a84fd5fa 100644 --- a/src/blackgui/components/navigatordialog.cpp +++ b/src/blackgui/components/navigatordialog.cpp @@ -69,9 +69,9 @@ namespace BlackGui void CNavigatorDialog::buildNavigator(int columns) { - if (m_firstBuild) + if (this->m_firstBuild) { - m_firstBuild = false; + this->m_firstBuild = false; this->insertOwnActions(); } @@ -238,15 +238,22 @@ namespace BlackGui this->insertAction(this->actions().first(), a); } - // close - QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarCloseButton), Qt::white, QSize(16, 16))); - a = new QAction(i, "Close", this); - connect(a, &QAction::triggered, this, &CNavigatorDialog::close); + a = new QAction(BlackMisc::CIcons::swiftLauncher16(), "Start launcher", this); + bool c = connect(a, &QAction::triggered, sGui, &CGuiApplication::startLauncher); + Q_ASSERT(c); this->addAction(a); // save a = new QAction(CIcons::save16(), "Save state", this); - connect(a, &QAction::triggered, this, &CNavigatorDialog::saveToSettings); + c = connect(a, &QAction::triggered, this, &CNavigatorDialog::saveToSettings); + Q_ASSERT(c); + this->addAction(a); + + // close + const QIcon i(CIcons::changeIconBackgroundColor(this->style()->standardIcon(QStyle::SP_TitleBarCloseButton), Qt::white, QSize(16, 16))); + a = new QAction(i, "Close", this); + c = connect(a, &QAction::triggered, this, &CNavigatorDialog::close); + Q_ASSERT(c); this->addAction(a); } diff --git a/src/blackgui/components/navigatordialog.h b/src/blackgui/components/navigatordialog.h index 2916d7b74..cb4ae83d0 100644 --- a/src/blackgui/components/navigatordialog.h +++ b/src/blackgui/components/navigatordialog.h @@ -50,7 +50,7 @@ namespace BlackGui CNavigatorDialog(QWidget *parent = nullptr); //! Destructor - ~CNavigatorDialog(); + virtual ~CNavigatorDialog(); //! Navigator void buildNavigator(int columns); @@ -121,9 +121,9 @@ namespace BlackGui void adjustNavigatorSize(QGridLayout *layout = nullptr); QScopedPointer ui; - bool m_firstBuild = true; + bool m_firstBuild = true; int m_currentColumns = 1; - QWidgetAction *m_marginMenuAction = nullptr; //!< menu widget(!) action for margin widget + QWidgetAction *m_marginMenuAction = nullptr; //!< menu widget(!) action for margin widget CMarginsInput *m_input = nullptr; //!< margins widget BlackMisc::CSetting m_settings { this, &CNavigatorDialog::ps_settingsChanged }; }; diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index 3d96c0533..9e186edfa 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -401,11 +402,20 @@ namespace BlackGui { addMenuForSettingsAndCache(menu); addMenuForStyleSheets(menu); + QAction *a = nullptr; + bool c = false; + if (this->getApplicationInfo().application() != CApplicationInfo::Laucher) + { + menu.addSeparator(); + a = menu.addAction(CIcons::swiftLauncher24(), "Start swift launcher"); + c = connect(a, &QAction::triggered, this, &CGuiApplication::startLauncher); + Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed"); + } menu.addSeparator(); - QAction *a = menu.addAction("E&xit"); + a = menu.addAction("E&xit"); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q)); - bool c = connect(a, &QAction::triggered, this, [a, this]() + c = connect(a, &QAction::triggered, this, [a, this]() { // a close event might already trigger a shutdown this->mainApplicationWindow()->close();