diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-02 14:22:24 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-02 14:22:24 -0400 |
| commit | 746e9c08e68ed7e44e6ef4e29b250c73b9c21440 (patch) | |
| tree | e03ca5cd5dcb5495691f36817716d219574c9be9 | |
| parent | 860eb49b45703d939196e92ba6e6d99f54ed3088 (diff) | |
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
| -rw-r--r-- | src/mainwindow.cpp | 32 | ||||
| -rw-r--r-- | src/mainwindow.h | 2 | ||||
| -rw-r--r-- | src/mainwindow.ui | 20 |
3 files changed, 22 insertions, 32 deletions
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<QToolButton*>(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<QString, int> IDs) void MainWindow::toggleMO2EndorseState() { - QToolButton *toolBtn = qobject_cast<QToolButton*>(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; } <string>&Tools</string> </property> <addaction name="actionNexus"/> + <addaction name="separator"/> + <addaction name="actionNotifications"/> <addaction name="actionModify_Executables"/> <addaction name="actionTool"/> + <addaction name="separator"/> <addaction name="actionSettings"/> </widget> <widget class="QMenu" name="menu_Help"> @@ -1427,13 +1430,7 @@ p, li { white-space: pre-wrap; } </property> <addaction name="actionHelp"/> <addaction name="actionUpdate"/> - <addaction name="actionEndorseMOMenu"/> - </widget> - <widget class="QMenu" name="menu_View"> - <property name="title"> - <string>&View</string> - </property> - <addaction name="actionNotifications"/> + <addaction name="actionEndorseMO"/> </widget> <widget class="QMenu" name="menu_Edit"> <property name="title"> @@ -1443,7 +1440,6 @@ p, li { white-space: pre-wrap; } </widget> <addaction name="menu_File"/> <addaction name="menu_Edit"/> - <addaction name="menu_View"/> <addaction name="menu_Tools"/> <addaction name="menu_Help"/> </widget> @@ -1694,14 +1690,6 @@ p, li { white-space: pre-wrap; } <string>Exits Mod Organizer</string> </property> </action> - <action name="actionEndorseMOMenu"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Endorse Mod Organizer</string> - </property> - </action> </widget> <layoutdefault spacing="6" margin="11"/> <customwidgets> |
