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.cpp | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src/mainwindow.cpp') 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")); } @@ -975,6 +970,13 @@ void MainWindow::showEvent(QShowEvent *event) void MainWindow::closeEvent(QCloseEvent* event) +{ + if (!exit()) { + event->ignore(); + } +} + +bool MainWindow::exit() { m_closing = true; @@ -982,8 +984,7 @@ void MainWindow::closeEvent(QCloseEvent* event) 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(), 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() -- cgit v1.3.1