diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-07 17:32:30 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-11-07 20:16:27 -0500 |
| commit | 079fd33cf18cc901d1a6a4463d8a8ccd1d730786 (patch) | |
| tree | 8e96f5af73389a1001a29ca761d1454d716c23d0 /src/main.cpp | |
| parent | ba7d24faef49858b9721c2ade0f3ea4a7ba4d96d (diff) | |
added sanitychecks.h, moved to namespace sanity
added a set SetThisThreadName() after creating the main window, Qt resets it
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp index 55fedc7a..40512006 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include "env.h" #include "envmodule.h" #include "commandline.h" +#include "sanitychecks.h" #include "shared/util.h" #include "shared/appconfig.h" #include "shared/error_report.h" @@ -41,14 +42,9 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <log.h> #include <utility.h> - using namespace MOBase; using namespace MOShared; -void sanityChecks(const env::Environment& env); -int checkIncompatibleModule(const env::Module& m); -int checkPathsForSanity(MOBase::IPluginGame& game, const Settings& s); - void purgeOldFiles() { // remove the temporary backup directory in case we're restarting after an @@ -159,11 +155,11 @@ int runApplication( env::Environment env; env.dump(settings); settings.dump(); - sanityChecks(env); + sanity::checkEnvironment(env); const auto moduleNotification = env.onModuleLoaded(qApp, [](auto&& m) { log::debug("loaded module {}", m.toString()); - checkIncompatibleModule(m); + sanity::checkIncompatibleModule(m); }); // this must outlive `organizer` @@ -204,7 +200,7 @@ int runApplication( log::debug("this is a portable instance"); } - checkPathsForSanity(*currentInstance.gamePlugin(), settings); + sanity::checkPaths(*currentInstance.gamePlugin(), settings); organizer.setManagedGame(currentInstance.gamePlugin()); organizer.createDefaultProfile(); @@ -249,10 +245,14 @@ int runApplication( int res = 1; - { // scope to control lifetime of mainwindow + { + // scope to control lifetime of mainwindow // set up main window and its data structures MainWindow mainWindow(settings, organizer, *pluginContainer); + // qt resets the thread name somewhere when creating the main window + MOShared::SetThisThreadName("main"); + ni.getAccessManager()->setTopLevelWidget(&mainWindow); QObject::connect(&mainWindow, SIGNAL(styleChanged(QString)), &application, @@ -373,6 +373,8 @@ int doOneRun( int main(int argc, char *argv[]) { + MOShared::SetThisThreadName("main"); + cl::CommandLine cl; if (auto r=cl.run(GetCommandLineW())) { @@ -381,8 +383,6 @@ int main(int argc, char *argv[]) TimeThis tt("main() to doOneRun()"); - SetThisThreadName("main"); - initLogging(); auto application = MOApplication::create(argc, argv); |
