diff options
| author | Chris Bessent <lost.dragonist@gmail.com> | 2021-11-23 20:05:29 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-23 20:05:29 -0700 |
| commit | fc40619fd9383eaf2bc7d0ba14695404b7f55bdb (patch) | |
| tree | 7c6dbfbdea980ac1913e3066a5f2fb50e196f9bd | |
| parent | 6ab88d5de108887dd97e0899e2554ee36cc3bdee (diff) | |
| parent | 565f2fddf4cf29fec3f8626ae4f7acba8aef615c (diff) | |
Merge pull request #1621 from LostDragonist/misc_fixes
Misc fixes
| -rw-r--r-- | src/createinstancedialog.cpp | 31 | ||||
| -rw-r--r-- | src/createinstancedialog.ui | 48 | ||||
| -rw-r--r-- | src/envwindows.cpp | 13 | ||||
| -rw-r--r-- | src/envwindows.h | 6 | ||||
| -rw-r--r-- | src/loglist.cpp | 2 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 63 | ||||
| -rw-r--r-- | src/mainwindow.h | 2 | ||||
| -rw-r--r-- | src/nexusinterface.cpp | 8 | ||||
| -rw-r--r-- | src/pluginlist.cpp | 7 | ||||
| -rw-r--r-- | src/settings.cpp | 1 | ||||
| -rw-r--r-- | src/settingsdialogworkarounds.cpp | 3 | ||||
| -rw-r--r-- | src/spawn.cpp | 2 |
12 files changed, 117 insertions, 69 deletions
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)); 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 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="page_10"> + <widget class="QWidget" name="page_1"> <layout class="QVBoxLayout" name="verticalLayout_21"> <item> <widget class="QLabel" name="label_15"> @@ -115,7 +115,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page"> + <widget class="QWidget" name="page_2"> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QWidget" name="widget_7" native="true"> @@ -226,7 +226,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_2"> + <widget class="QWidget" name="page_3"> <layout class="QVBoxLayout" name="verticalLayout_7"> <item> <widget class="QWidget" name="widget_5" native="true"> @@ -367,7 +367,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_9"> + <widget class="QWidget" name="page_4"> <layout class="QVBoxLayout" name="verticalLayout_19"> <item> <widget class="QWidget" name="widget_16" native="true"> @@ -594,7 +594,7 @@ <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="page_7"> + <widget class="QWidget" name="page_6_simple"> <layout class="QVBoxLayout" name="verticalLayout_12"> <property name="leftMargin"> <number>0</number> @@ -676,7 +676,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_8"> + <widget class="QWidget" name="page_6_advanced"> <layout class="QVBoxLayout" name="verticalLayout_13"> <property name="leftMargin"> <number>0</number> @@ -906,7 +906,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_3"> + <widget class="QWidget" name="page_7"> <layout class="QVBoxLayout" name="verticalLayout_4"> <item> <widget class="QWidget" name="widget_4" native="true"> @@ -1048,7 +1048,7 @@ </item> </layout> </widget> - <widget class="QWidget" name="page_11"> + <widget class="QWidget" name="page_8"> <layout class="QVBoxLayout" name="verticalLayout_22"> <item> <widget class="QWidget" name="widget_18" native="true"> @@ -1232,6 +1232,38 @@ <header location="global">linklabel.h</header> </customwidget> </customwidgets> + <tabstops> + <tabstop>next</tabstop> + <tabstop>cancel</tabstop> + <tabstop>hideIntro</tabstop> + <tabstop>createGlobal</tabstop> + <tabstop>createPortable</tabstop> + <tabstop>scrollArea_3</tabstop> + <tabstop>showAllGames</tabstop> + <tabstop>gamesFilter</tabstop> + <tabstop>scrollArea_2</tabstop> + <tabstop>instanceName</tabstop> + <tabstop>location</tabstop> + <tabstop>browseLocation</tabstop> + <tabstop>advancedPathOptions</tabstop> + <tabstop>base</tabstop> + <tabstop>browseBase</tabstop> + <tabstop>downloads</tabstop> + <tabstop>browseDownloads</tabstop> + <tabstop>mods</tabstop> + <tabstop>browseMods</tabstop> + <tabstop>profiles</tabstop> + <tabstop>browseProfiles</tabstop> + <tabstop>overwrite</tabstop> + <tabstop>browseOverwrite</tabstop> + <tabstop>nexusConnect</tabstop> + <tabstop>nexusManual</tabstop> + <tabstop>nexusLog</tabstop> + <tabstop>review</tabstop> + <tabstop>creationLog</tabstop> + <tabstop>launch</tabstop> + <tabstop>back</tabstop> + </tabstops> <resources> <include location="resources.qrc"/> </resources> 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 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);
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a7d7bddb..81c44c00 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); } @@ -1646,7 +1663,7 @@ void MainWindow::on_profileBox_currentIndexChanged(int index) } } -bool MainWindow::refreshProfiles(bool selectProfile) +bool MainWindow::refreshProfiles(bool selectProfile, QString newProfile) { QComboBox* profileBox = findChild<QComboBox*>("profileBox"); @@ -1675,7 +1692,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 +2210,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); 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 ""; 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 <http://www.gnu.org/licenses/>. #include <QDateTime>
#include <QDir>
#include <QFile>
+#include <QFileInfo>
#include <QTextCodec>
#include <QFileInfo>
#include <QListWidgetItem>
@@ -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);
diff --git a/src/settings.cpp b/src/settings.cpp index d3cdc910..c0eb80ca 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<QString>(m_Settings, "Settings", "executable_blacklist", def); 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 <report.h> #include <iplugingame.h> +#include <log.h> 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);
}
|
