From 57acd4949be967a4be00dbee1f84309634e26a74 Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Mon, 22 Nov 2021 16:13:06 -0700 Subject: Fix tab order of create instance dialog --- src/createinstancedialog.ui | 48 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/createinstancedialog.ui b/src/createinstancedialog.ui index 86fa900b..5c791aff 100644 --- a/src/createinstancedialog.ui +++ b/src/createinstancedialog.ui @@ -67,7 +67,7 @@ 0 - + @@ -115,7 +115,7 @@ - + @@ -226,7 +226,7 @@ - + @@ -367,7 +367,7 @@ - + @@ -594,7 +594,7 @@ 0 - + 0 @@ -676,7 +676,7 @@ - + 0 @@ -906,7 +906,7 @@ - + @@ -1048,7 +1048,7 @@ - + @@ -1232,6 +1232,38 @@
linklabel.h
+ + next + cancel + hideIntro + createGlobal + createPortable + scrollArea_3 + showAllGames + gamesFilter + scrollArea_2 + instanceName + location + browseLocation + advancedPathOptions + base + browseBase + downloads + browseDownloads + mods + browseMods + profiles + browseProfiles + overwrite + browseOverwrite + nexusConnect + nexusManual + nexusLog + review + creationLog + launch + back + -- cgit v1.3.1 From 1077a5bad0af00bdd113552518eac791b58eeb9a Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Mon, 22 Nov 2021 16:13:20 -0700 Subject: Allow portable instances to set custom paths Fixes #1610 --- src/createinstancedialog.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/createinstancedialog.cpp b/src/createinstancedialog.cpp index 9f0edf96..e728aec1 100644 --- a/src/createinstancedialog.cpp +++ b/src/createinstancedialog.cpp @@ -341,28 +341,25 @@ void CreateInstanceDialog::finish() s.game().setEdition(ci.gameVariant); } - if (ci.type == Global) { - if (ci.paths.base != ci.dataPath) { - s.paths().setBase(ci.paths.base); - } - - if (ci.paths.downloads != cid::makeDefaultPath(AppConfig::downloadPath())) { - s.paths().setDownloads(ci.paths.downloads); - } + if (ci.paths.base != ci.dataPath) { + s.paths().setBase(ci.paths.base); + } - if (ci.paths.mods != cid::makeDefaultPath(AppConfig::modsPath())) { - s.paths().setMods(ci.paths.mods); - } + if (ci.paths.downloads != cid::makeDefaultPath(AppConfig::downloadPath())) { + s.paths().setDownloads(ci.paths.downloads); + } - if (ci.paths.profiles != cid::makeDefaultPath(AppConfig::profilesPath())) { - s.paths().setProfiles(ci.paths.profiles); - } + if (ci.paths.mods != cid::makeDefaultPath(AppConfig::modsPath())) { + s.paths().setMods(ci.paths.mods); + } - if (ci.paths.overwrite != cid::makeDefaultPath(AppConfig::overwritePath())) { - s.paths().setOverwrite(ci.paths.overwrite); - } + if (ci.paths.profiles != cid::makeDefaultPath(AppConfig::profilesPath())) { + s.paths().setProfiles(ci.paths.profiles); } + if (ci.paths.overwrite != cid::makeDefaultPath(AppConfig::overwritePath())) { + s.paths().setOverwrite(ci.paths.overwrite); + } logCreation(tr("Writing %1...").arg(ci.iniPath)); -- cgit v1.3.1 From 9644fef8bdb3b96dfd8b20d1d2c4aa1827521783 Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Mon, 22 Nov 2021 16:35:38 -0700 Subject: Update Windows detection Windows 11 reports itself as Windows 10 using the methods normally employed. Microsoft seems to want people to use the BuildId to identify the version of Windows but I'm going to refuse to do that because it's stupid. This change also prefers DisplayVersion over ReleaseId as somehow I have both and DisplayVersion is more correct (21H2 vs 2009). /shrug. Fixes #1607 --- src/envwindows.cpp | 13 ++++--------- src/envwindows.h | 6 +----- 2 files changed, 5 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/envwindows.cpp b/src/envwindows.cpp index 98e78a3e..a2019fab 100644 --- a/src/envwindows.cpp +++ b/src/envwindows.cpp @@ -94,11 +94,6 @@ QString WindowsInfo::toString() const sl.push_back(m_release.buildLab); } - // product name - if (!m_release.productName.isEmpty()) { - sl.push_back(m_release.productName); - } - // elevated QString elevated = "?"; if (m_elevated.has_value()) { @@ -187,11 +182,11 @@ WindowsInfo::Release WindowsInfo::getRelease() const } } - // localized name of windows, such as "Windows 10 Pro" - r.productName = settings.value("ProductName", "").toString(); - // release ID, such as 1803 - r.ID = settings.value("ReleaseId", "").toString(); + r.ID = settings.value("DisplayVersion", "").toString(); + if (r.ID.isEmpty()) { + r.ID = settings.value("ReleaseId", "").toString(); + } // some other build number, shown in winver.exe r.UBR = settings.value("UBR", 0).toUInt(); diff --git a/src/envwindows.h b/src/envwindows.h index 90655e49..61ef609d 100644 --- a/src/envwindows.h +++ b/src/envwindows.h @@ -40,11 +40,7 @@ public: // the BuildLab entry from the registry, may be empty QString buildLab; - // product name such as "Windows 10 Pro", may not be in English, may be - // empty - QString productName; - - // release ID such as 1809, may be mepty + // release ID such as 1809, may be empty QString ID; // some sub-build number, undocumented, may be empty -- cgit v1.3.1 From cf137606fd98eb0bee65a10d6e6e65f525967689 Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Mon, 22 Nov 2021 16:38:12 -0700 Subject: Add Brave to the default blacklist Fixes #1592 --- src/settings.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/settings.cpp b/src/settings.cpp index 1e915603..1a67407d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -271,6 +271,7 @@ QString Settings::executablesBlacklist() const << "Discord.exe" << "GalaxyClient.exe" << "Spotify.exe" + << "Brave.exe" ).join(";"); return get(m_Settings, "Settings", "executable_blacklist", def); -- cgit v1.3.1 From b1db3019f4700021479e811029b11f3f824a244f Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Mon, 22 Nov 2021 17:02:07 -0700 Subject: Fix selecting a new profile This fixes clicking the "select" button in the profiles dialog when a newly created profile is selected. This was broken as the profile was being selected before the profile was added to the list of selections. Fixes #1489 --- src/mainwindow.cpp | 20 ++++++++------------ src/mainwindow.h | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4d1c16ac..98f7319e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1646,7 +1646,7 @@ void MainWindow::on_profileBox_currentIndexChanged(int index) } } -bool MainWindow::refreshProfiles(bool selectProfile) +bool MainWindow::refreshProfiles(bool selectProfile, QString newProfile) { QComboBox* profileBox = findChild("profileBox"); @@ -1675,7 +1675,12 @@ bool MainWindow::refreshProfiles(bool selectProfile) if (selectProfile) { if (profileBox->count() > 1) { - profileBox->setCurrentText(currentProfileName); + if (newProfile.isEmpty()) { + profileBox->setCurrentText(currentProfileName); + } + else { + profileBox->setCurrentText(newProfile); + } if (profileBox->currentIndex() == 0) { profileBox->setCurrentIndex(1); } @@ -2188,16 +2193,7 @@ 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()) { + if (refreshProfiles(true, profilesDialog.selectedProfile().value()) && !profilesDialog.failed()) { break; } } diff --git a/src/mainwindow.h b/src/mainwindow.h index 6626bf51..039f64ac 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -198,7 +198,7 @@ private: QMenu* createPopupMenu() override; void activateSelectedProfile(); - bool refreshProfiles(bool selectProfile = true); + bool refreshProfiles(bool selectProfile = true, QString newProfile = QString()); void refreshExecutablesList(); bool modifyExecutablesDialog(int selection); -- cgit v1.3.1 From a1e953f40936c9e52292fd06cb9b80fd66bf5e43 Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Mon, 22 Nov 2021 17:02:07 -0700 Subject: Don't add invalid games to the "visit Nexus" list --- src/mainwindow.cpp | 43 ++++++++++++++++++++++++++++++------------- src/nexusinterface.cpp | 8 +++++++- 2 files changed, 37 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 98f7319e..97d8fd84 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1447,15 +1447,20 @@ bool MainWindow::registerNexusPage(const QString& gameName) if (plugin == nullptr) return false; + // Get the gameURL + QString gameURL = NexusInterface::instance().getGameURL(gameName); + if (gameURL.isEmpty()) + return false; + // Create an action QAction* action = new QAction( plugin->gameIcon(), - QObject::tr("Visit %1 on Nexus").arg(plugin->gameName()), + QObject::tr("Visit %1 on Nexus").arg(gameName), this); // Bind the action - connect(action, &QAction::triggered, this, [this, gameName]() { - shell::Open(QUrl(NexusInterface::instance().getGameURL(gameName))); + connect(action, &QAction::triggered, this, [this, gameURL]() { + shell::Open(QUrl(gameURL)); }, Qt::QueuedConnection); // Add the action @@ -1479,7 +1484,7 @@ void MainWindow::updateModPageMenu() } ); - // Remove disabled plugins: + // Remove disabled plugins modPagePlugins.erase( std::remove_if(std::begin(modPagePlugins), std::end(modPagePlugins), [&](auto* tool) { return !m_PluginContainer.isEnabled(tool); @@ -1490,23 +1495,35 @@ void MainWindow::updateModPageMenu() registerModPage(modPagePlugin); } - // Add the primary game (with a separator) - registerNexusPage(m_OrganizerCore.managedGame()->gameShortName()); - ui->actionModPage->menu()->addSeparator(); + QStringList registeredSources; + + // Add the primary game + QString gameShortName = m_OrganizerCore.managedGame()->gameShortName(); + if (registerNexusPage(gameShortName)) + registeredSources << gameShortName; + + // Add the primary sources + for (auto gameName : m_OrganizerCore.managedGame()->primarySources()) + { + if (!registeredSources.contains(gameName) && registerNexusPage(gameName)) + registeredSources << gameName; + } + + // Add a separator if needed + if (registeredSources.length() > 0) + 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; - } + if (!registeredSources.contains(gameName) && registerNexusPage(gameName)) + registeredSources << gameName; } - // No mod page plugin and the menu was visible: - bool keepOriginalAction = modPagePlugins.size() == 0 && !secondaryGameAdded; + // No mod page plugin and the menu was visible + bool keepOriginalAction = modPagePlugins.size() == 0 && registeredSources.length() <= 1; if (keepOriginalAction) { ui->toolBar->insertAction(ui->actionAdd_Profile, ui->actionNexus); } diff --git a/src/nexusinterface.cpp b/src/nexusinterface.cpp index 1364d7e1..2e4496e1 100644 --- a/src/nexusinterface.cpp +++ b/src/nexusinterface.cpp @@ -371,7 +371,13 @@ QString NexusInterface::getGameURL(QString gameName) const { IPluginGame *game = getGame(gameName); if (game != nullptr) { - return "https://www.nexusmods.com/" + game->gameNexusName().toLower(); + QString gameNexusName = game->gameNexusName().toLower(); + if (gameNexusName.isEmpty()) { + return ""; + } + else { + return "https://www.nexusmods.com/" + gameNexusName; + } } else { log::error("getGameURL can't find plugin for {}", gameName); return ""; -- cgit v1.3.1 From 1755f526c96a547f33306008bff99f12a3e4da72 Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Tue, 23 Nov 2021 11:49:44 -0700 Subject: Fix extension parsing for the plugin list The old code was just looking at the last three letters of the filename instead of looking for any kind of proper extension. This led to something like "alice.__esp" being considered a plugin which is just wrong. --- src/pluginlist.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 10ed1e28..bec7f0c3 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -42,6 +42,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include #include #include @@ -201,9 +202,9 @@ void PluginList::refresh(const QString &profileName } QString filename = ToQString(current->getName()); - QString extension = filename.right(3).toLower(); - - if ((extension == "esp") || (extension == "esm") || (extension == "esl")) { + if (filename.endsWith(".esp", Qt::CaseInsensitive) || + filename.endsWith(".esm", Qt::CaseInsensitive) || + filename.endsWith(".esl", Qt::CaseInsensitive)) { availablePlugins.append(filename); -- cgit v1.3.1 From 1d80c547d7c63b694fa79825e67694eae63749b2 Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Tue, 23 Nov 2021 17:19:00 -0700 Subject: Blacklist Steam username and password from the log --- src/settingsdialogworkarounds.cpp | 3 +++ src/spawn.cpp | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/settingsdialogworkarounds.cpp b/src/settingsdialogworkarounds.cpp index 17b2259b..df87aa16 100644 --- a/src/settingsdialogworkarounds.cpp +++ b/src/settingsdialogworkarounds.cpp @@ -4,6 +4,7 @@ #include "settings.h" #include #include +#include WorkaroundsSettingsTab::WorkaroundsSettingsTab(Settings& s, SettingsDialog& d) : SettingsTab(s, d) @@ -16,6 +17,8 @@ WorkaroundsSettingsTab::WorkaroundsSettingsTab(Settings& s, SettingsDialog& d) // steam QString username, password; settings().steam().login(username, password); + MOBase::log::getDefault().addToBlacklist(username.toStdString(), "STEAM_USERNAME"); + MOBase::log::getDefault().addToBlacklist(password.toStdString(), "STEAM_PASSWORD"); ui->appIDEdit->setText(settings().steam().appID()); ui->steamUserEdit->setText(username); diff --git a/src/spawn.cpp b/src/spawn.cpp index 68526165..4f1fdd3e 100644 --- a/src/spawn.cpp +++ b/src/spawn.cpp @@ -625,6 +625,8 @@ bool startSteam(QWidget* parent) // See if username and password supplied. If so, pass them into steam. QString username, password; if (Settings::instance().steam().login(username, password)) { + MOBase::log::getDefault().addToBlacklist(username.toStdString(), "STEAM_USERNAME"); + MOBase::log::getDefault().addToBlacklist(password.toStdString(), "STEAM_PASSWORD"); sp.arguments = makeSteamArguments(username, password); } -- cgit v1.3.1 From 565f2fddf4cf29fec3f8626ae4f7acba8aef615c Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Tue, 23 Nov 2021 17:48:40 -0700 Subject: Blacklist %USERNAME% from the log in case it contains PII --- src/loglist.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/loglist.cpp b/src/loglist.cpp index bea7363f..172fcd64 100644 --- a/src/loglist.cpp +++ b/src/loglist.cpp @@ -359,6 +359,8 @@ void initLogging() log::getDefault().setCallback( [](log::Entry e){ LogModel::instance().add(e); }); + log::getDefault().addToBlacklist(getenv("USERNAME"), "USERNAME"); + qInstallMessageHandler(qtLogCallback); } -- cgit v1.3.1