Skip to content

Commit fc40619

Browse files
Merge pull request ModOrganizer2#1621 from LostDragonist/misc_fixes
Misc fixes
2 parents 6ab88d5 + 565f2fd commit fc40619

12 files changed

+117
-69
lines changed

src/createinstancedialog.cpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -341,28 +341,25 @@ void CreateInstanceDialog::finish()
341341
s.game().setEdition(ci.gameVariant);
342342
}
343343

344-
if (ci.type == Global) {
345-
if (ci.paths.base != ci.dataPath) {
346-
s.paths().setBase(ci.paths.base);
347-
}
348-
349-
if (ci.paths.downloads != cid::makeDefaultPath(AppConfig::downloadPath())) {
350-
s.paths().setDownloads(ci.paths.downloads);
351-
}
344+
if (ci.paths.base != ci.dataPath) {
345+
s.paths().setBase(ci.paths.base);
346+
}
352347

353-
if (ci.paths.mods != cid::makeDefaultPath(AppConfig::modsPath())) {
354-
s.paths().setMods(ci.paths.mods);
355-
}
348+
if (ci.paths.downloads != cid::makeDefaultPath(AppConfig::downloadPath())) {
349+
s.paths().setDownloads(ci.paths.downloads);
350+
}
356351

357-
if (ci.paths.profiles != cid::makeDefaultPath(AppConfig::profilesPath())) {
358-
s.paths().setProfiles(ci.paths.profiles);
359-
}
352+
if (ci.paths.mods != cid::makeDefaultPath(AppConfig::modsPath())) {
353+
s.paths().setMods(ci.paths.mods);
354+
}
360355

361-
if (ci.paths.overwrite != cid::makeDefaultPath(AppConfig::overwritePath())) {
362-
s.paths().setOverwrite(ci.paths.overwrite);
363-
}
356+
if (ci.paths.profiles != cid::makeDefaultPath(AppConfig::profilesPath())) {
357+
s.paths().setProfiles(ci.paths.profiles);
364358
}
365359

360+
if (ci.paths.overwrite != cid::makeDefaultPath(AppConfig::overwritePath())) {
361+
s.paths().setOverwrite(ci.paths.overwrite);
362+
}
366363

367364
logCreation(tr("Writing %1...").arg(ci.iniPath));
368365

src/createinstancedialog.ui

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<property name="currentIndex">
6868
<number>0</number>
6969
</property>
70-
<widget class="QWidget" name="page_10">
70+
<widget class="QWidget" name="page_1">
7171
<layout class="QVBoxLayout" name="verticalLayout_21">
7272
<item>
7373
<widget class="QLabel" name="label_15">
@@ -115,7 +115,7 @@
115115
</item>
116116
</layout>
117117
</widget>
118-
<widget class="QWidget" name="page">
118+
<widget class="QWidget" name="page_2">
119119
<layout class="QVBoxLayout" name="verticalLayout_3">
120120
<item>
121121
<widget class="QWidget" name="widget_7" native="true">
@@ -226,7 +226,7 @@
226226
</item>
227227
</layout>
228228
</widget>
229-
<widget class="QWidget" name="page_2">
229+
<widget class="QWidget" name="page_3">
230230
<layout class="QVBoxLayout" name="verticalLayout_7">
231231
<item>
232232
<widget class="QWidget" name="widget_5" native="true">
@@ -367,7 +367,7 @@
367367
</item>
368368
</layout>
369369
</widget>
370-
<widget class="QWidget" name="page_9">
370+
<widget class="QWidget" name="page_4">
371371
<layout class="QVBoxLayout" name="verticalLayout_19">
372372
<item>
373373
<widget class="QWidget" name="widget_16" native="true">
@@ -594,7 +594,7 @@
594594
<property name="currentIndex">
595595
<number>0</number>
596596
</property>
597-
<widget class="QWidget" name="page_7">
597+
<widget class="QWidget" name="page_6_simple">
598598
<layout class="QVBoxLayout" name="verticalLayout_12">
599599
<property name="leftMargin">
600600
<number>0</number>
@@ -676,7 +676,7 @@
676676
</item>
677677
</layout>
678678
</widget>
679-
<widget class="QWidget" name="page_8">
679+
<widget class="QWidget" name="page_6_advanced">
680680
<layout class="QVBoxLayout" name="verticalLayout_13">
681681
<property name="leftMargin">
682682
<number>0</number>
@@ -906,7 +906,7 @@
906906
</item>
907907
</layout>
908908
</widget>
909-
<widget class="QWidget" name="page_3">
909+
<widget class="QWidget" name="page_7">
910910
<layout class="QVBoxLayout" name="verticalLayout_4">
911911
<item>
912912
<widget class="QWidget" name="widget_4" native="true">
@@ -1048,7 +1048,7 @@
10481048
</item>
10491049
</layout>
10501050
</widget>
1051-
<widget class="QWidget" name="page_11">
1051+
<widget class="QWidget" name="page_8">
10521052
<layout class="QVBoxLayout" name="verticalLayout_22">
10531053
<item>
10541054
<widget class="QWidget" name="widget_18" native="true">
@@ -1232,6 +1232,38 @@
12321232
<header location="global">linklabel.h</header>
12331233
</customwidget>
12341234
</customwidgets>
1235+
<tabstops>
1236+
<tabstop>next</tabstop>
1237+
<tabstop>cancel</tabstop>
1238+
<tabstop>hideIntro</tabstop>
1239+
<tabstop>createGlobal</tabstop>
1240+
<tabstop>createPortable</tabstop>
1241+
<tabstop>scrollArea_3</tabstop>
1242+
<tabstop>showAllGames</tabstop>
1243+
<tabstop>gamesFilter</tabstop>
1244+
<tabstop>scrollArea_2</tabstop>
1245+
<tabstop>instanceName</tabstop>
1246+
<tabstop>location</tabstop>
1247+
<tabstop>browseLocation</tabstop>
1248+
<tabstop>advancedPathOptions</tabstop>
1249+
<tabstop>base</tabstop>
1250+
<tabstop>browseBase</tabstop>
1251+
<tabstop>downloads</tabstop>
1252+
<tabstop>browseDownloads</tabstop>
1253+
<tabstop>mods</tabstop>
1254+
<tabstop>browseMods</tabstop>
1255+
<tabstop>profiles</tabstop>
1256+
<tabstop>browseProfiles</tabstop>
1257+
<tabstop>overwrite</tabstop>
1258+
<tabstop>browseOverwrite</tabstop>
1259+
<tabstop>nexusConnect</tabstop>
1260+
<tabstop>nexusManual</tabstop>
1261+
<tabstop>nexusLog</tabstop>
1262+
<tabstop>review</tabstop>
1263+
<tabstop>creationLog</tabstop>
1264+
<tabstop>launch</tabstop>
1265+
<tabstop>back</tabstop>
1266+
</tabstops>
12351267
<resources>
12361268
<include location="resources.qrc"/>
12371269
</resources>

src/envwindows.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,6 @@ QString WindowsInfo::toString() const
9494
sl.push_back(m_release.buildLab);
9595
}
9696

