From 333a0c3c16ddde22ec2309e37679ac4f4b5f36c5 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 07:23:28 -0400 Subject: removed some debug logging --- src/filetreemodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/filetreemodel.cpp b/src/filetreemodel.cpp index a9cbeefe..282dfa73 100644 --- a/src/filetreemodel.cpp +++ b/src/filetreemodel.cpp @@ -855,7 +855,7 @@ void FileTreeModel::queueRemoveItem(FileTreeItem* item) void FileTreeModel::removeItems() { // see comment at the top of this file - log::debug("remove item timer: removing {} items", m_removeItems.size()); + trace(log::debug("remove item timer: removing {} items", m_removeItems.size())); auto copy = std::move(m_removeItems); m_removeItems.clear(); @@ -875,7 +875,7 @@ void FileTreeModel::queueSortItem(FileTreeItem* item) void FileTreeModel::sortItems() { // see comment at the top of this file - log::debug("sort item timer: sorting {} items", m_sortItems.size()); + trace(log::debug("sort item timer: sorting {} items", m_sortItems.size())); auto copy = std::move(m_sortItems); m_sortItems.clear(); -- cgit v1.3.1 From 4275cadf13dde2fc47efeaf7af9293b1554b78c3 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 07:24:02 -0400 Subject: changed first validation timeout back to 10s, a lot of people report that 5s is too short --- src/nxmaccessmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nxmaccessmanager.cpp b/src/nxmaccessmanager.cpp index 20540593..0064f888 100644 --- a/src/nxmaccessmanager.cpp +++ b/src/nxmaccessmanager.cpp @@ -621,7 +621,7 @@ void NexusKeyValidator::start(const QString& key, Behaviour b) case Retry: { - createAttempts({5s, 5s, 10s}); + createAttempts({10s, 15s, 20s}); break; } } -- cgit v1.3.1 From 15e04d4fe891702808ba7e66a568fd5c6dada276 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 07:24:12 -0400 Subject: fixed typo --- src/uilocker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/uilocker.cpp b/src/uilocker.cpp index 07fe7f1b..cabd7c89 100644 --- a/src/uilocker.cpp +++ b/src/uilocker.cpp @@ -321,7 +321,7 @@ private: case UILocker::PreventExit: { m_message->setText(QObject::tr( - "Mod Organizer is waiting on application to close before exiting.")); + "Mod Organizer is waiting on an application to close before exiting.")); break; } -- cgit v1.3.1 From d7ceadeae173e26d63db0b58b6ea5a3ed839999c Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 08:19:22 -0400 Subject: hook ctrl+f and escape directly on widgets instead of on the main window to allow other widgets to use the same shortcuts, like the FilterWidget --- src/mainwindow.cpp | 77 +++++++++++++++++++++++++++--------------------------- src/mainwindow.h | 3 --- 2 files changed, 39 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 85d0fe39..cac9a0b9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -204,6 +204,42 @@ QString UnmanagedModName() bool runLoot(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList); + +void setFilterShortcuts(QWidget* widget, QLineEdit* edit) +{ + auto activate = [=] { + edit->setFocus(); + edit->selectAll(); + }; + + auto reset = [=] { + edit->clear(); + widget->setFocus(); + }; + + auto hookActivate = [activate](auto* w) { + auto* s = new QShortcut(QKeySequence::Find, w); + s->setAutoRepeat(false); + s->setContext(Qt::WidgetWithChildrenShortcut); + QObject::connect(s, &QShortcut::activated, activate); + }; + + auto hookReset = [reset](auto* w) { + auto* s = new QShortcut(QKeySequence(Qt::Key_Escape), w); + s->setAutoRepeat(false); + s->setContext(Qt::WidgetWithChildrenShortcut); + QObject::connect(s, &QShortcut::activated, reset); + }; + + + hookActivate(widget); + hookReset(widget); + + hookActivate(edit); + hookReset(edit); +} + + MainWindow::MainWindow(Settings &settings , OrganizerCore &organizerCore , PluginContainer &pluginContainer @@ -432,8 +468,9 @@ MainWindow::MainWindow(Settings &settings new QShortcut(QKeySequence::Refresh, this, SLOT(refreshProfile_activated())); - new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F), this, SLOT(search_activated())); - new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(searchClear_activated())); + setFilterShortcuts(ui->modList, ui->modFilterEdit); + setFilterShortcuts(ui->espList, ui->espFilterEdit); + setFilterShortcuts(ui->downloadView, ui->downloadFilterEdit); m_UpdateProblemsTimer.setSingleShot(true); connect(&m_UpdateProblemsTimer, SIGNAL(timeout()), this, SLOT(updateProblemsButton())); @@ -3353,42 +3390,6 @@ void MainWindow::refreshProfile_activated() m_OrganizerCore.profileRefresh(); } -void MainWindow::search_activated() -{ - if (ui->modList->hasFocus() || ui->modFilterEdit->hasFocus()) { - ui->modFilterEdit->setFocus(); - ui->modFilterEdit->setSelection(0, INT_MAX); - } - - else if (ui->espList->hasFocus() || ui->espFilterEdit->hasFocus()) { - ui->espFilterEdit->setFocus(); - ui->espFilterEdit->setSelection(0, INT_MAX); - } - - else if (ui->downloadView->hasFocus() || ui->downloadFilterEdit->hasFocus()) { - ui->downloadFilterEdit->setFocus(); - ui->downloadFilterEdit->setSelection(0, INT_MAX); - } -} - -void MainWindow::searchClear_activated() -{ - if (ui->modList->hasFocus() || ui->modFilterEdit->hasFocus()) { - ui->modFilterEdit->clear(); - ui->modList->setFocus(); - } - - else if (ui->espList->hasFocus() || ui->espFilterEdit->hasFocus()) { - ui->espFilterEdit->clear(); - ui->espList->setFocus(); - } - - else if (ui->downloadView->hasFocus() || ui->downloadFilterEdit->hasFocus()) { - ui->downloadFilterEdit->clear(); - ui->downloadView->setFocus(); - } -} - void MainWindow::updateModCount() { int activeCount = 0; diff --git a/src/mainwindow.h b/src/mainwindow.h index b839e85e..25d09584 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -565,9 +565,6 @@ private slots: void modlistSelectionsChanged(const QItemSelection ¤t); void esplistSelectionsChanged(const QItemSelection ¤t); - void search_activated(); - void searchClear_activated(); - void resetActionIcons(); void updateModCount(); void updatePluginCount(); -- cgit v1.3.1 From 3b0fbebc6ad8979d9d4551fcd9db1b8f2ca4bf48 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:06:41 -0400 Subject: dump a bunch of counts for mods when selecting a profile --- src/main.cpp | 2 -- src/modinfoforeign.cpp | 3 +- src/modinfoforeign.h | 4 ++- src/organizercore.cpp | 4 +++ src/profile.cpp | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/profile.h | 2 ++ 6 files changed, 107 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index ceaa59f2..b6b25dd7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -266,8 +266,6 @@ QString determineProfile(QStringList &arguments, const Settings &settings) if (!selectedProfileName) { log::debug("no configured profile"); selectedProfileName = "Default"; - } else { - log::debug("configured profile: {}", *selectedProfileName); } return *selectedProfileName; diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp index 84199eae..e8f9548a 100644 --- a/src/modinfoforeign.cpp +++ b/src/modinfoforeign.cpp @@ -49,7 +49,8 @@ ModInfoForeign::ModInfoForeign(const QString &modName, DirectoryEntry **directoryStructure, PluginContainer *pluginContainer) : ModInfoWithConflictInfo(pluginContainer, directoryStructure), - m_ReferenceFile(referenceFile), m_Archives(archives) { + m_ReferenceFile(referenceFile), m_Archives(archives), m_ModType(modType) +{ m_CreationTime = QFileInfo(referenceFile).birthTime(); switch (modType) { case ModInfo::EModType::MOD_DLC: diff --git a/src/modinfoforeign.h b/src/modinfoforeign.h index 3308d42f..c5763d6b 100644 --- a/src/modinfoforeign.h +++ b/src/modinfoforeign.h @@ -65,6 +65,8 @@ public: virtual bool alwaysEnabled() const { return true; } virtual void addInstalledFile(int, int) {} + ModInfo::EModType modType() const { return m_ModType; } + protected: ModInfoForeign(const QString &modName, const QString &referenceFile, const QStringList &archives, ModInfo::EModType modType, @@ -77,7 +79,7 @@ private: QStringList m_Archives; QDateTime m_CreationTime; int m_Priority; - + ModInfo::EModType m_ModType; }; #endif // MODINFOFOREIGN_H diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 0b3a4bfe..dacf0175 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -508,6 +508,8 @@ void OrganizerCore::setCurrentProfile(const QString &profileName) return; } + log::debug("selecting profile '{}'", profileName); + QDir profileBaseDir(settings().paths().profiles()); QString profileDir = profileBaseDir.absoluteFilePath(profileName); @@ -537,6 +539,8 @@ void OrganizerCore::setCurrentProfile(const QString &profileName) connect(m_CurrentProfile, SIGNAL(modStatusChanged(uint)), this, SLOT(modStatusChanged(uint))); connect(m_CurrentProfile, SIGNAL(modStatusChanged(QList)), this, SLOT(modStatusChanged(QList))); refreshDirectoryStructure(); + + m_CurrentProfile->debugDump(); } MOBase::IModRepositoryBridge *OrganizerCore::createNexusBridge() const diff --git a/src/profile.cpp b/src/profile.cpp index 19c0d750..927e575c 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -31,6 +31,7 @@ along with Mod Organizer. If not, see . #include #include "util.h" #include "registry.h" +#include "modinfoforeign.h" #include #include @@ -1065,3 +1066,98 @@ void Profile::removeForcedLibraries(const QString &executable) { m_Settings->remove("forced_libraries/" + executable); } + +void Profile::debugDump() const +{ + struct Pair + { + std::size_t enabled=0; + std::size_t total=0; + }; + + Pair total; + Pair real; + Pair backup; + Pair separators; + Pair dlc; + Pair cc; + Pair unmanaged; + + auto add = [](Pair& p, const ModStatus& status) { + ++p.total; + + if (status.m_Enabled) { + ++p.enabled; + } + }; + + + for (const auto& status : m_ModStatus) { + if (status.m_Overwrite) { + continue; + } + + auto index = m_ModIndexByPriority.find(status.m_Priority); + if (index == m_ModIndexByPriority.end()) { + log::error("mod with priority {} not in priority map", status.m_Priority); + continue; + } + + auto m = ModInfo::getByIndex(index->second); + if (!m) { + log::error("mod index {} with priority {} not found", index->second, status.m_Priority); + continue; + } + + add(total, status); + + if (m->hasFlag(ModInfo::FLAG_BACKUP)) { + add(backup, status); + } + + if (m->hasFlag(ModInfo::FLAG_SEPARATOR)) { + add(separators, status); + } + + if (m->hasFlag(ModInfo::FLAG_FOREIGN)) { + if (auto* f = dynamic_cast(m.get())) { + switch (f->modType()) + { + case ModInfo::MOD_DLC: + add(dlc, status); + break; + + case ModInfo::MOD_CC: + add(cc, status); + break; + + default: + add(unmanaged, status); + break; + } + } + } + + if (!m->hasAnyOfTheseFlags({ + ModInfo::FLAG_BACKUP, ModInfo::FLAG_FOREIGN, + ModInfo::FLAG_SEPARATOR, ModInfo::FLAG_OVERWRITE })) + { + add(real, status); + } + } + + log::debug( + "profile '{}' in '{}': " + "mods={}/{} backup={}/{} separators={}/{} real={}/{} dlc={}/{} " + "cc={}/{} unmanaged={}/{} localsaves={}, localsettings={}", + name(), absolutePath(), + total.enabled, total.total, + backup.enabled, backup.total, + separators.enabled, separators.total, + real.enabled, real.total, + dlc.enabled, dlc.total, + cc.enabled, cc.total, + unmanaged.enabled, unmanaged.total, + localSavesEnabled() ? "yes" : "no", + localSettingsEnabled() ? "yes" : "no"); +} diff --git a/src/profile.h b/src/profile.h index d0bd4a84..c7cbc7b7 100644 --- a/src/profile.h +++ b/src/profile.h @@ -336,6 +336,8 @@ public: void storeForcedLibraries(const QString &executable, const QList &values); void removeForcedLibraries(const QString &executable); + void debugDump() const; + signals: /** -- cgit v1.3.1 From 52c7a6a181e0028e318b8ce6433fb577f7bbecad Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:14:24 -0400 Subject: added directory checks for desktop and onedrive --- src/sanitychecks.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/sanitychecks.cpp b/src/sanitychecks.cpp index 6da42e79..3372f81c 100644 --- a/src/sanitychecks.cpp +++ b/src/sanitychecks.cpp @@ -268,28 +268,23 @@ std::vector> getSystemDirectories() { // folder ids and display names for logging const std::vector> systemFolderIDs = { - {FOLDERID_ProgramFiles, "Program Files"}, - {FOLDERID_ProgramFilesX86, "Program Files"} + {FOLDERID_ProgramFiles, "in program files"}, + {FOLDERID_ProgramFilesX86, "in program files"}, + {FOLDERID_Desktop, "on the desktop"}, + {FOLDERID_OneDrive, "in OneDrive"} }; std::vector> systemDirs; for (auto&& p : systemFolderIDs) { - try - { - const auto dir = MOBase::getKnownFolder(p.first); - - auto path = QDir::toNativeSeparators(dir.absolutePath()).toLower(); + if (const auto dir=MOBase::getOptionalKnownFolder(p.first)) { + auto path = QDir::toNativeSeparators(dir->absolutePath()).toLower(); if (!path.endsWith("\\")) { path += "\\"; } systemDirs.push_back({path, p.second}); } - catch(std::exception&) - { - // ignore - } } return systemDirs; @@ -306,7 +301,7 @@ int checkProtected(const QDir& d, const QString& what) for (auto&& sd : systemDirs) { if (path.startsWith(sd.first)) { log::warn( - "{} is in {}; this may cause issues because it's a protected " + "{} is {}; this may cause issues because it's a special " "system folder", what, sd.second); -- cgit v1.3.1 From 77d292727b06841f07b4b3bc449655faff5f5d19 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:27:17 -0400 Subject: sanity checks: added nahimicmsiosd.dll, specialk64.dll and mactype64.dll --- src/sanitychecks.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/sanitychecks.cpp b/src/sanitychecks.cpp index 3372f81c..5ccd7699 100644 --- a/src/sanitychecks.cpp +++ b/src/sanitychecks.cpp @@ -214,7 +214,7 @@ int checkMissingFiles() return n; } -int checkIncompatibleModule(const env::Module& m) +int checkBadOSDs(const env::Module& m) { // these dlls seems to interfere mostly with dialogs, like the mod info // dialog: it renders dialogs fully white and makes it impossible to interact @@ -224,11 +224,16 @@ int checkIncompatibleModule(const env::Module& m) // where it got loaded later, so this is also called every time a new module // is loaded into this process + const char* nahimic = + "Nahimic (also known as SonicSuite, SonicRadar, SteelSeries, etc.)"; + static const std::map names = { - {"NahimicOSD.dll", "Nahimic"}, - {"RTSSHooks64.dll", "RivaTuner Statistics Server"}, - {"SSAudioOSD.dll", "SteelSeries Audio"}, - {"SS3DevProps.dll", "Sonic Suite 3"} + {"NahimicOSD.dll", nahimic}, + {"nahimicmsiosd.dll", nahimic}, + {"RTSSHooks64.dll", "RivaTuner Statistics Server"}, + {"SSAudioOSD.dll", "SteelSeries Audio"}, + {"SS3DevProps.dll", "Sonic Suite 3"}, + {"specialk64.dll", "SpecialK"} }; const QFileInfo file(m.path()); @@ -251,6 +256,44 @@ int checkIncompatibleModule(const env::Module& m) return n; } +int checkUsvfsIncompatibilites(const env::Module& m) +{ + // these dlls seems to interfere with usvfs + + static const std::map names = { + {"mactype64.dll", "Mactype"} + }; + + const QFileInfo file(m.path()); + int n = 0; + + for (auto&& p : names) { + if (file.fileName().compare(p.first, Qt::CaseInsensitive) == 0) { + log::warn("{}", QObject::tr( + "%1 is loaded. This program is known to cause issues with " + "Mod Organizer and its virtual filesystem, such script extenders " + "refusing to run. Consider uninstalling it.") + .arg(p.second)); + + log::warn("{}", file.absoluteFilePath()); + + ++n; + } + } + + return n; +} + +int checkIncompatibleModule(const env::Module& m) +{ + int n = 0; + + n += checkBadOSDs(m); + n += checkUsvfsIncompatibilites(m); + + return n; +} + int checkIncompatibilities(const env::Environment& e) { log::debug(" . incompatibilities"); -- cgit v1.3.1 From d49f038d5dc813796f8ae4e6ac1631e09bf06bf3 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:30:16 -0400 Subject: silenced a few annoying logs --- src/envmodule.cpp | 6 ++++++ src/envsecurity.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/envmodule.cpp b/src/envmodule.cpp index 2ff5027d..5f2a5f5a 100644 --- a/src/envmodule.cpp +++ b/src/envmodule.cpp @@ -124,6 +124,12 @@ Module::FileInfo Module::getFileInfo() const return {}; } + if (e == ERROR_RESOURCE_DATA_NOT_FOUND) { + // not an error, no version information built into that module; + // happens often in wine + return {}; + } + log::error( "GetFileVersionInfoSizeW() failed on '{}', {}", m_path, formatSystemMessage(e)); diff --git a/src/envsecurity.cpp b/src/envsecurity.cpp index 6f4826e7..3060e6f5 100644 --- a/src/envsecurity.cpp +++ b/src/envsecurity.cpp @@ -108,7 +108,8 @@ private: &rawService); if (FAILED(res) || !rawService) { - log::error( + // don't log as error, seems to happen often for some people + log::debug( "locator->ConnectServer() failed for namespace '{}', {}", ns, formatSystemMessage(res)); @@ -392,7 +393,8 @@ std::optional getWindowsFirewall() // testing for both because it's not clear which it is and nobody can // reproduce it if (hr != EPT_S_NOT_REGISTERED && hr != 0x800706d9) { - log::error("get_FirewallEnabled failed, {}", formatSystemMessage(hr)); + // don't log as error + log::debug("get_FirewallEnabled failed, {}", formatSystemMessage(hr)); } return {}; -- cgit v1.3.1 From e11ca50a57f1890eab160694ae9ee64f2f7096c8 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:31:59 -0400 Subject: update available log is now info instead of debug added AV warning when a game plugin is no longer available --- src/main.cpp | 5 ++++- src/selfupdater.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index b6b25dd7..2bb3f964 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -298,7 +298,10 @@ MOBase::IPluginGame *determineCurrentGame( if (gameConfigured) { MOBase::IPluginGame *game = plugins.managedGame(*gameName); if (game == nullptr) { - reportError(QObject::tr("Plugin to handle %1 no longer installed").arg(*gameName)); + reportError( + QObject::tr("Plugin to handle %1 no longer installed. An antivirus might have deleted files.") + .arg(*gameName)); + return nullptr; } diff --git a/src/selfupdater.cpp b/src/selfupdater.cpp index 5a70568e..086ae05f 100644 --- a/src/selfupdater.cpp +++ b/src/selfupdater.cpp @@ -160,7 +160,7 @@ void SelfUpdater::testForUpdate(const Settings& settings) VersionInfo newestVer(newest["tag_name"].toString()); if (newestVer > this->m_MOVersion) { m_UpdateCandidate = newest; - log::debug("update available: {} -> {}", + log::info("update available: {} -> {}", this->m_MOVersion.displayString(3), newestVer.displayString(3)); emit updateAvailable(); -- cgit v1.3.1 From 960afe9ea56fe43fd5258043f64a19eb867b022b Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:43:58 -0400 Subject: log command line --- src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 2bb3f964..eda31eb4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -960,6 +960,8 @@ int main(int argc, char *argv[]) log::getDefault().setFile(MOBase::log::File::single(logFile.toStdWString())); + log::debug("command line: '{}'", QString::fromWCharArray(GetCommandLineW())); + QString splash = dataPath + "/splash.png"; if (!QFile::exists(dataPath + "/splash.png")) { splash = ":/MO/gui/splash"; -- cgit v1.3.1 From 014df88aa874fcfc4c76fd13ad23deddecb7570d Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:44:28 -0400 Subject: typo --- src/envsecurity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/envsecurity.cpp b/src/envsecurity.cpp index 3060e6f5..8b1d25b2 100644 --- a/src/envsecurity.cpp +++ b/src/envsecurity.cpp @@ -244,7 +244,7 @@ QString SecurityProduct::providerToString() const } if (ps.empty()) { - return "doesn't provider anything"; + return "doesn't provide anything"; } return ps.join("|"); -- cgit v1.3.1 From f43c11497df6550ac224e0965b7a07d4c548055b Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:01:33 -0400 Subject: added game, instance and profile to status bar --- src/mainwindow.cpp | 2 ++ src/statusbar.cpp | 36 +++++++++++++++++++++++++++++++++--- src/statusbar.h | 4 ++++ 3 files changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cac9a0b9..df1063ba 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -523,6 +523,7 @@ MainWindow::MainWindow(Settings &settings updatePluginCount(); updateModCount(); processUpdates(); + ui->statusBar->updateNormalMessage(m_OrganizerCore); } void MainWindow::setupModList() @@ -1699,6 +1700,7 @@ void MainWindow::activateSelectedProfile() m_OrganizerCore.refreshModList(); updateModCount(); updatePluginCount(); + ui->statusBar->updateNormalMessage(m_OrganizerCore); } void MainWindow::on_profileBox_currentIndexChanged(int index) diff --git a/src/statusbar.cpp b/src/statusbar.cpp index 58189619..5897b6bb 100644 --- a/src/statusbar.cpp +++ b/src/statusbar.cpp @@ -1,12 +1,15 @@ #include "statusbar.h" #include "nexusinterface.h" #include "settings.h" +#include "organizercore.h" +#include "instancemanager.h" #include "ui_mainwindow.h" StatusBar::StatusBar(QWidget* parent) : - QStatusBar(parent), ui(nullptr), m_progress(new QProgressBar), - m_progressSpacer1(new QWidget), m_progressSpacer2(new QWidget), - m_notifications(nullptr), m_update(nullptr), m_api(new QLabel) + QStatusBar(parent), ui(nullptr), m_normal(new QLabel), + m_progress(new QProgressBar), m_progressSpacer1(new QWidget), + m_progressSpacer2(new QWidget), m_notifications(nullptr), m_update(nullptr), + m_api(new QLabel) { } @@ -16,6 +19,8 @@ void StatusBar::setup(Ui::MainWindow* mainWindowUI, const Settings& settings) m_notifications = new StatusBarAction(ui->actionNotifications); m_update = new StatusBarAction(ui->actionUpdate); + addWidget(m_normal); + m_progressSpacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); addPermanentWidget(m_progressSpacer1, 0); addPermanentWidget(m_progress); @@ -138,6 +143,31 @@ void StatusBar::checkSettings(const Settings& settings) m_api->setVisible(!settings.interface().hideAPICounter()); } +void StatusBar::updateNormalMessage(OrganizerCore& core) +{ + QString game; + + if (core.managedGame()) { + game = core.managedGame()->gameName(); + } else { + game = tr("Unknown game"); + } + + QString instance = InstanceManager::instance().currentInstance(); + if (instance.isEmpty()) { + instance = tr("Portable"); + } + + QString profile = core.profileName(); + + const auto s = QString("%1 - %2 - %3") + .arg(game) + .arg(instance) + .arg(profile); + + m_normal->setText(s); +} + void StatusBar::showEvent(QShowEvent*) { visibilityChanged(true); diff --git a/src/statusbar.h b/src/statusbar.h index 708615a1..7ff8fcbb 100644 --- a/src/statusbar.h +++ b/src/statusbar.h @@ -7,6 +7,8 @@ struct APIStats; class APIUserAccount; class Settings; +class OrganizerCore; + namespace Ui { class MainWindow; } @@ -41,6 +43,7 @@ public: void setAPI(const APIStats& stats, const APIUserAccount& user); void setUpdateAvailable(bool b); void checkSettings(const Settings& settings); + void updateNormalMessage(OrganizerCore& core); protected: void showEvent(QShowEvent* e); @@ -48,6 +51,7 @@ protected: private: Ui::MainWindow* ui; + QLabel* m_normal; QProgressBar* m_progress; QWidget* m_progressSpacer1; QWidget* m_progressSpacer2; -- cgit v1.3.1 From 47867d427f46a8478aa0107738adab1bfbfc7c56 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:23:10 -0400 Subject: fixed crash when switching to an instance with a lower refresh thread count fixed rare race condition when waking up handle closer threads --- src/envfs.cpp | 6 +++++- src/envfs.h | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/envfs.cpp b/src/envfs.cpp index a67faf84..4aaef082 100644 --- a/src/envfs.cpp +++ b/src/envfs.cpp @@ -173,7 +173,11 @@ public: void wakeup() { - m_ready = true; + { + std::unique_lock lock(m_mutex); + m_ready = true; + } + m_cv.notify_one(); } diff --git a/src/envfs.h b/src/envfs.h index 8790b071..bbc27005 100644 --- a/src/envfs.h +++ b/src/envfs.h @@ -128,6 +128,15 @@ private: thread = std::thread([&]{ run(); }); } + ~ThreadInfo() + { + if (thread.joinable()) { + stop = true; + wakeup(); + thread.join(); + } + } + void wakeup() { { -- cgit v1.3.1 From 21166f820bc793111ad40a950807dc84e961fad5 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 17 Apr 2020 10:25:42 -0400 Subject: bumped to alpha 7 --- src/version.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/version.rc b/src/version.rc index 4c77bfb6..f6900cd3 100644 --- a/src/version.rc +++ b/src/version.rc @@ -4,7 +4,7 @@ // 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,3,0 -#define VER_FILEVERSION_STR "2.3.0alpha6\0" +#define VER_FILEVERSION_STR "2.3.0alpha7\0" VS_VERSION_INFO VERSIONINFO FILEVERSION VER_FILEVERSION -- cgit v1.3.1