From 6feab2ea8f96704e44a14c212a635dc17f4ba71e Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sun, 17 Jan 2021 21:26:21 -0500 Subject: moved criticalOnTop() to uibase changed all calls to reportError(), which now uses the main window if it exists as a parent, or calls criticalOnTop() added errors when running something from the command line for a different instance/profile removed unused crap --- src/moapplication.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'src/moapplication.cpp') diff --git a/src/moapplication.cpp b/src/moapplication.cpp index da45e26c..91cac2b1 100644 --- a/src/moapplication.cpp +++ b/src/moapplication.cpp @@ -32,7 +32,6 @@ along with Mod Organizer. If not, see . #include "sanitychecks.h" #include "mainwindow.h" #include "messagedialog.h" -#include "shared/error_report.h" #include "shared/util.h" #include #include @@ -204,7 +203,7 @@ int MOApplication::setup(MOMultiProcess& multiProcess) setProperty("dataPath", dataPath); if (!setLogDirectory(dataPath)) { - reportError("Failed to create log folder"); + reportError(tr("Failed to create log folder.")); InstanceManager::singleton().clearCurrentInstance(); return 1; } @@ -271,7 +270,7 @@ int MOApplication::setup(MOMultiProcess& multiProcess) m_core.reset(new OrganizerCore(*m_settings)); if (!m_core->bootstrap()) { - reportError("failed to set up data paths"); + reportError(tr("Failed to set up data paths.")); InstanceManager::singleton().clearCurrentInstance(); return 1; } @@ -412,6 +411,30 @@ void MOApplication::externalMessage(const QString& message) return; } + if (auto i=cl.instance()) { + const auto ci = InstanceManager::singleton().currentInstance(); + + if (*i != ci->name()) { + reportError(tr( + "This shortcut or command line is for instance '%1', but the current " + "instance is '%2'.") + .arg(*i).arg(ci->name())); + + return; + } + } + + if (auto p=cl.profile()) { + if (*p != m_core->profileName()) { + reportError(tr( + "This shortcut or command line is for profile '%1', but the current " + "profile is '%2'.") + .arg(*p).arg(m_core->profileName())); + + return; + } + } + cl.runPostOrganizer(*m_core); } } @@ -436,11 +459,11 @@ std::unique_ptr MOApplication::getCurrentInstance() m.clearOverrides(); if (m.hasAnyInstances()) { - MOShared::criticalOnTop(QObject::tr( + reportError(QObject::tr( "Instance at '%1' not found. Select another instance.") .arg(currentInstance->directory())); } else { - MOShared::criticalOnTop(QObject::tr( + reportError(QObject::tr( "Instance at '%1' not found. You must create a new instance") .arg(currentInstance->directory())); } -- cgit v1.3.1