From eb190380e3044900a30ba41c81a23d813fd708e9 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 17 Jul 2019 12:15:08 -0400 Subject: dump executables on startup --- src/executableslist.cpp | 30 +++++++++++++++++++++++++++++- src/executableslist.h | 4 ++++ src/main.cpp | 35 +++++++++++++++++++++++------------ 3 files changed, 56 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/executableslist.cpp b/src/executableslist.cpp index 077d2a93..0ca880cd 100644 --- a/src/executableslist.cpp +++ b/src/executableslist.cpp @@ -21,6 +21,7 @@ along with Mod Organizer. If not, see . #include "iplugingame.h" #include "utility.h" +#include #include #include @@ -65,7 +66,7 @@ bool ExecutablesList::empty() const void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings) { - qDebug("setting up configured executables"); + log::debug("loading executables"); m_Executables.clear(); @@ -103,6 +104,8 @@ void ExecutablesList::load(const MOBase::IPluginGame* game, QSettings& settings) if (needsUpgrade) upgradeFromCustom(game); + + dump(); } void ExecutablesList::store(QSettings& settings) @@ -332,6 +335,31 @@ void ExecutablesList::upgradeFromCustom(MOBase::IPluginGame const *game) } } +void ExecutablesList::dump() const +{ + for (const auto& e : m_Executables) { + QStringList flags; + + if (e.flags() & Executable::ShowInToolbar) { + flags.push_back("toolbar"); + } + + if (e.flags() & Executable::UseApplicationIcon) { + flags.push_back("icon"); + } + + log::debug( + " . executable '{}'\n" + " binary: {}\n" + " arguments: {}\n" + " steam ID: {}\n" + " directory: {}\n" + " flags: {} ({})", + e.title(), e.binaryInfo().absoluteFilePath(), e.arguments(), + e.steamAppID(), e.workingDirectory(), flags.join("|"), e.flags()); + } +} + Executable::Executable(QString title) : m_title(title) diff --git a/src/executableslist.h b/src/executableslist.h index 2d1dd28e..eda2034e 100644 --- a/src/executableslist.h +++ b/src/executableslist.h @@ -214,6 +214,10 @@ private: * called when MO is still using the old custom executables from 2.2.0 **/ void upgradeFromCustom(const MOBase::IPluginGame* game); + + // logs all executables + // + void dump() const; }; Q_DECLARE_OPERATORS_FOR_FLAGS(Executable::Flags) diff --git a/src/main.cpp b/src/main.cpp index b89e4a80..6b4280b4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -503,6 +503,27 @@ void dumpEnvironment() } } +void dumpSettings(QSettings& settings) +{ + static QStringList ignore({ + "username", "password", "nexus_api_key" + }); + + log::debug("settings:"); + + settings.beginGroup("Settings"); + + for (auto k : settings.allKeys()) { + if (ignore.contains(k, Qt::CaseInsensitive)) { + continue; + } + + log::debug(" . {}={}", k, settings.value(k).toString()); + } + + settings.endGroup(); +} + int runApplication(MOApplication &application, SingleInstance &instance, const QString &splashPath) { @@ -538,22 +559,12 @@ int runApplication(MOApplication &application, SingleInstance &instance, Settings settings(initSettings); log::getDefault().setLevel(settings.logLevel()); - dumpEnvironment(); - // global crashDumpType sits in OrganizerCore to make a bit less ugly to // update it when the settings are changed during runtime OrganizerCore::setGlobalCrashDumpsType(settings.crashDumpsType()); - log::debug("Loaded settings:"); - - initSettings.beginGroup("Settings"); - for (auto k : initSettings.allKeys()) { - if (!k.contains("username") && !k.contains("password") && !k.contains("nexus_api_key")) { - log::debug(" {}={}", k, initSettings.value(k).toString()); - } - } - initSettings.endGroup(); - + dumpEnvironment(); + dumpSettings(initSettings); log::debug("initializing core"); OrganizerCore organizer(settings); -- cgit v1.3.1