diff --git a/lib/backend/src/command/c-download.cpp b/lib/backend/src/command/c-download.cpp index 6f1ef59..0f3c9d9 100644 --- a/lib/backend/src/command/c-download.cpp +++ b/lib/backend/src/command/c-download.cpp @@ -46,7 +46,7 @@ QString CDownload::name() const { return NAME; } Qx::Error CDownload::perform() { QString playlistName = mParser.value(CL_OPTION_PLAYLIST).trimmed(); - mCore.setStatus(STATUS_DOWNLOAD, playlistName); + postDirective(STATUS_DOWNLOAD, playlistName); Fp::Db* db = mCore.fpInstall().database(); Fp::PlaylistManager* pm = mCore.fpInstall().playlistManager(); diff --git a/lib/backend/src/command/c-link.cpp b/lib/backend/src/command/c-link.cpp index fe059cb..886f93e 100644 --- a/lib/backend/src/command/c-link.cpp +++ b/lib/backend/src/command/c-link.cpp @@ -52,7 +52,7 @@ Qx::Error CLink::perform() if(Qx::Error ide = getTitleId(shortcutId); ide.isValid()) return ide; - mCore.setStatus(STATUS_LINK, shortcutId.toString(QUuid::WithoutBraces)); + postDirective(STATUS_LINK, shortcutId.toString(QUuid::WithoutBraces)); // Get database Fp::Db* database = mCore.fpInstall().database(); diff --git a/lib/backend/src/command/c-play.cpp b/lib/backend/src/command/c-play.cpp index 77b74be..e462b9e 100644 --- a/lib/backend/src/command/c-play.cpp +++ b/lib/backend/src/command/c-play.cpp @@ -214,7 +214,7 @@ Qx::Error CPlay::handleEntry(const Fp::AddApp& addApp) QString platformName = parentResult.result.value(Fp::Db::Table_Game::COL_PLATFORM_NAME).toString(); // Enqueue - mCore.setStatus(STATUS_PLAY, addApp.name()); + postDirective(STATUS_PLAY, addApp.name()); if(sError = enqueueAdditionalApp(addApp, platformName, Task::Stage::Primary); sError.isValid()) return sError; @@ -292,7 +292,7 @@ Qx::Error CPlay::enqueueGame(const Fp::Game& game, const Fp::GameData& gameData, gameTask->setProcessType(TExec::ProcessType::Blocking); mCore.enqueueSingleTask(gameTask); - mCore.setStatus(STATUS_PLAY, game.title()); + postDirective(STATUS_PLAY, game.title()); #ifdef _WIN32 // Add wait task if required diff --git a/lib/backend/src/command/c-prepare.cpp b/lib/backend/src/command/c-prepare.cpp index 4474cf8..e4397ed 100644 --- a/lib/backend/src/command/c-prepare.cpp +++ b/lib/backend/src/command/c-prepare.cpp @@ -40,7 +40,7 @@ Qx::Error CPrepare::perform() if(Qx::Error ee = mCore.enqueueDataPackTasks(titleGameData); ee.isValid()) return ee; - mCore.setStatus(STATUS_PREPARE, id.toString(QUuid::WithoutBraces)); + postDirective(STATUS_PREPARE, id.toString(QUuid::WithoutBraces)); } else logError(Qx::GenericError(Qx::Warning, 12141, LOG_WRN_PREP_NOT_DATA_PACK.arg(id.toString(QUuid::WithoutBraces)))); diff --git a/lib/backend/src/command/c-run.cpp b/lib/backend/src/command/c-run.cpp index fabbc79..0e0cc1a 100644 --- a/lib/backend/src/command/c-run.cpp +++ b/lib/backend/src/command/c-run.cpp @@ -61,7 +61,7 @@ Qx::Error CRun::perform() runTask->setProcessType(TExec::ProcessType::Blocking); mCore.enqueueSingleTask(runTask); - mCore.setStatus(STATUS_RUN, inputInfo.fileName()); + postDirective(STATUS_RUN, inputInfo.fileName()); #ifdef _WIN32 // Add wait task if required diff --git a/lib/backend/src/command/c-share.cpp b/lib/backend/src/command/c-share.cpp index c9ef53b..73d2275 100644 --- a/lib/backend/src/command/c-share.cpp +++ b/lib/backend/src/command/c-share.cpp @@ -96,7 +96,7 @@ Qx::Error CShare::perform() if(Qx::Error ide = getTitleId(shareId); ide.isValid()) return ide; - mCore.setStatus(STATUS_SHARE, shareId.toString(QUuid::WithoutBraces)); + postDirective(STATUS_SHARE, shareId.toString(QUuid::WithoutBraces)); // Generate URL QString idStr = shareId.toString(QUuid::WithoutBraces); diff --git a/lib/backend/src/command/c-show.cpp b/lib/backend/src/command/c-show.cpp index dd205fd..0975604 100644 --- a/lib/backend/src/command/c-show.cpp +++ b/lib/backend/src/command/c-show.cpp @@ -52,7 +52,7 @@ Qx::Error CShow::perform() messageTask->setText(mParser.value(CL_OPTION_MSG)); mCore.enqueueSingleTask(messageTask); - mCore.setStatus(STATUS_SHOW_MSG, messageTask->text()); + postDirective(STATUS_SHOW_MSG, messageTask->text()); } else if(mParser.isSet(CL_OPTION_EXTRA)) { @@ -61,7 +61,7 @@ Qx::Error CShow::perform() extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + '/' + mParser.value(CL_OPTION_EXTRA))); mCore.enqueueSingleTask(extraTask); - mCore.setStatus(STATUS_SHOW_EXTRA, extraTask->directory().dirName()); + postDirective(STATUS_SHOW_EXTRA, extraTask->directory().dirName()); } else { diff --git a/lib/backend/src/command/c-update.cpp b/lib/backend/src/command/c-update.cpp index f2a2f02..f6b4bf1 100644 --- a/lib/backend/src/command/c-update.cpp +++ b/lib/backend/src/command/c-update.cpp @@ -274,7 +274,7 @@ CUpdateError CUpdate::checkAndPrepareUpdate() const } // Check for update - mCore.setStatus(STATUS, STATUS_CHECKING); + postDirective(STATUS, STATUS_CHECKING); logEvent(LOG_EVENT_CHECKING_FOR_NEWER_VERSION); // Get new release data @@ -363,7 +363,7 @@ CUpdateError CUpdate::checkAndPrepareUpdate() const Qx::Error CUpdate::installUpdate(const QFileInfo& existingAppInfo) const { - mCore.setStatus(STATUS, STATUS_INSTALLING); + postDirective(STATUS, STATUS_INSTALLING); // Wait for previous process to close, lock instance afterwards static const int totalGrace = 2000; diff --git a/lib/backend/src/command/command.cpp b/lib/backend/src/command/command.cpp index 9173b66..10a1cbf 100644 --- a/lib/backend/src/command/command.cpp +++ b/lib/backend/src/command/command.cpp @@ -196,7 +196,7 @@ void Command::showHelp() static QString helpStr; // Update status - mCore.setStatus(Core::STATUS_DISPLAY, Core::STATUS_DISPLAY_HELP); + postDirective(Core::STATUS_DISPLAY, Core::STATUS_DISPLAY_HELP); // One time setup if(helpStr.isNull()) diff --git a/lib/backend/src/kernel/core.cpp b/lib/backend/src/kernel/core.cpp index 2bb1d1e..e1eb78f 100644 --- a/lib/backend/src/kernel/core.cpp +++ b/lib/backend/src/kernel/core.cpp @@ -57,9 +57,7 @@ QString CoreError::deriveSecondary() const { return mSpecific; } //Public: Core::Core() : Directorate(&mDirector), - mServicesMode(ServicesMode::Standalone), - mStatusHeading(u"Initializing"_s), - mStatusMessage(u"..."_s) + mServicesMode(ServicesMode::Standalone) {} //-Instance Functions------------------------------------------------------------- @@ -82,7 +80,7 @@ void Core::showHelp() static QString helpStr; // Update status - setStatus(STATUS_DISPLAY, STATUS_DISPLAY_HELP); + postDirective(STATUS_DISPLAY, STATUS_DISPLAY_HELP); // One time setup if(helpStr.isNull()) @@ -116,7 +114,7 @@ void Core::showHelp() void Core::showVersion() { - setStatus(STATUS_DISPLAY, STATUS_DISPLAY_VERSION); + postDirective(STATUS_DISPLAY, STATUS_DISPLAY_VERSION); postDirective(CL_VERSION_MESSAGE); } @@ -230,6 +228,9 @@ void Core::logTask(const Task* task) { logEvent(LOG_EVENT_TASK_ENQ.arg(task->nam //Public: Qx::Error Core::initialize(QStringList& commandLine) { + // Send initial status + postDirective(u"Initializing"_s, u"..."_s); + // Setup CLI Parser QCommandLineParser clParser; clParser.setOptionsAfterPositionalArgumentsMode(QCommandLineParser::ParseAsPositionalArguments); @@ -821,18 +822,6 @@ bool Core::hasTasks() const { return mTaskQueue.size() > 0; } Task* Core::frontTask() { return mTaskQueue.front(); } void Core::removeFrontTask() { mTaskQueue.pop(); } -QString Core::statusHeading() { return mStatusHeading; } -QString Core::statusMessage() { return mStatusMessage;} -void Core::setStatus(QString heading, QString message) -{ - /* TODO: Probably can do away with this and just use postDirective() where it's needed. - * The stored status is never used currently and I can't think of any reason it would b - */ - mStatusHeading = heading; - mStatusMessage = message; - postDirective(heading, message); -} - BuildInfo Core::buildInfo() const { constexpr auto sysOpt = magic_enum::enum_cast(BUILDINFO_SYSTEM); diff --git a/lib/backend/src/kernel/core.h b/lib/backend/src/kernel/core.h index f8bb05d..f49af92 100644 --- a/lib/backend/src/kernel/core.h +++ b/lib/backend/src/kernel/core.h @@ -210,10 +210,6 @@ class Core : public QObject, public Directorate ServicesMode mServicesMode; std::queue mTaskQueue; - // Info - QString mStatusHeading; - QString mStatusMessage; - // Other QProcessEnvironment mChildTitleProcEnv; Qx::ProcessBider mLauncherWatcher; @@ -265,11 +261,6 @@ class Core : public QObject, public Directorate Task* frontTask(); void removeFrontTask(); - // Status - QString statusHeading(); - QString statusMessage(); - void setStatus(QString heading, QString message); - // Other BuildInfo buildInfo() const;