From 646e7bfd79aca062ca6cf89968d1811fe0151455 Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Sat, 22 Jul 2023 08:22:36 -0400 Subject: [PATCH] Use u""_s where possible --- CMakeLists.txt | 6 +- app/src/command/c-link.cpp | 10 +- app/src/command/c-link.h | 40 ++++---- app/src/command/c-link_linux.cpp | 8 +- app/src/command/c-link_win.cpp | 6 +- app/src/command/c-play.cpp | 2 +- app/src/command/c-play.h | 18 ++-- app/src/command/c-prepare.h | 8 +- app/src/command/c-run.cpp | 2 +- app/src/command/c-run.h | 26 ++--- app/src/command/c-show.cpp | 2 +- app/src/command/c-show.h | 28 +++--- app/src/command/command.cpp | 14 +-- app/src/command/command.h | 34 +++---- app/src/command/title-command.cpp | 2 +- app/src/command/title-command.h | 89 +++++++++-------- app/src/frontend/statusrelay.cpp | 8 +- app/src/frontend/statusrelay.h | 2 +- app/src/kernel/core.cpp | 62 ++++++------ app/src/kernel/core.h | 132 ++++++++++++------------- app/src/kernel/driver.h | 48 ++++----- app/src/kernel/errorstatus.h | 1 - app/src/task/t-awaitdocker.cpp | 4 +- app/src/task/t-awaitdocker.h | 22 ++--- app/src/task/t-bideprocess.cpp | 2 +- app/src/task/t-bideprocess.h | 10 +- app/src/task/t-download.cpp | 14 +-- app/src/task/t-download.h | 16 +-- app/src/task/t-exec.cpp | 16 +-- app/src/task/t-exec.h | 38 +++---- app/src/task/t-exec_linux.cpp | 18 ++-- app/src/task/t-exec_win.cpp | 8 +- app/src/task/t-extra.cpp | 2 +- app/src/task/t-extra.h | 10 +- app/src/task/t-extract.cpp | 8 +- app/src/task/t-extract.h | 20 ++-- app/src/task/t-generic.cpp | 4 +- app/src/task/t-generic.h | 6 +- app/src/task/t-message.cpp | 4 +- app/src/task/t-message.h | 4 +- app/src/task/t-mount.cpp | 4 +- app/src/task/t-mount.h | 6 +- app/src/task/t-sleep.cpp | 2 +- app/src/task/t-sleep.h | 8 +- app/src/tools/blockingprocessmanager.h | 8 +- app/src/tools/deferredprocessmanager.h | 10 +- app/src/tools/mounter.cpp | 50 +++++----- app/src/tools/mounter.h | 36 +++---- app/src/tools/processbider.cpp | 4 +- app/src/tools/processbider.h | 16 +-- app/src/utility.cpp | 17 ++-- 51 files changed, 457 insertions(+), 458 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5826fb..34340a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,18 +72,18 @@ endif() include(OB/FetchQx) ob_fetch_qx( - REF "036444f02843050c2d19fa6eddf4a270d8a485b8" + REF "e46b448cf6c60c75095c1e243a5684a0ff1ec911" COMPONENTS ${CLIFP_QX_COMPONENTS} ) # Fetch libfp (build and import from source) include(OB/Fetchlibfp) -ob_fetch_libfp("737939552cd4c6ac320e9470d2ecf48288acf485") +ob_fetch_libfp("7663b1eff2813dfa54efee1aaad32f501ea58fba") # Fetch QI-QMP (build and import from source) include(OB/FetchQI-QMP) -ob_fetch_qi_qmp("ae12edd5c9f4b3856e7f7a9c7564e463de7d867e") +ob_fetch_qi_qmp("b99be49cd0ec71f9c3c398676be147cb68452bb9") # Fetch QuaZip (build and import from source) include(OB/FetchQuaZip) diff --git a/app/src/command/c-link.cpp b/app/src/command/c-link.cpp index 45eb36f..93438f3 100644 --- a/app/src/command/c-link.cpp +++ b/app/src/command/c-link.cpp @@ -82,7 +82,7 @@ Qx::Error CLink::perform() Q_ASSERT(std::holds_alternative(entry_v)); Fp::Game parent = std::get(entry_v); - shortcutName = Qx::kosherizeFileName(parent.title() + " (" + addApp.name() + ")"); + shortcutName = Qx::kosherizeFileName(parent.title() + u" ("_s + addApp.name() + u")"_s); } else qCritical("Invalid variant state for std::variant."); @@ -110,8 +110,8 @@ Qx::Error CLink::perform() // Prompt user for path Core::SaveFileRequest sfr{ .caption = DIAG_CAPTION, - .dir = QDir::homePath() + "/Desktop/" + shortcutName, - .filter = "Shortcuts (*. " + shortcutExtension() + ")" + .dir = QDir::homePath() + u"/Desktop/"_s + shortcutName, + .filter = u"Shortcuts (*. "_s + shortcutExtension() + u")"_s }; QString selectedPath = mCore.requestSaveFilePath(sfr); @@ -122,8 +122,8 @@ Qx::Error CLink::perform() } else { - if(!selectedPath.endsWith("." + shortcutExtension(), Qt::CaseInsensitive)) - selectedPath += "." + shortcutExtension(); + if(!selectedPath.endsWith(u"."_s + shortcutExtension(), Qt::CaseInsensitive)) + selectedPath += u"."_s + shortcutExtension(); mCore.logEvent(NAME, LOG_EVENT_SEL_PATH.arg(QDir::toNativeSeparators(selectedPath))); QFileInfo pathInfo(selectedPath); diff --git a/app/src/command/c-link.h b/app/src/command/c-link.h index 0243dcd..3c4723a 100644 --- a/app/src/command/c-link.h +++ b/app/src/command/c-link.h @@ -22,9 +22,9 @@ class QX_ERROR_TYPE(CLinkError, "CLinkError", 1212) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {InvalidPath, QSL("The provided shortcut path is not valid or a location where you do not have permissions to create a shortcut.")}, - {IconInstallFailed, QSL("Failed to install icons required for the shortcut.")} + {NoError, u""_s}, + {InvalidPath, u"The provided shortcut path is not valid or a location where you do not have permissions to create a shortcut."_s}, + {IconInstallFailed, u"Failed to install icons required for the shortcut."_s} }; //-Instance Variables------------------------------------------------------------- @@ -54,37 +54,37 @@ class CLink : public TitleCommand //-Class Variables------------------------------------------------------------------------------------------------------ private: // Status - static inline const QString STATUS_LINK = QSL("Linking"); + static inline const QString STATUS_LINK = u"Linking"_s; // General - static inline const QString DIAG_CAPTION = QSL("Select a shortcut destination..."); + static inline const QString DIAG_CAPTION = u"Select a shortcut destination..."_s; // Logging - Messages - static inline const QString LOG_EVENT_FILE_PATH = QSL("Shortcut path provided is for a file"); - static inline const QString LOG_EVENT_DIR_PATH = QSL("Shortcut path provided is for a folder"); - static inline const QString LOG_EVENT_NO_PATH = QSL("No shortcut path provided, user will be prompted"); - static inline const QString LOG_EVENT_SEL_PATH = QSL("Shortcut path selected: %1"); - static inline const QString LOG_EVENT_DIAG_CANCEL = QSL("Shortcut path selection canceled."); - static inline const QString LOG_EVENT_CREATED_DIR_PATH = QSL("Created directories for shortcut: %1"); - static inline const QString LOG_EVENT_CREATED_SHORTCUT = QSL("Created shortcut to %1 at %2"); + static inline const QString LOG_EVENT_FILE_PATH = u"Shortcut path provided is for a file"_s; + static inline const QString LOG_EVENT_DIR_PATH = u"Shortcut path provided is for a folder"_s; + static inline const QString LOG_EVENT_NO_PATH = u"No shortcut path provided, user will be prompted"_s; + static inline const QString LOG_EVENT_SEL_PATH = u"Shortcut path selected: %1"_s; + static inline const QString LOG_EVENT_DIAG_CANCEL = u"Shortcut path selection canceled."_s; + static inline const QString LOG_EVENT_CREATED_DIR_PATH = u"Created directories for shortcut: %1"_s; + static inline const QString LOG_EVENT_CREATED_SHORTCUT = u"Created shortcut to %1 at %2"_s; // Command line option strings - static inline const QString CL_OPT_PATH_S_NAME = QSL("p"); - static inline const QString CL_OPT_PATH_L_NAME = QSL("path"); - static inline const QString CL_OPT_PATH_DESC = QSL("Path to new shortcut. Path's ending with "".lnk""//"".desktop"" will be interpreted as a named shortcut file. " - "Any other path will be interpreted as a directory and the title will automatically be used " - "as the filename"); + static inline const QString CL_OPT_PATH_S_NAME = u"p"_s; + static inline const QString CL_OPT_PATH_L_NAME = u"path"_s; + static inline const QString CL_OPT_PATH_DESC = u"Path to new shortcut. Path's ending with "".lnk""//"".desktop"" will be interpreted as a named shortcut file. " + "Any other path will be interpreted as a directory and the title will automatically be used " + "as the filename"_s; // Command line options - static inline const QCommandLineOption CL_OPTION_PATH{{CL_OPT_PATH_S_NAME, CL_OPT_PATH_L_NAME}, CL_OPT_PATH_DESC, "path"}; // Takes value + static inline const QCommandLineOption CL_OPTION_PATH{{CL_OPT_PATH_S_NAME, CL_OPT_PATH_L_NAME}, CL_OPT_PATH_DESC, u"path"s}; // Takes value static inline const QList CL_OPTIONS_SPECIFIC{&CL_OPTION_PATH}; static inline const QSet CL_OPTIONS_REQUIRED{}; public: // Meta - static inline const QString NAME = QSL("link"); - static inline const QString DESCRIPTION = QSL("Creates a shortcut to a Flashpoint title."); + static inline const QString NAME = u"link"_s; + static inline const QString DESCRIPTION = u"Creates a shortcut to a Flashpoint title."_s; //-Constructor---------------------------------------------------------------------------------------------------------- public: diff --git a/app/src/command/c-link_linux.cpp b/app/src/command/c-link_linux.cpp index 6f00304..9ad51a8 100644 --- a/app/src/command/c-link_linux.cpp +++ b/app/src/command/c-link_linux.cpp @@ -28,13 +28,13 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id) Qx::ApplicationDesktopEntry ade; ade.setName(name); ade.setIcon(PROJECT_SHORT_NAME); - QString args = CPlay::NAME + " -" + TitleCommand::CL_OPTION_ID.names().constFirst() + ' ' + id.toString(QUuid::WithoutBraces); + QString args = CPlay::NAME + u" -"_s + TitleCommand::CL_OPTION_ID.names().constFirst() + ' ' + id.toString(QUuid::WithoutBraces); ade.setExec(CLIFP_DIR_PATH + '/' + CLIFP_CUR_APP_FILENAME + ' ' + args); ade.setPath(CLIFP_DIR_PATH); - ade.setComment("Generated by " PROJECT_SHORT_NAME " " PROJECT_VERSION_STR); + ade.setComment(u"Generated by "_s PROJECT_SHORT_NAME " " PROJECT_VERSION_STR); // Create entry - QString filename = QStringLiteral("org.flashpoint.clifp.") + id.toString(QUuid::WithoutBraces) + + QString filename = u"org.flashpoint.clifp."_s + id.toString(QUuid::WithoutBraces) + '.' + shortcutExtension(); QString fullEntryPath = dir.absoluteFilePath(filename); Qx::IoOpReport writeReport = Qx::DesktopEntry::writeToDisk(fullEntryPath, &ade); @@ -52,4 +52,4 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id) return CLinkError(); } -QString CLink::shortcutExtension() const { return "desktop"; }; +QString CLink::shortcutExtension() const { return u"desktop"_s; }; diff --git a/app/src/command/c-link_win.cpp b/app/src/command/c-link_win.cpp index c3ef72d..84d4412 100644 --- a/app/src/command/c-link_win.cpp +++ b/app/src/command/c-link_win.cpp @@ -18,8 +18,8 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id) { // Create shortcut properties Qx::ShortcutProperties sp; - sp.target = CLIFP_DIR_PATH + "/" + CLIFP_CUR_APP_FILENAME; - sp.targetArgs = CPlay::NAME + " -" + TitleCommand::CL_OPTION_ID.names().constFirst() + " " + id.toString(QUuid::WithoutBraces); + sp.target = CLIFP_DIR_PATH + '/' + CLIFP_CUR_APP_FILENAME; + sp.targetArgs = CPlay::NAME + u" -"_s + TitleCommand::CL_OPTION_ID.names().constFirst() + ' ' + id.toString(QUuid::WithoutBraces); sp.comment = name; // Create shortcut @@ -39,4 +39,4 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id) return CLinkError(); } -QString CLink::shortcutExtension() const { return "lnk"; }; +QString CLink::shortcutExtension() const { return u"lnk"_s; }; diff --git a/app/src/command/c-play.cpp b/app/src/command/c-play.cpp index f3e300e..7eb824c 100644 --- a/app/src/command/c-play.cpp +++ b/app/src/command/c-play.cpp @@ -202,7 +202,7 @@ Qx::Error CPlay::enqueueAdditionalApp(const Fp::AddApp& addApp, const QString& p { TExtra* extraTask = new TExtra(&mCore); extraTask->setStage(taskStage); - extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + "/" + addApp.launchCommand())); + extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + '/' + addApp.launchCommand())); mCore.enqueueSingleTask(extraTask); } diff --git a/app/src/command/c-play.h b/app/src/command/c-play.h index 9ccd211..4dcaeb3 100644 --- a/app/src/command/c-play.h +++ b/app/src/command/c-play.h @@ -12,20 +12,20 @@ class CPlay : public TitleCommand //-Class Variables------------------------------------------------------------------------------------------------------ private: // Status - static inline const QString STATUS_PLAY = QSL("Playing"); + static inline const QString STATUS_PLAY = u"Playing"_s; // Logging - Messages - static inline const QString LOG_EVENT_ENQ_AUTO = QSL("Enqueuing automatic tasks..."); - static inline const QString LOG_EVENT_ID_MATCH_TITLE = QSL("ID matches main title: %1"); - static inline const QString LOG_EVENT_ID_MATCH_ADDAPP = QSL("ID matches additional app: %1 (Child of %2)"); - static inline const QString LOG_EVENT_QUEUE_CLEARED = QSL("Previous queue entries cleared due to auto task being a Message/Extra"); - static inline const QString LOG_EVENT_FOUND_AUTORUN = QSL("Found autorun-before additional app: %1"); - static inline const QString LOG_EVENT_DATA_PACK_TITLE = QSL("Selected title uses a data pack"); + static inline const QString LOG_EVENT_ENQ_AUTO = u"Enqueuing automatic tasks..."_s; + static inline const QString LOG_EVENT_ID_MATCH_TITLE = u"ID matches main title: %1"_s; + static inline const QString LOG_EVENT_ID_MATCH_ADDAPP = u"ID matches additional app: %1 (Child of %2)"_s; + static inline const QString LOG_EVENT_QUEUE_CLEARED = u"Previous queue entries cleared due to auto task being a Message/Extra"_s; + static inline const QString LOG_EVENT_FOUND_AUTORUN = u"Found autorun-before additional app: %1"_s; + static inline const QString LOG_EVENT_DATA_PACK_TITLE = u"Selected title uses a data pack"_s; public: // Meta - static inline const QString NAME = QSL("play"); - static inline const QString DESCRIPTION = QSL("Launch a title and all of it's support applications, in the same manner as using the GUI"); + static inline const QString NAME = u"play"_s; + static inline const QString DESCRIPTION = u"Launch a title and all of it's support applications, in the same manner as using the GUI"_s; //-Constructor---------------------------------------------------------------------------------------------------------- public: diff --git a/app/src/command/c-prepare.h b/app/src/command/c-prepare.h index 662a2ab..75e62f8 100644 --- a/app/src/command/c-prepare.h +++ b/app/src/command/c-prepare.h @@ -12,15 +12,15 @@ class CPrepare : public TitleCommand //-Class Variables------------------------------------------------------------------------------------------------------ private: // Status - static inline const QString STATUS_PREPARE = QSL("Preparing"); + static inline const QString STATUS_PREPARE = u"Preparing"_s; // Logging - Errors - static inline const QString LOG_WRN_PREP_NOT_DATA_PACK = QSL("The provided ID does not belong to a Data Pack based game (%1). No action will be taken."); + static inline const QString LOG_WRN_PREP_NOT_DATA_PACK = u"The provided ID does not belong to a Data Pack based game (%1). No action will be taken."_s; public: // Meta - static inline const QString NAME = QSL("prepare"); - static inline const QString DESCRIPTION = QSL("Initializes Flashpoint for playing the provided Data Pack based title by UUID. If the title does not use a Data Pack this command has no effect."); + static inline const QString NAME = u"prepare"_s; + static inline const QString DESCRIPTION = u"Initializes Flashpoint for playing the provided Data Pack based title by UUID. If the title does not use a Data Pack this command has no effect."_s; //-Constructor---------------------------------------------------------------------------------------------------------- public: diff --git a/app/src/command/c-run.cpp b/app/src/command/c-run.cpp index ae98bde..e629e65 100644 --- a/app/src/command/c-run.cpp +++ b/app/src/command/c-run.cpp @@ -58,7 +58,7 @@ Qx::Error CRun::perform() QFileInfo inputInfo = QFileInfo(mCore.fpInstall().fullPath() + '/' + inputPath); TExec* runTask = new TExec(&mCore); - runTask->setIdentifier(NAME + " program"); + runTask->setIdentifier(NAME + u" program"_s); runTask->setStage(Task::Stage::Primary); runTask->setExecutable(inputInfo.canonicalFilePath()); runTask->setDirectory(inputInfo.canonicalPath()); diff --git a/app/src/command/c-run.h b/app/src/command/c-run.h index 340aa11..5c65a80 100644 --- a/app/src/command/c-run.h +++ b/app/src/command/c-run.h @@ -21,8 +21,8 @@ class QX_ERROR_TYPE(CRunError, "CRunError", 1215) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {MissingApp, QSL("No application to run was provided.")} + {NoError, u""_s}, + {MissingApp, u"No application to run was provided."_s} }; //-Instance Variables------------------------------------------------------------- @@ -52,26 +52,26 @@ class CRun : public Command //-Class Variables------------------------------------------------------------------------------------------------------ private: // Status - static inline const QString STATUS_RUN = QSL("Running"); + static inline const QString STATUS_RUN = u"Running"_s; // Command line option strings - static inline const QString CL_OPT_APP_S_NAME = QSL("a"); - static inline const QString CL_OPT_APP_L_NAME = QSL("app"); - static inline const QString CL_OPT_APP_DESC = QSL("Relative (to Flashpoint directory) path of application to launch."); + static inline const QString CL_OPT_APP_S_NAME = u"a"_s; + static inline const QString CL_OPT_APP_L_NAME = u"app"_s; + static inline const QString CL_OPT_APP_DESC = u"Relative (to Flashpoint directory) path of application to launch."_s; - static inline const QString CL_OPT_PARAM_S_NAME = QSL("p"); - static inline const QString CL_OPT_PARAM_L_NAME = QSL("param"); - static inline const QString CL_OPT_PARAM_DESC = QSL("Command-line parameters to use when starting the application."); + static inline const QString CL_OPT_PARAM_S_NAME = u"p"_s; + static inline const QString CL_OPT_PARAM_L_NAME = u"param"_s; + static inline const QString CL_OPT_PARAM_DESC = u"Command-line parameters to use when starting the application."_s; // Command line options - static inline const QCommandLineOption CL_OPTION_APP{{CL_OPT_APP_S_NAME, CL_OPT_APP_L_NAME}, CL_OPT_APP_DESC, "application"}; // Takes value - static inline const QCommandLineOption CL_OPTION_PARAM{{CL_OPT_PARAM_S_NAME, CL_OPT_PARAM_L_NAME}, CL_OPT_PARAM_DESC, "parameters"}; // Takes value + static inline const QCommandLineOption CL_OPTION_APP{{CL_OPT_APP_S_NAME, CL_OPT_APP_L_NAME}, CL_OPT_APP_DESC, u"application"_s}; // Takes value + static inline const QCommandLineOption CL_OPTION_PARAM{{CL_OPT_PARAM_S_NAME, CL_OPT_PARAM_L_NAME}, CL_OPT_PARAM_DESC, u"parameters"_s}; // Takes value static inline const QList CL_OPTIONS_SPECIFIC{&CL_OPTION_APP, &CL_OPTION_PARAM}; public: // Meta - static inline const QString NAME = QSL("run"); - static inline const QString DESCRIPTION = QSL("Start Flashpoint's webserver and then execute the provided application"); + static inline const QString NAME = u"run"_s; + static inline const QString DESCRIPTION = u"Start Flashpoint's webserver and then execute the provided application"_s; //-Constructor---------------------------------------------------------------------------------------------------------- public: diff --git a/app/src/command/c-show.cpp b/app/src/command/c-show.cpp index 99b86f4..8f570c1 100644 --- a/app/src/command/c-show.cpp +++ b/app/src/command/c-show.cpp @@ -58,7 +58,7 @@ Qx::Error CShow::perform() { TExtra* extraTask = new TExtra(&mCore); extraTask->setStage(Task::Stage::Primary); - extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + "/" + mParser.value(CL_OPTION_EXTRA))); + extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + '/' + mParser.value(CL_OPTION_EXTRA))); mCore.enqueueSingleTask(extraTask); mCore.setStatus(STATUS_SHOW_EXTRA, extraTask->directory().dirName()); diff --git a/app/src/command/c-show.h b/app/src/command/c-show.h index 7c8dcec..9d0c253 100644 --- a/app/src/command/c-show.h +++ b/app/src/command/c-show.h @@ -21,8 +21,8 @@ class QX_ERROR_TYPE(CShowError, "CShowError", 1216) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {MissingThing, QSL("No message or extra to show was provided.")} + {NoError, u""_s}, + {MissingThing, u"No message or extra to show was provided."_s} }; //-Instance Variables------------------------------------------------------------- @@ -52,27 +52,27 @@ class CShow : public Command //-Class Variables------------------------------------------------------------------------------------------------------ private: // Status - static inline const QString STATUS_SHOW_MSG = QSL("Displaying message"); - static inline const QString STATUS_SHOW_EXTRA = QSL("Displaying extra"); + static inline const QString STATUS_SHOW_MSG = u"Displaying message"_s; + static inline const QString STATUS_SHOW_EXTRA = u"Displaying extra"_s; // Command line option strings - static inline const QString CL_OPT_MSG_S_NAME = QSL("m"); - static inline const QString CL_OPT_MSG_L_NAME = QSL("message"); - static inline const QString CL_OPT_MSG_DESC = QSL("Displays an pop-up dialog with the supplied message. Used primarily for some additional apps."); + static inline const QString CL_OPT_MSG_S_NAME = u"m"_s; + static inline const QString CL_OPT_MSG_L_NAME = u"message"_s; + static inline const QString CL_OPT_MSG_DESC = u"Displays an pop-up dialog with the supplied message. Used primarily for some additional apps."_s; - static inline const QString CL_OPT_EXTRA_S_NAME = QSL("e"); - static inline const QString CL_OPT_EXTRA_L_NAME = QSL("extra"); - static inline const QString CL_OPT_EXTRA_DESC = QSL("Opens an explorer window to the specified extra. Used primarily for some additional apps."); + static inline const QString CL_OPT_EXTRA_S_NAME = u"e"_s; + static inline const QString CL_OPT_EXTRA_L_NAME = u"extra"_s; + static inline const QString CL_OPT_EXTRA_DESC = u"Opens an explorer window to the specified extra. Used primarily for some additional apps."_s; // Command line options - static inline const QCommandLineOption CL_OPTION_MSG{{CL_OPT_MSG_S_NAME, CL_OPT_MSG_L_NAME}, CL_OPT_MSG_DESC, "message"}; // Takes value - static inline const QCommandLineOption CL_OPTION_EXTRA{{CL_OPT_EXTRA_S_NAME, CL_OPT_EXTRA_L_NAME}, CL_OPT_EXTRA_DESC, "extra"}; // Takes value + static inline const QCommandLineOption CL_OPTION_MSG{{CL_OPT_MSG_S_NAME, CL_OPT_MSG_L_NAME}, CL_OPT_MSG_DESC, u"message"_s}; // Takes value + static inline const QCommandLineOption CL_OPTION_EXTRA{{CL_OPT_EXTRA_S_NAME, CL_OPT_EXTRA_L_NAME}, CL_OPT_EXTRA_DESC, u"extra"_s}; // Takes value static inline const QList CL_OPTIONS_SPECIFIC{&CL_OPTION_MSG, &CL_OPTION_EXTRA}; public: // Meta - static inline const QString NAME = QSL("show"); - static inline const QString DESCRIPTION = QSL("Display a message or extra folder"); + static inline const QString NAME = u"show"_s; + static inline const QString DESCRIPTION = u"Display a message or extra folder"_s; //-Constructor---------------------------------------------------------------------------------------------------------- public: diff --git a/app/src/command/command.cpp b/app/src/command/command.cpp index ebecaea..2a3d5e9 100644 --- a/app/src/command/command.cpp +++ b/app/src/command/command.cpp @@ -80,13 +80,13 @@ CommandError Command::parse(const QStringList& commandLine) { // Add switch to interpreted string if(!optionsStr.isEmpty()) - optionsStr += " "; // Space after every switch except first one + optionsStr += ' '; // Space after every switch except first one - optionsStr += "--" + (*clOption).names().at(1); // Always use long name + optionsStr += u"--"_s + (*clOption).names().at(1); // Always use long name // Add value of switch if it takes one if(!(*clOption).valueName().isEmpty()) - optionsStr += R"(=")" + mParser.value(*clOption) + R"(")"; + optionsStr += uR"(=")"_s + mParser.value(*clOption) + uR"(")"_s; } } if(optionsStr.isEmpty()) @@ -127,7 +127,7 @@ CommandError Command::checkRequiredOptions() missing.append(opt->names().constFirst()); if(!missing.isEmpty()) - return ERR_MISSING_REQ_OPT.arged(name()).wDetails("'" + missing.join("','") + "'"); + return ERR_MISSING_REQ_OPT.arged(name()).wDetails(u"'"_s + missing.join(u"','"_s) + u"'"_s); return CommandError(); } @@ -151,11 +151,11 @@ void Command::showHelp() // Handle names QStringList dashedNames; for(const QString& name : qxAsConst(clOption->names())) - dashedNames << ((name.length() > 1 ? "--" : "-") + name); + dashedNames << ((name.length() > 1 ? u"--"_s : u"-"_s) + name); // Add option - QString marker = requiredOptions().contains(clOption) ? "*" : ""; - optStr += HELP_OPT_TEMPL.arg(marker, dashedNames.join(" | "), clOption->description()); + QString marker = requiredOptions().contains(clOption) ? u"*"_s : u""_s; + optStr += HELP_OPT_TEMPL.arg(marker, dashedNames.join(u" | "_s), clOption->description()); } // Complete string diff --git a/app/src/command/command.h b/app/src/command/command.h index 95bc7e1..3b43e7a 100644 --- a/app/src/command/command.h +++ b/app/src/command/command.h @@ -35,7 +35,7 @@ class QX_ERROR_TYPE(CommandError, "CommandError", 1210) //-Class Variables------------------------------------------------------------------------------------------------ private: - static inline const QString PRIMARY_STRING = QSL("Command parsing error."); + static inline const QString PRIMARY_STRING = u"Command parsing error."_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: @@ -88,36 +88,36 @@ class Command private: // Error static inline const CommandError ERR_INVALID_ARGS = - CommandError(CommandError::InvalidArguments, QSL("Invalid command arguments.")); + CommandError(CommandError::InvalidArguments, u"Invalid command arguments."_s); static inline const CommandError ERR_INVALID_COMMAND = - CommandError(CommandError::InvalidCommand, QSL("'%1' is not a valid command")); + CommandError(CommandError::InvalidCommand, u"'%1' is not a valid command"_s); static inline const CommandError ERR_MISSING_REQ_OPT = - CommandError(CommandError::MissingRequiredOption, QSL("Missing required options for '%1'")); + CommandError(CommandError::MissingRequiredOption, u"Missing required options for '%1'"_s); // Help template - static inline const QString HELP_TEMPL = QSL("Usage:
" - "%1 <options>
" - "
" - "Options:%2
" - "
" - "*Required Option
"); - static inline const QString HELP_OPT_TEMPL = QSL("
%1%2:  %3"); + static inline const QString HELP_TEMPL = u"Usage:
" + "%1 <options>
" + "
" + "Options:%2
" + "
" + "*Required Option
"_s; + static inline const QString HELP_OPT_TEMPL = u"
%1%2:  %3"_s; // Logging - Messages - static inline const QString LOG_EVENT_C_HELP_SHOWN = QSL("Displayed help infomration for: %1"); + static inline const QString LOG_EVENT_C_HELP_SHOWN = u"Displayed help infomration for: %1"_s; // Standard command line option strings - static inline const QString CL_OPT_HELP_S_NAME = QSL("h"); - static inline const QString CL_OPT_HELP_L_NAME = QSL("help"); - static inline const QString CL_OPT_HELP_E_NAME = QSL("?"); - static inline const QString CL_OPT_HELP_DESC = QSL("Prints this help message."); + static inline const QString CL_OPT_HELP_S_NAME = u"h"_s; + static inline const QString CL_OPT_HELP_L_NAME = u"help"_s; + static inline const QString CL_OPT_HELP_E_NAME = u"?"_s; + static inline const QString CL_OPT_HELP_DESC = u"Prints this help message."_s; // Standard command line options static inline const QCommandLineOption CL_OPTION_HELP{{CL_OPT_HELP_S_NAME, CL_OPT_HELP_L_NAME, CL_OPT_HELP_E_NAME}, CL_OPT_HELP_DESC}; // Boolean option static inline const QList CL_OPTIONS_STANDARD{&CL_OPTION_HELP}; // Meta - static inline const QString NAME = QSL("command"); + static inline const QString NAME = u"command"_s; //-Instance Variables------------------------------------------------------------------------------------------------------ private: diff --git a/app/src/command/title-command.cpp b/app/src/command/title-command.cpp index c79d3cd..3680e08 100644 --- a/app/src/command/title-command.cpp +++ b/app/src/command/title-command.cpp @@ -164,7 +164,7 @@ Qx::Error TitleCommand::getRandomSelectionInfo(QString& infoBuffer, QUuid mainId // Determine variant if(subId.isNull()) - infoFillTemplate = infoFillTemplate.arg("N/A"); + infoFillTemplate = infoFillTemplate.arg(u"N/A"_s); else { // Get sub entry info diff --git a/app/src/command/title-command.h b/app/src/command/title-command.h index 935ca50..5bba30f 100644 --- a/app/src/command/title-command.h +++ b/app/src/command/title-command.h @@ -20,10 +20,10 @@ class QX_ERROR_TYPE(TitleCommandError, "TitleCommandError", 1211) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {InvalidId, QSL("The provided string was not a valid GUID/UUID.")}, - {InvalidRandomFilter, QSL("The provided string for random operation was not a valid filter.")}, - {MissingTitle, QSL("No title was specified.")}, + {NoError, u""_s}, + {InvalidId, u"The provided string was not a valid GUID/UUID."_s}, + {InvalidRandomFilter, u"The provided string for random operation was not a valid filter."_s}, + {MissingTitle, u"No title was specified."_s}, }; //-Instance Variables------------------------------------------------------------- @@ -53,73 +53,72 @@ class TitleCommand : public Command //-Class Variables------------------------------------------------------------------------------------------------------ private: // Logging - Errors - static inline const QString LOG_WRN_INVALID_RAND_ID = QSL("A UUID found in the database during Random operation is invalid (%1)"); + static inline const QString LOG_WRN_INVALID_RAND_ID = u"A UUID found in the database during Random operation is invalid (%1)"_s; // Logging - Messages - static inline const QString LOG_EVENT_SEL_RAND = QSL("Selecting a playable title at random..."); - static inline const QString LOG_EVENT_INIT_RAND_ID = QSL("Randomly chose primary title is \"%1\""); - static inline const QString LOG_EVENT_INIT_RAND_PLAY_ADD_COUNT = QSL("Chosen title has %1 playable additional-apps"); - static inline const QString LOG_EVENT_RAND_DET_PRIM = QSL("Selected primary title"); - static inline const QString LOG_EVENT_RAND_DET_ADD_APP = QSL("Selected additional-app \"%1\""); - static inline const QString LOG_EVENT_RAND_GET_INFO = QSL("Querying random game info..."); - static inline const QString LOG_EVENT_PLAYABLE_COUNT = QSL("Found %1 playable primary titles"); + static inline const QString LOG_EVENT_SEL_RAND = u"Selecting a playable title at random..."_s; + static inline const QString LOG_EVENT_INIT_RAND_ID = u"Randomly chose primary title is \"%1\""_s; + static inline const QString LOG_EVENT_INIT_RAND_PLAY_ADD_COUNT = u"Chosen title has %1 playable additional-apps"_s; + static inline const QString LOG_EVENT_RAND_DET_PRIM = u"Selected primary title"_s; + static inline const QString LOG_EVENT_RAND_DET_ADD_APP = u"Selected additional-app \"%1\""_s; + static inline const QString LOG_EVENT_RAND_GET_INFO = u"Querying random game info..."_s; + static inline const QString LOG_EVENT_PLAYABLE_COUNT = u"Found %1 playable primary titles"_s; // Random Selection Info - static inline const QString RAND_SEL_INFO = QSL( - "Randomly Selected Game
" + static inline const QString RAND_SEL_INFO = + u"Randomly Selected Game
" "
" "Title: %1
" "Developer: %2
" "Publisher: %3
" "Library: %4
" - "Variant: %5
" - ); + "Variant: %5
"_s; // Random Filter Sets - static inline const QStringList RAND_ALL_FILTER_NAMES{QSL("all"), QSL("any")}; - static inline const QStringList RAND_GAME_FILTER_NAMES{QSL("game"), QSL("arcade")}; - static inline const QStringList RAND_ANIM_FILTER_NAMES{QSL("animation"), QSL("theatre")}; + static inline const QStringList RAND_ALL_FILTER_NAMES{u"all"_s, u"any"_s}; + static inline const QStringList RAND_GAME_FILTER_NAMES{u"game"_s, u"arcade"_s}; + static inline const QStringList RAND_ANIM_FILTER_NAMES{u"animation"_s, u"theatre"_s}; // Command line option strings - static inline const QString CL_OPT_ID_S_NAME = QSL("i"); - static inline const QString CL_OPT_ID_L_NAME = QSL("id"); - static inline const QString CL_OPT_ID_DESC = QSL("UUID of title to process"); + static inline const QString CL_OPT_ID_S_NAME = u"i"_s; + static inline const QString CL_OPT_ID_L_NAME = u"id"_s; + static inline const QString CL_OPT_ID_DESC = u"UUID of title to process"_s; - static inline const QString CL_OPT_TITLE_S_NAME = QSL("t"); - static inline const QString CL_OPT_TITLE_L_NAME = QSL("title"); - static inline const QString CL_OPT_TITLE_DESC = QSL("Title to process"); + static inline const QString CL_OPT_TITLE_S_NAME = u"t"_s; + static inline const QString CL_OPT_TITLE_L_NAME = u"title"_s; + static inline const QString CL_OPT_TITLE_DESC = u"Title to process"_s; - static inline const QString CL_OPT_TITLE_STRICT_S_NAME = QSL("T"); - static inline const QString CL_OPT_TITLE_STRICT_L_NAME = QSL("title-strict"); - static inline const QString CL_OPT_TITLE_STRICT_DESC = QSL("Same as -t, but exact matches only"); + static inline const QString CL_OPT_TITLE_STRICT_S_NAME = u"T"_s; + static inline const QString CL_OPT_TITLE_STRICT_L_NAME = u"title-strict"_s; + static inline const QString CL_OPT_TITLE_STRICT_DESC = u"Same as -t, but exact matches only"_s; - static inline const QString CL_OPT_SUBTITLE_S_NAME = QSL("s"); - static inline const QString CL_OPT_SUBTITLE_L_NAME = QSL("subtitle"); - static inline const QString CL_OPT_SUBTITLE_DESC = QSL("Name of additional-app under the title to process. Must be used with -t / -T"); + static inline const QString CL_OPT_SUBTITLE_S_NAME = u"s"_s; + static inline const QString CL_OPT_SUBTITLE_L_NAME = u"subtitle"_s; + static inline const QString CL_OPT_SUBTITLE_DESC = u"Name of additional-app under the title to process. Must be used with -t / -T"_s; - static inline const QString CL_OPT_SUBTITLE_STRICT_S_NAME = QSL("S"); - static inline const QString CL_OPT_SUBTITLE_STRICT_L_NAME = QSL("subtitle-strict"); - static inline const QString CL_OPT_SUBTITLE_STRICT_DESC = QSL("Same as -s, but exact matches only"); + static inline const QString CL_OPT_SUBTITLE_STRICT_S_NAME = u"S"_s; + static inline const QString CL_OPT_SUBTITLE_STRICT_L_NAME = u"subtitle-strict"_s; + static inline const QString CL_OPT_SUBTITLE_STRICT_DESC = u"Same as -s, but exact matches only"_s; - static inline const QString CL_OPT_RAND_S_NAME = QSL("r"); - static inline const QString CL_OPT_RAND_L_NAME = QSL("random"); - static inline const QString CL_OPT_RAND_DESC = "Select a random title from the database to start. Must be followed by a library filter: " + - RAND_ALL_FILTER_NAMES.join("/") + ", " + RAND_GAME_FILTER_NAMES.join("/") + " or " + RAND_ANIM_FILTER_NAMES.join("/"); + static inline const QString CL_OPT_RAND_S_NAME = u"r"_s; + static inline const QString CL_OPT_RAND_L_NAME = u"random"_s; + static inline const QString CL_OPT_RAND_DESC = u"Select a random title from the database to start. Must be followed by a library filter: "_s + + RAND_ALL_FILTER_NAMES.join('/') + u", "_s + RAND_GAME_FILTER_NAMES.join('/') + u" or "_s + RAND_ANIM_FILTER_NAMES.join('/'); protected: // Command line options - static inline const QCommandLineOption CL_OPTION_ID{{CL_OPT_ID_S_NAME, CL_OPT_ID_L_NAME}, CL_OPT_ID_DESC, "id"}; // Takes value - static inline const QCommandLineOption CL_OPTION_TITLE{{CL_OPT_TITLE_S_NAME, CL_OPT_TITLE_L_NAME}, CL_OPT_TITLE_DESC, "title"}; // Takes value - static inline const QCommandLineOption CL_OPTION_TITLE_STRICT{{CL_OPT_TITLE_STRICT_S_NAME, CL_OPT_TITLE_STRICT_L_NAME}, CL_OPT_TITLE_STRICT_DESC, "title-strict"}; // Takes value - static inline const QCommandLineOption CL_OPTION_SUBTITLE{{CL_OPT_SUBTITLE_S_NAME, CL_OPT_SUBTITLE_L_NAME}, CL_OPT_SUBTITLE_DESC, "subtitle"}; // Takes value - static inline const QCommandLineOption CL_OPTION_SUBTITLE_STRICT{{CL_OPT_SUBTITLE_STRICT_S_NAME, CL_OPT_SUBTITLE_STRICT_L_NAME}, CL_OPT_SUBTITLE_STRICT_DESC, "subtitle-strict"}; // Takes value - static inline const QCommandLineOption CL_OPTION_RAND{{CL_OPT_RAND_S_NAME, CL_OPT_RAND_L_NAME}, CL_OPT_RAND_DESC, "random"}; // Takes value + static inline const QCommandLineOption CL_OPTION_ID{{CL_OPT_ID_S_NAME, CL_OPT_ID_L_NAME}, CL_OPT_ID_DESC, u"id"_s}; // Takes value + static inline const QCommandLineOption CL_OPTION_TITLE{{CL_OPT_TITLE_S_NAME, CL_OPT_TITLE_L_NAME}, CL_OPT_TITLE_DESC, u"title"_s}; // Takes value + static inline const QCommandLineOption CL_OPTION_TITLE_STRICT{{CL_OPT_TITLE_STRICT_S_NAME, CL_OPT_TITLE_STRICT_L_NAME}, CL_OPT_TITLE_STRICT_DESC, u"title-strict"_s}; // Takes value + static inline const QCommandLineOption CL_OPTION_SUBTITLE{{CL_OPT_SUBTITLE_S_NAME, CL_OPT_SUBTITLE_L_NAME}, CL_OPT_SUBTITLE_DESC, u"subtitle"_s}; // Takes value + static inline const QCommandLineOption CL_OPTION_SUBTITLE_STRICT{{CL_OPT_SUBTITLE_STRICT_S_NAME, CL_OPT_SUBTITLE_STRICT_L_NAME}, CL_OPT_SUBTITLE_STRICT_DESC, u"subtitle-strict"_s}; // Takes value + static inline const QCommandLineOption CL_OPTION_RAND{{CL_OPT_RAND_S_NAME, CL_OPT_RAND_L_NAME}, CL_OPT_RAND_DESC, u"random"_s}; // Takes value static inline const QList CL_OPTIONS_SPECIFIC{&CL_OPTION_ID, &CL_OPTION_TITLE, &CL_OPTION_TITLE_STRICT, &CL_OPTION_SUBTITLE, &CL_OPTION_SUBTITLE_STRICT, &CL_OPTION_RAND}; public: // Meta - static inline const QString NAME = QSL("title-command"); + static inline const QString NAME = u"title-command"_s; //-Constructor---------------------------------------------------------------------------------------------------------- public: diff --git a/app/src/frontend/statusrelay.cpp b/app/src/frontend/statusrelay.cpp index f7b215f..11e2595 100644 --- a/app/src/frontend/statusrelay.cpp +++ b/app/src/frontend/statusrelay.cpp @@ -25,7 +25,7 @@ StatusRelay::StatusRelay(QObject* parent) : void StatusRelay::setupTrayIcon() { // Set Icon - mTrayIcon.setIcon(QIcon(":/app/CLIFp.ico")); + mTrayIcon.setIcon(QIcon(u":/app/CLIFp.ico"_s)); // Set ToolTip Action mTrayIcon.setToolTip(SYS_TRAY_STATUS); @@ -36,8 +36,8 @@ void StatusRelay::setupTrayIcon() // Set Context Menu QAction* quit = new QAction(&mTrayIconContextMenu); - quit->setIcon(QIcon(":/tray/Exit.png")); - quit->setText("Quit"); + quit->setIcon(QIcon(u":/tray/Exit.png"_s)); + quit->setText(u"Quit"_s); connect(quit, &QAction::triggered, this, &StatusRelay::quitRequested); mTrayIconContextMenu.addAction(quit); mTrayIcon.setContextMenu(&mTrayIconContextMenu); @@ -49,7 +49,7 @@ void StatusRelay::setupTrayIcon() void StatusRelay::setupProgressDialog() { // Initialize dialog - mLongTaskProgressDialog.setCancelButtonText("Cancel"); + mLongTaskProgressDialog.setCancelButtonText(u"Cancel"_s); mLongTaskProgressDialog.setWindowModality(Qt::NonModal); mLongTaskProgressDialog.setMinimumDuration(0); mLongTaskProgressDialog.setAutoClose(true); diff --git a/app/src/frontend/statusrelay.h b/app/src/frontend/statusrelay.h index b299e51..4c12969 100644 --- a/app/src/frontend/statusrelay.h +++ b/app/src/frontend/statusrelay.h @@ -21,7 +21,7 @@ class StatusRelay : public QObject //-Class Variables------------------------------------------------------------------------------------------------------ private: // System Messages - static inline const QString SYS_TRAY_STATUS = QSL("CLIFp is running"); + static inline const QString SYS_TRAY_STATUS = u"CLIFp is running"_s; //-Instance Variables------------------------------------------------------------------------------------------------------ public: diff --git a/app/src/kernel/core.cpp b/app/src/kernel/core.cpp index cd0881f..5bcaaed 100644 --- a/app/src/kernel/core.cpp +++ b/app/src/kernel/core.cpp @@ -59,8 +59,8 @@ QString CoreError::deriveSecondary() const { return mSpecific; } Core::Core(QObject* parent) : QObject(parent), mCriticalErrorOccured(false), - mStatusHeading("Initializing"), - mStatusMessage("...") + mStatusHeading(u"Initializing"_s), + mStatusMessage(u"..."_s) {} //-Instance Functions------------------------------------------------------------- @@ -93,10 +93,10 @@ void Core::showHelp() // Handle names QStringList dashedNames; for(const QString& name : qxAsConst(clOption->names())) - dashedNames << ((name.length() > 1 ? "--" : "-") + name); + dashedNames << ((name.length() > 1 ? u"--"_s : u"-"_s) + name); // Add option - optStr += HELP_OPT_TEMPL.arg(dashedNames.join(" | "), clOption->description()); + optStr += HELP_OPT_TEMPL.arg(dashedNames.join(u" | "_s), clOption->description()); } // Help commands @@ -244,13 +244,13 @@ Qx::Error Core::initialize(QStringList& commandLine) { // Add switch to interpreted string if(!globalOptions.isEmpty()) - globalOptions += " "; // Space after every switch except first one + globalOptions += ' '; // Space after every switch except first one - globalOptions += "--" + (*clOption).names().at(1); // Always use long name + globalOptions += u"--"_s + (*clOption).names().at(1); // Always use long name // Add value of switch if it takes one if(!(*clOption).valueName().isEmpty()) - globalOptions += R"(=")" + clParser.value(*clOption) + R"(")"; + globalOptions += uR"(=")"_s + clParser.value(*clOption) + uR"(")"_s; } } if(globalOptions.isEmpty()) @@ -329,16 +329,16 @@ void Core::attachFlashpoint(std::unique_ptr flashpointInstall) mChildTitleProcEnv = QProcessEnvironment::systemEnvironment(); // Add FP root var - mChildTitleProcEnv.insert("FP_PATH", mFlashpointInstall->fullPath()); + mChildTitleProcEnv.insert(u"FP_PATH"_s, mFlashpointInstall->fullPath()); #ifdef __linux__ // Add HTTTP proxy var QString baseProxy = mFlashpointInstall->preferences().browserModeProxy; if(!baseProxy.isEmpty()) { - QString fullProxy = "http://" + baseProxy + '/'; - mChildTitleProcEnv.insert("http_proxy", fullProxy); - mChildTitleProcEnv.insert("HTTP_PROXY", fullProxy); + QString fullProxy = u"http://"_s + baseProxy + '/'; + mChildTitleProcEnv.insert(u"http_proxy"_s, fullProxy); + mChildTitleProcEnv.insert(u"HTTP_PROXY"_s, fullProxy); } /* NOTE: It's called "browserModeProxy" but it seems to be used everywhere and not just @@ -373,8 +373,8 @@ QString Core::resolveTrueAppPath(const QString& appPath, const QString& platform * override it with Basilisk. Basilisk was removed in FP11 but the app path overrides * contains an entry for it that's appropriate on both platforms. */ - if(transformedPath == ":browser-mode:") - transformedPath = "FPSoftware\\Basilisk-Portable\\Basilisk-Portable.exe"; + if(transformedPath == u":browser-mode:"_s) + transformedPath = u"FPSoftware\\Basilisk-Portable\\Basilisk-Portable.exe"_s; // Resolve both swap types transformedPath = mFlashpointInstall->resolveExecSwaps(transformedPath, platform); @@ -414,9 +414,9 @@ CoreError Core::enqueueStartupTasks() * if docker isn't used, but leaving for now. */ TExec* xhostSet = new TExec(this); - xhostSet->setIdentifier("xhost Set"); + xhostSet->setIdentifier(u"xhost Set"_s); xhostSet->setStage(Task::Stage::Startup); - xhostSet->setExecutable("xhost"); + xhostSet->setExecutable(u"xhost"_s); xhostSet->setDirectory(mFlashpointInstall->fullPath()); xhostSet->setParameters({"+SI:localuser:root"}); xhostSet->setProcessType(TExec::ProcessType::Blocking); @@ -457,7 +457,7 @@ CoreError Core::enqueueStartupTasks() Fp::ServerDaemon configuredServer = fpServices.server.value(fpConfig.server); TExec* serverTask = new TExec(this); - serverTask->setIdentifier("Server"); + serverTask->setIdentifier(u"Server"_s); serverTask->setStage(Task::Stage::Startup); serverTask->setExecutable(configuredServer.filename); serverTask->setDirectory(mFlashpointInstall->fullPath() + '/' + configuredServer.path); @@ -472,7 +472,7 @@ CoreError Core::enqueueStartupTasks() for(const Fp::ServerDaemon& d : qAsConst(fpServices.daemon)) { TExec* currentTask = new TExec(this); - currentTask->setIdentifier("Daemon"); + currentTask->setIdentifier(u"Daemon"_s); currentTask->setStage(Task::Stage::Startup); currentTask->setExecutable(d.filename); currentTask->setDirectory(mFlashpointInstall->fullPath() + '/' + d.path); @@ -490,7 +490,7 @@ CoreError Core::enqueueStartupTasks() TAwaitDocker* dockerWait = new TAwaitDocker(this); dockerWait->setStage(Task::Stage::Startup); // NOTE: Other than maybe picking it out of the 2nd argument of the stop docker StartStop, there's no clean way to get this name - dockerWait->setImageName("gamezip"); + dockerWait->setImageName(u"gamezip"_s); dockerWait->setTimeout(10000); mTaskQueue.push(dockerWait); @@ -535,9 +535,9 @@ void Core::enqueueShutdownTasks() #ifdef __linux__ // Undo xhost permissions modifications TExec* xhostClear = new TExec(this); - xhostClear->setIdentifier("xhost Clear"); + xhostClear->setIdentifier(u"xhost Clear"_s); xhostClear->setStage(Task::Stage::Shutdown); - xhostClear->setExecutable("xhost"); + xhostClear->setExecutable(u"xhost"_s); xhostClear->setDirectory(mFlashpointInstall->fullPath()); xhostClear->setParameters({"-SI:localuser:root"}); xhostClear->setProcessType(TExec::ProcessType::Blocking); @@ -581,11 +581,11 @@ Qx::Error Core::enqueueDataPackTasks(const Fp::GameData& gameData) logEvent(NAME, LOG_EVENT_ENQ_DATA_PACK); // Extract relevant data - QString packDestFolderPath = mFlashpointInstall->fullPath() + "/" + mFlashpointInstall->preferences().dataPacksFolderPath; + QString packDestFolderPath = mFlashpointInstall->fullPath() + '/' + mFlashpointInstall->preferences().dataPacksFolderPath; QString packFileName = gameData.path(); QString packSha256 = gameData.sha256(); QString packParameters = gameData.parameters(); - QFile packFile(packDestFolderPath + "/" + packFileName); + QFile packFile(packDestFolderPath + '/' + packFileName); // Get current file checksum if it exists bool checksumMatches = false; @@ -609,14 +609,14 @@ Qx::Error Core::enqueueDataPackTasks(const Fp::GameData& gameData) // Enqueue pack download if it doesn't exist or is different than expected if(!packFile.exists() || !checksumMatches) { - if(!mFlashpointInstall->preferences().gameDataSources.contains("Flashpoint Project")) + if(!mFlashpointInstall->preferences().gameDataSources.contains(u"Flashpoint Project"_s)) { - CoreError err(CoreError::DataPackSourceMissing, "Flashpoint Project"); + CoreError err(CoreError::DataPackSourceMissing, u"Flashpoint Project"_s); postError(NAME, err); return err; } - Fp::GameDataSource gameSource = mFlashpointInstall->preferences().gameDataSources.value("Flashpoint Project"); + Fp::GameDataSource gameSource = mFlashpointInstall->preferences().gameDataSources.value(u"Flashpoint Project"_s); QString gameSourceBase = gameSource.arguments.value(0); TDownload* downloadTask = new TDownload(this); @@ -634,7 +634,7 @@ Qx::Error Core::enqueueDataPackTasks(const Fp::GameData& gameData) TGeneric* onDiskUpdateTask = new TGeneric(this); onDiskUpdateTask->setStage(Task::Stage::Auxiliary); - onDiskUpdateTask->setDescription("Update GameData onDisk state."); + onDiskUpdateTask->setDescription(u"Update GameData onDisk state."_s); onDiskUpdateTask->setAction([gameDataId, this]{ return mFlashpointInstall->database()->updateGameDataOnDiskState(gameDataId, true); }); @@ -644,14 +644,14 @@ Qx::Error Core::enqueueDataPackTasks(const Fp::GameData& gameData) } // Enqueue pack mount or extract - if(packParameters.contains("-extract")) + if(packParameters.contains(u"-extract"_s)) { logEvent(NAME, LOG_EVENT_DATA_PACK_NEEDS_EXTRACT); TExtract* extractTask = new TExtract(this); extractTask->setStage(Task::Stage::Auxiliary); - extractTask->setPackPath(packDestFolderPath + "/" + packFileName); - extractTask->setPathInPack("content"); + extractTask->setPackPath(packDestFolderPath + '/' + packFileName); + extractTask->setPathInPack(u"content"_s); extractTask->setDestinationPath(mFlashpointInstall->preferences().htdocsFolderPath); mTaskQueue.push(extractTask); @@ -668,7 +668,7 @@ Qx::Error Core::enqueueDataPackTasks(const Fp::GameData& gameData) TMount* mountTask = new TMount(this); mountTask->setStage(Task::Stage::Auxiliary); mountTask->setTitleId(gameData.gameId()); - mountTask->setPath(packDestFolderPath + "/" + packFileName); + mountTask->setPath(packDestFolderPath + '/' + packFileName); mountTask->setSkipQemu(!qemuUsed); mTaskQueue.push(mountTask); @@ -714,7 +714,7 @@ void Core::logEvent(QString src, QString event) postError(src, Qx::Error(logReport).setSeverity(Qx::Warning), false); } -void Core::logTask(QString src, const Task* task) { logEvent(src, LOG_EVENT_TASK_ENQ.arg(task->name(), task->members().join(", "))); } +void Core::logTask(QString src, const Task* task) { logEvent(src, LOG_EVENT_TASK_ENQ.arg(task->name(), task->members().join(u", "_s))); } ErrorCode Core::logFinish(QString src, Qx::Error errorState) { diff --git a/app/src/kernel/core.h b/app/src/kernel/core.h index b3ad3e7..095511e 100644 --- a/app/src/kernel/core.h +++ b/app/src/kernel/core.h @@ -46,13 +46,13 @@ class QX_ERROR_TYPE(CoreError, "CoreError", 1200) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {InvalidOptions, QSL("Invalid global options provided.")}, - {TitleNotFound, QSL("Could not find the title in the Flashpoint database.")}, - {TooManyResults, QSL("More results than can be presented were returned in a search.")}, - {ConfiguredServerMissing, QSL("The server specified in the Flashpoint config was not found within the Flashpoint services store.")}, - {DataPackSumMismatch, QSL("The existing Data Pack of the selected title does not contain the data expected. It will be re-downloaded.")}, - {DataPackSourceMissing, QSL("The expected primary data pack source was missing.")} + {NoError, u""_s}, + {InvalidOptions, u"Invalid global options provided."_s}, + {TitleNotFound, u"Could not find the title in the Flashpoint database."_s}, + {TooManyResults, u"More results than can be presented were returned in a search."_s}, + {ConfiguredServerMissing, u"The server specified in the Flashpoint config was not found within the Flashpoint services store."_s}, + {DataPackSumMismatch, u"The existing Data Pack of the selected title does not contain the data expected. It will be re-downloaded."_s}, + {DataPackSourceMissing, u"The expected primary data pack source was missing."_s} }; //-Instance Variables------------------------------------------------------------- @@ -120,65 +120,65 @@ class Core : public QObject //-Class Variables------------------------------------------------------------------------------------------------------ public: // Status - static inline const QString STATUS_DISPLAY = QSL("Displaying"); - static inline const QString STATUS_DISPLAY_HELP = QSL("Help"); - static inline const QString STATUS_DISPLAY_VERSION = QSL("Version"); + static inline const QString STATUS_DISPLAY = u"Displaying"_s; + static inline const QString STATUS_DISPLAY_HELP = u"Help"_s; + static inline const QString STATUS_DISPLAY_VERSION = u"Version"_s; // Logging - Primary Labels - static inline const QString COMMAND_LABEL = QSL("Command: %1"); - static inline const QString COMMAND_OPT_LABEL = QSL("Command Options: %1"); + static inline const QString COMMAND_LABEL = u"Command: %1"_s; + static inline const QString COMMAND_OPT_LABEL = u"Command Options: %1"_s; // Logging - Primary Values - static inline const QString LOG_FILE_EXT = QSL("log"); - static inline const QString LOG_NO_PARAMS = QSL("*None*"); + static inline const QString LOG_FILE_EXT = u"log"_s; + static inline const QString LOG_NO_PARAMS = u"*None*"_s; static const int LOG_MAX_ENTRIES = 50; // Logging - Errors - static inline const QString LOG_ERR_INVALID_PARAM = QSL("Invalid parameters provided"); - static inline const QString LOG_ERR_CRITICAL = QSL("Aborting execution due to previous critical errors"); + static inline const QString LOG_ERR_INVALID_PARAM = u"Invalid parameters provided"_s; + static inline const QString LOG_ERR_CRITICAL = u"Aborting execution due to previous critical errors"_s; // Logging - Messages - static inline const QString LOG_EVENT_INIT = QSL("Initializing CLIFp..."); - static inline const QString LOG_EVENT_GLOBAL_OPT = QSL("Global Options: %1"); - static inline const QString LOG_EVENT_G_HELP_SHOWN = QSL("Displayed general help information"); - static inline const QString LOG_EVENT_VER_SHOWN = QSL("Displayed version information"); - static inline const QString LOG_EVENT_NOTIFCATION_LEVEL = QSL("Notification Level is: %1"); - static inline const QString LOG_EVENT_RECOGNIZED_DAEMONS = QSL("Recognized service daemons: %1"); - static inline const QString LOG_EVENT_ENQ_START = QSL("Enqueuing startup tasks..."); - static inline const QString LOG_EVENT_ENQ_STOP = QSL("Enqueuing shutdown tasks..."); - static inline const QString LOG_EVENT_ENQ_DATA_PACK = QSL("Enqueuing Data Pack tasks..."); - static inline const QString LOG_EVENT_DATA_PACK_MISS = QSL("Title Data Pack is not available locally"); - static inline const QString LOG_EVENT_DATA_PACK_FOUND = QSL("Title Data Pack with correct hash is already present, no need to download"); - static inline const QString LOG_EVENT_DATA_PACK_NEEDS_MOUNT = QSL("Title Data Pack requires mounting"); - static inline const QString LOG_EVENT_DATA_PACK_NEEDS_EXTRACT = QSL("Title Data Pack requires extraction"); - static inline const QString LOG_EVENT_TASK_ENQ = QSL("Enqueued %1: {%2}"); - static inline const QString LOG_EVENT_APP_PATH_ALT = QSL("App path \"%1\" maps to alternative \"%2\"."); + static inline const QString LOG_EVENT_INIT = u"Initializing CLIFp..."_s; + static inline const QString LOG_EVENT_GLOBAL_OPT = u"Global Options: %1"_s; + static inline const QString LOG_EVENT_G_HELP_SHOWN = u"Displayed general help information"_s; + static inline const QString LOG_EVENT_VER_SHOWN = u"Displayed version information"_s; + static inline const QString LOG_EVENT_NOTIFCATION_LEVEL = u"Notification Level is: %1"_s; + static inline const QString LOG_EVENT_RECOGNIZED_DAEMONS = u"Recognized service daemons: %1"_s; + static inline const QString LOG_EVENT_ENQ_START = u"Enqueuing startup tasks..."_s; + static inline const QString LOG_EVENT_ENQ_STOP = u"Enqueuing shutdown tasks..."_s; + static inline const QString LOG_EVENT_ENQ_DATA_PACK = u"Enqueuing Data Pack tasks..."_s; + static inline const QString LOG_EVENT_DATA_PACK_MISS = u"Title Data Pack is not available locally"_s; + static inline const QString LOG_EVENT_DATA_PACK_FOUND = u"Title Data Pack with correct hash is already present, no need to download"_s; + static inline const QString LOG_EVENT_DATA_PACK_NEEDS_MOUNT = u"Title Data Pack requires mounting"_s; + static inline const QString LOG_EVENT_DATA_PACK_NEEDS_EXTRACT = u"Title Data Pack requires extraction"_s; + static inline const QString LOG_EVENT_TASK_ENQ = u"Enqueued %1: {%2}"_s; + static inline const QString LOG_EVENT_APP_PATH_ALT = u"App path \"%1\" maps to alternative \"%2\"."_s; // Logging - Title Search - static inline const QString LOG_EVENT_GAME_SEARCH = QSL("Searching for game with title '%1'"); - static inline const QString LOG_EVENT_ADD_APP_SEARCH = QSL("Searching for additional-app with title '%1' and parent %2"); - static inline const QString LOG_EVENT_TITLE_ID_COUNT = QSL("Found %1 ID(s) when searching for title %2"); - static inline const QString LOG_EVENT_TITLE_SEL_PROMNPT = QSL("Prompting user to disambiguate multiple IDs..."); - static inline const QString LOG_EVENT_TITLE_ID_DETERMINED = QSL("ID of title %1 determined to be %2"); - static inline const QString LOG_EVENT_TITLE_SEL_CANCELED = QSL("Title selection was canceled by the user."); + static inline const QString LOG_EVENT_GAME_SEARCH = u"Searching for game with title '%1'"_s; + static inline const QString LOG_EVENT_ADD_APP_SEARCH = u"Searching for additional-app with title '%1' and parent %2"_s; + static inline const QString LOG_EVENT_TITLE_ID_COUNT = u"Found %1 ID(s) when searching for title %2"_s; + static inline const QString LOG_EVENT_TITLE_SEL_PROMNPT = u"Prompting user to disambiguate multiple IDs..."_s; + static inline const QString LOG_EVENT_TITLE_ID_DETERMINED = u"ID of title %1 determined to be %2"_s; + static inline const QString LOG_EVENT_TITLE_SEL_CANCELED = u"Title selection was canceled by the user."_s; // Global command line option strings - static inline const QString CL_OPT_HELP_S_NAME = QSL("h"); - static inline const QString CL_OPT_HELP_L_NAME = QSL("help"); - static inline const QString CL_OPT_HELP_E_NAME = QSL("?"); - static inline const QString CL_OPT_HELP_DESC = QSL("Prints this help message."); + static inline const QString CL_OPT_HELP_S_NAME = u"h"_s; + static inline const QString CL_OPT_HELP_L_NAME = u"help"_s; + static inline const QString CL_OPT_HELP_E_NAME = u"?"_s; + static inline const QString CL_OPT_HELP_DESC = u"Prints this help message."_s; - static inline const QString CL_OPT_VERSION_S_NAME = QSL("v"); - static inline const QString CL_OPT_VERSION_L_NAME = QSL("version"); - static inline const QString CL_OPT_VERSION_DESC = QSL("Prints the current version of this tool."); + static inline const QString CL_OPT_VERSION_S_NAME = u"v"_s; + static inline const QString CL_OPT_VERSION_L_NAME = u"version"_s; + static inline const QString CL_OPT_VERSION_DESC = u"Prints the current version of this tool."_s; - static inline const QString CL_OPT_QUIET_S_NAME = QSL("q"); - static inline const QString CL_OPT_QUIET_L_NAME = QSL("quiet"); - static inline const QString CL_OPT_QUIET_DESC = QSL("Silences all non-critical messages."); + static inline const QString CL_OPT_QUIET_S_NAME = u"q"_s; + static inline const QString CL_OPT_QUIET_L_NAME = u"quiet"_s; + static inline const QString CL_OPT_QUIET_DESC = u"Silences all non-critical messages."_s; - static inline const QString CL_OPT_SILENT_S_NAME = QSL("s"); - static inline const QString CL_OPT_SILENT_L_NAME = QSL("silent"); - static inline const QString CL_OPT_SILENT_DESC = QSL("Silences all messages (takes precedence over quiet mode)."); + static inline const QString CL_OPT_SILENT_S_NAME = u"s"_s; + static inline const QString CL_OPT_SILENT_L_NAME = u"silent"_s; + static inline const QString CL_OPT_SILENT_DESC = u"Silences all messages (takes precedence over quiet mode)."_s; // Global command line options static inline const QCommandLineOption CL_OPTION_HELP{{CL_OPT_HELP_S_NAME, CL_OPT_HELP_L_NAME, CL_OPT_HELP_E_NAME}, CL_OPT_HELP_DESC}; // Boolean option @@ -190,31 +190,31 @@ class Core : public QObject static inline const QSet CL_OPTIONS_ACTIONABLE{&CL_OPTION_HELP, &CL_OPTION_VERSION}; // Help template - static inline const QString HELP_TEMPL = QSL("Usage:
" - PROJECT_SHORT_NAME "<global options> command <command options>
" - "
" - "Global Options:%1
" - "
" - "Commands:%2
" - "
" - "Use the -h switch after a command to see it's specific usage notes"); - static inline const QString HELP_OPT_TEMPL = QSL("
%1:  %2"); - static inline const QString HELP_COMMAND_TEMPL = QSL("
%1:  %2"); + static inline const QString HELP_TEMPL = u"Usage:
" + PROJECT_SHORT_NAME "<global options> command <command options>
" + "
" + "Global Options:%1
" + "
" + "Commands:%2
" + "
" + "Use the -h switch after a command to see it's specific usage notes"_s; + static inline const QString HELP_OPT_TEMPL = u"
%1:  %2"_s; + static inline const QString HELP_COMMAND_TEMPL = u"
%1:  %2"_s; // Command line messages - static inline const QString CL_VERSION_MESSAGE = QSL("CLI Flashpoint version " PROJECT_VERSION_STR ", designed for use with BlueMaxima's Flashpoint " PROJECT_TARGET_FP_VER_PFX_STR " series"); + static inline const QString CL_VERSION_MESSAGE = u"CLI Flashpoint version " PROJECT_VERSION_STR ", designed for use with BlueMaxima's Flashpoint " PROJECT_TARGET_FP_VER_PFX_STR " series"_s; // Input strings - static inline const QString MULTI_TITLE_SEL_CAP = QSL("Title Disambiguation"); - static inline const QString MULTI_TITLE_SEL_LABEL = QSL("Title to start:"); - static inline const QString MULTI_GAME_SEL_TEMP = QSL("[%1] %2 (%3) {%4}"); - static inline const QString MULTI_ADD_APP_SEL_TEMP = QSL("%1 {%2}"); + static inline const QString MULTI_TITLE_SEL_CAP = u"Title Disambiguation"_s; + static inline const QString MULTI_TITLE_SEL_LABEL = u"Title to start:"_s; + static inline const QString MULTI_GAME_SEL_TEMP = u"[%1] %2 (%3) {%4}"_s; + static inline const QString MULTI_ADD_APP_SEL_TEMP = u"%1 {%2}"_s; // Helper static const int FIND_ENTRY_LIMIT = 20; // Meta - static inline const QString NAME = QSL("core"); + static inline const QString NAME = u"core"_s; //-Instance Variables------------------------------------------------------------------------------------------------------ private: diff --git a/app/src/kernel/driver.h b/app/src/kernel/driver.h index d725bfd..ec7c39c 100644 --- a/app/src/kernel/driver.h +++ b/app/src/kernel/driver.h @@ -28,10 +28,10 @@ class QX_ERROR_TYPE(DriverError, "DriverError", 1201) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {AlreadyOpen, QSL("Only one instance of CLIFp can be used at a time!")}, - {LauncherRunning, QSL("The CLI cannot be used while the Flashpoint Launcher is running.")}, - {InvalidInstall, QSL("CLIFp does not appear to be deployed in a valid Flashpoint install")} + {NoError, u""_s}, + {AlreadyOpen, u"Only one instance of CLIFp can be used at a time!"_s}, + {LauncherRunning, u"The CLI cannot be used while the Flashpoint Launcher is running."_s}, + {InvalidInstall, u"CLIFp does not appear to be deployed in a valid Flashpoint install"_s} }; //-Instance Variables------------------------------------------------------------- @@ -62,32 +62,32 @@ class Driver : public QObject //-Class Variables------------------------------------------------------------------------------------------------------ private: // Single Instance ID - static inline const QString SINGLE_INSTANCE_ID = QSL("CLIFp_ONE_INSTANCE"); // Basically never change this + static inline const QString SINGLE_INSTANCE_ID = u"CLIFp_ONE_INSTANCE"_s; // Basically never change this // Error Messages - static inline const QString ERR_LAUNCHER_RUNNING_TIP = QSL("Please close the Launcher first."); - static inline const QString ERR_INSTALL_INVALID_TIP = QSL("Check its location and compatibility with your Flashpoint version."); + static inline const QString ERR_LAUNCHER_RUNNING_TIP = u"Please close the Launcher first."_s; + static inline const QString ERR_INSTALL_INVALID_TIP = u"Check its location and compatibility with your Flashpoint version."_s; // Logging - static inline const QString LOG_EVENT_FLASHPOINT_SEARCH = QSL("Searching for Flashpoint root..."); - static inline const QString LOG_EVENT_FLASHPOINT_ROOT_CHECK = QSL(R"(Checking if "%1" is flashpoint root)"); - static inline const QString LOG_EVENT_FLASHPOINT_LINK = QSL(R"(Linked to Flashpoint install at: "%1")"); - static inline const QString LOG_EVENT_TASK_COUNT = QSL("%1 task(s) to perform"); - static inline const QString LOG_EVENT_QUEUE_START = QSL("Processing Task queue"); - static inline const QString LOG_EVENT_TASK_START = QSL("Handling task %1 [%2] (%3)"); - static inline const QString LOG_EVENT_TASK_FINISH = QSL("End of task %1"); - static inline const QString LOG_EVENT_TASK_FINISH_ERR = QSL("Premature end of task %1"); - static inline const QString LOG_EVENT_QUEUE_FINISH = QSL("Finished processing Task queue"); - static inline const QString LOG_EVENT_ENDING_CHILD_PROCESSES = QSL("Closing deferred processes..."); - static inline const QString LOG_EVENT_CLEANUP_START = QSL("Cleaning up..."); - static inline const QString LOG_EVENT_CLEANUP_FINISH = QSL("Finished cleanup"); - static inline const QString LOG_EVENT_TASK_SKIP_ERROR = QSL("Task skipped due to previous errors"); - static inline const QString LOG_EVENT_TASK_SKIP_QUIT = QSL("Task skipped because the application is quitting"); - static inline const QString LOG_EVENT_QUIT_REQUEST = QSL("Received quit request"); - static inline const QString LOG_EVENT_QUIT_REQUEST_REDUNDANT = QSL("Received redundant quit request"); + static inline const QString LOG_EVENT_FLASHPOINT_SEARCH = u"Searching for Flashpoint root..."_s; + static inline const QString LOG_EVENT_FLASHPOINT_ROOT_CHECK = uR"(Checking if u"%1"_s is flashpoint root)"_s; + static inline const QString LOG_EVENT_FLASHPOINT_LINK = uR"(Linked to Flashpoint install at: u"%1"_s)"_s; + static inline const QString LOG_EVENT_TASK_COUNT = u"%1 task(s) to perform"_s; + static inline const QString LOG_EVENT_QUEUE_START = u"Processing Task queue"_s; + static inline const QString LOG_EVENT_TASK_START = u"Handling task %1 [%2] (%3)"_s; + static inline const QString LOG_EVENT_TASK_FINISH = u"End of task %1"_s; + static inline const QString LOG_EVENT_TASK_FINISH_ERR = u"Premature end of task %1"_s; + static inline const QString LOG_EVENT_QUEUE_FINISH = u"Finished processing Task queue"_s; + static inline const QString LOG_EVENT_ENDING_CHILD_PROCESSES = u"Closing deferred processes..."_s; + static inline const QString LOG_EVENT_CLEANUP_START = u"Cleaning up..."_s; + static inline const QString LOG_EVENT_CLEANUP_FINISH = u"Finished cleanup"_s; + static inline const QString LOG_EVENT_TASK_SKIP_ERROR = u"Task skipped due to previous errors"_s; + static inline const QString LOG_EVENT_TASK_SKIP_QUIT = u"Task skipped because the application is quitting"_s; + static inline const QString LOG_EVENT_QUIT_REQUEST = u"Received quit request"_s; + static inline const QString LOG_EVENT_QUIT_REQUEST_REDUNDANT = u"Received redundant quit request"_s; // Meta - static inline const QString NAME = QSL("driver"); + static inline const QString NAME = u"driver"_s; //-Instance Variables------------------------------------------------------------------------------------------------------------ private: diff --git a/app/src/kernel/errorstatus.h b/app/src/kernel/errorstatus.h index 5256cfb..d611338 100644 --- a/app/src/kernel/errorstatus.h +++ b/app/src/kernel/errorstatus.h @@ -4,7 +4,6 @@ // Qx Includes #include #include -//static inline const auto compare = [](const Qx::Error& a, const Qx::Error& b){ return a == b; }; class ErrorStatus : public Qx::SetOnce { diff --git a/app/src/task/t-awaitdocker.cpp b/app/src/task/t-awaitdocker.cpp index 9909b45..1216eac 100644 --- a/app/src/task/t-awaitdocker.cpp +++ b/app/src/task/t-awaitdocker.cpp @@ -127,8 +127,8 @@ QString TAwaitDocker::name() const { return NAME; } QStringList TAwaitDocker::members() const { QStringList ml = Task::members(); - ml.append(".imageName() = \"" + mImageName + "\""); - ml.append(".timeout() = " + QString::number(mTimeout)); + ml.append(u".imageName() = \""_s + mImageName + u"\""_s); + ml.append(u".timeout() = "_s + QString::number(mTimeout)); return ml; } diff --git a/app/src/task/t-awaitdocker.h b/app/src/task/t-awaitdocker.h index b7eb303..b81c94b 100644 --- a/app/src/task/t-awaitdocker.h +++ b/app/src/task/t-awaitdocker.h @@ -24,10 +24,10 @@ class QX_ERROR_TYPE(TAwaitDockerError, "TAwaitDockerError", 1260) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {DirectQueryFailed, QSL("Failed to directly query docker image status.")}, - {ListenFailed, QSL("Failed to start the docker event listener.")}, - {StartFailed, QSL("The start of the docker image timed out.")} + {NoError, u""_s}, + {DirectQueryFailed, u"Failed to directly query docker image status."_s}, + {ListenFailed, u"Failed to start the docker event listener."_s}, + {StartFailed, u"The start of the docker image timed out."_s} }; //-Instance Variables------------------------------------------------------------- @@ -58,17 +58,17 @@ class TAwaitDocker : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QStringLiteral("TAwaitDocker"); + static inline const QString NAME = u"TAwaitDocker"_s; // Functional - static inline const QString DOCKER = QStringLiteral("docker"); + static inline const QString DOCKER = u"docker"_s; // Logging - static inline const QString LOG_EVENT_DIRECT_QUERY = "Checking if docker image '%1' is running directly"; - static inline const QString LOG_EVENT_STARTING_LISTENER = "Docker image isn't running, starting listener..."; - static inline const QString LOG_EVENT_START_RECEIVED = "Received docker image start event"; - static inline const QString LOG_EVENT_FINAL_CHECK_PASS = "The docker image was found to be running after the final timeout check"; - static inline const QString LOG_EVENT_STOPPING_LISTENER = "Stopping event listener..."; + static inline const QString LOG_EVENT_DIRECT_QUERY = u"Checking if docker image '%1' is running directly"_s; + static inline const QString LOG_EVENT_STARTING_LISTENER = u"Docker image isn't running, starting listener..."_s; + static inline const QString LOG_EVENT_START_RECEIVED = u"Received docker image start event"_s; + static inline const QString LOG_EVENT_FINAL_CHECK_PASS = u"The docker image was found to be running after the final timeout check"_s; + static inline const QString LOG_EVENT_STOPPING_LISTENER = u"Stopping event listener..."_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/task/t-bideprocess.cpp b/app/src/task/t-bideprocess.cpp index d93574f..ad9a699 100644 --- a/app/src/task/t-bideprocess.cpp +++ b/app/src/task/t-bideprocess.cpp @@ -50,7 +50,7 @@ QString TBideProcess::name() const { return NAME; } QStringList TBideProcess::members() const { QStringList ml = Task::members(); - ml.append(".processName() = \"" + mProcessName + "\""); + ml.append(u".processName() = \""_s + mProcessName + u"\""_s); return ml; } diff --git a/app/src/task/t-bideprocess.h b/app/src/task/t-bideprocess.h index cfe69ae..eebb9cd 100644 --- a/app/src/task/t-bideprocess.h +++ b/app/src/task/t-bideprocess.h @@ -22,8 +22,8 @@ class QX_ERROR_TYPE(TBideProcessError, "TBideProcessError", 1251) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {CantClose, QSL("Could not automatically end the running title! It will have to be closed manually.")}, + {NoError, u""_s}, + {CantClose, u"Could not automatically end the running title! It will have to be closed manually."_s}, }; //-Instance Variables------------------------------------------------------------- @@ -54,13 +54,13 @@ class TBideProcess : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TBideProcess"); + static inline const QString NAME = u"TBideProcess"_s; // Logging - static inline const QString LOG_EVENT_STOPPING_BIDE_PROCESS = QSL("Stopping current bide process..."); + static inline const QString LOG_EVENT_STOPPING_BIDE_PROCESS = u"Stopping current bide process..."_s; // Errors - static inline const QString ERR_CANT_CLOSE_BIDE_PROCESS = QSL("Could not automatically end the running title! It will have to be closed manually."); + static inline const QString ERR_CANT_CLOSE_BIDE_PROCESS = u"Could not automatically end the running title! It will have to be closed manually."_s; // Functional static const uint STANDARD_GRACE = 2; // Seconds to allow the process to restart in cases it does diff --git a/app/src/task/t-download.cpp b/app/src/task/t-download.cpp index 3bbc88e..9c75dff 100644 --- a/app/src/task/t-download.cpp +++ b/app/src/task/t-download.cpp @@ -69,10 +69,10 @@ QString TDownload::name() const { return NAME; } QStringList TDownload::members() const { QStringList ml = Task::members(); - ml.append(".destinationPath() = \"" + QDir::toNativeSeparators(mDestinationPath) + "\""); - ml.append(".destinationFilename() = \"" + mDestinationFilename + "\""); - ml.append(".targetFile() = \"" + mTargetFile.toString() + "\""); - ml.append(".sha256() = " + mSha256); + ml.append(u".destinationPath() = \""_s + QDir::toNativeSeparators(mDestinationPath) + u"\""_s); + ml.append(u".destinationFilename() = \""_s + mDestinationFilename + u"\""_s); + ml.append(u".targetFile() = \""_s + mTargetFile.toString() + u"\""_s); + ml.append(u".sha256() = "_s + mSha256); return ml; } @@ -89,7 +89,7 @@ void TDownload::setSha256(QString sha256) { mSha256 = sha256; } void TDownload::perform() { // Setup download - QFile packFile(mDestinationPath + "/" + mDestinationFilename); + QFile packFile(mDestinationPath + '/' + mDestinationFilename); QFileInfo packFileInfo(packFile); Qx::DownloadTask download{ .target = mTargetFile, @@ -126,12 +126,12 @@ void TDownload::postDownload(Qx::DownloadManagerReport downloadReport) if(downloadReport.wasSuccessful()) { // Confirm checksum is correct - QFile packFile(mDestinationPath + "/" + mDestinationFilename); + QFile packFile(mDestinationPath + '/' + mDestinationFilename); bool checksumMatch; Qx::IoOpReport cr = Qx::fileMatchesChecksum(checksumMatch, packFile, mSha256, QCryptographicHash::Sha256); if(cr.isFailure() || !checksumMatch) { - TDownloadError err(TDownloadError::ChecksumMismatch, cr.isFailure() ? cr.outcomeInfo() : ""); + TDownloadError err(TDownloadError::ChecksumMismatch, cr.isFailure() ? cr.outcomeInfo() : u""_s); errorStatus = err; emit errorOccurred(NAME, errorStatus); } diff --git a/app/src/task/t-download.h b/app/src/task/t-download.h index fdff659..566bb38 100644 --- a/app/src/task/t-download.h +++ b/app/src/task/t-download.h @@ -23,9 +23,9 @@ class QX_ERROR_TYPE(TDownloadError, "TDownloadError", 1252) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {ChecksumMismatch, QSL("The title's Data Pack checksum does not match its record!")}, - {Incomeplete, QSL("The download could not be completed.")} + {NoError, u""_s}, + {ChecksumMismatch, u"The title's Data Pack checksum does not match its record!"_s}, + {Incomeplete, u"The download could not be completed."_s} }; //-Instance Variables------------------------------------------------------------- @@ -56,13 +56,13 @@ class TDownload : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TDownload"); + static inline const QString NAME = u"TDownload"_s; // Logging - static inline const QString LOG_EVENT_DOWNLOADING_DATA_PACK = QSL("Downloading Data Pack %1"); - static inline const QString LOG_EVENT_DOWNLOAD_SUCC = QSL("Data Pack downloaded successfully"); - static inline const QString LOG_EVENT_DOWNLOAD_AUTH = QSL("Data Pack download unexpectedly requires authentication (%1)"); - static inline const QString LOG_EVENT_STOPPING_DOWNLOADS = QSL("Stopping current download(s)..."); + static inline const QString LOG_EVENT_DOWNLOADING_DATA_PACK = u"Downloading Data Pack %1"_s; + static inline const QString LOG_EVENT_DOWNLOAD_SUCC = u"Data Pack downloaded successfully"_s; + static inline const QString LOG_EVENT_DOWNLOAD_AUTH = u"Data Pack download unexpectedly requires authentication (%1)"_s; + static inline const QString LOG_EVENT_STOPPING_DOWNLOADS = u"Stopping current download(s)..."_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/task/t-exec.cpp b/app/src/task/t-exec.cpp index 4a2f6fd..d6abf64 100644 --- a/app/src/task/t-exec.cpp +++ b/app/src/task/t-exec.cpp @@ -96,8 +96,8 @@ QString TExec::createEscapedShellArguments() QStringList rebuild = QProcess::splitCommand(escapedArgs); if(rebuild != parameters) { - emit eventOccurred(NAME, LOG_EVENT_ARGS_ESCAPED.arg("{\"" + parameters.join(R"(", ")") + "\"}", - "{\"" + rebuild.join(R"(", ")") + "\"}")); + emit eventOccurred(NAME, LOG_EVENT_ARGS_ESCAPED.arg(u"{\""_s + parameters.join(uR"(", ")"_s) + u"\"}"_s, + u"{\""_s + rebuild.join(uR"(", ")"_s) + u"\"}"_s)); } } @@ -141,14 +141,14 @@ QString TExec::name() const { return NAME; } QStringList TExec::members() const { QStringList ml = Task::members(); - ml.append(".executable() = \"" + mExecutable + "\""); - ml.append(".directory() = \"" + mDirectory.absolutePath() + "\""); + ml.append(u".executable() = \""_s + mExecutable + u"\""_s); + ml.append(u".directory() = \""_s + mDirectory.absolutePath() + u"\""_s); if(std::holds_alternative(mParameters)) - ml.append(".parameters() = \"" + std::get(mParameters) + "\""); + ml.append(u".parameters() = \""_s + std::get(mParameters) + u"\""_s); else - ml.append(".parameters() = {\"" + std::get(mParameters).join(R"(", ")") + "\"}"); - ml.append(".processType() = " + ENUM_NAME(mProcessType)); - ml.append(".identifier() = \"" + mIdentifier + "\""); + ml.append(u".parameters() = {\""_s + std::get(mParameters).join(uR"(", ")"_s) + u"\"}"_s); + ml.append(u".processType() = "_s + ENUM_NAME(mProcessType)); + ml.append(u".identifier() = \""_s + mIdentifier + u"\""_s); return ml; } diff --git a/app/src/task/t-exec.h b/app/src/task/t-exec.h index 84f500b..1638e24 100644 --- a/app/src/task/t-exec.h +++ b/app/src/task/t-exec.h @@ -30,10 +30,10 @@ class QX_ERROR_TYPE(TExecError, "TExecError", 1253) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {CouldNotStart, QSL("Failed to start executable.")}, - {CouldNotFind, QSL("Failed to find executable.")}, - {NotValid, QSL("Tried to start invalid executable.")} + {NoError, u""_s}, + {CouldNotStart, u"Failed to start executable."_s}, + {CouldNotFind, u"Failed to find executable."_s}, + {NotValid, u"Tried to start invalid executable."_s} }; //-Instance Variables------------------------------------------------------------- @@ -69,31 +69,31 @@ class TExec : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TExec"); + static inline const QString NAME = u"TExec"_s; // Logging - Process Prep - static inline const QString LOG_EVENT_PREPARING_PROCESS = QSL("Preparing %1 process '%2' (%3)..."); - static inline const QString LOG_EVENT_FINAL_EXECUTABLE = QSL("Final Executable: %1"); - static inline const QString LOG_EVENT_FINAL_PARAMETERS = QSL("Final Parameters: %1"); + static inline const QString LOG_EVENT_PREPARING_PROCESS = u"Preparing %1 process '%2' (%3)..."_s; + static inline const QString LOG_EVENT_FINAL_EXECUTABLE = u"Final Executable: %1"_s; + static inline const QString LOG_EVENT_FINAL_PARAMETERS = u"Final Parameters: %1"_s; // Logging - Process Attribute Modification - static inline const QString LOG_EVENT_ARGS_ESCAPED = QSL("CMD arguments escaped from [[%1]] to [[%2]]"); - static inline const QString LOG_EVENT_FORCED_BASH = QSL("Forced use of 'sh' from Windows 'bat'"); - static inline const QString LOG_EVENT_FORCED_WIN = QSL("Forced use of WINE from Windows 'exe'"); + static inline const QString LOG_EVENT_ARGS_ESCAPED = u"CMD arguments escaped from [[%1]] to [[%2]]"_s; + static inline const QString LOG_EVENT_FORCED_BASH = u"Forced use of 'sh' from Windows 'bat'"_s; + static inline const QString LOG_EVENT_FORCED_WIN = u"Forced use of WINE from Windows 'exe'"_s; // Logging - Process Management - static inline const QString LOG_EVENT_CD = QSL("Changed current directory to: %1"); - static inline const QString LOG_EVENT_STARTING = QSL("Starting '%1' (%2)"); - static inline const QString LOG_EVENT_STARTED_PROCESS = QSL("Started '%1'"); - static inline const QString LOG_EVENT_STOPPING_BLOCKING_PROCESS = QSL("Stopping blocking process '%1'..."); + static inline const QString LOG_EVENT_CD = u"Changed current directory to: %1"_s; + static inline const QString LOG_EVENT_STARTING = u"Starting '%1' (%2)"_s; + static inline const QString LOG_EVENT_STARTED_PROCESS = u"Started '%1'"_s; + static inline const QString LOG_EVENT_STOPPING_BLOCKING_PROCESS = u"Stopping blocking process '%1'..."_s; // Errors - static inline const QString ERR_DETAILS_TEMPLATE = QSL("%1 - %2"); + static inline const QString ERR_DETAILS_TEMPLATE = u"%1 - %2"_s; // Extensions - static inline const QString SHELL_EXT_WIN = QSL("bat"); - static inline const QString SHELL_EXT_LINUX = QSL("sh"); - static inline const QString EXECUTABLE_EXT_WIN = QSL("exe"); + static inline const QString SHELL_EXT_WIN = u"bat"_s; + static inline const QString SHELL_EXT_LINUX = u"sh"_s; + static inline const QString EXECUTABLE_EXT_WIN = u"exe"_s; // Deferred Processes static inline DeferredProcessManager* smDeferredProcessManager; diff --git a/app/src/task/t-exec_linux.cpp b/app/src/task/t-exec_linux.cpp index a450a5c..4d57b16 100644 --- a/app/src/task/t-exec_linux.cpp +++ b/app/src/task/t-exec_linux.cpp @@ -29,13 +29,13 @@ QProcess* setupExeProcess(const QString& exePath, const QStringList& exeArgs) QProcess* process = new QProcess(); // Force WINE - process->setProgram("wine"); + process->setProgram(u"wine"_s); // Set arguments QStringList fullArgs{ - "start", - "/wait", - "/unix" + u"start"_s, + u"/wait"_s, + u"/unix"_s }; fullArgs.append(exePath); fullArgs.append(exeArgs); @@ -50,11 +50,11 @@ QProcess* setupShellScriptProcess(const QString& scriptPath, const QString& scri QProcess* process = new QProcess(); // Set program - process->setProgram("/bin/sh"); + process->setProgram(u"/bin/sh"_s); // Set arguments - QString bashCommand = "'" + scriptPath + "' " + scriptArgs; - process->setArguments({"-c", bashCommand}); + QString bashCommand = u"'"_s + scriptPath + u"' "_s + scriptArgs; + process->setArguments({u"-c"_s, bashCommand}); return process; } @@ -174,6 +174,6 @@ void TExec::logPreparedProcess(const QProcess* process) { emit eventOccurred(NAME, LOG_EVENT_FINAL_EXECUTABLE.arg(process->program())); emit eventOccurred(NAME, LOG_EVENT_FINAL_PARAMETERS.arg(!process->arguments().isEmpty() ? - "{\"" + process->arguments().join(R"(", ")") + "\"}" : - "")); + u"{\""_s + process->arguments().join(uR"(", ")"_s) + u"\"}"_s : + u""_s)); } diff --git a/app/src/task/t-exec_win.cpp b/app/src/task/t-exec_win.cpp index 8ceb099..142bf42 100644 --- a/app/src/task/t-exec_win.cpp +++ b/app/src/task/t-exec_win.cpp @@ -12,12 +12,12 @@ namespace // Unit helper functions QProcess* setupBatchScriptProcess(const QString& scriptPath, const QString& scriptArgs) { - static const QString CMD_ARG_TEMPLATE = R"(/d /s /c ""%1" %2")"; + static const QString CMD_ARG_TEMPLATE = uR"(/d /s /c ""%1" %2")"_s; QProcess* childProcess = new QProcess(); // Set program - childProcess->setProgram("cmd.exe"); + childProcess->setProgram(u"cmd.exe"_s); // Set arguments QString cmdCommand = CMD_ARG_TEMPLATE.arg(scriptPath, scriptArgs); @@ -116,6 +116,6 @@ void TExec::logPreparedProcess(const QProcess* process) emit eventOccurred(NAME, LOG_EVENT_FINAL_PARAMETERS.arg(!process->nativeArguments().isEmpty() ? process->nativeArguments() : !process->arguments().isEmpty() ? - "{\"" + process->arguments().join(R"(", ")") + "\"}" : - "")); + u"{\""_s + process->arguments().join(uR"(", ")"_s) + u"\"}"_s : + u""_s)); } diff --git a/app/src/task/t-extra.cpp b/app/src/task/t-extra.cpp index 95de00c..6c5231d 100644 --- a/app/src/task/t-extra.cpp +++ b/app/src/task/t-extra.cpp @@ -44,7 +44,7 @@ QString TExtra::name() const { return NAME; } QStringList TExtra::members() const { QStringList ml = Task::members(); - ml.append(".directory() = \"" + QDir::toNativeSeparators(mDirectory.path()) + "\""); + ml.append(u".directory() = \""_s + QDir::toNativeSeparators(mDirectory.path()) + u"\""_s); return ml; } diff --git a/app/src/task/t-extra.h b/app/src/task/t-extra.h index d0038d7..b87a069 100644 --- a/app/src/task/t-extra.h +++ b/app/src/task/t-extra.h @@ -24,8 +24,8 @@ class QX_ERROR_TYPE(TExtraError, "TExtraError", 1254) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {NotFound, QSL("Could not find an extra to display.")} + {NoError, u""_s}, + {NotFound, u"Could not find an extra to display."_s} }; //-Instance Variables------------------------------------------------------------- @@ -56,13 +56,13 @@ class TExtra : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TExtra"); + static inline const QString NAME = u"TExtra"_s; // Logging - static inline const QString LOG_EVENT_SHOW_EXTRA = QSL("Opened folder of extra %1"); + static inline const QString LOG_EVENT_SHOW_EXTRA = u"Opened folder of extra %1"_s; // Errors - static inline const QString ERR_EXTRA_NOT_FOUND = QSL("The extra %1 does not exist!"); + static inline const QString ERR_EXTRA_NOT_FOUND = u"The extra %1 does not exist!"_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/task/t-extract.cpp b/app/src/task/t-extract.cpp index b361391..f55975a 100644 --- a/app/src/task/t-extract.cpp +++ b/app/src/task/t-extract.cpp @@ -97,7 +97,7 @@ TExtractError TExtract::extractZipSubFolderContentToDir(QString zipFilePath, QSt if(pathOnDisk.absolutePath() != currentDirOnDisk.absolutePath()) { currentDirOnDisk = pathOnDisk.absoluteDir(); - if(!currentDirOnDisk.mkpath(".")) + if(!currentDirOnDisk.mkpath(u"."_s)) return TExtractError(zipName, TExtractError::MakePath); } @@ -138,9 +138,9 @@ QString TExtract::name() const { return NAME; } QStringList TExtract::members() const { QStringList ml = Task::members(); - ml.append(".packPath() = \"" + mPackPath + "\""); - ml.append(".pathInPack() = \"" + mPathInPack + "\""); - ml.append(".destinationPath() = \"" + mDestinationPath + "\""); + ml.append(u".packPath() = \""_s + mPackPath + u"\""_s); + ml.append(u".pathInPack() = \""_s + mPathInPack + u"\""_s); + ml.append(u".destinationPath() = \""_s + mDestinationPath + u"\""_s); return ml; } diff --git a/app/src/task/t-extract.h b/app/src/task/t-extract.h index eb93d96..7597680 100644 --- a/app/src/task/t-extract.h +++ b/app/src/task/t-extract.h @@ -29,13 +29,13 @@ class QX_ERROR_TYPE(TExtractError, "TExtractError", 1255) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {OpenArchive, QSL("Failed to open archive.")}, - {MakePath, QSL("Failed to create file path.")}, - {OpenArchiveFile, QSL("Failed to open archive file.")}, - {OpenDiskFile, QSL("Failed to open disk file.")}, - {WriteDiskFile, QSL("Failed to write disk file.")}, - {GeneralZip, QSL("General zip error.")} + {NoError, u""_s}, + {OpenArchive, u"Failed to open archive."_s}, + {MakePath, u"Failed to create file path."_s}, + {OpenArchiveFile, u"Failed to open archive file."_s}, + {OpenDiskFile, u"Failed to open disk file."_s}, + {WriteDiskFile, u"Failed to write disk file."_s}, + {GeneralZip, u"General zip error."_s} }; //-Instance Variables------------------------------------------------------------- @@ -70,13 +70,13 @@ class TExtract : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TExtract"); + static inline const QString NAME = u"TExtract"_s; // Logging - static inline const QString LOG_EVENT_EXTRACTING_DATA_PACK = QSL("Extracting Data Pack %1"); + static inline const QString LOG_EVENT_EXTRACTING_DATA_PACK = u"Extracting Data Pack %1"_s; // Error - static inline const QString ERR_CODE_TEMPLATE = QSL("Code: 0x%1"); + static inline const QString ERR_CODE_TEMPLATE = u"Code: 0x%1"_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/task/t-generic.cpp b/app/src/task/t-generic.cpp index 940e491..eb04c2d 100644 --- a/app/src/task/t-generic.cpp +++ b/app/src/task/t-generic.cpp @@ -17,8 +17,8 @@ QString TGeneric::name() const { return NAME; } QStringList TGeneric::members() const { QStringList ml = Task::members(); - ml.append(".description() = \"" + mDescription + "\""); - ml.append(".action() = "); + ml.append(u".description() = \""_s + mDescription + u"\""_s); + ml.append(u".action() = "_s); return ml; } diff --git a/app/src/task/t-generic.h b/app/src/task/t-generic.h index 7c666d8..27af024 100644 --- a/app/src/task/t-generic.h +++ b/app/src/task/t-generic.h @@ -13,11 +13,11 @@ class TGeneric : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TGeneric"); + static inline const QString NAME = u"TGeneric"_s; // Logging - static inline const QString LOG_EVENT_START_ACTION = QSL("Starting generic action: %1"); - static inline const QString LOG_EVENT_END_ACTION = QSL("Finished generic action."); + static inline const QString LOG_EVENT_START_ACTION = u"Starting generic action: %1"_s; + static inline const QString LOG_EVENT_END_ACTION = u"Finished generic action."_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/task/t-message.cpp b/app/src/task/t-message.cpp index a5ac178..58006df 100644 --- a/app/src/task/t-message.cpp +++ b/app/src/task/t-message.cpp @@ -17,8 +17,8 @@ QString TMessage::name() const { return NAME; } QStringList TMessage::members() const { QStringList ml = Task::members(); - ml.append(".message() = \"" + mMessage + "\""); - ml.append(".isModal() = \"" + QString(mModal ? "true" : "false") + "\""); + ml.append(u".message() = \""_s + mMessage + u"\""_s); + ml.append(u".isModal() = \""_s + QString(mModal ? u"true"_s : u"false"_s) + u"\""_s); return ml; } diff --git a/app/src/task/t-message.h b/app/src/task/t-message.h index 4c01d93..4f50b51 100644 --- a/app/src/task/t-message.h +++ b/app/src/task/t-message.h @@ -13,10 +13,10 @@ class TMessage : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TMessage"); + static inline const QString NAME = u"TMessage"_s; // Logging - static inline const QString LOG_EVENT_SHOW_MESSAGE = QSL("Displayed message"); + static inline const QString LOG_EVENT_SHOW_MESSAGE = u"Displayed message"_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/task/t-mount.cpp b/app/src/task/t-mount.cpp index 8aec963..458858f 100644 --- a/app/src/task/t-mount.cpp +++ b/app/src/task/t-mount.cpp @@ -32,8 +32,8 @@ QString TMount::name() const { return NAME; } QStringList TMount::members() const { QStringList ml = Task::members(); - ml.append(".titleId() = \"" + mTitleId.toString() + "\""); - ml.append(".path() = \"" + QDir::toNativeSeparators(mPath) + "\""); + ml.append(u".titleId() = \""_s + mTitleId.toString() + u"\""_s); + ml.append(u".path() = \""_s + QDir::toNativeSeparators(mPath) + u"\""_s); return ml; } diff --git a/app/src/task/t-mount.h b/app/src/task/t-mount.h index d2a0cd4..e8d0aba 100644 --- a/app/src/task/t-mount.h +++ b/app/src/task/t-mount.h @@ -15,11 +15,11 @@ class TMount : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TMount"); + static inline const QString NAME = u"TMount"_s; // Logging - static inline const QString LOG_EVENT_MOUNTING_DATA_PACK = QSL("Mounting Data Pack %1"); - static inline const QString LOG_EVENT_STOPPING_MOUNT = QSL("Stopping current mount(s)..."); + static inline const QString LOG_EVENT_MOUNTING_DATA_PACK = u"Mounting Data Pack %1"_s; + static inline const QString LOG_EVENT_STOPPING_MOUNT = u"Stopping current mount(s)..."_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/task/t-sleep.cpp b/app/src/task/t-sleep.cpp index 44e3ec9..dafd864 100644 --- a/app/src/task/t-sleep.cpp +++ b/app/src/task/t-sleep.cpp @@ -21,7 +21,7 @@ QString TSleep::name() const { return NAME; } QStringList TSleep::members() const { QStringList ml = Task::members(); - ml.append(".duration() = " + QString::number(mDuration)); + ml.append(u".duration() = "_s + QString::number(mDuration)); return ml; } diff --git a/app/src/task/t-sleep.h b/app/src/task/t-sleep.h index 6adba1c..2daa62b 100644 --- a/app/src/task/t-sleep.h +++ b/app/src/task/t-sleep.h @@ -16,12 +16,12 @@ class TSleep : public Task //-Class Variables------------------------------------------------------------------------------------------------- private: // Meta - static inline const QString NAME = QSL("TSleep"); + static inline const QString NAME = u"TSleep"_s; // Logging - static inline const QString LOG_EVENT_START_SLEEP = QSL("Sleeping for %1 milliseconds"); - static inline const QString LOG_EVENT_SLEEP_INTERUPTED = QSL("Sleep interrupted"); - static inline const QString LOG_EVENT_FINISH_SLEEP = QSL("Finished sleeping"); + static inline const QString LOG_EVENT_START_SLEEP = u"Sleeping for %1 milliseconds"_s; + static inline const QString LOG_EVENT_SLEEP_INTERUPTED = u"Sleep interrupted"_s; + static inline const QString LOG_EVENT_FINISH_SLEEP = u"Finished sleeping"_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/tools/blockingprocessmanager.h b/app/src/tools/blockingprocessmanager.h index e213a78..d66ad1c 100644 --- a/app/src/tools/blockingprocessmanager.h +++ b/app/src/tools/blockingprocessmanager.h @@ -15,12 +15,12 @@ class BlockingProcessManager : public QObject //-Class Variables------------------------------------------------------------------------------------------------------ private: // Meta - static inline const QString NAME = QStringLiteral("BlockingProcessManager"); + static inline const QString NAME = u"BlockingProcessManager"_s; // Log - static inline const QString LOG_EVENT_PROCCESS_CLOSED = QSL("Blocking process '%1' ( %2 ) finished. Status: '%3', Code: %4"); - static inline const QString LOG_EVENT_PROCCESS_STDOUT = QSL("( %1 ) %2"); - static inline const QString LOG_EVENT_PROCCESS_STDERR = QSL("( %1 ) %2"); + static inline const QString LOG_EVENT_PROCCESS_CLOSED = u"Blocking process '%1' ( %2 ) finished. Status: '%3', Code: %4"_s; + static inline const QString LOG_EVENT_PROCCESS_STDOUT = u"( %1 ) %2"_s; + static inline const QString LOG_EVENT_PROCCESS_STDERR = u"( %1 ) %2"_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/tools/deferredprocessmanager.h b/app/src/tools/deferredprocessmanager.h index 41ae843..a3221cf 100644 --- a/app/src/tools/deferredprocessmanager.h +++ b/app/src/tools/deferredprocessmanager.h @@ -16,15 +16,15 @@ class DeferredProcessManager : public QObject //-Class Variables------------------------------------------------------------------------------------------------------ private: // Meta - static inline const QString NAME = QSL("DeferredProcessManager"); + static inline const QString NAME = u"DeferredProcessManager"_s; // Log - static inline const QString LOG_EVENT_PROCCESS_CLOSED = QSL("Deferred process '%1' ( %2 ) finished. Status: '%3', Code: %4"); - static inline const QString LOG_EVENT_PROCCESS_STDOUT = QSL("'%1' ( %2 | %3 ) %4"); - static inline const QString LOG_EVENT_PROCCESS_STDERR = QSL("'%1' ( %2 | %3 ) %4"); + static inline const QString LOG_EVENT_PROCCESS_CLOSED = u"Deferred process '%1' ( %2 ) finished. Status: '%3', Code: %4"_s; + static inline const QString LOG_EVENT_PROCCESS_STDOUT = u"'%1' ( %2 | %3 ) %4"_s; + static inline const QString LOG_EVENT_PROCCESS_STDERR = u"'%1' ( %2 | %3 ) %4"_s; // Error - static inline const QString ERR_PROCESS_END_PREMATURE = "Deferred process '%1' ( %2 ) unexpectedly finished. Status: '%3', Code: %4"; + static inline const QString ERR_PROCESS_END_PREMATURE = u"Deferred process '%1' ( %2 ) unexpectedly finished. Status: '%3', Code: %4"_s; //-Instance Variables------------------------------------------------------------------------------------------------ private: diff --git a/app/src/tools/mounter.cpp b/app/src/tools/mounter.cpp index 7b7f753..028755f 100644 --- a/app/src/tools/mounter.cpp +++ b/app/src/tools/mounter.cpp @@ -80,18 +80,18 @@ Mounter::Mounter(QObject* parent) : * them to be used as to help make that clear in the logs when the update causes this to stop working). */ connect(&mNam, &QNetworkAccessManager::authenticationRequired, this, [this](){ - emit eventOccured("Unexpected use of authentication by PHP server!"); + emit eventOccured(u"Unexpected use of authentication by PHP server!"_s); }); connect(&mNam, &QNetworkAccessManager::preSharedKeyAuthenticationRequired, this, [this](){ - emit eventOccured("Unexpected use of PSK authentication by PHP server!"); + emit eventOccured(u"Unexpected use of PSK authentication by PHP server!"_s); }); connect(&mNam, &QNetworkAccessManager::proxyAuthenticationRequired, this, [this](){ - emit eventOccured("Unexpected use of proxy by PHP server!"); + emit eventOccured(u"Unexpected use of proxy by PHP server!"_s); }); connect(&mNam, &QNetworkAccessManager::sslErrors, this, [this](QNetworkReply* reply, const QList& errors){ Q_UNUSED(reply); - QString errStrList = Qx::String::join(errors, [](const QSslError& err){ return err.errorString(); }, ","); - emit eventOccured("Unexpected SSL errors from PHP server! {" + errStrList + "}"); + QString errStrList = Qx::String::join(errors, [](const QSslError& err){ return err.errorString(); }, u","_s); + emit eventOccured(u"Unexpected SSL errors from PHP server! {"_s + errStrList + u"}"_s"}"); }); } @@ -111,23 +111,23 @@ void Mounter::createMountPoint() emit eventOccured(EVENT_CREATING_MOUNT_POINT); // Build commands - QString blockDevAddCmd = "blockdev-add"; - QString deviceAddCmd = "device_add"; + QString blockDevAddCmd = u"blockdev-add"_s; + QString deviceAddCmd = u"device_add"_s; QJsonObject blockDevAddArgs; - blockDevAddArgs["node-name"] = mCurrentMountInfo.driveId; - blockDevAddArgs["driver"] = "raw"; - blockDevAddArgs["read-only"] = true; + blockDevAddArgs[u"node-name"_s] = mCurrentMountInfo.driveId; + blockDevAddArgs[u"driver"_s] = u"raw"_s; + blockDevAddArgs[u"read-only"_s] = true; QJsonObject fileArgs; - fileArgs["driver"] = "file"; - fileArgs["filename"] = mCurrentMountInfo.filePath; - blockDevAddArgs["file"] = fileArgs; + fileArgs[u"driver"_s] = u"file"_s; + fileArgs[u"filename"_s] = mCurrentMountInfo.filePath; + blockDevAddArgs[u"file"_s] = fileArgs; QJsonObject deviceAddArgs; - deviceAddArgs["driver"] = "virtio-blk-pci"; - deviceAddArgs["drive"] = mCurrentMountInfo.driveId; - deviceAddArgs["id"] = mCurrentMountInfo.driveId; - deviceAddArgs["serial"] = mCurrentMountInfo.driveSerial; + deviceAddArgs[u"driver"_s] = u"virtio-blk-pci"_s; + deviceAddArgs[u"drive"_s] = mCurrentMountInfo.driveId; + deviceAddArgs[u"id"_s] = mCurrentMountInfo.driveId; + deviceAddArgs[u"serial"_s] = mCurrentMountInfo.driveSerial; // Log formatter QJsonDocument formatter; @@ -137,12 +137,12 @@ void Mounter::createMountPoint() formatter.setObject(blockDevAddArgs); cmdLog = formatter.toJson(QJsonDocument::Compact); mQemuMounter.execute(blockDevAddCmd, blockDevAddArgs, - blockDevAddCmd + " " + cmdLog); + blockDevAddCmd + ' ' + cmdLog); formatter.setObject(deviceAddArgs); cmdLog = formatter.toJson(QJsonDocument::Compact); mQemuMounter.execute(deviceAddCmd, deviceAddArgs, - deviceAddCmd + " " + cmdLog); + deviceAddCmd + ' ' + cmdLog); // Await finished() signal... } @@ -153,13 +153,13 @@ void Mounter::setMountOnServer() // Create mount request QUrl mountUrl; - mountUrl.setScheme("http"); - mountUrl.setHost("127.0.0.1"); + mountUrl.setScheme(u"http"_s); + mountUrl.setHost(u"127.0.0.1"_s); mountUrl.setPort(mWebServerPort); - mountUrl.setPath("/mount.php"); + mountUrl.setPath(u"/mount.php"_s); QUrlQuery query; - QString queryKey = "file"; + QString queryKey = u"file"_s; QString queryValue = QUrl::toPercentEncoding(mQemuEnabled ? mCurrentMountInfo.driveSerial : QFileInfo(mCurrentMountInfo.filePath).fileName()); query.addQueryItem(queryKey, queryValue); @@ -283,7 +283,7 @@ void Mounter::qmpiEventOccurredHandler(QString name, QJsonObject data, QDateTime { QJsonDocument formatter(data); QString dataStr = formatter.toJson(QJsonDocument::Compact); - QString timestampStr = timestamp.toString("hh:mm:s s.zzz"); + QString timestampStr = timestamp.toString(u"hh:mm:s s.zzz"_s); emit eventOccured(EVENT_QMP_EVENT.arg(name, dataStr, timestampStr)); } @@ -318,7 +318,7 @@ void Mounter::mount(QUuid titleId, QString filePath) // Log info logMountInfo(mCurrentMountInfo); - emit eventOccured(EVENT_QEMU_DETECTION.arg(mQemuEnabled ? "is" : "isn't")); + emit eventOccured(EVENT_QEMU_DETECTION.arg(mQemuEnabled ? u"is"_s : u"isn't"_s)); // Connect to QEMU instance, or go straight to web server portion if bypassing if(mQemuEnabled) diff --git a/app/src/tools/mounter.h b/app/src/tools/mounter.h index 09d409f..0da0ad0 100644 --- a/app/src/tools/mounter.h +++ b/app/src/tools/mounter.h @@ -32,11 +32,11 @@ class QX_ERROR_TYPE(MounterError, "MounterError", 1232) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {PhpMount, QSL("Failed to mount data pack (PHP).")}, - {QemuConnection, QSL("QMPI connection error.")}, - {QemuCommunication, QSL("QMPI communication error.")}, - {QemuCommand, QSL("QMPI command error.")}, + {NoError, u""_s}, + {PhpMount, u"Failed to mount data pack (PHP)."_s}, + {QemuConnection, u"QMPI connection error."_s}, + {QemuCommunication, u"QMPI communication error."_s}, + {QemuCommand, u"QMPI command error."_s}, }; //-Instance Variables------------------------------------------------------------- @@ -81,23 +81,23 @@ class Mounter : public QObject }; // Error - static inline const QString ERR_QMP_CONNECTION_ABORT = QSL("The connection was aborted."); - static inline const QString ERR_QMP_COMMAND = QSL("Command %1 - [%2] \"%3\""); + static inline const QString ERR_QMP_CONNECTION_ABORT = u"The connection was aborted."_s; + static inline const QString ERR_QMP_COMMAND = u"Command %1 - [%2] \"%3\""_s; // Events - External - static inline const QString EVENT_QMP_WELCOME_MESSAGE = QSL("QMPI connected to QEMU Version: %1 | Capabilities: %2"); - static inline const QString EVENT_QMP_COMMAND_RESPONSE = QSL("QMPI command %1 returned - \"%2\""); - static inline const QString EVENT_QMP_EVENT = QSL("QMPI event occurred at %1 - [%2] \"%3\""); - static inline const QString EVENT_PHP_RESPONSE = QSL("Mount.php Response: \"%1\""); + static inline const QString EVENT_QMP_WELCOME_MESSAGE = u"QMPI connected to QEMU Version: %1 | Capabilities: %2"_s; + static inline const QString EVENT_QMP_COMMAND_RESPONSE = u"QMPI command %1 returned - \"%2\""_s; + static inline const QString EVENT_QMP_EVENT = u"QMPI event occurred at %1 - [%2] \"%3\""_s; + static inline const QString EVENT_PHP_RESPONSE = u"Mount.php Response: \"%1\""_s; // Events - Internal - static inline const QString EVENT_CONNECTING_TO_QEMU = QSL("Connecting to FP QEMU instance..."); - static inline const QString EVENT_MOUNT_INFO_DETERMINED = QSL("Mount Info: {.filePath = \"%1\", .driveId = \"%2\", .driveSerial = \"%3\"}"); - static inline const QString EVENT_QEMU_DETECTION = QSL("QEMU %1 in use."); - static inline const QString EVENT_CREATING_MOUNT_POINT = QSL("Creating data pack mount point on QEMU instance..."); - static inline const QString EVENT_DISCONNECTING_FROM_QEMU = QSL("Disconnecting from FP QEMU instance..."); - static inline const QString EVENT_MOUNTING_THROUGH_SERVER = QSL("Mounting data pack via PHP server..."); - static inline const QString EVENT_REQUEST_SENT = QSL("Sent request (%1): %2}"); + static inline const QString EVENT_CONNECTING_TO_QEMU = u"Connecting to FP QEMU instance..."_s; + static inline const QString EVENT_MOUNT_INFO_DETERMINED = u"Mount Info: {.filePath = \"%1\", .driveId = \"%2\", .driveSerial = \"%3\"}"_s; + static inline const QString EVENT_QEMU_DETECTION = u"QEMU %1 in use."_s; + static inline const QString EVENT_CREATING_MOUNT_POINT = u"Creating data pack mount point on QEMU instance..."_s; + static inline const QString EVENT_DISCONNECTING_FROM_QEMU = u"Disconnecting from FP QEMU instance..."_s; + static inline const QString EVENT_MOUNTING_THROUGH_SERVER = u"Mounting data pack via PHP server..."_s; + static inline const QString EVENT_REQUEST_SENT = u"Sent request (%1): %2}"_s; // Connections static const int QMP_TRANSACTION_TIMEOUT = 5000; // ms diff --git a/app/src/tools/processbider.cpp b/app/src/tools/processbider.cpp index c0e948a..d208a6a 100644 --- a/app/src/tools/processbider.cpp +++ b/app/src/tools/processbider.cpp @@ -56,8 +56,8 @@ bool ProcessBider::closeAdminProcess(DWORD processId, bool force) // Setup taskkill args QString tkArgs; if(force) - tkArgs += "/F "; - tkArgs += "/PID "; + tkArgs += u"/F "_s; + tkArgs += u"/PID "_s; tkArgs += QString::number(processId); const std::wstring tkArgsStd = tkArgs.toStdWString(); diff --git a/app/src/tools/processbider.h b/app/src/tools/processbider.h index 64c3720..d211d6c 100644 --- a/app/src/tools/processbider.h +++ b/app/src/tools/processbider.h @@ -43,9 +43,9 @@ class QX_ERROR_TYPE(ProcessBiderError, "ProcessBiderError", 1233) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {HandleAquisition, QSL("Could not get a wait handle to a restartable process, the title will likely not work correctly.")}, - {ProcessHook, QSL("Could not hook a restartable process for waiting, the title will likely not work correctly.")}, + {NoError, u""_s}, + {HandleAquisition, u"Could not get a wait handle to a restartable process, the title will likely not work correctly."_s}, + {ProcessHook, u"Could not hook a restartable process for waiting, the title will likely not work correctly."_s}, }; //-Instance Variables------------------------------------------------------------- @@ -76,11 +76,11 @@ class ProcessBider : public QThread //-Class Variables------------------------------------------------------------------------------------------------------ private: // Status Messages - static inline const QString LOG_EVENT_BIDE_GRACE = QSL("Waiting %1 seconds for process %2 to be running"); - static inline const QString LOG_EVENT_BIDE_RUNNING = QSL("Wait-on process %1 is running"); - static inline const QString LOG_EVENT_BIDE_ON = QSL("Waiting for process %1 to finish"); - static inline const QString LOG_EVENT_BIDE_QUIT = QSL("Wait-on process %1 has finished"); - static inline const QString LOG_EVENT_BIDE_FINISHED = QSL("Wait-on process %1 was not running after the grace period"); + static inline const QString LOG_EVENT_BIDE_GRACE = u"Waiting %1 seconds for process %2 to be running"_s; + static inline const QString LOG_EVENT_BIDE_RUNNING = u"Wait-on process %1 is running"_s; + static inline const QString LOG_EVENT_BIDE_ON = u"Waiting for process %1 to finish"_s; + static inline const QString LOG_EVENT_BIDE_QUIT = u"Wait-on process %1 has finished"_s; + static inline const QString LOG_EVENT_BIDE_FINISHED = u"Wait-on process %1 was not running after the grace period"_s; //-Instance Variables------------------------------------------------------------------------------------------------------------ private: diff --git a/app/src/utility.cpp b/app/src/utility.cpp index 9d9aea6..cc5cdf4 100644 --- a/app/src/utility.cpp +++ b/app/src/utility.cpp @@ -9,7 +9,9 @@ #include "project_vars.h" //-Macros---------------------------------------- -#define APP_ICON_RES_BASE_PATH ":/app/" +#define APP_ICON_RES_BASE_PATH u":/app/"_s + +using namespace Qt::Literals::StringLiterals; namespace Utility { @@ -18,13 +20,13 @@ namespace { const QString dimStr(int w, int h) { - static const QString dimTemplate = QStringLiteral("%1x%2"); + static const QString dimTemplate = u"%1x%2"_s; return dimTemplate.arg(w).arg(h); } const QString appIconResourceFullPath(int w, int h) { - return APP_ICON_RES_BASE_PATH + dimStr(w, h) + '/' + PROJECT_SHORT_NAME ".png"; + return APP_ICON_RES_BASE_PATH + dimStr(w, h) + '/' + PROJECT_SHORT_NAME u".png"_s; } const QList& availableAppIconSizes() @@ -61,20 +63,19 @@ const QIcon& appIconFromResources() bool installAppIconForUser() { - static const QDir iconDestBaseDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - QStringLiteral("/icons/hicolor")); + static const QDir iconDestBaseDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + u"/icons/hicolor"_s); const QList& sizes = availableAppIconSizes(); for(const QSize& size : sizes) { - QString resSpecificSubPath = dimStr(size.width(), size.height()) + "/apps"; + QString resSpecificSubPath = dimStr(size.width(), size.height()) + u"/apps"_s; // Ensure path exists - iconDestBaseDir.mkpath("./" + resSpecificSubPath); + iconDestBaseDir.mkpath(u"./"_s + resSpecificSubPath); // Determine paths QString fullSrcPath = appIconResourceFullPath(size.width(), size.height()); - QString fullDestPath = iconDestBaseDir.absolutePath() + '/' + resSpecificSubPath + '/' + PROJECT_SHORT_NAME + ".png"; + QString fullDestPath = iconDestBaseDir.absolutePath() + '/' + resSpecificSubPath + '/' + PROJECT_SHORT_NAME + u".png"_s; // Remove exiting file if it exists (icon could need to be updated), then copy the new icon if((QFile::exists(fullDestPath) && !QFile::remove(fullDestPath) ) || !QFile::copy(fullSrcPath, fullDestPath))