From 3c7b232361d01f79a1d48ae3d8200cb6a68bbf32 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 2 Jun 2019 11:55:13 -0400
Subject: - always show statusbar, used by the menu and toolbar to display
status tips - reduced margins around central widgets to align it with status
bar text, removed bottom margins completely because the statusbar is enough -
notifications: now always enabled, dialog shows a special item when empty,
just change the tooltip and leave the text alone - added all toolbar actions
to menu - non functional in menu for now: tools, help and endorse because
they're menus - changed some of the action strings to be the same on both
toolbar and menu, added missing status tips
---
src/mainwindow.ui | 195 +++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 177 insertions(+), 18 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index d876b54a..84d3c9e4 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -31,6 +31,18 @@
+
+ 6
+
+
+ 6
+
+
+ 6
+
+
+ 0
+
-
@@ -1381,13 +1393,67 @@ p, li { white-space: pre-wrap; }
+
:/MO/gui/resources/system-installer.png:/MO/gui/resources/system-installer.png
- Install Mod
+ Install &Mod...
Install &Mod
@@ -1395,6 +1461,9 @@ p, li { white-space: pre-wrap; }
Install a new mod from an archive
+
+ Install a new mod from an archive
+
Ctrl+M
@@ -1405,13 +1474,16 @@ p, li { white-space: pre-wrap; }
:/MO/gui/profiles:/MO/gui/profiles
- Profiles
+ &Profiles...
&Profiles
- Configure Profiles
+ Configure profiles
+
+
+ Configure profiles
Ctrl+P
@@ -1423,7 +1495,7 @@ p, li { white-space: pre-wrap; }
:/MO/gui/icon_executable:/MO/gui/icon_executable
- Executables
+ &Executables...
&Executables
@@ -1431,6 +1503,9 @@ p, li { white-space: pre-wrap; }
Configure the executables that can be started through Mod Organizer
+
+ Configure the executables that can be started through Mod Organizer
+
Ctrl+E
@@ -1441,7 +1516,7 @@ p, li { white-space: pre-wrap; }
:/MO/gui/plugins:/MO/gui/plugins
- Tools
+ &Tools
&Tools
@@ -1459,7 +1534,7 @@ p, li { white-space: pre-wrap; }
:/MO/gui/settings:/MO/gui/settings
- Settings
+ &Settings...
&Settings
@@ -1467,6 +1542,9 @@ p, li { white-space: pre-wrap; }
Configure settings and workarounds
+
+ Configure settings and workarounds
+
Ctrl+S
@@ -1477,10 +1555,16 @@ p, li { white-space: pre-wrap; }
:/MO/gui/resources/internet-web-browser.png:/MO/gui/resources/internet-web-browser.png
- Nexus
+ Visit &Nexus
+
+
+ Visit &Nexus
- Search nexus network for more mods
+ Visit the Nexus website in your browser for more mods
+
+
+ Visit the Nexus website in your browser for more mods
Ctrl+N
@@ -1495,25 +1579,34 @@ p, li { white-space: pre-wrap; }
:/MO/gui/update:/MO/gui/update
- Update
+ &Update Mod Organizer
+
+
+ &Update Mod Organizer
Mod Organizer is up-to-date
+
+ Mod Organizer is up-to-date
+
-
- false
-
:/MO/gui/warning:/MO/gui/warning
- No Notifications
+ Notifications...
+
+
+ Open the notifications dialog
+
+
+ Open the notifications dialog
- This button will be highlighted if MO discovered potential problems in your setup and provide tips on how to fix them.
+ This button will be highlighted on the toolbar if MO discovered potential problems in your setup and provide tips on how to fix them.
@@ -1522,7 +1615,10 @@ p, li { white-space: pre-wrap; }
:/MO/gui/help:/MO/gui/help
- Help
+ &Help
+
+
+ &Help
Help
@@ -1537,15 +1633,30 @@ p, li { white-space: pre-wrap; }
:/MO/gui/icon_favorite:/MO/gui/icon_favorite
- Endorse MO
+ &Endorse ModOrganizer
+
+
+ &Endorse ModOrganizer
Endorse Mod Organizer
+
+ Endorse Mod Organizer
+
- Copy Log to Clipboard
+ Copy &Log
+
+
+ Copy &Log
+
+
+ Copy log to clipboard
+
+
+ Copy log to clipboard
@@ -1554,11 +1665,59 @@ p, li { white-space: pre-wrap; }
:/MO/gui/instance_switch:/MO/gui/instance_switch
- Change Game
+ &Change Game...
+
+
+ &Change Game
Open the Instance selection dialog to manage a different Game
+
+ Open the Instance selection dialog to manage a different Game
+
+
+
+
+ E&xit
+
+
+ E&xit
+
+
+ Exits Mod Organizer
+
+
+ Exits Mod Organizer
+
+
+
+
+ false
+
+
+
+ :/MO/gui/plugins:/MO/gui/plugins
+
+
+ &Tools
+
+
+
+
+ false
+
+
+ &Help menu
+
+
+
+
+ false
+
+
+ Endorse Mod Organizer
+
--
cgit v1.3.1
From 860eb49b45703d939196e92ba6e6d99f54ed3088 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 2 Jun 2019 13:14:21 -0400
Subject: removed actionToToolButton(), which was replacing QAction's in the
toolbar with QToolButton's, making it very difficult to have an equivalent in
the main menu. QAction's can have a menu, so use that instead. the only place
this doesn't work is with the nexus button, which can be replaced by a menu
if there are IPluginModPage plugins adding items to it; registerModPage()
works fine with the toolbar, but doesn't handle the main menu yet
---
src/mainwindow.cpp | 117 ++++++++++++++++++++++-------------------------------
src/mainwindow.h | 9 +++--
src/mainwindow.ui | 29 +++----------
3 files changed, 59 insertions(+), 96 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index ff62e05e..462eb5e0 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -206,6 +206,7 @@ MainWindow::MainWindow(QSettings &initSettings
, m_ContextItem(nullptr)
, m_ContextAction(nullptr)
, m_ContextRow(-1)
+ , m_browseModPage(nullptr)
, m_CurrentSaveView(nullptr)
, m_OrganizerCore(organizerCore)
, m_PluginContainer(pluginContainer)
@@ -248,17 +249,12 @@ MainWindow::MainWindow(QSettings &initSettings
// Setup toolbar
QWidget *spacer = new QWidget(ui->toolBar);
spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
- QWidget *widget = ui->toolBar->widgetForAction(ui->actionTool);
- QToolButton *toolBtn = qobject_cast(widget);
- if (toolBtn->menu() == nullptr) {
- actionToToolButton(ui->actionTool);
- }
-
- actionToToolButton(ui->actionHelp);
- createHelpWidget();
+ setupActionMenu(ui->actionTool);
+ setupActionMenu(ui->actionHelp);
+ setupActionMenu(ui->actionEndorseMO);
- actionToToolButton(ui->actionEndorseMO);
+ createHelpMenu();
createEndorseWidget();
toggleMO2EndorseState();
@@ -611,28 +607,13 @@ static QModelIndex mapToModel(const QAbstractItemModel *targetModel, QModelIndex
return result;
}
-
-void MainWindow::actionToToolButton(QAction *&sourceAction)
+void MainWindow::setupActionMenu(QAction* a)
{
- QToolButton *button = new QToolButton(ui->toolBar);
- button->setObjectName(sourceAction->objectName());
- button->setIcon(sourceAction->icon());
- button->setText(sourceAction->text());
- button->setPopupMode(QToolButton::InstantPopup);
- button->setToolButtonStyle(ui->toolBar->toolButtonStyle());
- button->setToolTip(sourceAction->toolTip());
- button->setShortcut(sourceAction->shortcut());
- QMenu *buttonMenu = new QMenu(sourceAction->text(), button);
- button->setMenu(buttonMenu);
- QAction *newAction = ui->toolBar->insertWidget(sourceAction, button);
- newAction->setObjectName(sourceAction->objectName());
- newAction->setIcon(sourceAction->icon());
- newAction->setText(sourceAction->text());
- newAction->setToolTip(sourceAction->toolTip());
- newAction->setShortcut(sourceAction->shortcut());
- ui->toolBar->removeAction(sourceAction);
- sourceAction->deleteLater();
- sourceAction = newAction;
+ a->setMenu(new QMenu(this));
+
+ auto* w = ui->toolBar->widgetForAction(a);
+ if (auto* tb=dynamic_cast(w))
+ tb->setPopupMode(QToolButton::InstantPopup);
}
void MainWindow::updateToolBar()
@@ -760,32 +741,34 @@ void MainWindow::createEndorseWidget()
}
-void MainWindow::createHelpWidget()
+void MainWindow::createHelpMenu()
{
- QToolButton *toolBtn = qobject_cast(ui->toolBar->widgetForAction(ui->actionHelp));
- QMenu *buttonMenu = toolBtn->menu();
- if (buttonMenu == nullptr) {
+ auto* menu = ui->actionHelp->menu();
+ if (!menu) {
+ // this happens on startup because languageChanged() (which calls this) is
+ // called before the menus are actually created
return;
}
- buttonMenu->clear();
- QAction *helpAction = new QAction(tr("Help on UI"), buttonMenu);
+ menu->clear();
+
+ QAction *helpAction = new QAction(tr("Help on UI"), menu);
connect(helpAction, SIGNAL(triggered()), this, SLOT(helpTriggered()));
- buttonMenu->addAction(helpAction);
+ menu->addAction(helpAction);
- QAction *wikiAction = new QAction(tr("Documentation"), buttonMenu);
+ QAction *wikiAction = new QAction(tr("Documentation"), menu);
connect(wikiAction, SIGNAL(triggered()), this, SLOT(wikiTriggered()));
- buttonMenu->addAction(wikiAction);
+ menu->addAction(wikiAction);
- QAction *discordAction = new QAction(tr("Chat on Discord"), buttonMenu);
+ QAction *discordAction = new QAction(tr("Chat on Discord"), menu);
connect(discordAction, SIGNAL(triggered()), this, SLOT(discordTriggered()));
- buttonMenu->addAction(discordAction);
+ menu->addAction(discordAction);
- QAction *issueAction = new QAction(tr("Report Issue"), buttonMenu);
+ QAction *issueAction = new QAction(tr("Report Issue"), menu);
connect(issueAction, SIGNAL(triggered()), this, SLOT(issueTriggered()));
- buttonMenu->addAction(issueAction);
+ menu->addAction(issueAction);
- QMenu *tutorialMenu = new QMenu(tr("Tutorials"), buttonMenu);
+ QMenu *tutorialMenu = new QMenu(tr("Tutorials"), menu);
typedef std::vector > ActionList;
@@ -823,9 +806,9 @@ void MainWindow::createHelpWidget()
tutorialMenu->addAction(iter->second);
}
- buttonMenu->addMenu(tutorialMenu);
- buttonMenu->addAction(tr("About"), this, SLOT(about()));
- buttonMenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt()));
+ menu->addMenu(tutorialMenu);
+ menu->addAction(tr("About"), this, SLOT(about()));
+ menu->addAction(tr("About Qt"), qApp, SLOT(aboutQt()));
}
void MainWindow::modFilterActive(bool filterActive)
@@ -1128,21 +1111,20 @@ void MainWindow::modPagePluginInvoke()
void MainWindow::registerPluginTool(IPluginTool *tool, QString name, QMenu *menu)
{
+ if (!menu) {
+ menu = ui->actionTool->menu();
+ }
+
if (name.isEmpty())
name = tool->displayName();
- QAction *action = new QAction(tool->icon(), name, ui->toolBar);
+ QAction *action = new QAction(tool->icon(), name, menu);
action->setToolTip(tool->tooltip());
tool->setParentWidget(this);
action->setData(qVariantFromValue((QObject*)tool));
connect(action, SIGNAL(triggered()), this, SLOT(toolPluginInvoke()), Qt::QueuedConnection);
- if (menu == nullptr) {
- QToolButton *toolBtn = qobject_cast(ui->toolBar->widgetForAction(ui->actionTool));
- toolBtn->menu()->addAction(action);
- } else {
- menu->addAction(action);
- }
+ menu->addAction(action);
}
void MainWindow::registerPluginTools(std::vector toolPlugins)
@@ -1176,8 +1158,7 @@ void MainWindow::registerPluginTools(std::vector toolPlugins)
for (auto info : submenuMap[submenuKey]) {
registerPluginTool(info.second, info.first, submenu);
}
- QToolButton *toolBtn = qobject_cast(ui->toolBar->widgetForAction(ui->actionTool));
- toolBtn->menu()->addMenu(submenu);
+ ui->actionTool->menu()->addMenu(submenu);
}
else {
registerPluginTool(submenuMap[submenuKey].front().second);
@@ -1188,25 +1169,23 @@ void MainWindow::registerPluginTools(std::vector toolPlugins)
void MainWindow::registerModPage(IPluginModPage *modPage)
{
// turn the browser action into a drop-down menu if necessary
- if (ui->actionNexus->menu() == nullptr) {
- QAction *nexusAction = ui->actionNexus;
- // TODO: use a different icon for nexus!
- ui->actionNexus = new QAction(nexusAction->icon(), tr("Browse Mod Page"), ui->toolBar);
- ui->toolBar->insertAction(nexusAction, ui->actionNexus);
- ui->toolBar->removeAction(nexusAction);
- actionToToolButton(ui->actionNexus);
+ if (!m_browseModPage) {
+ m_browseModPage = new QAction(ui->actionNexus->icon(), tr("Browse Mod Page"), this);
+ setupActionMenu(m_browseModPage);
- QToolButton *browserBtn = qobject_cast(ui->toolBar->widgetForAction(ui->actionNexus));
- browserBtn->menu()->addAction(nexusAction);
+ m_browseModPage->menu()->addAction(ui->actionNexus);
+
+ ui->toolBar->insertAction(ui->actionNexus, m_browseModPage);
+ ui->toolBar->removeAction(ui->actionNexus);
}
- QAction *action = new QAction(modPage->icon(), modPage->displayName(), ui->toolBar);
+ QAction *action = new QAction(modPage->icon(), modPage->displayName(), this);
modPage->setParentWidget(this);
action->setData(qVariantFromValue(reinterpret_cast(modPage)));
connect(action, SIGNAL(triggered()), this, SLOT(modPagePluginInvoke()), Qt::QueuedConnection);
- QToolButton *toolBtn = qobject_cast(ui->toolBar->widgetForAction(ui->actionNexus));
- toolBtn->menu()->addAction(action);
+
+ m_browseModPage->menu()->addAction(action);
}
@@ -5096,7 +5075,7 @@ void MainWindow::languageChange(const QString &newLanguage)
ui->profileBox->setItemText(0, QObject::tr(""));
- createHelpWidget();
+ createHelpMenu();
updateDownloadView();
updateProblemsButton();
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 1f0dd5ff..7281aab7 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -206,7 +206,9 @@ private:
void cleanup();
- void actionToToolButton(QAction *&sourceAction);
+ void setupActionMenu(QAction* a);
+ void createHelpMenu();
+ void createEndorseWidget();
void updateToolBar();
void activateSelectedProfile();
@@ -255,9 +257,6 @@ private:
// remove invalid category-references from mods
void fixCategories();
- void createEndorseWidget();
- void createHelpWidget();
-
bool extractProgress(QProgressDialog &extractProgress, int percentage, std::string fileName);
size_t checkForProblems();
@@ -343,6 +342,8 @@ private:
QTreeWidgetItem *m_ContextItem;
QAction *m_ContextAction;
+ QAction* m_browseModPage;
+
CategoryFactory &m_CategoryFactory;
bool m_LoginAttempted;
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 84d3c9e4..a3eb8504 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1418,14 +1418,14 @@ p, li { white-space: pre-wrap; }
-
+
@@ -1621,7 +1621,10 @@ p, li { white-space: pre-wrap; }
&Help
- Help
+ Show help options
+
+
+ Show help options
Ctrl+H
@@ -1691,26 +1694,6 @@ p, li { white-space: pre-wrap; }
Exits Mod Organizer
-
-
- false
-
-
-
- :/MO/gui/plugins:/MO/gui/plugins
-
-
- &Tools
-
-
-
-
- false
-
-
- &Help menu
-
-
false
--
cgit v1.3.1
From 746e9c08e68ed7e44e6ef4e29b250c73b9c21440 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 2 Jun 2019 14:22:24 -0400
Subject: moved notification menu item to tools, was the only thing in view
fixed endorse action to also work with the menu fixed changing endorsement
integration setting not changing visibility of actions
---
src/mainwindow.cpp | 32 +++++++++++++++++---------------
src/mainwindow.h | 2 +-
src/mainwindow.ui | 20 ++++----------------
3 files changed, 22 insertions(+), 32 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 462eb5e0..8e0d2624 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -255,7 +255,7 @@ MainWindow::MainWindow(QSettings &initSettings
setupActionMenu(ui->actionEndorseMO);
createHelpMenu();
- createEndorseWidget();
+ createEndorseMenu();
toggleMO2EndorseState();
@@ -722,22 +722,23 @@ void MainWindow::about()
}
-void MainWindow::createEndorseWidget()
+void MainWindow::createEndorseMenu()
{
- QToolButton *toolBtn = qobject_cast(ui->toolBar->widgetForAction(ui->actionEndorseMO));
- QMenu *buttonMenu = toolBtn->menu();
- if (buttonMenu == nullptr) {
+ auto* menu = ui->actionEndorseMO->menu();
+ if (!menu) {
+ // shouldn't happen
return;
}
- buttonMenu->clear();
- QAction *endorseAction = new QAction(tr("Endorse"), buttonMenu);
+ menu->clear();
+
+ QAction *endorseAction = new QAction(tr("Endorse"), menu);
connect(endorseAction, SIGNAL(triggered()), this, SLOT(actionEndorseMO()));
- buttonMenu->addAction(endorseAction);
+ menu->addAction(endorseAction);
- QAction *wontEndorseAction = new QAction(tr("Won't Endorse"), buttonMenu);
+ QAction *wontEndorseAction = new QAction(tr("Won't Endorse"), menu);
connect(wontEndorseAction, SIGNAL(triggered()), this, SLOT(actionWontEndorseMO()));
- buttonMenu->addAction(wontEndorseAction);
+ menu->addAction(wontEndorseAction);
}
@@ -5021,6 +5022,8 @@ void MainWindow::on_actionSettings_triggered()
m_OrganizerCore.updateVFSParams(settings.logLevel(), settings.crashDumpsType(), settings.executablesBlacklist());
m_OrganizerCore.cycleDiagnostics();
+
+ toggleMO2EndorseState();
}
@@ -5473,20 +5476,19 @@ void MainWindow::modUpdateCheck(std::multimap IDs)
void MainWindow::toggleMO2EndorseState()
{
- QToolButton *toolBtn = qobject_cast(ui->toolBar->widgetForAction(ui->actionEndorseMO));
if (Settings::instance().endorsementIntegration()) {
ui->actionEndorseMO->setVisible(true);
if (Settings::instance().directInterface().contains("endorse_state")) {
- ui->actionEndorseMO->setEnabled(false);
+ ui->actionEndorseMO->menu()->setEnabled(false);
if (Settings::instance().directInterface().value("endorse_state").toString() == "Endorsed") {
ui->actionEndorseMO->setToolTip(tr("Thank you for endorsing MO2! :)"));
- toolBtn->setToolTip(tr("Thank you for endorsing MO2! :)"));
+ ui->actionEndorseMO->setStatusTip(tr("Thank you for endorsing MO2! :)"));
} else if (Settings::instance().directInterface().value("endorse_state").toString() == "Abstained") {
ui->actionEndorseMO->setToolTip(tr("Please reconsider endorsing MO2 on Nexus!"));
- toolBtn->setToolTip(tr("Please reconsider endorsing MO2 on Nexus!"));
+ ui->actionEndorseMO->setStatusTip(tr("Please reconsider endorsing MO2 on Nexus!"));
}
} else {
- ui->actionEndorseMO->setEnabled(true);
+ ui->actionEndorseMO->menu()->setEnabled(true);
}
} else
ui->actionEndorseMO->setVisible(false);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 7281aab7..96660aeb 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -208,7 +208,7 @@ private:
void setupActionMenu(QAction* a);
void createHelpMenu();
- void createEndorseWidget();
+ void createEndorseMenu();
void updateToolBar();
void activateSelectedProfile();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index a3eb8504..03cb9ab7 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1417,8 +1417,11 @@ p, li { white-space: pre-wrap; }
&Tools
+
+
+
-
-
@@ -1694,14 +1690,6 @@ p, li { white-space: pre-wrap; }
Exits Mod Organizer
-
-
- false
-
-
- Endorse Mod Organizer
-
-
--
cgit v1.3.1
From 41ef9813dd7b3b7587afe8dfe3a16f2711200edb Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 2 Jun 2019 15:22:11 -0400
Subject: moved links to a new dedicated toolbar
---
src/mainwindow.cpp | 56 ++++++++++++++++++++++++++++++------------------------
src/mainwindow.h | 4 +---
src/mainwindow.ui | 43 +++++++++++++++++++++++------------------
3 files changed, 57 insertions(+), 46 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 8e0d2624..09ecc3f9 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -247,8 +247,6 @@ MainWindow::MainWindow(QSettings &initSettings
updateProblemsButton();
// Setup toolbar
- QWidget *spacer = new QWidget(ui->toolBar);
- spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
setupActionMenu(ui->actionTool);
setupActionMenu(ui->actionHelp);
@@ -259,16 +257,6 @@ MainWindow::MainWindow(QSettings &initSettings
toggleMO2EndorseState();
- for (QAction *action : ui->toolBar->actions()) {
- if (action->isSeparator()) {
- // insert spacers
- ui->toolBar->insertWidget(action, spacer);
- m_Sep = action;
- // m_Sep would only use the last separator anyway, and we only have the one anyway?
- break;
- }
- }
-
TaskProgressManager::instance().tryCreateTaskbar();
// set up mod list
@@ -407,7 +395,7 @@ MainWindow::MainWindow(QSettings &initSettings
connect(&TutorialManager::instance(), SIGNAL(windowTutorialFinished(QString)), this, SLOT(windowTutorialFinished(QString)));
connect(ui->tabWidget, SIGNAL(currentChanged(int)), &TutorialManager::instance(), SIGNAL(tabChanged(int)));
connect(ui->modList->header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(modListSortIndicatorChanged(int,Qt::SortOrder)));
- connect(ui->toolBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(toolBar_customContextMenuRequested(QPoint)));
+ connect(ui->linksToolBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(linksToolBar_customContextMenuRequested(QPoint)));
connect(&m_OrganizerCore, &OrganizerCore::modInstalled, this, &MainWindow::modInstalled);
connect(&m_OrganizerCore, &OrganizerCore::close, this, &QMainWindow::close);
@@ -618,29 +606,36 @@ void MainWindow::setupActionMenu(QAction* a)
void MainWindow::updateToolBar()
{
- for (QAction *action : ui->toolBar->actions()) {
- if (action->objectName().startsWith("custom__")) {
- ui->toolBar->removeAction(action);
- action->deleteLater();
- }
+ for (auto* a : ui->linksToolBar->actions()) {
+ ui->linksToolBar->removeAction(a);
+ a->deleteLater();
}
+ bool hasLinks = false;
+
std::vector::iterator begin, end;
m_OrganizerCore.executablesList()->getExecutables(begin, end);
+
for (auto iter = begin; iter != end; ++iter) {
if (iter->isShownOnToolbar()) {
+ hasLinks = true;
+
QAction *exeAction = new QAction(iconForExecutable(iter->m_BinaryInfo.filePath()),
iter->m_Title,
ui->toolBar);
+
exeAction->setObjectName(QString("custom__") + iter->m_Title);
if (!connect(exeAction, SIGNAL(triggered()), this, SLOT(startExeAction()))) {
qDebug("failed to connect trigger?");
}
- ui->toolBar->insertAction(m_Sep, exeAction);
+
+ ui->linksToolBar->addAction(exeAction);
}
}
-}
+ // don't show the toolbar if there are no links
+ ui->linksToolBar->setVisible(hasLinks);
+}
void MainWindow::scheduleUpdateButton()
{
@@ -649,7 +644,6 @@ void MainWindow::scheduleUpdateButton()
}
}
-
void MainWindow::updateProblemsButton()
{
size_t numProblems = checkForProblems();
@@ -1834,6 +1828,10 @@ void MainWindow::readSettings()
restoreGeometry(settings.value("window_geometry").toByteArray());
}
+ if (settings.contains("window_state")) {
+ restoreState(settings.value("window_state").toByteArray());
+ }
+
if (settings.contains("window_split")) {
ui->splitter->restoreState(settings.value("window_split").toByteArray());
}
@@ -1910,6 +1908,7 @@ void MainWindow::storeSettings(QSettings &settings) {
if (settings.value("reset_geometry", false).toBool()) {
settings.remove("window_geometry");
+ settings.remove("window_state");
settings.remove("window_split");
settings.remove("log_split");
settings.remove("filters_visible");
@@ -1918,6 +1917,7 @@ void MainWindow::storeSettings(QSettings &settings) {
settings.remove("reset_geometry");
} else {
settings.setValue("window_geometry", saveGeometry());
+ settings.setValue("window_state", saveState());
settings.setValue("window_split", ui->splitter->saveState());
settings.setValue("log_split", ui->topLevelSplitter->saveState());
settings.setValue("browser_geometry", m_IntegratedBrowser.saveGeometry());
@@ -6062,17 +6062,23 @@ void MainWindow::removeFromToolbar()
}
-void MainWindow::toolBar_customContextMenuRequested(const QPoint &point)
+void MainWindow::linksToolBar_customContextMenuRequested(const QPoint &point)
{
- QAction *action = ui->toolBar->actionAt(point);
+ QAction *action = ui->linksToolBar->actionAt(point);
+
if (action != nullptr) {
if (action->objectName().startsWith("custom_")) {
m_ContextAction = action;
QMenu menu;
- menu.addAction(tr("Remove"), this, SLOT(removeFromToolbar()));
- menu.exec(ui->toolBar->mapToGlobal(point));
+ menu.addAction(tr("Remove '%1' from the toolbar").arg(action->text()), this, SLOT(removeFromToolbar()));
+ menu.exec(ui->linksToolBar->mapToGlobal(point));
+ return;
}
}
+
+ // did not click a link button, show the default context menu
+ auto* m = createPopupMenu();
+ m->exec(ui->linksToolBar->mapToGlobal(point));
}
void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos)
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 96660aeb..8e50fa2e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -316,8 +316,6 @@ private:
Ui::MainWindow *ui;
- QAction *m_Sep; // Executable Shortcuts are added after this. Non owning.
-
bool m_WasVisible;
MOBase::TutorialControl m_Tutorial;
@@ -594,7 +592,7 @@ private slots:
*/
void allowListResize();
- void toolBar_customContextMenuRequested(const QPoint &point);
+ void linksToolBar_customContextMenuRequested(const QPoint &point);
void removeFromToolbar();
void overwriteClosed(int);
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 03cb9ab7..59d30a09 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1349,17 +1349,8 @@ p, li { white-space: pre-wrap; }
-
- true
-
-
- Qt::CustomContextMenu
-
- Tool Bar
-
-
- false
+ Main ToolBar
@@ -1367,12 +1358,6 @@ p, li { white-space: pre-wrap; }
36
-
- Qt::ToolButtonIconOnly
-
-
- false
-
TopToolBarArea
@@ -1380,9 +1365,11 @@ p, li { white-space: pre-wrap; }
false
-
-
+
+
+
+
@@ -1443,6 +1430,26 @@ p, li { white-space: pre-wrap; }
+
+
+ Qt::CustomContextMenu
+
+
+ Links ToolBar
+
+
+
+ 42
+ 36
+
+
+
+ TopToolBarArea
+
+
+ false
+
+
--
cgit v1.3.1
From e6706c7a5b82e68443de6ca262c77e1543986b1e Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 2 Jun 2019 16:28:09 -0400
Subject: the toolbar menu is now in the ui file instead of being created by
hand it's also shared between the main menu and the context menu
---
src/mainwindow.cpp | 82 +++++++++++++++++++++++++++++------------------
src/mainwindow.h | 10 ++++++
src/mainwindow.ui | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
3 files changed, 153 insertions(+), 32 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 642b0c99..3da571f9 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -399,6 +399,7 @@ MainWindow::MainWindow(QSettings &initSettings
connect(ui->tabWidget, SIGNAL(currentChanged(int)), &TutorialManager::instance(), SIGNAL(tabChanged(int)));
connect(ui->modList->header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(modListSortIndicatorChanged(int,Qt::SortOrder)));
connect(ui->linksToolBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(linksToolBar_customContextMenuRequested(QPoint)));
+ connect(ui->menuToolbars, &QMenu::aboutToShow, [&]{ toolbarMenu_aboutToShow(); });
connect(&m_OrganizerCore, &OrganizerCore::modInstalled, this, &MainWindow::modInstalled);
connect(&m_OrganizerCore, &OrganizerCore::close, this, &QMainWindow::close);
@@ -640,45 +641,66 @@ void MainWindow::updateToolBar()
ui->linksToolBar->setVisible(hasLinks);
}
-QMenu* MainWindow::createPopupMenu()
+void MainWindow::toolbarMenu_aboutToShow()
{
- auto* m = QMainWindow::createPopupMenu();
+ // well, this is a bit of a hack to allow the same toolbar menu to be shown
+ // in both the main menu and the context menu
+ //
+ // the toolbar menu is returned by createPopupMenu(), but Qt takes ownership
+ // of it and deletes it by setting the WA_DeleteOnClose attribute on it
+ //
+ // to avoid deleting the menu, the attribute is removed here
+ ui->menuToolbars->setAttribute(Qt::WA_DeleteOnClose, false);
- m->addSeparator();
+ ui->actionToolBarMainToggle->setChecked(ui->toolBar->isVisible());
+ ui->actionToolBarLinksToggle->setChecked(ui->linksToolBar->isVisible());
- auto* a = new QAction(tr("Small Icons"), m);
- connect(a, &QAction::triggered, [&]{ setToolbarSize(SmallToolbarSize); });
- a->setCheckable(true);
- a->setChecked(ui->toolBar->iconSize() == SmallToolbarSize);
- m->addAction(a);
+ ui->actionToolBarLargeIcons->setChecked(ui->toolBar->iconSize() == LargeToolbarSize);
+ ui->actionToolBarSmallIcons->setChecked(ui->toolBar->iconSize() == SmallToolbarSize);
- a = new QAction(tr("Large Icons"), m);
- connect(a, &QAction::triggered, [&]{ setToolbarSize(LargeToolbarSize); });
- a->setCheckable(true);
- a->setChecked(ui->toolBar->iconSize() == LargeToolbarSize);
- m->addAction(a);
+ ui->actionToolBarIconsOnly->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonIconOnly);
+ ui->actionToolBarTextOnly->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonTextOnly);
+ ui->actionToolBarIconsAndText->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonTextUnderIcon);
+}
- m->addSeparator();
+QMenu* MainWindow::createPopupMenu()
+{
+ return ui->menuToolbars;
+}
- a = new QAction(tr("Icons only"), m);
- connect(a, &QAction::triggered, [&]{ setToolbarButtonStyle(Qt::ToolButtonIconOnly); });
- a->setCheckable(true);
- a->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonIconOnly);
- m->addAction(a);
+void MainWindow::on_actionToolBarMainToggle_triggered()
+{
+ ui->toolBar->setVisible(!ui->toolBar->isVisible());
+}
- a = new QAction(tr("Text only"), m);
- connect(a, &QAction::triggered, [&]{ setToolbarButtonStyle(Qt::ToolButtonTextOnly); });
- a->setCheckable(true);
- a->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonTextOnly);
- m->addAction(a);
+void MainWindow::on_actionToolBarLinksToggle_triggered()
+{
+ ui->linksToolBar->setVisible(!ui->linksToolBar->isVisible());
+}
- a = new QAction(tr("Text and Icons"), m);
- connect(a, &QAction::triggered, [&]{ setToolbarButtonStyle(Qt::ToolButtonTextUnderIcon); });
- a->setCheckable(true);
- a->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonTextUnderIcon);
- m->addAction(a);
+void MainWindow::on_actionToolBarLargeIcons_triggered()
+{
+ setToolbarSize(LargeToolbarSize);
+}
+
+void MainWindow::on_actionToolBarSmallIcons_triggered()
+{
+ setToolbarSize(SmallToolbarSize);
+}
- return m;
+void MainWindow::on_actionToolBarIconsOnly_triggered()
+{
+ setToolbarButtonStyle(Qt::ToolButtonIconOnly);
+}
+
+void MainWindow::on_actionToolBarTextOnly_triggered()
+{
+ setToolbarButtonStyle(Qt::ToolButtonTextOnly);
+}
+
+void MainWindow::on_actionToolBarIconsAndText_triggered()
+{
+ setToolbarButtonStyle(Qt::ToolButtonTextUnderIcon);
}
void MainWindow::setToolbarSize(const QSize& s)
diff --git a/src/mainwindow.h b/src/mainwindow.h
index fa5912b8..18aa525e 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -213,6 +213,8 @@ private:
void updateToolBar();
void setToolbarSize(const QSize& s);
void setToolbarButtonStyle(Qt::ToolButtonStyle s);
+ void toolbarMenu_aboutToShow();
+
QMenu* createPopupMenu() override;
void activateSelectedProfile();
@@ -631,6 +633,14 @@ private slots: // ui slots
void on_actionSettings_triggered();
void on_actionUpdate_triggered();
void on_actionExit_triggered();
+ void on_actionToolBarMainToggle_triggered();
+ void on_actionToolBarLinksToggle_triggered();
+ void on_actionToolBarLargeIcons_triggered();
+ void on_actionToolBarSmallIcons_triggered();
+ void on_actionToolBarIconsOnly_triggered();
+ void on_actionToolBarTextOnly_triggered();
+ void on_actionToolBarIconsAndText_triggered();
+
void on_bsaList_customContextMenuRequested(const QPoint &pos);
void on_clearFiltersButton_clicked();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 59d30a09..a4bd2888 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1358,6 +1358,9 @@ p, li { white-space: pre-wrap; }
36
+
+ Qt::ToolButtonTextUnderIcon
+
TopToolBarArea
@@ -1405,10 +1408,8 @@ p, li { white-space: pre-wrap; }
-
-
+
+
@@ -1697,6 +1720,72 @@ p, li { white-space: pre-wrap; }
Exits Mod Organizer
+
+
+ Toolbar Size
+
+
+
+
+ Toolbar Buttons
+
+
+
+
+ true
+
+
+ &Main
+
+
+
+
+ true
+
+
+ &Links
+
+
+
+
+ true
+
+
+ &Small Icons
+
+
+
+
+ true
+
+
+ Lar&ge Icons
+
+
+
+
+ true
+
+
+ &Icons Only
+
+
+
+
+ true
+
+
+ &Text Only
+
+
+
+
+ true
+
+
+ I&cons and Text
+
+
--
cgit v1.3.1
From 71a9f085138bf8f9dc75a27abd9b54cdb89a0876 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 2 Jun 2019 16:45:58 -0400
Subject: added medium toolbar icon size
---
src/mainwindow.cpp | 17 ++++++++++++-----
src/mainwindow.h | 3 ++-
src/mainwindow.ui | 9 ++++++---
3 files changed, 20 insertions(+), 9 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 3da571f9..753b6a5d 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -190,6 +190,7 @@ using namespace MOBase;
using namespace MOShared;
const QSize SmallToolbarSize(24, 24);
+const QSize MediumToolbarSize(32, 32);
const QSize LargeToolbarSize(42, 36);
@@ -655,8 +656,9 @@ void MainWindow::toolbarMenu_aboutToShow()
ui->actionToolBarMainToggle->setChecked(ui->toolBar->isVisible());
ui->actionToolBarLinksToggle->setChecked(ui->linksToolBar->isVisible());
- ui->actionToolBarLargeIcons->setChecked(ui->toolBar->iconSize() == LargeToolbarSize);
ui->actionToolBarSmallIcons->setChecked(ui->toolBar->iconSize() == SmallToolbarSize);
+ ui->actionToolBarMediumIcons->setChecked(ui->toolBar->iconSize() == MediumToolbarSize);
+ ui->actionToolBarLargeIcons->setChecked(ui->toolBar->iconSize() == LargeToolbarSize);
ui->actionToolBarIconsOnly->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonIconOnly);
ui->actionToolBarTextOnly->setChecked(ui->toolBar->toolButtonStyle() == Qt::ToolButtonTextOnly);
@@ -678,14 +680,19 @@ void MainWindow::on_actionToolBarLinksToggle_triggered()
ui->linksToolBar->setVisible(!ui->linksToolBar->isVisible());
}
-void MainWindow::on_actionToolBarLargeIcons_triggered()
+void MainWindow::on_actionToolBarSmallIcons_triggered()
{
- setToolbarSize(LargeToolbarSize);
+ setToolbarSize(SmallToolbarSize);
}
-void MainWindow::on_actionToolBarSmallIcons_triggered()
+void MainWindow::on_actionToolBarMediumIcons_triggered()
{
- setToolbarSize(SmallToolbarSize);
+ setToolbarSize(MediumToolbarSize);
+}
+
+void MainWindow::on_actionToolBarLargeIcons_triggered()
+{
+ setToolbarSize(LargeToolbarSize);
}
void MainWindow::on_actionToolBarIconsOnly_triggered()
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 18aa525e..a0cce858 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -635,8 +635,9 @@ private slots: // ui slots
void on_actionExit_triggered();
void on_actionToolBarMainToggle_triggered();
void on_actionToolBarLinksToggle_triggered();
- void on_actionToolBarLargeIcons_triggered();
void on_actionToolBarSmallIcons_triggered();
+ void on_actionToolBarMediumIcons_triggered();
+ void on_actionToolBarLargeIcons_triggered();
void on_actionToolBarIconsOnly_triggered();
void on_actionToolBarTextOnly_triggered();
void on_actionToolBarIconsAndText_triggered();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index a4bd2888..29a8ac76 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1358,9 +1358,6 @@ p, li { white-space: pre-wrap; }
36
-
- Qt::ToolButtonTextUnderIcon
-
TopToolBarArea
@@ -1438,6 +1435,7 @@ p, li { white-space: pre-wrap; }
+
@@ -1786,6 +1784,11 @@ p, li { white-space: pre-wrap; }
I&cons and Text
+
+
+ M&edium Icons
+
+
--
cgit v1.3.1
From 3c69f1e54ab1eb99b2d1b30e5dfa5f28239e4314 Mon Sep 17 00:00:00 2001
From: isanae <14251494+isanae@users.noreply.github.com>
Date: Sun, 2 Jun 2019 21:50:52 -0400
Subject: update styles to handle the new menu bar also formatted the
Transparent styles, all the css was on one line added a separator before the
settings menu item fixed medium icon item not being checkable
---
src/mainwindow.ui | 4 +
src/stylesheets/Night Eyes.qss | 50 +-
src/stylesheets/Paper Automata.qss | 10 +
src/stylesheets/Paper Dark by 6788.qss | 12 +
src/stylesheets/Paper Light by 6788.qss | 12 +
src/stylesheets/Parchment v1.1 by Bob.qss | 68 ++-
src/stylesheets/Transparent-Style-101-Green.qss | 490 +++++++++++++++-
src/stylesheets/Transparent-Style-BOS.qss | 743 +++++++++++++++++++++++-
src/stylesheets/Transparent-Style-Skyrim.qss | 743 +++++++++++++++++++++++-
src/stylesheets/dark.qss | 5 +
src/stylesheets/skyrim.qss | 8 +
src/stylesheets/vs15 Dark-Green.qss | 14 +-
src/stylesheets/vs15 Dark-Orange.qss | 14 +-
src/stylesheets/vs15 Dark-Purple.qss | 14 +-
src/stylesheets/vs15 Dark-Red.qss | 14 +-
src/stylesheets/vs15 Dark-Yellow.qss | 14 +-
src/stylesheets/vs15 Dark.qss | 14 +-
17 files changed, 2135 insertions(+), 94 deletions(-)
(limited to 'src/mainwindow.ui')
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 29a8ac76..05d64bdf 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1407,6 +1407,7 @@ p, li { white-space: pre-wrap; }
+