From c82c7af678c088a6b94fc8a4a0f31fc9498e8220 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sun, 26 May 2019 04:00:54 -0400 Subject: changed rest of ShellExecuteW() calls to use shell::Execute(), shell::OpenLink() or shell::OpenFile() --- src/problemsdialog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/problemsdialog.cpp') diff --git a/src/problemsdialog.cpp b/src/problemsdialog.cpp index 795baab0..56109d34 100644 --- a/src/problemsdialog.cpp +++ b/src/problemsdialog.cpp @@ -1,5 +1,6 @@ #include "problemsdialog.h" #include "ui_problemsdialog.h" +#include "organizercore.h" #include #include #include @@ -87,5 +88,5 @@ void ProblemsDialog::startFix() void ProblemsDialog::urlClicked(const QUrl &url) { - ::ShellExecuteW(nullptr, L"open", ToWString(url.toString()).c_str(), nullptr, nullptr, SW_SHOWNORMAL); + shell::OpenLink(url); } -- cgit v1.3.1 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 ++++++------ src/mainwindow.h | 3 + src/mainwindow.ui | 195 ++++++++++++++++++++++++++++++++++++++++++++----- src/problemsdialog.cpp | 24 +++++- src/problemsdialog.h | 6 +- 5 files changed, 226 insertions(+), 48 deletions(-) (limited to 'src/problemsdialog.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() 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 @@ + + 6 + + + 6 + + + 6 + + + 0 + @@ -1381,13 +1393,67 @@ p, li { white-space: pre-wrap; } + + + + 0 + 0 + 926 + 21 + + + + + &File + + + + + + + + + + &Tools + + + + + + + + + &Help + + + + + + + + &View + + + + + + &Edit + + + + + + + + + :/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 + 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 pluginObjects, QWidget *parent) - : QDialog(parent), ui(new Ui::ProblemsDialog), m_PluginObjects(pluginObjects) +ProblemsDialog::ProblemsDialog(std::vector 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(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 m_PluginObjects; + bool m_hasProblems; }; #endif // PROBLEMSDIALOG_H -- cgit v1.3.1