97-
// product name
98-
if (!m_release.productName.isEmpty()) {
99-
sl.push_back(m_release.productName);
100-
}
101-
10297
// elevated
10398
QString elevated = "?";
10499
if (m_elevated.has_value()) {
@@ -187,11 +182,11 @@ WindowsInfo::Release WindowsInfo::getRelease() const
187182
}
188183
}
189184

190-
// localized name of windows, such as "Windows 10 Pro"
191-
r.productName = settings.value("ProductName", "").toString();
192-
193185
// release ID, such as 1803
194-
r.ID = settings.value("ReleaseId", "").toString();
186+
r.ID = settings.value("DisplayVersion", "").toString();
187+
if (r.ID.isEmpty()) {
188+
r.ID = settings.value("ReleaseId", "").toString();
189+
}
195190

196191
// some other build number, shown in winver.exe
197192
r.UBR = settings.value("UBR", 0).toUInt();

src/envwindows.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ class WindowsInfo
4040
// the BuildLab entry from the registry, may be empty
4141
QString buildLab;
4242

43-
// product name such as "Windows 10 Pro", may not be in English, may be
44-
// empty
45-
QString productName;
46-
47-
// release ID such as 1809, may be mepty
43+
// release ID such as 1809, may be empty
4844
QString ID;
4945

