From 97026b4da03dbb9dda460c6046aaa09a23a927bf Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Mon, 3 Jun 2019 18:30:23 -0400
Subject: added menubar toggle in the context menu removed two unused actions:
actionToolbar_Size and actionToolbar_style added ways to make the menu
reappear if you hide everything: - show the toolbar popup when
right-clicking around the border of the main window - intercept the Alt key
and make the main menu visible
---
src/mainwindow.ui | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 9656cbf2..e25111e1 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -30,6 +30,9 @@
0
+
+ Qt::CustomContextMenu
+
6
@@ -1432,6 +1435,7 @@ p, li { white-space: pre-wrap; }
&Toolbars
+
@@ -1719,22 +1723,12 @@ p, li { white-space: pre-wrap; }
Exits Mod Organizer
-
-
- Toolbar Size
-
-
-
-
- Toolbar Buttons
-
-
true
- &Main
+ M&ain
@@ -1793,6 +1787,14 @@ p, li { white-space: pre-wrap; }
M&edium Icons
+
+
+ true
+
+
+ &Menu
+
+
--
cgit v1.3.1
From 254304217d6cb00cbedf13f8c493dc6c80e11e24 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Mon, 3 Jun 2019 19:00:44 -0400
Subject: renamed some of the menus to remove underscores added Run menu with
shortcuts, only visible when there are shortcuts to show fixed menubar
visibility not being remembered
---
src/mainwindow.cpp | 30 +++++++++++++++++++-----------
src/mainwindow.h | 6 +++++-
src/mainwindow.ui | 22 ++++++++++++++--------
3 files changed, 38 insertions(+), 20 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 1098b529..62971f00 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -201,6 +201,7 @@ MainWindow::MainWindow(QSettings &initSettings
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, m_WasVisible(false)
+ , m_menuBarVisible(true)
, m_Tutorial(this, "MainWindow")
, m_OldProfileIndex(-1)
, m_ModListGroupingProxy(nullptr)
@@ -321,7 +322,7 @@ MainWindow::MainWindow(QSettings &initSettings
resizeLists(modListAdjusted, pluginListAdjusted);
QMenu *linkMenu = new QMenu(this);
- linkMenu->addAction(QIcon(":/MO/gui/link"), tr("Toolbar"), this, SLOT(linkToolbar()));
+ linkMenu->addAction(QIcon(":/MO/gui/link"), tr("Toolbar and Menu"), this, SLOT(linkToolbar()));
linkMenu->addAction(QIcon(":/MO/gui/link"), tr("Desktop"), this, SLOT(linkDesktop()));
linkMenu->addAction(QIcon(":/MO/gui/link"), tr("Start Menu"), this, SLOT(linkMenu()));
ui->linkButton->setMenu(linkMenu);
@@ -470,7 +471,7 @@ MainWindow::MainWindow(QSettings &initSettings
}
refreshExecutablesList();
- updateToolBar();
+ updatePinnedExecutables();
for (QAction *action : ui->toolBar->actions()) {
// set the name of the widget to the name of the action to allow styling
@@ -609,13 +610,15 @@ void MainWindow::setupActionMenu(QAction* a)
tb->setPopupMode(QToolButton::InstantPopup);
}
-void MainWindow::updateToolBar()
+void MainWindow::updatePinnedExecutables()
{
for (auto* a : ui->linksToolBar->actions()) {
ui->linksToolBar->removeAction(a);
a->deleteLater();
}
+ ui->menuRun->clear();
+
bool hasLinks = false;
std::vector::iterator begin, end;
@@ -625,21 +628,23 @@ void MainWindow::updateToolBar()
if (iter->isShownOnToolbar()) {
hasLinks = true;
- QAction *exeAction = new QAction(iconForExecutable(iter->m_BinaryInfo.filePath()),
- iter->m_Title,
- ui->toolBar);
+ QAction *exeAction = new QAction(
+ iconForExecutable(iter->m_BinaryInfo.filePath()), iter->m_Title);
exeAction->setObjectName(QString("custom__") + iter->m_Title);
+
if (!connect(exeAction, SIGNAL(triggered()), this, SLOT(startExeAction()))) {
qDebug("failed to connect trigger?");
}
ui->linksToolBar->addAction(exeAction);
+ ui->menuRun->addAction(exeAction);
}
}
- // don't show the toolbar if there are no links
+ // don't show the toolbar or menu if there are no links
ui->linksToolBar->setVisible(hasLinks);
+ ui->menuRun->menuAction()->setVisible(hasLinks);
}
void MainWindow::toolbarMenu_aboutToShow()
@@ -674,6 +679,7 @@ QMenu* MainWindow::createPopupMenu()
void MainWindow::on_actionMainMenuToggle_triggered()
{
ui->menuBar->setVisible(!ui->menuBar->isVisible());
+ m_menuBarVisible = ui->menuBar->isVisible();
}
void MainWindow::on_actionToolBarMainToggle_triggered()
@@ -1952,7 +1958,8 @@ void MainWindow::readSettings()
}
if (settings.contains("menubar_visible")) {
- ui->menuBar->setVisible(settings.value("menubar_visible").toBool());
+ m_menuBarVisible = settings.value("menubar_visible").toBool();
+ ui->menuBar->setVisible(m_menuBarVisible);
}
if (settings.contains("window_split")) {
@@ -2047,7 +2054,7 @@ void MainWindow::storeSettings(QSettings &settings) {
settings.setValue("window_state", saveState());
settings.setValue("toolbar_size", ui->toolBar->iconSize());
settings.setValue("toolbar_button_style", static_cast(ui->toolBar->toolButtonStyle()));
- settings.setValue("menubar_visible", ui->menuBar->isVisible());
+ settings.setValue("menubar_visible", m_menuBarVisible);
settings.setValue("window_split", ui->splitter->saveState());
settings.setValue("window_monitor", QApplication::desktop()->screenNumber(this));
settings.setValue("log_split", ui->topLevelSplitter->saveState());
@@ -5001,7 +5008,7 @@ void MainWindow::linkToolbar()
Executable &exe(getSelectedExecutable());
exe.showOnToolbar(!exe.isShownOnToolbar());
ui->linkButton->menu()->actions().at(static_cast(ShortcutType::Toolbar))->setIcon(exe.isShownOnToolbar() ? QIcon(":/MO/gui/remove") : QIcon(":/MO/gui/link"));
- updateToolBar();
+ updatePinnedExecutables();
}
namespace {
@@ -6189,7 +6196,7 @@ void MainWindow::removeFromToolbar()
qDebug("executable doesn't exist any more");
}
- updateToolBar();
+ updatePinnedExecutables();
}
@@ -6850,6 +6857,7 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Alt) {
if (!ui->menuBar->isVisible()) {
ui->menuBar->setVisible(true);
+ m_menuBarVisible = true;
}
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 09aeb044..4847d65c 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -211,7 +211,7 @@ private:
void createHelpMenu();
void createEndorseMenu();
- void updateToolBar();
+ void updatePinnedExecutables();
void setToolbarSize(const QSize& s);
void setToolbarButtonStyle(Qt::ToolButtonStyle s);
void toolbarMenu_aboutToShow();
@@ -324,6 +324,10 @@ private:
bool m_WasVisible;
+ // this has to be remembered because by the time storeSettings() is called,
+ // the window is closed and the menubar is hidden
+ bool m_menuBarVisible;
+
MOBase::TutorialControl m_Tutorial;
int m_OldProfileIndex;
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index e25111e1..e093fd3f 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1392,7 +1392,7 @@ p, li { white-space: pre-wrap; }
21
-