refs #883, launcher can be started from the applications and navigator

This commit is contained in:
Klaus Basan
2017-02-15 03:39:51 +01:00
committed by Mathew Sutcliffe
parent 24a9b332b0
commit a0b5258346
3 changed files with 29 additions and 12 deletions

View File

@@ -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);
}

View File

@@ -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::CNavigatorDialog> 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<BlackGui::Settings::TNavigator> m_settings { this, &CNavigatorDialog::ps_settingsChanged };
};

View File

@@ -38,6 +38,7 @@
#include <QKeySequence>
#include <QMenu>
#include <QMessageBox>
#include <QProcess>
#include <QRegExp>
#include <QSplashScreen>
#include <QStyleFactory>
@@ -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();