5046
// some sub-build number, undocumented, may be empty

src/loglist.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ void initLogging()
359359
log::getDefault().setCallback(
360360
[](log::Entry e){ LogModel::instance().add(e); });
361361

362+
log::getDefault().addToBlacklist(getenv("USERNAME"), "USERNAME");
363+
362364
qInstallMessageHandler(qtLogCallback);
363365
}
364366

src/mainwindow.cpp

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,15 +1447,20 @@ bool MainWindow::registerNexusPage(const QString& gameName)
14471447
if (plugin == nullptr)
14481448
return false;
14491449

1450+
// Get the gameURL
1451+
QString gameURL = NexusInterface::instance().getGameURL(gameName);
1452+
if (gameURL.isEmpty())
1453+
return false;
1454+
14501455
// Create an action
14511456
QAction* action = new QAction(
14521457
plugin->gameIcon(),
1453-
QObject::tr("Visit %1 on Nexus").arg(plugin->gameName()),
1458+
QObject::tr("Visit %1 on Nexus").arg(gameName),
14541459
this);
14551460

14561461
// Bind the action
1457-
connect(action, &QAction::triggered, this, [this, gameName]() {
1458-
shell::Open(QUrl(NexusInterface::instance().getGameURL(gameName)));
1462+
connect(action, &QAction::triggered, this, [this, gameURL]() {
1463+
shell::Open(QUrl(gameURL));
14591464
}, Qt::QueuedConnection);
14601465

14611466
// Add the action
@@ -1479,7 +1484,7 @@ void MainWindow::updateModPageMenu()
14791484
}
14801485
);
14811486

1482-
// Remove disabled plugins:
1487+
// Remove disabled plugins
14831488
modPagePlugins.erase(
14841489
std::remove_if(std::begin(modPagePlugins), std::end(modPagePlugins), [&](auto* tool) {
14851490
return !m_PluginContainer.isEnabled(tool);
@@ -1490,23 +1495,35 @@ void MainWindow::updateModPageMenu()
14901495
registerModPage(modPagePlugin);
14911496
}
14921497

1493-
// Add the primary game (with a separator)
1494-
registerNexusPage(m_OrganizerCore.managedGame()->gameShortName());
1495-
ui->actionModPage->menu()->addSeparator();
1498+
QStringList registeredSources;
1499+
1500+
// Add the primary game
1501+
QString gameShortName = m_OrganizerCore.managedGame()->gameShortName();
1502+
if (registerNexusPage(gameShortName))
1503+
registeredSources << gameShortName;
1504+
1505+
// Add the primary sources
1506+
for (auto gameName : m_OrganizerCore.managedGame()->primarySources())
1507+
{
1508+
if (!registeredSources.contains(gameName) && registerNexusPage(gameName))
1509+
registeredSources << gameName;
1510+
}
1511+
1512+
// Add a separator if needed
1513+
if (registeredSources.length() > 0)
1514+
ui->actionModPage->menu()->addSeparator();
14961515

14971516
// Add the secondary games (sorted)
1498-
bool secondaryGameAdded = false;
14991517
QStringList secondaryGames = m_OrganizerCore.managedGame()->validShortNames();
15001518
secondaryGames.sort(Qt::CaseInsensitive);
15011519
for (auto gameName : secondaryGames)
15021520
{
1503-
if (registerNexusPage(gameName)) {
1504-
secondaryGameAdded = true;
1505-
}
1521+
if (!registeredSources.contains(gameName) && registerNexusPage(gameName))
1522+
registeredSources << gameName;
15061523
}
15071524

1508-
// No mod page plugin and the menu was visible:
1509-
bool keepOriginalAction = modPagePlugins.size() == 0 && !secondaryGameAdded;
1525+
// No mod page plugin and the menu was visible
1526+
bool keepOriginalAction = modPagePlugins.size() == 0 && registeredSources.length() <= 1;
15101527
if (keepOriginalAction) {
15111528
ui->toolBar->insertAction(ui->actionAdd_Profile, ui->actionNexus);
15121529
}
@@ -1646,7 +1663,7 @@ void MainWindow::on_profileBox_currentIndexChanged(int index)
16461663
}
16471664
}
16481665

