diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-02 11:55:13 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-02 11:55:13 -0400 |
| commit | 3c7b232361d01f79a1d48ae3d8200cb6a68bbf32 (patch) | |
| tree | 3b82f55b743f9ccf6a5b2cbcca2ab364f9a1ce87 | |
| parent | f00314442b9c3c28e846c64da3c3f776e50656de (diff) | |
- 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
| -rw-r--r-- | src/mainwindow.cpp | 46 | ||||
| -rw-r--r-- | src/mainwindow.h | 3 | ||||
| -rw-r--r-- | src/mainwindow.ui | 195 | ||||
| -rw-r--r-- | src/problemsdialog.cpp | 24 | ||||
| -rw-r--r-- | src/problemsdialog.h | 6 |
5 files changed, 226 insertions, 48 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0ef9bc80..ff62e05e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -242,7 +242,6 @@ MainWindow::MainWindow(QSettings &initSettings m_RefreshProgress->setVisible(false); statusBar()->addWidget(m_RefreshProgress, 1000); statusBar()->clearMessage(); - statusBar()->hide(); updateProblemsButton(); @@ -674,8 +673,6 @@ void MainWindow::updateProblemsButton() { size_t numProblems = checkForProblems(); if (numProblems > 0) { - ui->actionNotifications->setEnabled(true); - ui->actionNotifications->setIconText(tr("Notifications")); ui->actionNotifications->setToolTip(tr("There are notifications to read")); QPixmap mergedIcon = QPixmap(":/MO/gui/warning").scaled(64, 64); @@ -686,8 +683,6 @@ void MainWindow::updateProblemsButton() } ui->actionNotifications->setIcon(QIcon(mergedIcon)); } else { - ui->actionNotifications->setEnabled(false); - ui->actionNotifications->setIconText(tr("No Notifications")); ui->actionNotifications->setToolTip(tr("There are no notifications")); ui->actionNotifications->setIcon(QIcon(":/MO/gui/warning")); } @@ -976,14 +971,20 @@ void MainWindow::showEvent(QShowEvent *event) void MainWindow::closeEvent(QCloseEvent* event) { + if (!exit()) { + event->ignore(); + } +} + +bool MainWindow::exit() +{ m_closing = true; if (m_OrganizerCore.downloadManager()->downloadsInProgressNoPause()) { if (QMessageBox::question(this, tr("Downloads in progress"), tr("There are still downloads in progress, do you really want to quit?"), QMessageBox::Yes | QMessageBox::Cancel) == QMessageBox::Cancel) { - event->ignore(); - return; + return false; } else { m_OrganizerCore.downloadManager()->pauseAll(); } @@ -996,12 +997,12 @@ void MainWindow::closeEvent(QCloseEvent* event) { m_OrganizerCore.waitForApplication(injected_process_still_running); if (!m_closing) { // if operation cancelled - event->ignore(); - return; + return false; } } setCursor(Qt::WaitCursor); + return true; } void MainWindow::cleanup() @@ -2292,11 +2293,9 @@ void MainWindow::refresher_progress(int percent) { if (percent == 100) { m_RefreshProgress->setVisible(false); - statusBar()->hide(); this->setEnabled(true); } else if (!m_RefreshProgress->isVisible()) { this->setEnabled(false); - statusBar()->show(); m_RefreshProgress->setVisible(true); m_RefreshProgress->setRange(0, 100); m_RefreshProgress->setValue(percent); @@ -2309,7 +2308,6 @@ void MainWindow::directory_refreshed() // now refreshDataTreeKeepExpandedNodes(); updateProblemsButton(); - statusBar()->hide(); } void MainWindow::esplist_changed() @@ -2930,7 +2928,6 @@ void MainWindow::untrack_clicked() void MainWindow::validationFailed(const QString &error) { qDebug("Nexus API validation failed: %s", qUtf8Printable(error)); - statusBar()->hide(); } void MainWindow::windowTutorialFinished(const QString &windowName) @@ -4115,7 +4112,6 @@ void MainWindow::checkModsForUpdates() QString apiKey; if (m_OrganizerCore.settings().getNexusApiKey(apiKey)) { m_OrganizerCore.doAfterLogin([this] () { this->checkModsForUpdates(); }); - statusBar()->show(); NexusInterface::instance(&m_PluginContainer)->getAccessManager()->apiCheck(apiKey); } else { qWarning("You are not currently authenticated with Nexus. Please do so under Settings -> Nexus."); @@ -5391,12 +5387,15 @@ void MainWindow::on_conflictsCheckBox_toggled(bool) refreshDataTreeKeepExpandedNodes(); } - void MainWindow::on_actionUpdate_triggered() { m_OrganizerCore.startMOUpdate(); } +void MainWindow::on_actionExit_triggered() +{ + exit(); +} void MainWindow::actionEndorseMO() { @@ -5974,16 +5973,15 @@ void MainWindow::on_actionNotifications_triggered() { updateProblemsButton(); ProblemsDialog problems(m_PluginContainer.plugins<QObject>(), this); - if (problems.hasProblems()) { - QSettings &settings = m_OrganizerCore.settings().directInterface(); - QString key = QString("geometry/%1").arg(problems.objectName()); - if (settings.contains(key)) { - problems.restoreGeometry(settings.value(key).toByteArray()); - } - problems.exec(); - settings.setValue(key, problems.saveGeometry()); - updateProblemsButton(); + + QSettings &settings = m_OrganizerCore.settings().directInterface(); + QString key = QString("geometry/%1").arg(problems.objectName()); + if (settings.contains(key)) { + problems.restoreGeometry(settings.value(key).toByteArray()); } + problems.exec(); + settings.setValue(key, problems.saveGeometry()); + updateProblemsButton(); } void MainWindow::on_actionChange_Game_triggered() diff --git a/src/mainwindow.h b/src/mainwindow.h index b4ad0bdb..1f0dd5ff 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -153,6 +153,8 @@ public: void displayModInformation(ModInfo::Ptr modInfo, unsigned int index, int tab); + bool exit(); + virtual bool closeWindow(); virtual void setWindowEnabled(bool enabled); @@ -626,6 +628,7 @@ private slots: // ui slots void on_actionNotifications_triggered(); void on_actionSettings_triggered(); void on_actionUpdate_triggered(); + void on_actionExit_triggered(); void on_bsaList_customContextMenuRequested(const QPoint &pos); void on_clearFiltersButton_clicked(); 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 @@ </sizepolicy> </property> <layout class="QHBoxLayout" name="horizontalLayout_8"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <item> <widget class="QSplitter" name="topLevelSplitter"> <property name="orientation"> @@ -1381,13 +1393,67 @@ p, li { white-space: pre-wrap; } <addaction name="actionHelp"/> </widget> <widget class="QStatusBar" name="statusBar"/> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>926</width> + <height>21</height> + </rect> + </property> + <widget class="QMenu" name="menu_File"> + <property name="title"> + <string>&File</string> + </property> + <addaction name="actionChange_Game"/> + <addaction name="actionInstallMod"/> + <addaction name="actionAdd_Profile"/> + <addaction name="separator"/> + <addaction name="actionExit"/> + </widget> + <widget class="QMenu" name="menu_Tools"> + <property name="title"> + <string>&Tools</string> + </property> + <addaction name="actionNexus"/> + <addaction name="actionModify_Executables"/> + <addaction name="actionToolMenu"/> + <addaction name="actionSettings"/> + </widget> + <widget class="QMenu" name="menu_Help"> + <property name="title"> + <string>&Help</string> + </property> + <addaction name="actionHelpMenu"/> + <addaction name="actionUpdate"/> + <addaction name="actionEndorseMOMenu"/> + </widget> + <widget class="QMenu" name="menu_View"> + <property name="title"> + <string>&View</string> + </property> + <addaction name="actionNotifications"/> + </widget> + <widget class="QMenu" name="menu_Edit"> + <property name="title"> + <string>&Edit</string> + </property> + <addaction name="actionCopy_Log_to_Clipboard"/> + </widget> + <addaction name="menu_File"/> + <addaction name="menu_Edit"/> + <addaction name="menu_View"/> + <addaction name="menu_Tools"/> + <addaction name="menu_Help"/> + </widget> <action name="actionInstallMod"> <property name="icon"> <iconset resource="resources.qrc"> <normaloff>:/MO/gui/resources/system-installer.png</normaloff>:/MO/gui/resources/system-installer.png</iconset> </property> <property name="text"> - <string>Install Mod</string> + <string>Install &Mod...</string> </property> <property name="iconText"> <string>Install &Mod</string> @@ -1395,6 +1461,9 @@ p, li { white-space: pre-wrap; } <property name="toolTip"> <string>Install a new mod from an archive</string> </property> + <property name="statusTip"> + <string>Install a new mod from an archive</string> + </property> <property name="shortcut"> <string>Ctrl+M</string> </property> @@ -1405,13 +1474,16 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/profiles</normaloff>:/MO/gui/profiles</iconset> </property> <property name="text"> - <string>Profiles</string> + <string>&Profiles...</string> </property> <property name="iconText"> <string>&Profiles</string> </property> <property name="toolTip"> - <string>Configure Profiles</string> + <string>Configure profiles</string> + </property> + <property name="statusTip"> + <string>Configure profiles</string> </property> <property name="shortcut"> <string>Ctrl+P</string> @@ -1423,7 +1495,7 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/icon_executable</normaloff>:/MO/gui/icon_executable</iconset> </property> <property name="text"> - <string>Executables</string> + <string>&Executables...</string> </property> <property name="iconText"> <string>&Executables</string> @@ -1431,6 +1503,9 @@ p, li { white-space: pre-wrap; } <property name="toolTip"> <string>Configure the executables that can be started through Mod Organizer</string> </property> + <property name="statusTip"> + <string>Configure the executables that can be started through Mod Organizer</string> + </property> <property name="shortcut"> <string>Ctrl+E</string> </property> @@ -1441,7 +1516,7 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/plugins</normaloff>:/MO/gui/plugins</iconset> </property> <property name="text"> - <string>Tools</string> + <string>&Tools</string> </property> <property name="iconText"> <string>&Tools</string> @@ -1459,7 +1534,7 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/settings</normaloff>:/MO/gui/settings</iconset> </property> <property name="text"> - <string>Settings</string> + <string>&Settings...</string> </property> <property name="iconText"> <string>&Settings</string> @@ -1467,6 +1542,9 @@ p, li { white-space: pre-wrap; } <property name="toolTip"> <string>Configure settings and workarounds</string> </property> + <property name="statusTip"> + <string>Configure settings and workarounds</string> + </property> <property name="shortcut"> <string>Ctrl+S</string> </property> @@ -1477,10 +1555,16 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/resources/internet-web-browser.png</normaloff>:/MO/gui/resources/internet-web-browser.png</iconset> </property> <property name="text"> - <string>Nexus</string> + <string>Visit &Nexus</string> + </property> + <property name="iconText"> + <string>Visit &Nexus</string> </property> <property name="toolTip"> - <string>Search nexus network for more mods</string> + <string>Visit the Nexus website in your browser for more mods</string> + </property> + <property name="statusTip"> + <string>Visit the Nexus website in your browser for more mods</string> </property> <property name="shortcut"> <string>Ctrl+N</string> @@ -1495,25 +1579,34 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/update</normaloff>:/MO/gui/update</iconset> </property> <property name="text"> - <string>Update</string> + <string>&Update Mod Organizer</string> + </property> + <property name="iconText"> + <string>&Update Mod Organizer</string> </property> <property name="toolTip"> <string>Mod Organizer is up-to-date</string> </property> + <property name="statusTip"> + <string>Mod Organizer is up-to-date</string> + </property> </action> <action name="actionNotifications"> - <property name="enabled"> - <bool>false</bool> - </property> <property name="icon"> <iconset resource="resources.qrc"> <normaloff>:/MO/gui/warning</normaloff>:/MO/gui/warning</iconset> </property> <property name="text"> - <string>No Notifications</string> + <string>Notifications...</string> + </property> + <property name="toolTip"> + <string>Open the notifications dialog</string> + </property> + <property name="statusTip"> + <string>Open the notifications dialog</string> </property> <property name="whatsThis"> - <string>This button will be highlighted if MO discovered potential problems in your setup and provide tips on how to fix them.</string> + <string>This button will be highlighted on the toolbar if MO discovered potential problems in your setup and provide tips on how to fix them.</string> </property> </action> <action name="actionHelp"> @@ -1522,7 +1615,10 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/help</normaloff>:/MO/gui/help</iconset> </property> <property name="text"> - <string>Help</string> + <string>&Help</string> + </property> + <property name="iconText"> + <string>&Help</string> </property> <property name="toolTip"> <string>Help</string> @@ -1537,15 +1633,30 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/icon_favorite</normaloff>:/MO/gui/icon_favorite</iconset> </property> <property name="text"> - <string>Endorse MO</string> + <string>&Endorse ModOrganizer</string> + </property> + <property name="iconText"> + <string>&Endorse ModOrganizer</string> </property> <property name="toolTip"> <string>Endorse Mod Organizer</string> </property> + <property name="statusTip"> + <string>Endorse Mod Organizer</string> + </property> </action> <action name="actionCopy_Log_to_Clipboard"> <property name="text"> - <string>Copy Log to Clipboard</string> + <string>Copy &Log</string> + </property> + <property name="iconText"> + <string>Copy &Log</string> + </property> + <property name="toolTip"> + <string>Copy log to clipboard</string> + </property> + <property name="statusTip"> + <string>Copy log to clipboard</string> </property> </action> <action name="actionChange_Game"> @@ -1554,11 +1665,59 @@ p, li { white-space: pre-wrap; } <normaloff>:/MO/gui/instance_switch</normaloff>:/MO/gui/instance_switch</iconset> </property> <property name="text"> - <string>Change Game</string> + <string>&Change Game...</string> + </property> + <property name="iconText"> + <string>&Change Game</string> </property> <property name="toolTip"> <string>Open the Instance selection dialog to manage a different Game</string> </property> + <property name="statusTip"> + <string>Open the Instance selection dialog to manage a different Game</string> + </property> + </action> + <action name="actionExit"> + <property name="text"> + <string>E&xit</string> + </property> + <property name="iconText"> + <string>E&xit</string> + </property> + <property name="toolTip"> + <string>Exits Mod Organizer</string> + </property> + <property name="statusTip"> + <string>Exits Mod Organizer</string> + </property> + </action> + <action name="actionToolMenu"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/MO/gui/plugins</normaloff>:/MO/gui/plugins</iconset> + </property> + <property name="text"> + <string>&Tools</string> + </property> + </action> + <action name="actionHelpMenu"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Help menu</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"/> diff --git a/src/problemsdialog.cpp b/src/problemsdialog.cpp index 56109d34..1e8e800f 100644 --- a/src/problemsdialog.cpp +++ b/src/problemsdialog.cpp @@ -11,8 +11,9 @@ using namespace MOBase;
-ProblemsDialog::ProblemsDialog(std::vector<QObject *> pluginObjects, QWidget *parent)
- : QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginObjects(pluginObjects)
+ProblemsDialog::ProblemsDialog(std::vector<QObject *> pluginObjects, QWidget *parent) :
+ QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginObjects(pluginObjects),
+ m_hasProblems(false)
{
ui->setupUi(this);
@@ -30,7 +31,9 @@ ProblemsDialog::~ProblemsDialog() void ProblemsDialog::runDiagnosis()
{
+ m_hasProblems = false;
ui->problemsWidget->clear();
+
for(QObject *pluginObj : m_PluginObjects) {
IPlugin *plugin = qobject_cast<IPlugin*>(pluginObj);
if (plugin != nullptr && !plugin->isActive())
@@ -47,6 +50,7 @@ void ProblemsDialog::runDiagnosis() newItem->setData(0, Qt::UserRole, diagnose->fullDescription(key));
ui->problemsWidget->addTopLevelItem(newItem);
+ m_hasProblems = true;
if (diagnose->hasGuidedFix(key)) {
newItem->setText(1, tr("Fix"));
@@ -60,11 +64,25 @@ void ProblemsDialog::runDiagnosis() }
}
}
+
+ if (!m_hasProblems) {
+ auto* item = new QTreeWidgetItem;
+
+ item->setText(0, tr("(There are no notifications)"));
+ item->setText(1, "");
+ item->setData(0, Qt::UserRole, QString());
+
+ QFont font = item->font(0);
+ font.setItalic(true);
+ item->setFont(0, font);
+
+ ui->problemsWidget->addTopLevelItem(item);
+ }
}
bool ProblemsDialog::hasProblems() const
{
- return ui->problemsWidget->topLevelItemCount() != 0;
+ return m_hasProblems;
}
void ProblemsDialog::selectionChanged()
diff --git a/src/problemsdialog.h b/src/problemsdialog.h index a48a5de1..c211e4f5 100644 --- a/src/problemsdialog.h +++ b/src/problemsdialog.h @@ -21,20 +21,20 @@ public: ~ProblemsDialog();
bool hasProblems() const;
-private:
+private:
void runDiagnosis();
private slots:
-
void selectionChanged();
void urlClicked(const QUrl &url);
void startFix();
-private:
+private:
Ui::ProblemsDialog *ui;
std::vector<QObject *> m_PluginObjects;
+ bool m_hasProblems;
};
#endif // PROBLEMSDIALOG_H
|
