diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 55 | ||||
| -rw-r--r-- | src/mainwindow.h | 1 | ||||
| -rw-r--r-- | src/mainwindow.ui | 2 | ||||
| -rw-r--r-- | src/version.rc | 4 |
4 files changed, 56 insertions, 6 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bc9a3ce6..78efa182 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1440,12 +1440,36 @@ void MainWindow::registerModPage(IPluginModPage *modPage) ui->actionModPage->menu()->addAction(action); } +bool MainWindow::registerNexusPage(const QString& gameName) +{ + // Get the plugin + IPluginGame* plugin = m_OrganizerCore.getGame(gameName); + if (plugin == nullptr) + return false; + + // Create an action + QAction* action = new QAction( + plugin->gameIcon(), + QObject::tr("Visit %1 on Nexus").arg(plugin->gameName()), + this); + + // Bind the action + connect(action, &QAction::triggered, this, [this, gameName]() { + shell::Open(QUrl(NexusInterface::instance().getGameURL(gameName))); + }, Qt::QueuedConnection); + + // Add the action + ui->actionModPage->menu()->addAction(action); + + return true; +} + void MainWindow::updateModPageMenu() { // Clear the menu: ui->actionModPage->menu()->clear(); - ui->actionModPage->menu()->addAction(ui->actionNexus); + // Determine the loaded mod page plugins std::vector<IPluginModPage*> modPagePlugins = m_PluginContainer.plugins<IPluginModPage>(); // Sort the plugins by display name @@ -1466,14 +1490,30 @@ void MainWindow::updateModPageMenu() registerModPage(modPagePlugin); } + // Add the primary game (with a separator) + registerNexusPage(m_OrganizerCore.managedGame()->gameShortName()); + ui->actionModPage->menu()->addSeparator(); + + // Add the secondary games (sorted) + bool secondaryGameAdded = false; + QStringList secondaryGames = m_OrganizerCore.managedGame()->validShortNames(); + secondaryGames.sort(Qt::CaseInsensitive); + for (auto gameName : secondaryGames) + { + if (registerNexusPage(gameName)) { + secondaryGameAdded = true; + } + } + // No mod page plugin and the menu was visible: - if (modPagePlugins.empty()) { + bool keepOriginalAction = modPagePlugins.size() == 0 && !secondaryGameAdded; + if (keepOriginalAction) { ui->toolBar->insertAction(ui->actionAdd_Profile, ui->actionNexus); } else { ui->toolBar->removeAction(ui->actionNexus); } - ui->actionModPage->setVisible(!modPagePlugins.empty()); + ui->actionModPage->setVisible(!keepOriginalAction); } void MainWindow::startExeAction() @@ -2148,6 +2188,15 @@ void MainWindow::on_actionAdd_Profile_triggered() profilesDialog.exec(); m_SavesTab->refreshSaveList(); // since the save list may now be outdated we have to refresh it completely + if (profilesDialog.selectedProfile()) + { + // Change profile while blocking signals to prevent extra signals being sent + // Doesn't matter much as refreshProfiles() is being called after this + ui->profileBox->blockSignals(true); + ui->profileBox->setCurrentText(profilesDialog.selectedProfile().value()); + ui->profileBox->blockSignals(false); + } + if (refreshProfiles() && !profilesDialog.failed()) { break; } diff --git a/src/mainwindow.h b/src/mainwindow.h index 7afd954a..6626bf51 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -187,6 +187,7 @@ private: void setToolbarButtonStyle(Qt::ToolButtonStyle s); void registerModPage(MOBase::IPluginModPage* modPage); + bool registerNexusPage(const QString& gameName); void registerPluginTool(MOBase::IPluginTool* tool, QString name = QString(), QMenu* menu = nullptr); void updateToolbarMenu(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index fd149dfb..0c4d9984 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1246,7 +1246,7 @@ p, li { white-space: pre-wrap; } <bool>false</bool> </attribute> <attribute name="headerStretchLastSection"> - <bool>false</bool> + <bool>true</bool> </attribute> <column> <property name="text"> diff --git a/src/version.rc b/src/version.rc index c38aa375..850a52f7 100644 --- a/src/version.rc +++ b/src/version.rc @@ -4,13 +4,13 @@ // Otherwise, if letters are used in VER_FILEVERSION_STR, uses the full MOBase::VersionInfo parser // Otherwise, uses the numbers from VER_FILEVERSION and sets the release type as pre-alpha #define VER_FILEVERSION 2,4,1 -#define VER_FILEVERSION_STR "2.4.1rc1\0" +#define VER_FILEVERSION_STR "2.4.1\0" VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_FILEVERSION FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -FILEFLAGS VS_FF_PRERELEASE +FILEFLAGS (0) FILEOS VOS__WINDOWS32 FILETYPE VFT_APP FILESUBTYPE (0) |