1649-
bool MainWindow::refreshProfiles(bool selectProfile)
1666+
bool MainWindow::refreshProfiles(bool selectProfile, QString newProfile)
16501667
{
16511668
QComboBox* profileBox = findChild<QComboBox*>("profileBox");
16521669

@@ -1675,7 +1692,12 @@ bool MainWindow::refreshProfiles(bool selectProfile)
16751692

16761693
if (selectProfile) {
16771694
if (profileBox->count() > 1) {
1678-
profileBox->setCurrentText(currentProfileName);
1695+
if (newProfile.isEmpty()) {
1696+
profileBox->setCurrentText(currentProfileName);
1697+
}
1698+
else {
1699+
profileBox->setCurrentText(newProfile);
1700+
}
16791701
if (profileBox->currentIndex() == 0) {
16801702
profileBox->setCurrentIndex(1);
16811703
}
@@ -2188,16 +2210,7 @@ void MainWindow::on_actionAdd_Profile_triggered()
21882210
profilesDialog.exec();
21892211
m_SavesTab->refreshSaveList(); // since the save list may now be outdated we have to refresh it completely
21902212

2191-
if (profilesDialog.selectedProfile())
2192-
{
2193-
// Change profile while blocking signals to prevent extra signals being sent
2194-
// Doesn't matter much as refreshProfiles() is being called after this
2195-
ui->profileBox->blockSignals(true);
2196-
ui->profileBox->setCurrentText(profilesDialog.selectedProfile().value());
2197-
ui->profileBox->blockSignals(false);
2198-
}
2199-
2200-
if (refreshProfiles() && !profilesDialog.failed()) {
2213+
if (refreshProfiles(true, profilesDialog.selectedProfile().value()) && !profilesDialog.failed()) {
22012214
break;
22022215
}
22032216
}

src/mainwindow.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private slots:
198198
QMenu* createPopupMenu() override;
199199
void activateSelectedProfile();
200200

201-
bool refreshProfiles(bool selectProfile = true);
201+
bool refreshProfiles(bool selectProfile = true, QString newProfile = QString());
202202
void refreshExecutablesList();
203203

204204
bool modifyExecutablesDialog(int selection);

src/nexusinterface.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,13 @@ QString NexusInterface::getGameURL(QString gameName) const
371371
{
372372
IPluginGame *game = getGame(gameName);
373373
if (game != nullptr) {
374-
return "https://www.nexusmods.com/" + game->gameNexusName().toLower();
374+
QString gameNexusName = game->gameNexusName().toLower();
375+
if (gameNexusName.isEmpty()) {
376+
return "";
377+
}
378+
else {
379+
return "https://www.nexusmods.com/" + gameNexusName;
380+
}
375381
} else {
376382
log::error("getGameURL can't find plugin for {}", gameName);
377383
return "";

src/pluginlist.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
4242
#include <QDateTime>
4343
#include <QDir>
4444
#include <QFile>
45+
#include <QFileInfo>
4546
#include <QTextCodec>
4647
#include <QFileInfo>
4748
#include <QListWidgetItem>
@@ -201,9 +202,9 @@ void PluginList::refresh(const QString &profileName
201202
}
202203
QString filename = ToQString(current->getName());
203204

204-
QString extension = filename.right(3).toLower();
205-
206-
if ((extension == "esp") || (extension == "esm") || (extension == "esl")) {
205+
if (filename.endsWith(".esp", Qt::CaseInsensitive) ||
206+
filename.endsWith(".esm", Qt::CaseInsensitive) ||
207+
filename.endsWith(".esl", Qt::CaseInsensitive)) {
207208

208209
availablePlugins.append(filename);
209210

src/settings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ QString Settings::executablesBlacklist() const
271271
<< "Discord.exe"
272272
<< "GalaxyClient.exe"
273273
<< "Spotify.exe"
274+
<< "Brave.exe"
274275
).join(";");
275276

276277
return get<QString>(m_Settings, "Settings", "executable_blacklist", def);

0 commit comments

Comments
 (0)