From fb76e75d61488d6f232e67db52d33dd344c015f0 Mon Sep 17 00:00:00 2001 From: Christian Heimlich Date: Sat, 22 Jul 2023 21:04:23 -0400 Subject: [PATCH] String touchup Largely using u""_s where possible. --- CMakeLists.txt | 6 +- app/src/clifp.cpp | 12 +- app/src/clifp.h | 12 +- app/src/frontend/attractmode/am-data.cpp | 14 +- app/src/frontend/attractmode/am-data.h | 34 ++--- app/src/frontend/attractmode/am-install.cpp | 50 +++---- app/src/frontend/attractmode/am-install.h | 36 ++--- app/src/frontend/attractmode/am-items.cpp | 6 +- .../frontend/attractmode/am-settings-data.cpp | 14 +- .../frontend/attractmode/am-settings-data.h | 32 ++--- .../frontend/attractmode/am-settings-items.h | 12 +- app/src/frontend/fe-data.h | 32 ++--- app/src/frontend/fe-install.cpp | 2 +- app/src/frontend/fe-installfoundation.h | 16 +-- app/src/frontend/fe-items.h | 6 +- app/src/frontend/launchbox/lb-data.cpp | 126 +++++++++--------- app/src/frontend/launchbox/lb-data.h | 2 +- app/src/frontend/launchbox/lb-install.cpp | 16 +-- app/src/frontend/launchbox/lb-install.h | 26 ++-- app/src/frontend/launchbox/lb-items.cpp | 6 +- app/src/frontend/launchbox/lb-items.h | 2 +- app/src/import-worker.cpp | 2 +- app/src/import-worker.h | 44 +++--- app/src/main.cpp | 2 +- app/src/mainwindow.cpp | 32 ++--- app/src/mainwindow.h | 96 ++++++------- 26 files changed, 321 insertions(+), 317 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c0b82d..5e16219 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,18 +64,18 @@ set(FIL_QX_COMPONENTS include(OB/FetchQx) ob_fetch_qx( - REF "4951c7abcb49033122f08545f80bf38ccf025b21" + REF "6812df5c1fe1c584a9dfa0ded76db8727ca059b5" COMPONENTS ${FIL_QX_COMPONENTS} ) # Fetch libfp (build and import from source) include(OB/Fetchlibfp) -ob_fetch_libfp("8bdbad935bb790435cf60966555bd086292d1383") +ob_fetch_libfp("12fb5e56c105a9e66c1e214d403722f721015789") # Fetch CLIFp (build and import from source) include(OB/FetchCLIFp) -ob_fetch_clifp("269da20a7bb36a3d0ea19073ca790aa5d5e86885") +ob_fetch_clifp("0db4b8142f18d59f28d5d095cf2235cde9d8715c") # TODO: The shared build of this is essentially useless as only the CLIFp executable # is deployed, which only works if it's statically linked. There isn't a simple way diff --git a/app/src/clifp.cpp b/app/src/clifp.cpp index 2c0e2c0..4f8f24a 100644 --- a/app/src/clifp.cpp +++ b/app/src/clifp.cpp @@ -13,7 +13,7 @@ //-Class Functions-------------------------------------------------------------------------------------------- //Public: -QString CLIFp::standardCLIFpPath(const Fp::Install& fpInstall) { return fpInstall.fullPath() + "/" + EXE_NAME; } +QString CLIFp::standardCLIFpPath(const Fp::Install& fpInstall) { return fpInstall.fullPath() + '/' + EXE_NAME; } bool CLIFp::hasCLIFp(const Fp::Install& fpInstall) { @@ -60,16 +60,16 @@ bool CLIFp::deployCLIFp(QString& errorMsg, const Fp::Install& fpInstall, QString QString CLIFp::parametersFromStandard(QString originalAppPath, QString originalAppParams) { - QString clifpParam = "-q "; // Start with global quiet switch + QString clifpParam = u"-q "_s; // Start with global quiet switch if(originalAppPath == Fp::Db::Table_Add_App::ENTRY_MESSAGE) - clifpParam += SHOW_COMMAND + " " + MSG_ARG.arg(originalAppParams); + clifpParam += SHOW_COMMAND + ' ' + MSG_ARG.arg(originalAppParams); else if(originalAppPath == Fp::Db::Table_Add_App::ENTRY_EXTRAS) - clifpParam += SHOW_COMMAND + " " + EXTRA_ARG.arg(originalAppParams); + clifpParam += SHOW_COMMAND + ' ' + EXTRA_ARG.arg(originalAppParams); else - clifpParam += RUN_COMMAND + " " + APP_ARG.arg(originalAppPath) + " " + PARAM_ARG.arg(originalAppParams); + clifpParam += RUN_COMMAND + ' ' + APP_ARG.arg(originalAppPath) + ' ' + PARAM_ARG.arg(originalAppParams); return clifpParam; } -QString CLIFp::parametersFromStandard(QUuid titleId) { return "-q " + PLAY_COMMAND + " " + ID_ARG.arg(titleId.toString(QUuid::WithoutBraces)); } +QString CLIFp::parametersFromStandard(QUuid titleId) { return u"-q "_s + PLAY_COMMAND + ' ' + ID_ARG.arg(titleId.toString(QUuid::WithoutBraces)); } diff --git a/app/src/clifp.h b/app/src/clifp.h index ffca2b5..a41145f 100644 --- a/app/src/clifp.h +++ b/app/src/clifp.h @@ -14,18 +14,18 @@ class CLIFp { // Class members public: - static inline const QString NAME = "CLIFp"; - static inline const QString EXE_NAME = NAME + ".exe"; - static inline const QString PLAY_COMMAND = "play"; - static inline const QString RUN_COMMAND = "run"; - static inline const QString SHOW_COMMAND = "show"; + static inline const QString NAME = u"CLIFp"_s; + static inline const QString EXE_NAME = NAME + u".exe"_s; + static inline const QString PLAY_COMMAND = u"play"_s; + static inline const QString RUN_COMMAND = u"run"_s; + static inline const QString SHOW_COMMAND = u"show"_s; static inline const QString ID_ARG = R"(--id="%1")"; static inline const QString APP_ARG = R"(--app="%1")"; static inline const QString PARAM_ARG = R"(--param="%1")"; static inline const QString MSG_ARG = R"(--msg="%1")"; static inline const QString EXTRA_ARG = R"(--extra="%1")"; - static inline const QString ERR_FP_CANT_DEPLOY_CLIFP = "Failed to deploy " + EXE_NAME + " to the selected Flashpoint install.\n" + static inline const QString ERR_FP_CANT_DEPLOY_CLIFP = u"Failed to deploy "_s + EXE_NAME + u" to the selected Flashpoint install.\n"_s "\n" "%1\n" "\n" diff --git a/app/src/frontend/attractmode/am-data.cpp b/app/src/frontend/attractmode/am-data.cpp index 2da7487..030b3b4 100644 --- a/app/src/frontend/attractmode/am-data.cpp +++ b/app/src/frontend/attractmode/am-data.cpp @@ -145,8 +145,8 @@ bool ConfigDoc::Reader::splitKeyValue(const QString& line, QString& key, QString QRegularExpressionMatch keyValueCheck = KEY_VALUE_REGEX.match(line); if(keyValueCheck.hasMatch()) { - key = keyValueCheck.captured("key"); - value = keyValueCheck.captured("value"); + key = keyValueCheck.captured(u"key"_s); + value = keyValueCheck.captured(u"value"_s); return true; } else @@ -188,7 +188,7 @@ bool ConfigDoc::Writer::writeSourceDoc() { // Write config doc "header" mStreamWriter.writeLine(static_cast(mSourceDocument)->versionedTagline()); - mStreamWriter.writeLine("#"); + mStreamWriter.writeLine(u"#"_s); if(mStreamWriter.hasError()) return false; @@ -236,7 +236,7 @@ bool Taglist::Writer::writeSourceDoc() // Write tags for(const QString& tag : qAsConst(sourceList->mTags)) - mStreamWriter << tag << "\n"; + mStreamWriter << tag << '\n'; // Return error status return !mStreamWriter.hasError(); @@ -565,7 +565,7 @@ QString BulkOverviewWriter::fileErrorString() { return mFile.errorString(); } bool BulkOverviewWriter::writeOverview(const QUuid& gameId, const QString& overview) { // Set file to overview path - QString fileName = gameId.toString(QUuid::WithoutBraces) + QStringLiteral(".txt"); + QString fileName = gameId.toString(QUuid::WithoutBraces) + u".txt"_s; mFile.setFileName(mOverviewDir.absoluteFilePath(fileName)); // Open file, always truncate @@ -804,11 +804,11 @@ void EmulatorReader::parseArgs(const QString& value) { targetEmulator()->setArgs void EmulatorReader::parseWorkDir(const QString& value) { targetEmulator()->setWorkDir(value); } void EmulatorReader::parseRomPath(const QString& value) { - targetEmulator()->setRomPath(value == R"("")" ? "" : value); + targetEmulator()->setRomPath(value == uR"("")"_s ? u""_s : value); } void EmulatorReader::parseRomExt(const QString& value) { - targetEmulator()->setRomPath(value == R"("")" ? "" : value); + targetEmulator()->setRomPath(value == uR"("")"_s ? u""_s : value); } void EmulatorReader::parseSystem(const QString& value) { targetEmulator()->setSystem(value); } void EmulatorReader::parseInfoSource(const QString& value) { targetEmulator()->setInfoSource(value); } diff --git a/app/src/frontend/attractmode/am-data.h b/app/src/frontend/attractmode/am-data.h index 5c917e3..38328fd 100644 --- a/app/src/frontend/attractmode/am-data.h +++ b/app/src/frontend/attractmode/am-data.h @@ -71,7 +71,7 @@ class ConfigDoc : public Fe::DataDoc //-Class Variables-------------------------------------------------------------------------------------------------- public: - static inline const QString TAGLINE = "# Generated by Attract-Mode v"; + static inline const QString TAGLINE = u"# Generated by Attract-Mode v"_s; //-Constructor-------------------------------------------------------------------------------------------------------- protected: @@ -187,8 +187,8 @@ class Romlist : public Fe::UpdateableDoc //-Class Variables---------------------------------------------------------------------------------------------------- private: - static inline const QString HEADER = "#Name;Title;Emulator;CloneOf;Year;Manufacturer;Category;Players;Rotation;Control;Status;" - "DisplayCount;DisplayType;AltRomname;AltTitle;Extra;Buttons;Series;Language;Region;Rating"; + static inline const QString HEADER = u"#Name;Title;Emulator;CloneOf;Year;Manufacturer;Category;Players;Rotation;Control;Status;"_s + u"DisplayCount;DisplayType;AltRomname;AltTitle;Extra;Buttons;Series;Language;Region;Rating"_s; //-Instance Variables-------------------------------------------------------------------------------------------------- private: @@ -360,23 +360,23 @@ class Emulator : public ConfigDoc class Keys { public: - static inline const QString EXECUTABLE = "executable"; - static inline const QString ARGS = "args"; - static inline const QString WORK_DIR = "workdir"; - static inline const QString ROM_PATH = "rompath"; - static inline const QString ROM_EXT = "romext"; - static inline const QString SYSTEM = "system"; - static inline const QString INFO_SOURCE = "info_source"; - static inline const QString EXIT_HOTKEY = "exit_hotkey"; - - static inline const QString ARTWORK = "artwork"; + static inline const QString EXECUTABLE = u"executable"_s; + static inline const QString ARGS = u"args"_s; + static inline const QString WORK_DIR = u"workdir"_s; + static inline const QString ROM_PATH = u"rompath"_s; + static inline const QString ROM_EXT = u"romext"_s; + static inline const QString SYSTEM = u"system"_s; + static inline const QString INFO_SOURCE = u"info_source"_s; + static inline const QString EXIT_HOTKEY = u"exit_hotkey"_s; + + static inline const QString ARTWORK = u"artwork"_s; class Artwork { public: - static inline const QString FLYER = "flyer"; - static inline const QString MARQUEE = "marquee"; - static inline const QString SNAP = "snap"; - static inline const QString WHEEL = "wheel"; + static inline const QString FLYER = u"flyer"_s; + static inline const QString MARQUEE = u"marquee"_s; + static inline const QString SNAP = u"snap"_s; + static inline const QString WHEEL = u"wheel"_s; }; }; diff --git a/app/src/frontend/attractmode/am-install.cpp b/app/src/frontend/attractmode/am-install.cpp index 65deb86..2be28b9 100644 --- a/app/src/frontend/attractmode/am-install.cpp +++ b/app/src/frontend/attractmode/am-install.cpp @@ -84,7 +84,7 @@ Qx::Error Install::populateExistingDocs() */ // Check for platforms - Qx::IoOpReport existingCheck = Qx::dirContentInfoList(existingList, mFpTagDirectory, {"[[]Platform[]] *." + TAG_EXT}); + Qx::IoOpReport existingCheck = Qx::dirContentInfoList(existingList, mFpTagDirectory, {u"[[]Platform[]] *."_s + TAG_EXT}); if(existingCheck.isFailure()) return existingCheck; @@ -92,7 +92,7 @@ Qx::Error Install::populateExistingDocs() catalogueExistingDoc(Fe::DataDoc::Identifier(Fe::DataDoc::Type::Platform, platformFile.baseName())); // Check for playlists - existingCheck = Qx::dirContentInfoList(existingList, mFpTagDirectory, {"[[]Playlist[]] *." + TAG_EXT}, + existingCheck = Qx::dirContentInfoList(existingList, mFpTagDirectory, {u"[[]Playlist[]] *."_s + TAG_EXT}, QDir::NoFilter, QDirIterator::Subdirectories); if(existingCheck.isFailure()) return existingCheck; @@ -143,7 +143,7 @@ QString Install::imageDestinationPath(Fp::ImageType imageType, const Fe::Game* g std::shared_ptr Install::preparePlatformDocCheckout(std::unique_ptr& platformDoc, const QString& translatedName) { // Determine path to the taglist that corresponds with the interface - QString taglistPath = mFpTagDirectory.absoluteFilePath(translatedName + "." + TAG_EXT) ; + QString taglistPath = mFpTagDirectory.absoluteFilePath(translatedName + u"."_s + TAG_EXT) ; // Overviews QDir overviewDir(mFpScraperDirectory.absoluteFilePath(OVERVIEW_FOLDER_NAME)); // Not a file, but works @@ -158,7 +158,7 @@ std::shared_ptr Install::preparePlatformDocCheckout(std std::shared_ptr Install::preparePlaylistDocCheckout(std::unique_ptr& playlistDoc, const QString& translatedName) { // Determine path to the taglist that corresponds with the interface - QString taglistPath = mFpTagDirectory.absoluteFilePath(translatedName + "." + TAG_EXT) ; + QString taglistPath = mFpTagDirectory.absoluteFilePath(translatedName + u"."_s + TAG_EXT) ; // Construct unopened document playlistDoc = std::make_unique(this, taglistPath, translatedName, DocKey{}); @@ -346,7 +346,7 @@ QString Install::versionString() const } // Can't determine version - return QStringLiteral("UNKNOWN VERSION"); + return u"UNKNOWN VERSION"_s; } Qx::Error Install::preImport(const ImportDetails& details) @@ -355,13 +355,13 @@ Qx::Error Install::preImport(const ImportDetails& details) // Tag dir if(!mFpTagDirectory.exists()) - if(!mFpTagDirectory.mkpath(".")) + if(!mFpTagDirectory.mkpath(u"."_s)) return Qx::IoOpReport(Qx::IO_OP_WRITE, Qx::IO_ERR_CANT_CREATE, mFpTagDirectory); // Overview dir QDir overviewDir(mFpScraperDirectory.absoluteFilePath(OVERVIEW_FOLDER_NAME)); if(!overviewDir.exists()) - if(!overviewDir.mkpath(".")) + if(!overviewDir.mkpath(u"."_s)) return Qx::IoOpReport(Qx::IO_OP_WRITE, Qx::IO_ERR_CANT_CREATE, overviewDir); // Logo and screenshot dir @@ -369,12 +369,12 @@ Qx::Error Install::preImport(const ImportDetails& details) { QDir logoDir(mFpScraperDirectory.absoluteFilePath(LOGO_FOLDER_NAME)); if(!logoDir.exists()) - if(!logoDir.mkpath(".")) + if(!logoDir.mkpath(u"."_s)) return Qx::IoOpReport(Qx::IO_OP_WRITE, Qx::IO_ERR_CANT_CREATE, logoDir); QDir ssDir(mFpScraperDirectory.absoluteFilePath(SCREENSHOT_FOLDER_NAME)); if(!ssDir.exists()) - if(!ssDir.mkpath(".")) + if(!ssDir.mkpath(u"."_s)) return Qx::IoOpReport(Qx::IO_OP_WRITE, Qx::IO_ERR_CANT_CREATE, ssDir); } @@ -408,10 +408,10 @@ Qx::Error Install::preImageProcessing(QList& workerTransfers, Fe::Imag workerTransfers.swap(mWorkerImageJobs); return Qx::Error(); case Fe::ImageMode::Reference: - qWarning() << Q_FUNC_INFO << "unsupported image mode"; + qWarning() << Q_FUNC_INFO << u"unsupported image mode"_s; return Qx::Error(); default: - qWarning() << Q_FUNC_INFO << "unhandled image mode"; + qWarning() << Q_FUNC_INFO << u"unhandled image mode"_s; return Qx::Error(); } } @@ -431,7 +431,7 @@ Qx::Error Install::postImport() // General emulator setup QString workingDir = QDir::toNativeSeparators(QFileInfo(mImportDetails->clifpPath).absolutePath()); emulatorConfig->setExecutable(CLIFp::EXE_NAME); - emulatorConfig->setArgs(R"(play -i "[romfilename]")"); + emulatorConfig->setArgs(uR"(play -i u"[romfilename]"_s)"_s); emulatorConfig->setWorkDir(workingDir); emulatorConfig->setRomPath(""); emulatorConfig->setRomExt(""); @@ -443,13 +443,13 @@ Qx::Error Install::postImport() // Can reuse builder since all fields are set in each entry aeb.wPaths({}); - aeb.wType("flyer"); + aeb.wType(u"flyer"_s); emulatorConfig->setArtworkEntry(aeb.build()); - aeb.wType("snap"); + aeb.wType(u"snap"_s); emulatorConfig->setArtworkEntry(aeb.build()); - aeb.wType("marquee"); + aeb.wType(u"marquee"_s); emulatorConfig->setArtworkEntry(aeb.build()); - aeb.wType("wheel"); + aeb.wType(u"wheel"_s); emulatorConfig->setArtworkEntry(aeb.build()); // Commit emulator config @@ -474,21 +474,21 @@ Qx::Error Install::postImport() { Display::Builder db; db.wName(Fp::NAME); - db.wLayout("Attrac-Man"); + db.wLayout(u"Attrac-Man"_s); db.wRomlist(Fp::NAME); db.wInCycle(false); db.wInMenu(true); // All filter DisplayFilter::Builder dfb; - dfb.wName("All"); - dfb.wSortBy(DisplayFilter::Sort::AltTitle); // This uses FP's "orderTtile" + dfb.wName(u"All"_s); + dfb.wSortBy(DisplayFilter::Sort::AltTitle); // This uses FP's u"orderTtile"_s db.wFilter(dfb.build()); // Favorites filter dfb = DisplayFilter::Builder(); - dfb.wName("Favourites"); - dfb.wRule("Favourite equals 1"); + dfb.wName(u"Favourites"_s); + dfb.wRule(u"Favourite equals 1"_s); dfb.wSortBy(DisplayFilter::Sort::AltTitle); db.wFilter(dfb.build()); @@ -504,7 +504,7 @@ Qx::Error Install::postImport() const QStringList rules = filter.rules(); for(const QString& rule : rules) { - if(rule.contains("\\[Platform\\]") || rule.contains("\\[Playlist\\]")) + if(rule.contains(u"\\[Platform\\]"_s) || rule.contains(u"\\[Playlist\\]"_s)) return true; } @@ -520,13 +520,13 @@ Qx::Error Install::postImport() { // Escape brackets in name since AM uses regex for value QString escaped = tagFile; - escaped.replace("[", "\\[").replace("]", "\\]"); + escaped.replace(u"["_s, u"\\["_s).replace(u"]"_s, u"\\]"_s); DisplayFilter::Builder dfb; dfb = DisplayFilter::Builder(); dfb.wName('"' + tagFile + '"'); dfb.wSortBy(DisplayFilter::Sort::AltTitle); - dfb.wRule("Tags contains " + escaped); + dfb.wRule(u"Tags contains "_s + escaped); displayFilters.append(dfb.build()); } @@ -540,7 +540,7 @@ Qx::Error Install::postImport() // Add/Update marquee (if it fails, not worth aborting over so ignore error status) QDir fpMarqueeDirectory(mFpScraperDirectory.absoluteFilePath(MARQUEE_FOLDER_NAME)); - fpMarqueeDirectory.mkpath("."); + fpMarqueeDirectory.mkpath(u"."_s); QFileInfo srcMarqueeInfo(MARQUEE_PATH); QFile::copy(MARQUEE_PATH, fpMarqueeDirectory.absoluteFilePath(Fp::NAME + '.' + srcMarqueeInfo.completeSuffix())); diff --git a/app/src/frontend/attractmode/am-install.h b/app/src/frontend/attractmode/am-install.h index f0d6a34..9555b80 100644 --- a/app/src/frontend/attractmode/am-install.h +++ b/app/src/frontend/attractmode/am-install.h @@ -20,32 +20,32 @@ class Install : public Fe::Install //-Class Variables-------------------------------------------------------------------------------------------------- public: // Identity - static inline const QString NAME = "AttractMode"; - static inline const QString ICON_PATH = ":/frontend/AttractMode/icon.png"; + static inline const QString NAME = u"AttractMode"_s; + static inline const QString ICON_PATH = u":/frontend/AttractMode/icon.png"_s; static inline const QUrl HELP_URL = QUrl(""); // Naming - static inline const QString PLATFORM_TAG_PREFIX = "[Platform] "; - static inline const QString PLAYLIST_TAG_PREFIX = "[Playlist] "; + static inline const QString PLATFORM_TAG_PREFIX = u"[Platform] "_s; + static inline const QString PLAYLIST_TAG_PREFIX = u"[Playlist] "_s; // Paths - static inline const QString EMULATORS_PATH = "emulators"; - static inline const QString ROMLISTS_PATH = "romlists"; - static inline const QString SCRAPER_PATH = "scraper"; - static inline const QString MAIN_CFG_PATH = "attract.cfg"; - static inline const QString MAIN_EXE_PATH = "attract.exe"; - static inline const QString CONSOLE_EXE_PATH = "attract-console.exe"; + static inline const QString EMULATORS_PATH = u"emulators"_s; + static inline const QString ROMLISTS_PATH = u"romlists"_s; + static inline const QString SCRAPER_PATH = u"scraper"_s; + static inline const QString MAIN_CFG_PATH = u"attract.cfg"_s; + static inline const QString MAIN_EXE_PATH = u"attract.exe"_s; + static inline const QString CONSOLE_EXE_PATH = u"attract-console.exe"_s; // Sub paths - static inline const QString LOGO_FOLDER_NAME = "flyer"; - static inline const QString SCREENSHOT_FOLDER_NAME = "snap"; - static inline const QString OVERVIEW_FOLDER_NAME = "overview"; - static inline const QString MARQUEE_FOLDER_NAME = "marquee"; + static inline const QString LOGO_FOLDER_NAME = u"flyer"_s; + static inline const QString SCREENSHOT_FOLDER_NAME = u"snap"_s; + static inline const QString OVERVIEW_FOLDER_NAME = u"overview"_s; + static inline const QString MARQUEE_FOLDER_NAME = u"marquee"_s; // Files - static inline const QString TXT_EXT = "txt"; - static inline const QString TAG_EXT = "tag"; - static inline const QString CFG_EXT = "cfg"; + static inline const QString TXT_EXT = u"txt"_s; + static inline const QString TAG_EXT = u"tag"_s; + static inline const QString CFG_EXT = u"cfg"_s; // Support static inline const QList IMAGE_MODE_ORDER { @@ -58,7 +58,7 @@ class Install : public Fe::Install */ // Extra - static inline const QString MARQUEE_PATH = ":/frontend/AttractMode/marquee.png"; + static inline const QString MARQUEE_PATH = u":/frontend/AttractMode/marquee.png"_s; //-Instance Variables----------------------------------------------------------------------------------------------- private: diff --git a/app/src/frontend/attractmode/am-items.cpp b/app/src/frontend/attractmode/am-items.cpp index 2c92ceb..24c8c00 100644 --- a/app/src/frontend/attractmode/am-items.cpp +++ b/app/src/frontend/attractmode/am-items.cpp @@ -5,7 +5,7 @@ #include // Quote escape -#define ESCAPE(str) (str).replace(R"(")",R"(\")") +#define ESCAPE(str) (str).replace(uR"(")"_s, uR"(\")"_s) namespace Am { @@ -69,7 +69,7 @@ RomEntry::RomEntry(const Fp::AddApp& flashpointAddApp, const Fp::Game& parentGam //Public: QString RomEntry::addAppTitle(const QString& parentTitle, const QString& originalAddAppTitle) { - return parentTitle + " |> " + originalAddAppTitle; + return parentTitle + u" |> "_s + originalAddAppTitle; } QString RomEntry::addAppSortTitle(const QString& parentTitle, const QString& originalAddAppTitle) @@ -78,7 +78,7 @@ QString RomEntry::addAppSortTitle(const QString& parentTitle, const QString& ori * uppercase ensures sorting isn't broken up between lower and uppercase letters as AM's * sorting doesn't account for case and seems to be a basic character code sorter */ - return (parentTitle + " " + originalAddAppTitle).toUpper(); + return (parentTitle + u" "_s + originalAddAppTitle).toUpper(); } //-Instance Functions------------------------------------------------------------------------------------------------ diff --git a/app/src/frontend/attractmode/am-settings-data.cpp b/app/src/frontend/attractmode/am-settings-data.cpp index 78f706d..ac5b89c 100644 --- a/app/src/frontend/attractmode/am-settings-data.cpp +++ b/app/src/frontend/attractmode/am-settings-data.cpp @@ -78,7 +78,7 @@ bool DisplayFilter::Parser::parse(QString key, QString value, int depth) mSetting->mSortBy = DisplayFilter::Sort::NoSort; } else if(key == CrudeSettings::Keys::Display::Filter::REVERSE_ORDER) - mSetting->mReverseOrder = value == "true" ? true : false; + mSetting->mReverseOrder = value == u"true"_s ? true : false; else if(key == CrudeSettings::Keys::Display::Filter::LIST_LIMIT) mSetting->mListLimit = value.toInt(); else @@ -107,9 +107,9 @@ bool Display::Parser::parse(QString key, QString value, int depth) else if(key == CrudeSettings::Keys::Display::ROMLIST) mSetting->mRomlist = value; else if(key == CrudeSettings::Keys::Display::IN_CYCLE) - mSetting->mInCycle = value == "yes" ? true : false; + mSetting->mInCycle = value == u"yes"_s ? true : false; else if(key == CrudeSettings::Keys::Display::IN_MENU) - mSetting->mInMenu = value == "yes" ? true : false; + mSetting->mInMenu = value == u"yes"_s ? true : false; else if(key == CrudeSettings::Keys::Display::GLOBAL_FILTER) { // Set empty global filter to display @@ -333,7 +333,7 @@ bool CrudeSettingsWriter::writeConfigDoc() bool CrudeSettingsWriter::writeDisplay(const Display& display) { // Write identifier - mStreamWriter << CrudeSettings::Keys::DISPLAY << " " << display.name() << "\n"; + mStreamWriter << CrudeSettings::Keys::DISPLAY << ' ' << display.name() << '\n'; // Set tab depth mTabDepth++; @@ -343,8 +343,8 @@ bool CrudeSettingsWriter::writeDisplay(const Display& display) writeKeyValue(CrudeSettings::Keys::Display::LAYOUT, display.layout()); if(!display.romlist().isEmpty()) writeKeyValue(CrudeSettings::Keys::Display::ROMLIST, display.romlist()); - writeKeyValue(CrudeSettings::Keys::Display::IN_CYCLE, display.inCycle() ? "yes" : "no"); - writeKeyValue(CrudeSettings::Keys::Display::IN_MENU, display.inMenu() ? "yes" : "no"); + writeKeyValue(CrudeSettings::Keys::Display::IN_CYCLE, display.inCycle() ? u"yes"_s : u"no"_s); + writeKeyValue(CrudeSettings::Keys::Display::IN_MENU, display.inMenu() ? u"yes"_s : u"no"_s); // Write global filter, if present std::optional globalFilter = display.globalFilter(); @@ -407,7 +407,7 @@ bool CrudeSettingsWriter::writeDisplayFilter(const DisplayFilter& filter) } if(filter.reverseOrder() != false) - writeKeyValue(CrudeSettings::Keys::Display::Filter::REVERSE_ORDER, "true"); + writeKeyValue(CrudeSettings::Keys::Display::Filter::REVERSE_ORDER, u"true"_s); if(filter.listLimit() != 0) writeKeyValue(CrudeSettings::Keys::Display::Filter::LIST_LIMIT, QString::number(filter.listLimit())); diff --git a/app/src/frontend/attractmode/am-settings-data.h b/app/src/frontend/attractmode/am-settings-data.h index 3f07e97..901b32b 100644 --- a/app/src/frontend/attractmode/am-settings-data.h +++ b/app/src/frontend/attractmode/am-settings-data.h @@ -123,32 +123,32 @@ class CrudeSettings : public ConfigDoc class Keys { public: - static inline const QString DISPLAY = "display"; + static inline const QString DISPLAY = u"display"_s; class Display { public: - static inline const QString LAYOUT = "layout"; - static inline const QString ROMLIST = "romlist"; - static inline const QString IN_CYCLE = "in_cycle"; - static inline const QString IN_MENU = "in_menu"; - static inline const QString GLOBAL_FILTER = "global_filter"; + static inline const QString LAYOUT = u"layout"_s; + static inline const QString ROMLIST = u"romlist"_s; + static inline const QString IN_CYCLE = u"in_cycle"_s; + static inline const QString IN_MENU = u"in_menu"_s; + static inline const QString GLOBAL_FILTER = u"global_filter"_s; class GlobalFilter { public: - static inline const QString RULE = "rule"; - static inline const QString EXCEPTION = "exception"; + static inline const QString RULE = u"rule"_s; + static inline const QString EXCEPTION = u"exception"_s; }; - static inline const QString FILTER = "filter"; + static inline const QString FILTER = u"filter"_s; class Filter { public: - static inline const QString RULE = "rule"; - static inline const QString EXCEPTION = "exception"; - static inline const QString SORT_BY = "sort_by"; - static inline const QString REVERSE_ORDER = "reverse_order"; - static inline const QString LIST_LIMIT = "list_limit"; + static inline const QString RULE = u"rule"_s; + static inline const QString EXCEPTION = u"exception"_s; + static inline const QString SORT_BY = u"sort_by"_s; + static inline const QString REVERSE_ORDER = u"reverse_order"_s; + static inline const QString LIST_LIMIT = u"list_limit"_s; }; }; @@ -156,7 +156,7 @@ class CrudeSettings : public ConfigDoc //-Class Variables----------------------------------------------------------------------------------------------------- public: - static inline const QString STD_NAME = "attract"; + static inline const QString STD_NAME = u"attract"_s; //-Instance Variables-------------------------------------------------------------------------------------------------- private: @@ -185,7 +185,7 @@ class CrudeSettingsReader : public ConfigDoc::Reader { //-Class Variables-------------------------------------------------------------------------------------------------- private: - static inline const QString UNKNOWN_KEY_ERROR = R"(Unknown key "%1" for setting "%2".)"; + static inline const QString UNKNOWN_KEY_ERROR = uR"(Unknown key "%1" for setting "%2".)"_s; //-Instance Variables-------------------------------------------------------------------------------------------------- private: diff --git a/app/src/frontend/attractmode/am-settings-items.h b/app/src/frontend/attractmode/am-settings-items.h index ff161c2..46c5dd1 100644 --- a/app/src/frontend/attractmode/am-settings-items.h +++ b/app/src/frontend/attractmode/am-settings-items.h @@ -4,6 +4,8 @@ // Project Includes #include "../fe-items.h" +using namespace Qt::Literals::StringLiterals; + namespace Am { @@ -31,7 +33,7 @@ class DisplayGlobalFilter : public SettingsItem //-Class Variables--------------------------------------------------------------------------------------------------- private: - static inline const QString META_NAME = "DisplayGlobalFilter"; + static inline const QString META_NAME = u"DisplayGlobalFilter"_s; //-Instance Variables----------------------------------------------------------------------------------------------- private: @@ -101,7 +103,7 @@ class DisplayFilter : public SettingsItem //-Class Variables--------------------------------------------------------------------------------------------------- private: - static inline const QString META_NAME = "DisplayFilter"; + static inline const QString META_NAME = u"DisplayFilter"_s; //-Instance Variables----------------------------------------------------------------------------------------------- private: @@ -152,7 +154,7 @@ class Display : public SettingsItem //-Class Variables--------------------------------------------------------------------------------------------------- private: - static inline const QString META_NAME = "Display"; + static inline const QString META_NAME = u"Display"_s; //-Instance Variables----------------------------------------------------------------------------------------------- private: @@ -207,8 +209,8 @@ class OtherSetting : public SettingsItem //-Class Variables-------------------------------------------------------------------------------------------------- private: - static inline const QUuid NAMESPACE_SEED = QUuid("13d88ae7-9e9f-4736-bff4-e330e76c3b12"); - static inline const QString META_NAME = "OtherSetting"; + static inline const QUuid NAMESPACE_SEED = QUuid(u"13d88ae7-9e9f-4736-bff4-e330e76c3b12"_s); + static inline const QString META_NAME = u"OtherSetting"_s; //-Class Structs--------------------------------------------------------------------------------------------------- public: diff --git a/app/src/frontend/fe-data.h b/app/src/frontend/fe-data.h index 1c3e117..8329c0b 100644 --- a/app/src/frontend/fe-data.h +++ b/app/src/frontend/fe-data.h @@ -103,21 +103,21 @@ class QX_ERROR_TYPE(DocHandlingError, "Fe::DocHandlingError", 1310) //-Class Variables------------------------------------------------------------- private: // Message Macros - static inline const QString M_DOC_TYPE = ""; - static inline const QString M_DOC_NAME = ""; - static inline const QString M_DOC_PARENT = ""; + static inline const QString M_DOC_TYPE = u""_s; + static inline const QString M_DOC_NAME = u""_s; + static inline const QString M_DOC_PARENT = u""_s; static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {DocAlreadyOpen, "The target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") is already open."}, - {DocCantOpen, "The target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") cannot be opened."}, - {DocCantSave, "The target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") cannot be saved."}, - {NotParentDoc, "The target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") is not a" + M_DOC_PARENT + "document."}, - {CantRemoveBackup, "The existing backup of the target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") could not be removed."}, - {CantCreateBackup, "Could not create a backup of the target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ")."}, - {DocInvalidType, "The document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") is invalid or of the wrong type."}, - {DocReadFailed, "Reading the target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") failed."}, - {DocWriteFailed, "Writing to the target document (" + M_DOC_TYPE + " | " + M_DOC_NAME + ") failed."} + {NoError, u""_s}, + {DocAlreadyOpen, u"The target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") is already open."_s}, + {DocCantOpen, u"The target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") cannot be opened."_s}, + {DocCantSave, u"The target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") cannot be saved."_s}, + {NotParentDoc, u"The target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") is not a"_s + M_DOC_PARENT + u"document."_s}, + {CantRemoveBackup, u"The existing backup of the target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") could not be removed."_s}, + {CantCreateBackup, u"Could not create a backup of the target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u")."_s}, + {DocInvalidType, u"The document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") is invalid or of the wrong type."_s}, + {DocReadFailed, u"Reading the target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") failed."_s}, + {DocWriteFailed, u"Writing to the target document ("_s + M_DOC_TYPE + u" | "_s + M_DOC_NAME + u") failed."_s} }; //-Instance Variables------------------------------------------------------------- @@ -206,9 +206,9 @@ class DataDoc //-Class Variables----------------------------------------------------------------------------------------------------- private: static inline const QHash TYPE_STRINGS = { - {Type::Platform, "Platform"}, - {Type::Playlist, "Playlist"}, - {Type::Config, "Config"} + {Type::Platform, u"Platform"_s}, + {Type::Playlist, u"Playlist"_s}, + {Type::Config, u"Config"_s} }; //-Instance Variables-------------------------------------------------------------------------------------------------- diff --git a/app/src/frontend/fe-install.cpp b/app/src/frontend/fe-install.cpp index f95cbd3..9a01460 100644 --- a/app/src/frontend/fe-install.cpp +++ b/app/src/frontend/fe-install.cpp @@ -78,7 +78,7 @@ QString Install::versionString() const else if(!productVersionStr.isEmpty()) return productVersionStr; else - return "Unknown Version"; + return u"Unknown Version"_s; } /* These functions can be overridden by children as needed. diff --git a/app/src/frontend/fe-installfoundation.h b/app/src/frontend/fe-installfoundation.h index 059786f..bb7bede 100644 --- a/app/src/frontend/fe-installfoundation.h +++ b/app/src/frontend/fe-installfoundation.h @@ -28,12 +28,12 @@ class QX_ERROR_TYPE(RevertError, "Fe::RevertError", 1301) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {FileWontDelete, QSL("Cannot remove a file. It may need to be deleted manually.")}, - {FileWontRestore, QSL("Cannot restore a file backup. It may need to be renamed manually..")} + {NoError, u""_s}, + {FileWontDelete, u"Cannot remove a file. It may need to be deleted manually."_s}, + {FileWontRestore, u"Cannot restore a file backup. It may need to be renamed manually.."_s} }; - static inline const QString CAPTION_REVERT_ERR = "Error reverting changes"; + static inline const QString CAPTION_REVERT_ERR = u"Error reverting changes"_s; //-Instance Variables------------------------------------------------------------- private: @@ -83,19 +83,19 @@ class InstallFoundation //-Class Variables----------------------------------------------------------------------------------------------- private: // Files - static inline const QString BACKUP_FILE_EXT = "fbk"; + static inline const QString BACKUP_FILE_EXT = u"fbk"_s; protected: // Files - static inline const QString IMAGE_EXT = "png"; + static inline const QString IMAGE_EXT = u"png"_s; public: // Base errors // TODO: This is unused, should it be in-use somewhere? - static inline const QString ERR_UNSUPPORTED_FEATURE = "A feature unsupported by the frontend was called upon!"; + static inline const QString ERR_UNSUPPORTED_FEATURE = u"A feature unsupported by the frontend was called upon!"_s; // Image Errors - static inline const QString CAPTION_IMAGE_ERR = "Error importing game image(s)"; + static inline const QString CAPTION_IMAGE_ERR = u"Error importing game image(s)"_s; //-Instance Variables-------------------------------------------------------------------------------------------- private: diff --git a/app/src/frontend/fe-items.h b/app/src/frontend/fe-items.h index 5c088c3..22c6717 100644 --- a/app/src/frontend/fe-items.h +++ b/app/src/frontend/fe-items.h @@ -8,6 +8,8 @@ #include #include +using namespace Qt::Literals::StringLiterals; + namespace Fe { @@ -124,8 +126,8 @@ class Game : public BasicItem //-Class Variables-------------------------------------------------------------------------------------------------- protected: - static inline const QString RELEASE_TYPE_GAME = "Game"; - static inline const QString RELEASE_TYPE_ANIM = "Animation"; + static inline const QString RELEASE_TYPE_GAME = u"Game"_s; + static inline const QString RELEASE_TYPE_ANIM = u"Animation"_s; //-Instance Variables----------------------------------------------------------------------------------------------- protected: diff --git a/app/src/frontend/launchbox/lb-data.cpp b/app/src/frontend/launchbox/lb-data.cpp index 5eb4ae4..85b51fd 100644 --- a/app/src/frontend/launchbox/lb-data.cpp +++ b/app/src/frontend/launchbox/lb-data.cpp @@ -16,100 +16,100 @@ namespace Xml namespace Element_Game { - const QString NAME = "Game"; - - const QString ELEMENT_ID = "ID"; - const QString ELEMENT_TITLE = "Title"; - const QString ELEMENT_SERIES = "Series"; - const QString ELEMENT_DEVELOPER = "Developer"; - const QString ELEMENT_PUBLISHER = "Publisher"; - const QString ELEMENT_PLATFORM = "Platform"; - const QString ELEMENT_SORT_TITLE = "SortTitle"; - const QString ELEMENT_DATE_ADDED = "DateAdded"; - const QString ELEMENT_DATE_MODIFIED = "DateModified"; - const QString ELEMENT_BROKEN = "Broken"; - const QString ELEMENT_PLAYMODE = "PlayMode"; - const QString ELEMENT_STATUS = "Status"; - const QString ELEMENT_REGION = "Region"; - const QString ELEMENT_NOTES = "Notes"; - const QString ELEMENT_SOURCE = "Source"; - const QString ELEMENT_APP_PATH = "ApplicationPath"; - const QString ELEMENT_COMMAND_LINE = "CommandLine"; - const QString ELEMENT_RELEASE_DATE = "ReleaseDate"; - const QString ELEMENT_VERSION = "Version"; - const QString ELEMENT_RELEASE_TYPE = "ReleaseType"; + const QString NAME = u"Game"_s; + + const QString ELEMENT_ID = u"ID"_s; + const QString ELEMENT_TITLE = u"Title"_s; + const QString ELEMENT_SERIES = u"Series"_s; + const QString ELEMENT_DEVELOPER = u"Developer"_s; + const QString ELEMENT_PUBLISHER = u"Publisher"_s; + const QString ELEMENT_PLATFORM = u"Platform"_s; + const QString ELEMENT_SORT_TITLE = u"SortTitle"_s; + const QString ELEMENT_DATE_ADDED = u"DateAdded"_s; + const QString ELEMENT_DATE_MODIFIED = u"DateModified"_s; + const QString ELEMENT_BROKEN = u"Broken"_s; + const QString ELEMENT_PLAYMODE = u"PlayMode"_s; + const QString ELEMENT_STATUS = u"Status"_s; + const QString ELEMENT_REGION = u"Region"_s; + const QString ELEMENT_NOTES = u"Notes"_s; + const QString ELEMENT_SOURCE = u"Source"_s; + const QString ELEMENT_APP_PATH = u"ApplicationPath"_s; + const QString ELEMENT_COMMAND_LINE = u"CommandLine"_s; + const QString ELEMENT_RELEASE_DATE = u"ReleaseDate"_s; + const QString ELEMENT_VERSION = u"Version"_s; + const QString ELEMENT_RELEASE_TYPE = u"ReleaseType"_s; }; namespace Element_AddApp { - const QString NAME = "AdditionalApplication"; - - const QString ELEMENT_ID = "Id"; - const QString ELEMENT_GAME_ID = "GameID"; - const QString ELEMENT_APP_PATH = "ApplicationPath"; - const QString ELEMENT_COMMAND_LINE = "CommandLine"; - const QString ELEMENT_AUTORUN_BEFORE = "AutoRunBefore"; - const QString ELEMENT_NAME = "Name"; - const QString ELEMENT_WAIT_FOR_EXIT = "WaitForExit"; + const QString NAME = u"AdditionalApplication"_s; + + const QString ELEMENT_ID = u"Id"_s; + const QString ELEMENT_GAME_ID = u"GameID"_s; + const QString ELEMENT_APP_PATH = u"ApplicationPath"_s; + const QString ELEMENT_COMMAND_LINE = u"CommandLine"_s; + const QString ELEMENT_AUTORUN_BEFORE = u"AutoRunBefore"_s; + const QString ELEMENT_NAME = u"Name"_s; + const QString ELEMENT_WAIT_FOR_EXIT = u"WaitForExit"_s; }; namespace Element_CustomField { - const QString NAME = "CustomField"; + const QString NAME = u"CustomField"_s; - const QString ELEMENT_GAME_ID = "GameID"; - const QString ELEMENT_NAME = "Name"; - const QString ELEMENT_VALUE = "Value"; + const QString ELEMENT_GAME_ID = u"GameID"_s; + const QString ELEMENT_NAME = u"Name"_s; + const QString ELEMENT_VALUE = u"Value"_s; }; namespace Element_PlaylistHeader { - const QString NAME = "Playlist"; + const QString NAME = u"Playlist"_s; - const QString ELEMENT_ID = "PlaylistId"; - const QString ELEMENT_NAME = "Name"; - const QString ELEMENT_NESTED_NAME = "NestedName"; - const QString ELEMENT_NOTES = "Notes"; + const QString ELEMENT_ID = u"PlaylistId"_s; + const QString ELEMENT_NAME = u"Name"_s; + const QString ELEMENT_NESTED_NAME = u"NestedName"_s; + const QString ELEMENT_NOTES = u"Notes"_s; }; namespace Element_PlaylistGame { - const QString NAME = "PlaylistGame"; - - const QString ELEMENT_ID = "GameId"; - const QString ELEMENT_GAME_TITLE = "GameTitle"; - const QString ELEMENT_GAME_FILE_NAME = "GameFileName"; - const QString ELEMENT_GAME_PLATFORM = "GamePlatform"; - const QString ELEMENT_MANUAL_ORDER = "ManualOrder"; - const QString ELEMENT_LB_DB_ID = "LaunchBoxDbId"; + const QString NAME = u"PlaylistGame"_s; + + const QString ELEMENT_ID = u"GameId"_s; + const QString ELEMENT_GAME_TITLE = u"GameTitle"_s; + const QString ELEMENT_GAME_FILE_NAME = u"GameFileName"_s; + const QString ELEMENT_GAME_PLATFORM = u"GamePlatform"_s; + const QString ELEMENT_MANUAL_ORDER = u"ManualOrder"_s; + const QString ELEMENT_LB_DB_ID = u"LaunchBoxDbId"_s; }; namespace Element_Platform { - const QString NAME = "Platform"; + const QString NAME = u"Platform"_s; - const QString ELEMENT_NAME = "Name"; - const QString ELEMENT_CATEGORY = "Category"; + const QString ELEMENT_NAME = u"Name"_s; + const QString ELEMENT_CATEGORY = u"Category"_s; }; namespace Element_PlatformFolder { - const QString NAME = "PlatformFolder"; + const QString NAME = u"PlatformFolder"_s; - const QString ELEMENT_MEDIA_TYPE = "MediaType"; - const QString ELEMENT_FOLDER_PATH = "FolderPath"; - const QString ELEMENT_PLATFORM = "Platform"; + const QString ELEMENT_MEDIA_TYPE = u"MediaType"_s; + const QString ELEMENT_FOLDER_PATH = u"FolderPath"_s; + const QString ELEMENT_PLATFORM = u"Platform"_s; }; namespace Element_PlatformCategory { - const QString NAME = "PlatformCategory"; + const QString NAME = u"PlatformCategory"_s; - const QString ELEMENT_NAME = "Name"; - const QString ELEMENT_NESTED_NAME = "NestedName"; + const QString ELEMENT_NAME = u"Name"_s; + const QString ELEMENT_NESTED_NAME = u"NestedName"_s; }; -const QString ROOT_ELEMENT = "LaunchBox"; +const QString ROOT_ELEMENT = u"LaunchBox"_s; }; namespace Lb @@ -206,7 +206,7 @@ Fe::DocHandlingError XmlDocWriter::writeOutOf() mStreamWriter.setAutoFormattingIndent(2); // Write standard XML header - mStreamWriter.writeStartDocument("1.0", true); + mStreamWriter.writeStartDocument(u"1.0"_s, true); // Write main LaunchBox tag mStreamWriter.writeStartElement(Xml::ROOT_ELEMENT); @@ -507,7 +507,7 @@ bool PlatformDoc::Writer::writeGame(const Game& game) if(game.dateModified().isValid())// LB is picky with dates writeCleanTextElement(Xml::Element_Game::ELEMENT_DATE_MODIFIED, game.dateModified().toString(Qt::ISODateWithMs)); - writeCleanTextElement(Xml::Element_Game::ELEMENT_BROKEN, game.isBroken() ? "true" : "false"); + writeCleanTextElement(Xml::Element_Game::ELEMENT_BROKEN, game.isBroken() ? u"true"_s : u"false"_s); writeCleanTextElement(Xml::Element_Game::ELEMENT_PLAYMODE, game.playMode()); writeCleanTextElement(Xml::Element_Game::ELEMENT_STATUS, game.status()); writeCleanTextElement(Xml::Element_Game::ELEMENT_REGION, game.region()); @@ -542,9 +542,9 @@ bool PlatformDoc::Writer::writeAddApp(const AddApp& addApp) writeCleanTextElement(Xml::Element_AddApp::ELEMENT_GAME_ID, addApp.gameId().toString(QUuid::WithoutBraces)); writeCleanTextElement(Xml::Element_AddApp::ELEMENT_APP_PATH, addApp.appPath()); writeCleanTextElement(Xml::Element_AddApp::ELEMENT_COMMAND_LINE, addApp.commandLine()); - writeCleanTextElement(Xml::Element_AddApp::ELEMENT_AUTORUN_BEFORE, addApp.isAutorunBefore() ? "true" : "false"); + writeCleanTextElement(Xml::Element_AddApp::ELEMENT_AUTORUN_BEFORE, addApp.isAutorunBefore() ? u"true"_s : u"false"_s); writeCleanTextElement(Xml::Element_AddApp::ELEMENT_NAME, addApp.name()); - writeCleanTextElement(Xml::Element_AddApp::ELEMENT_WAIT_FOR_EXIT, addApp.isWaitForExit() ? "true" : "false"); + writeCleanTextElement(Xml::Element_AddApp::ELEMENT_WAIT_FOR_EXIT, addApp.isWaitForExit() ? u"true"_s : u"false"_s); // Write other tags writeOtherFields(addApp.otherFields()); diff --git a/app/src/frontend/launchbox/lb-data.h b/app/src/frontend/launchbox/lb-data.h index 1c0b33d..596533a 100644 --- a/app/src/frontend/launchbox/lb-data.h +++ b/app/src/frontend/launchbox/lb-data.h @@ -190,7 +190,7 @@ class PlatformsConfigDoc : public Fe::UpdateableDoc //-Class Variables----------------------------------------------------------------------------------------------------- public: - static inline const QString STD_NAME = "Platforms"; + static inline const QString STD_NAME = u"Platforms"_s; //-Instance Variables-------------------------------------------------------------------------------------------------- private: diff --git a/app/src/frontend/launchbox/lb-install.cpp b/app/src/frontend/launchbox/lb-install.cpp index 3477d9e..5b2ba82 100644 --- a/app/src/frontend/launchbox/lb-install.cpp +++ b/app/src/frontend/launchbox/lb-install.cpp @@ -34,7 +34,7 @@ Install::Install(QString installPath) : mPlaylistsDirectory = QDir(installPath + '/' + PLAYLISTS_PATH); // Check validity - QFileInfo mainExe(installPath + "/" + MAIN_EXE_PATH); + QFileInfo mainExe(installPath + '/' + MAIN_EXE_PATH); if(!mainExe.exists() || !mainExe.isFile() || !mPlatformsDirectory.exists() || !mPlaylistsDirectory.exists()) { declareValid(false); @@ -63,7 +63,7 @@ Qx::Error Install::populateExistingDocs() QFileInfoList existingList; // Check for platforms - Qx::IoOpReport existingCheck = Qx::dirContentInfoList(existingList, mPlatformsDirectory, {"*." + XML_EXT}, QDir::NoFilter, QDirIterator::Subdirectories); + Qx::IoOpReport existingCheck = Qx::dirContentInfoList(existingList, mPlatformsDirectory, {u"*."_s + XML_EXT}, QDir::NoFilter, QDirIterator::Subdirectories); if(existingCheck.isFailure()) return existingCheck; @@ -71,7 +71,7 @@ Qx::Error Install::populateExistingDocs() catalogueExistingDoc(Fe::DataDoc::Identifier(Fe::DataDoc::Type::Platform, platformFile.baseName())); // Check for playlists - existingCheck = Qx::dirContentInfoList(existingList, mPlaylistsDirectory, {"*." + XML_EXT}, QDir::NoFilter, QDirIterator::Subdirectories); + existingCheck = Qx::dirContentInfoList(existingList, mPlaylistsDirectory, {u"*."_s + XML_EXT}, QDir::NoFilter, QDirIterator::Subdirectories); if(existingCheck.isFailure()) return existingCheck; @@ -79,7 +79,7 @@ Qx::Error Install::populateExistingDocs() catalogueExistingDoc(Fe::DataDoc::Identifier(Fe::DataDoc::Type::Playlist, playlistFile.baseName())); // Check for config docs - existingCheck = Qx::dirContentInfoList(existingList, mDataDirectory, {"*." + XML_EXT}); + existingCheck = Qx::dirContentInfoList(existingList, mDataDirectory, {u"*."_s + XML_EXT}); if(existingCheck.isFailure()) return existingCheck; @@ -141,7 +141,7 @@ void Install::editBulkImageReferences(const Fe::ImageSources& imageSources) QString Install::dataDocPath(Fe::DataDoc::Identifier identifier) const { - QString fileName = identifier.docName() + "." + XML_EXT; + QString fileName = identifier.docName() + u"."_s + XML_EXT; switch(identifier.docType()) { @@ -266,7 +266,7 @@ QList Install::preferredImageModeOrder() const { return IMAGE_MOD QString Install::versionString() const { // Try LaunchBox.deps.json - QFile depsJson(mCoreDirectory.path() + "/" + "LaunchBox.deps.json"); + QFile depsJson(mCoreDirectory.path() + '/' + u"LaunchBox.deps.json"_s); QByteArray settingsData; Qx::IoOpReport settingsLoadReport = Qx::readBytesFromFile(settingsData, depsJson); @@ -292,7 +292,7 @@ QString Install::versionString() const } // Try unins000.exe - Qx::FileDetails uninsDetails = Qx::FileDetails::readFileDetails(path() + "/" + "unins000.exe"); + Qx::FileDetails uninsDetails = Qx::FileDetails::readFileDetails(path() + '/' + u"unins000.exe"_s); if(!uninsDetails.isNull()) { Qx::VersionNumber ver = uninsDetails.productVersion(); @@ -346,7 +346,7 @@ Qx::Error Install::preImageProcessing(QList& workerTransfers, Fe::Imag case Fe::ImageMode::Reference: editBulkImageReferences(bulkSources); default: - qWarning() << Q_FUNC_INFO << "unhandled image mode"; + qWarning() << Q_FUNC_INFO << u"unhandled image mode"_s; } return Qx::Error(); diff --git a/app/src/frontend/launchbox/lb-install.h b/app/src/frontend/launchbox/lb-install.h index a317346..4bfffb3 100644 --- a/app/src/frontend/launchbox/lb-install.h +++ b/app/src/frontend/launchbox/lb-install.h @@ -22,25 +22,25 @@ class Install : public Fe::Install //-Class Variables-------------------------------------------------------------------------------------------------- public: // Identity - static inline const QString NAME = "LaunchBox"; - static inline const QString ICON_PATH = ":/frontend/LaunchBox/icon.svg"; - static inline const QUrl HELP_URL = QUrl("https://forums.launchbox-app.com/files/file/2652-obbys-flashpoint-importer-for-launchbox"); + static inline const QString NAME = u"LaunchBox"_s; + static inline const QString ICON_PATH = u":/frontend/LaunchBox/icon.svg"_s; + static inline const QUrl HELP_URL = QUrl(u"https://forums.launchbox-app.com/files/file/2652-obbys-flashpoint-importer-for-launchbox"_s); // Paths - static inline const QString PLATFORMS_PATH = "Data/Platforms"; - static inline const QString PLAYLISTS_PATH = "Data/Playlists"; - static inline const QString DATA_PATH = "Data"; - static inline const QString CORE_PATH = "Core"; - static inline const QString MAIN_EXE_PATH = "LaunchBox.exe"; - static inline const QString PLATFORM_IMAGES_PATH = "Images"; - static inline const QString LOGO_PATH = "Box - Front"; - static inline const QString SCREENSHOT_PATH = "Screenshot - Gameplay"; + static inline const QString PLATFORMS_PATH = u"Data/Platforms"_s; + static inline const QString PLAYLISTS_PATH = u"Data/Playlists"_s; + static inline const QString DATA_PATH = u"Data"_s; + static inline const QString CORE_PATH = u"Core"_s; + static inline const QString MAIN_EXE_PATH = u"LaunchBox.exe"_s; + static inline const QString PLATFORM_IMAGES_PATH = u"Images"_s; + static inline const QString LOGO_PATH = u"Box - Front"_s; + static inline const QString SCREENSHOT_PATH = u"Screenshot - Gameplay"_s; // Files - static inline const QString XML_EXT = "xml"; + static inline const QString XML_EXT = u"xml"_s; // Other - static inline const QString PLATFORM_CATEGORY = "Flashpoint"; + static inline const QString PLATFORM_CATEGORY = u"Flashpoint"_s; // Support static inline const QList IMAGE_MODE_ORDER { diff --git a/app/src/frontend/launchbox/lb-items.cpp b/app/src/frontend/launchbox/lb-items.cpp index e95758b..2b02d73 100644 --- a/app/src/frontend/launchbox/lb-items.cpp +++ b/app/src/frontend/launchbox/lb-items.cpp @@ -27,7 +27,7 @@ Game::Game(const Fp::Game& flashpointGame, QString fullCLIFpPath) : mStatus(flashpointGame.status()), mRegion(), // Ensures this field is cleared because of older tool versions mNotes(flashpointGame.originalDescription() + - (!flashpointGame.notes().isEmpty() ? "\n\n" + flashpointGame.notes() : "")), + (!flashpointGame.notes().isEmpty() ? u"\n\n"_s + flashpointGame.notes() : u""_s)), mSource(flashpointGame.source()), mAppPath(QDir::toNativeSeparators(fullCLIFpPath)), mCommandLine(CLIFp::parametersFromStandard(flashpointGame.id())), @@ -139,8 +139,8 @@ AddApp::Builder::Builder() {} //Public: AddApp::Builder& AddApp::Builder::wAppPath(QString appPath) { mItemBlueprint.mAppPath = appPath; return *this; } AddApp::Builder& AddApp::Builder::wCommandLine(QString commandLine) { mItemBlueprint.mCommandLine = commandLine; return *this; } -AddApp::Builder& AddApp::Builder::wAutorunBefore(QString rawAutorunBefore) { mItemBlueprint.mAutorunBefore = rawAutorunBefore != "0"; return *this; } -AddApp::Builder& AddApp::Builder::wWaitForExit(QString rawWaitForExit) { mItemBlueprint.mWaitForExit = rawWaitForExit != "0"; return *this; } +AddApp::Builder& AddApp::Builder::wAutorunBefore(QString rawAutorunBefore) { mItemBlueprint.mAutorunBefore = rawAutorunBefore != u"0"_s; return *this; } +AddApp::Builder& AddApp::Builder::wWaitForExit(QString rawWaitForExit) { mItemBlueprint.mWaitForExit = rawWaitForExit != u"0"_s; return *this; } //=============================================================================================================== // CustomField diff --git a/app/src/frontend/launchbox/lb-items.h b/app/src/frontend/launchbox/lb-items.h index 225aebf..f3208a0 100644 --- a/app/src/frontend/launchbox/lb-items.h +++ b/app/src/frontend/launchbox/lb-items.h @@ -144,7 +144,7 @@ class CustomField : public Fe::Item //-Class Variables-------------------------------------------------------------------------------------------------- public: - static inline const QString LANGUAGE = "Language"; + static inline const QString LANGUAGE = u"Language"_s; //-Instance Variables----------------------------------------------------------------------------------------------- private: diff --git a/app/src/import-worker.cpp b/app/src/import-worker.cpp index e40a202..f7bfd00 100644 --- a/app/src/import-worker.cpp +++ b/app/src/import-worker.cpp @@ -152,7 +152,7 @@ ImageTransferError ImportWorker::transferImage(bool symlink, QString sourcePath, } // Ensure destination path exists - if(!destinationDir.mkpath(".")) + if(!destinationDir.mkpath(u"."_s)) return ImageTransferError(ImageTransferError::CantCreateDirectory, QString(), destinationDir.absolutePath()); // Determine backup path diff --git a/app/src/import-worker.h b/app/src/import-worker.h index 9cac400..8dc49e9 100644 --- a/app/src/import-worker.h +++ b/app/src/import-worker.h @@ -32,18 +32,18 @@ class QX_ERROR_TYPE(ImageTransferError, "ImageTransferError", 1350) //-Class Variables------------------------------------------------------------- private: static inline const QHash ERR_STRINGS{ - {NoError, QSL("")}, - {ImageSourceUnavailable, "An Expected source image does not exist."}, - {ImageWontBackup, "Cannot rename an existing image for backup."}, - {ImageWontCopy, "Cannot copy an image to its destination."}, - {ImageWontLink, "Cannot create a symbolic link for an image."}, - {CantCreateDirectory, "Could not create a directory for an image destination."} + {NoError, u""_s}, + {ImageSourceUnavailable, u"An Expected source image does not exist."_s}, + {ImageWontBackup, u"Cannot rename an existing image for backup."_s}, + {ImageWontCopy, u"Cannot copy an image to its destination."_s}, + {ImageWontLink, u"Cannot create a symbolic link for an image."_s}, + {CantCreateDirectory, u"Could not create a directory for an image destination."_s} }; - static inline const QString CAPTION_IMAGE_ERR = "Error importing game image(s)"; - static inline const QString IMAGE_RETRY_PROMPT = "Retry?"; - static inline const QString SRC_PATH_TEMPLATE = "Source: %1"; - static inline const QString DEST_PATH_TEMPLATE = "Destination: %1"; + static inline const QString CAPTION_IMAGE_ERR = u"Error importing game image(s)"_s; + static inline const QString IMAGE_RETRY_PROMPT = u"Retry?"_s; + static inline const QString SRC_PATH_TEMPLATE = u"Source: %1"_s; + static inline const QString DEST_PATH_TEMPLATE = u"Destination: %1"_s; //-Instance Variables------------------------------------------------------------- private: @@ -83,11 +83,11 @@ class ImportWorker : public QObject class Pg { public: - static inline const QString AddAppPreload = "AddAppPreload"; - static inline const QString ImageDownload = "ImageDownload"; - static inline const QString ImageTransfer = "ImageTransfer"; - static inline const QString GameImport = "GameImport"; - static inline const QString PlaylistImport = "PlaylistImport"; + static inline const QString AddAppPreload = u"AddAppPreload"_s; + static inline const QString ImageDownload = u"ImageDownload"_s; + static inline const QString ImageTransfer = u"ImageTransfer"_s; + static inline const QString GameImport = u"GameImport"_s; + static inline const QString PlaylistImport = u"PlaylistImport"_s; }; //-Class Structs------------------------------------------------------------------------------------------------- @@ -110,13 +110,13 @@ class ImportWorker : public QObject //-Class Variables----------------------------------------------------------------------------------------------- public: // Import Steps - static inline const QString STEP_ADD_APP_PRELOAD = "Pre-loading Additional Apps..."; - static inline const QString STEP_IMPORTING_PLATFORM_SETS = "Importing games and additional apps for platform %1..."; - static inline const QString STEP_IMPORTING_PLAYLIST_SPEC_SETS = "Importing playlist specific and additional apps for platform %1..."; - static inline const QString STEP_IMPORTING_PLAYLISTS = "Importing playlist %1..."; - static inline const QString STEP_DOWNLOADING_IMAGES = "Downloading images..."; - static inline const QString STEP_IMPORTING_IMAGES = "Importing images..."; - static inline const QString STEP_FINALIZING = "Finalizing..."; + static inline const QString STEP_ADD_APP_PRELOAD = u"Pre-loading Additional Apps..."_s; + static inline const QString STEP_IMPORTING_PLATFORM_SETS = u"Importing games and additional apps for platform %1..."_s; + static inline const QString STEP_IMPORTING_PLAYLIST_SPEC_SETS = u"Importing playlist specific and additional apps for platform %1..."_s; + static inline const QString STEP_IMPORTING_PLAYLISTS = u"Importing playlist %1..."_s; + static inline const QString STEP_DOWNLOADING_IMAGES = u"Downloading images..."_s; + static inline const QString STEP_IMPORTING_IMAGES = u"Importing images..."_s; + static inline const QString STEP_FINALIZING = u"Finalizing..."_s; //-Instance Variables-------------------------------------------------------------------------------------------- private: diff --git a/app/src/main.cpp b/app/src/main.cpp index b452c70..1d42cad 100644 --- a/app/src/main.cpp +++ b/app/src/main.cpp @@ -8,7 +8,7 @@ int main(int argc, char *argv[]) if(!w.initCompleted()) { - QMessageBox::critical(nullptr, "Cannot Start", "Initialization failed!"); + QMessageBox::critical(nullptr, u"Cannot Start"_s, u"Initialization failed!"_s); return 1; } diff --git a/app/src/mainwindow.cpp b/app/src/mainwindow.cpp index 31f9d70..30316da 100644 --- a/app/src/mainwindow.cpp +++ b/app/src/mainwindow.cpp @@ -60,7 +60,7 @@ MainWindow::MainWindow(QWidget *parent) : { // Create local copy of internal CLIFp.exe since internal path cannot be used with WinAPI QString localCopyPath = tempDir.path() + '/' + CLIFp::EXE_NAME; - if(QFile::copy(":/file/" + CLIFp::EXE_NAME, localCopyPath)) + if(QFile::copy(u":/file/"_s + CLIFp::EXE_NAME, localCopyPath)) mInternalCLIFpVersion = Qx::FileDetails::readFileDetails(localCopyPath).fileVersion(); } @@ -98,13 +98,13 @@ bool MainWindow::testForLinkPermissions() QTemporaryDir testLinkDir; if(testLinkDir.isValid()) { - QFile testLinkTarget(testLinkDir.filePath("linktarget.tmp")); + QFile testLinkTarget(testLinkDir.filePath(u"linktarget.tmp"_s)); if(testLinkTarget.open(QIODevice::WriteOnly)) { testLinkTarget.close(); std::error_code symlinkError; - std::filesystem::create_symlink(testLinkTarget.fileName().toStdString(), testLinkDir.filePath("testlink.tmp").toStdString(), symlinkError); + std::filesystem::create_symlink(testLinkTarget.fileName().toStdString(), testLinkDir.filePath(u"testlink.tmp"_s).toStdString(), symlinkError); if(!symlinkError) return true; @@ -121,7 +121,7 @@ void MainWindow::initializeForms() mExistingItemColor = ui->label_existingItemColor->palette().color(QPalette::Window); // Add CLIFp version to deploy option - ui->action_deployCLIFp->setText(ui->action_deployCLIFp->text() + " " + mInternalCLIFpVersion.normalized(2).toString()); + ui->action_deployCLIFp->setText(ui->action_deployCLIFp->text() + ' ' + mInternalCLIFpVersion.normalized(2).toString()); // Prepare help messages mArgedPlaylistGameModeHelp = MSG_PLAYLIST_GAME_MODE_HELP.arg(ui->radioButton_selectedPlatformsOnly->text(), @@ -227,8 +227,8 @@ void MainWindow::validateInstall(QString installPath, InstallType install) mFrontendInstall = Fe::Install::acquireMatch(installPath); if(mFrontendInstall) { - ui->icon_frontend_install_status->setPixmap(QPixmap(":/ui/Valid_Install.png")); - ui->label_frontendVersion->setText(mFrontendInstall->name() + " " + mFrontendInstall->versionString()); + ui->icon_frontend_install_status->setPixmap(QPixmap(u":/ui/Valid_Install.png"_s)); + ui->label_frontendVersion->setText(mFrontendInstall->name() + ' ' + mFrontendInstall->versionString()); } else invalidateInstall(install, true); @@ -240,10 +240,10 @@ void MainWindow::validateInstall(QString installPath, InstallType install) { ui->label_flashpointVersion->setText(mFlashpointInstall->nameVersionString()); if(installMatchesTargetSeries(*mFlashpointInstall)) - ui->icon_flashpoint_install_status->setPixmap(QPixmap(":/ui/Valid_Install.png")); + ui->icon_flashpoint_install_status->setPixmap(QPixmap(u":/ui/Valid_Install.png"_s)); else { - ui->icon_flashpoint_install_status->setPixmap(QPixmap(":/ui/Mismatch_Install.png")); + ui->icon_flashpoint_install_status->setPixmap(QPixmap(u":/ui/Mismatch_Install.png"_s)); QMessageBox::warning(this, QApplication::applicationName(), MSG_FP_VER_NOT_TARGET); } } @@ -396,7 +396,7 @@ void MainWindow::invalidateInstall(InstallType install, bool informUser) switch(install) { case InstallType::Frontend: - ui->icon_frontend_install_status->setPixmap(QPixmap(":/ui/Invalid_Install.png")); + ui->icon_frontend_install_status->setPixmap(QPixmap(u":/ui/Invalid_Install.png"_s)); ui->label_frontendVersion->clear(); if(informUser) QMessageBox::critical(this, QApplication::applicationName(), MSG_FE_INSTALL_INVALID); @@ -404,7 +404,7 @@ void MainWindow::invalidateInstall(InstallType install, bool informUser) break; case InstallType::Flashpoint: - ui->icon_flashpoint_install_status->setPixmap(QPixmap(":/ui/Invalid_Install.png")); + ui->icon_flashpoint_install_status->setPixmap(QPixmap(u":/ui/Invalid_Install.png"_s)); ui->label_flashpointVersion->clear(); if(informUser) Qx::postBlockingError(mFlashpointInstall->error(), QMessageBox::Ok); @@ -474,7 +474,7 @@ void MainWindow::postListError(QString mainText, QStringList detailedItems) QMessageBox listError; listError.setIcon(QMessageBox::Critical); listError.setText(mainText); - listError.setDetailedText(detailedItems.join("\n")); + listError.setDetailedText(detailedItems.join('\n')); listError.setStandardButtons(QMessageBox::Ok); listError.exec(); @@ -619,7 +619,7 @@ void MainWindow::prepareImport() if(!feRunning) { // Create progress dialog, set initial state and show - mImportProgressDialog = std::make_unique(STEP_FP_DB_INITIAL_QUERY, "Cancel", 0, 0, this); + mImportProgressDialog = std::make_unique(STEP_FP_DB_INITIAL_QUERY, u"Cancel"_s, 0, 0, this); mImportProgressDialog->setWindowTitle(CAPTION_IMPORTING); mImportProgressDialog->setWindowModality(Qt::WindowModal); mImportProgressDialog->setWindowFlags(mImportProgressDialog->windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -739,7 +739,7 @@ void MainWindow::standaloneCLIFpDeploy() { // Deploy exe QString deployError; - while(!CLIFp::deployCLIFp(deployError, tempFlashpointInstall, ":/file/CLIFp.exe")) + while(!CLIFp::deployCLIFp(deployError, tempFlashpointInstall, u":/file/CLIFp.exe"_s)) if(QMessageBox::critical(this, CAPTION_CLIFP_ERR, MSG_FP_CANT_DEPLOY_CLIFP.arg(deployError), QMessageBox::Retry | QMessageBox::Cancel, QMessageBox::Retry) == QMessageBox::Cancel) break; } @@ -909,7 +909,7 @@ void MainWindow::all_on_lineEdit_editingFinished() throw std::runtime_error("Unhandled use of all_on_linedEdit_textEdited() slot"); } -void MainWindow::all_on_listWidget_itemChanged(QListWidgetItem* item) // Proxy for "onItemChecked" +void MainWindow::all_on_listWidget_itemChanged(QListWidgetItem* item) // Proxy for u"onItemChecked"_s { // Get the object that called this slot QListWidget* senderListWidget = qobject_cast(sender()); @@ -973,7 +973,7 @@ void MainWindow::all_on_menu_triggered(QAction *action) if(frontendMatch.hasMatch()) { - QString frontendName = frontendMatch.captured("frontend"); + QString frontendName = frontendMatch.captured(u"frontend"_s); if(!frontendName.isNull() && Fe::Install::registry().contains(frontendName)) { const QUrl* helpUrl = Fe::Install::registry()[frontendName].helpUrl; @@ -1045,7 +1045,7 @@ void MainWindow::handleImportResult(ImportWorker::ImportResult importResult, Qx: if(willDeploy) { QString deployError; - while(!CLIFp::deployCLIFp(deployError, *mFlashpointInstall, ":/file/CLIFp.exe")) + while(!CLIFp::deployCLIFp(deployError, *mFlashpointInstall, u":/file/CLIFp.exe"_s)) if(QMessageBox::critical(this, CAPTION_CLIFP_ERR, MSG_FP_CANT_DEPLOY_CLIFP.arg(deployError), QMessageBox::Retry | QMessageBox::Ignore, QMessageBox::Retry) == QMessageBox::Ignore) break; } diff --git a/app/src/mainwindow.h b/app/src/mainwindow.h index 510d5d2..625b419 100644 --- a/app/src/mainwindow.h +++ b/app/src/mainwindow.h @@ -38,20 +38,20 @@ class MainWindow : public QMainWindow //-Class Variables-------------------------------------------------------------------------------------------- private: // UI Text - static inline const QString REQUIRE_ELEV = " [Run as Admin/Dev Mode]"; + static inline const QString REQUIRE_ELEV = u" [Run as Admin/Dev Mode]"_s; // Messages - General - static inline const QString MSG_FATAL_NO_INTERNAL_CLIFP_VER = "Failed to get version information from the internal copy of CLIFp.exe!\n" + static inline const QString MSG_FATAL_NO_INTERNAL_CLIFP_VER = u"Failed to get version information from the internal copy of CLIFp.exe!\n" "\n" - "Execution cannot continue."; + "Execution cannot continue."_s; // Messages - Help - static inline const QString MSG_PLAYLIST_GAME_MODE_HELP = "%1 - Games found in the selected playlists that are not part of any selected platform will be excluded.
" + static inline const QString MSG_PLAYLIST_GAME_MODE_HELP = u"%1 - Games found in the selected playlists that are not part of any selected platform will be excluded.
" "
" "%2 - Unselected platforms that contain games from the selected playlists will be partially imported, so that they only contain said games. This guarantees that all games " "from each selected playlist will be present in your collection. NOTE: It's possible that this will include existing platforms so make sure you have your update options set as " - "intended."; + "intended."_s; - static inline const QString MSG_UPDATE_MODE_HELP = "%1 - Only games not already present in your collection will be added, existing entries will be left completely untouched.
" + static inline const QString MSG_UPDATE_MODE_HELP = u"%1 - Only games not already present in your collection will be added, existing entries will be left completely untouched.
" "
" "%2 - Games not already present in your collection will be added and existing entries will have their descriptive metadata (i.e. Title, Author, Images etc.) replaced by the " "the details present in the target Flashpoint version; however, personal metadata (i.e. Playcount, Achievements, etc.) will not be altered.
" @@ -59,8 +59,8 @@ class MainWindow : public QMainWindow "%3 - Games in your collection that are not present in the target version of Flashpoint will be removed (only for selected items). You will no longer be able to play such " "games if this option is unchecked, but this may be useful for archival purposes or in case you later want to revert to a previous version of Flashpoint and maintain the entries personal " "metadata. Note that this option will also remove any games that are not covered by your current import selections (i.e. platforms, playlists, tag filter, etc.), even if they still remain " - "in Flashpoint"; - static inline const QString MSG_IMAGE_MODE_HELP = "%1 - All relevant images from Flashpoint will be fully copied into your frontend installation. This causes zero overhead but will require additional storage space proportional to " + "in Flashpoint"_s; + static inline const QString MSG_IMAGE_MODE_HELP = u"%1 - All relevant images from Flashpoint will be fully copied into your frontend installation. This causes zero overhead but will require additional storage space proportional to " "the number of games you end up importing, up to double if all platforms are selected.
" "Space Consumption: High
" "Import Speed: Very Slow
" @@ -76,80 +76,80 @@ class MainWindow : public QMainWindow "amount of overhead when it loads images and require almost no extra disk space to store.
" "Space Consumption: Near-zero
" "Import Speed: Slow
" - ">Frontend Access Speed: Fast
"; + ">Frontend Access Speed: Fast
"_s; // Messages - Input - static inline const QString MSG_FE_INSTALL_INVALID = "The specified directory either doesn't contain a valid frontend install, or it contains a version that is incompatible with this tool."; - static inline const QString MSG_FP_INSTALL_INVALID = "The specified directory either doesn't contain a valid Flashpoint install, or it contains a version that is incompatible with this tool."; - static inline const QString MSG_FP_VER_NOT_TARGET = "The selected Flashpoint install contains a version of Flashpoint that is different from the target version series (" PROJECT_TARGET_FP_VER_PFX_STR "), but appears to have a compatible structure. " - "You may proceed at your own risk as the tool is not guaranteed to work correctly in this circumstance. Please use a newer version of " PROJECT_SHORT_NAME " if available."; + static inline const QString MSG_FE_INSTALL_INVALID = u"The specified directory either doesn't contain a valid frontend install, or it contains a version that is incompatible with this tool."_s; + static inline const QString MSG_FP_INSTALL_INVALID = u"The specified directory either doesn't contain a valid Flashpoint install, or it contains a version that is incompatible with this tool."_s; + static inline const QString MSG_FP_VER_NOT_TARGET = u"The selected Flashpoint install contains a version of Flashpoint that is different from the target version series (" PROJECT_TARGET_FP_VER_PFX_STR "), but appears to have a compatible structure. " + "You may proceed at your own risk as the tool is not guaranteed to work correctly in this circumstance. Please use a newer version of " PROJECT_SHORT_NAME " if available."_s; - static inline const QString MSG_INSTALL_CONTENTS_CHANGED = "The contents of your installs have been changed since the initial scan and therefore must be re-evaluated. You will need to make your selections again."; + static inline const QString MSG_INSTALL_CONTENTS_CHANGED = u"The contents of your installs have been changed since the initial scan and therefore must be re-evaluated. You will need to make your selections again."_s; // Messages - General import procedure - static inline const QString MSG_PRE_EXISTING_IMPORT = "One or more existing Platforms/Playlists may be affected by this import. These will be altered even if they did not originate from this program (i.e. if you " + static inline const QString MSG_PRE_EXISTING_IMPORT = u"One or more existing Platforms/Playlists may be affected by this import. These will be altered even if they did not originate from this program (i.e. if you " "already happened to have a Platform/Playlist with the same name as one present in Flashpoint).\n" "\n" - "Are you sure you want to proceed?"; - static inline const QString MSG_FRONTEND_CLOSE_PROMPT = "The importer has detected that the selected frontend is running. It must be closed in order to continue. If recently closed, wait a few moments before trying to proceed again as it performs significant cleanup in the background."; - static inline const QString MSG_POST_IMPORT = "The Flashpoint import has completed successfully. Next time you start the frontend it may take longer than usual as it may have to fill in some default fields for the imported Platforms/Playlists.\n" + "Are you sure you want to proceed?"_s; + static inline const QString MSG_FRONTEND_CLOSE_PROMPT = u"The importer has detected that the selected frontend is running. It must be closed in order to continue. If recently closed, wait a few moments before trying to proceed again as it performs significant cleanup in the background."_s; + static inline const QString MSG_POST_IMPORT = u"The Flashpoint import has completed successfully. Next time you start the frontend it may take longer than usual as it may have to fill in some default fields for the imported Platforms/Playlists.\n" "\n" - "If you wish to import further selections or update to a newer version of Flashpoint, simply re-run this procedure after pointing it to the desired Flashpoint installation."; + "If you wish to import further selections or update to a newer version of Flashpoint, simply re-run this procedure after pointing it to the desired Flashpoint installation."_s; // Initial import status - static inline const QString STEP_FP_DB_INITIAL_QUERY = "Making initial Flashpoint database queries..."; + static inline const QString STEP_FP_DB_INITIAL_QUERY = u"Making initial Flashpoint database queries..."_s; // Messages - FP General - static inline const QString MSG_FP_CLOSE_PROMPT = "It is strongly recommended to close Flashpoint before proceeding as it can severely slow or interfere with the import process"; + static inline const QString MSG_FP_CLOSE_PROMPT = u"It is strongly recommended to close Flashpoint before proceeding as it can severely slow or interfere with the import process"_s; // Messages - FP Database read - static inline const QString MSG_FP_DB_MISSING_TABLE = "The Flashpoint database is missing tables critical to the import process."; - static inline const QString MSG_FP_DB_TABLE_MISSING_COLUMN = "The Flashpoint database tables are missing columns critical to the import process."; - static inline const QString MSG_FP_DB_UNEXPECTED_ERROR = "An unexpected SQL error occurred while reading the Flashpoint database:"; + static inline const QString MSG_FP_DB_MISSING_TABLE = u"The Flashpoint database is missing tables critical to the import process."_s; + static inline const QString MSG_FP_DB_TABLE_MISSING_COLUMN = u"The Flashpoint database tables are missing columns critical to the import process."_s; + static inline const QString MSG_FP_DB_UNEXPECTED_ERROR = u"An unexpected SQL error occurred while reading the Flashpoint database:"_s; // Messages - FP CLIFp - static inline const QString MSG_FP_CLFIP_WILL_DOWNGRADE = "The existing version of " + CLIFp::EXE_NAME + " in your Flashpoint install is newer than the version package with this tool.\n" + static inline const QString MSG_FP_CLFIP_WILL_DOWNGRADE = u"The existing version of "_s + CLIFp::EXE_NAME + u" in your Flashpoint install is newer than the version package with this tool.\n" "\n" "Replacing it with the packaged Version (downgrade) will likely cause compatibility issues unless you are specifically re-importing are downgrading your Flashpoint install to a previous version.\n" "\n" - "Do you wish to downgrade " + CLIFp::EXE_NAME + "?"; + "Do you wish to downgrade "_s + CLIFp::EXE_NAME + u"?"_s; - static inline const QString MSG_FP_CANT_DEPLOY_CLIFP = "Failed to deploy " + CLIFp::EXE_NAME + " to the selected Flashpoint install.\n" + static inline const QString MSG_FP_CANT_DEPLOY_CLIFP = u"Failed to deploy "_s + CLIFp::EXE_NAME + u" to the selected Flashpoint install.\n" "\n" "%1\n" "\n" - "If you choose to ignore this you will have to place CLIFp in your Flashpoint install directory manually."; + "If you choose to ignore this you will have to place CLIFp in your Flashpoint install directory manually."_s; // Messages - Import Result - static inline const QString MSG_HAVE_TO_REVERT = "Due to previous unrecoverable errors, all changes that occurred during import will now be reverted (other than existing images that were replaced with newer versions).\n" + static inline const QString MSG_HAVE_TO_REVERT = u"Due to previous unrecoverable errors, all changes that occurred during import will now be reverted (other than existing images that were replaced with newer versions).\n" "\n" "Afterwards, check to see if there is a newer version of " PROJECT_SHORT_NAME " and try again using that version. If not ask for help on the relevant forums where this tool was released (see Help).\n" "\n" - "If you believe this to be due to a bug with this software, please submit an issue to its GitHub page (listed under help)"; + "If you believe this to be due to a bug with this software, please submit an issue to its GitHub page (listed under help)"_s; - static inline const QString MSG_USER_CANCELED = "Import canceled by user, all changes that occurred during import will now be reverted (other than existing images that were replaced with newer versions)."; - static inline const QString MSG_NO_WORK = "The provided import selections/options resulted in no tasks to perform. Double-check your settings."; + static inline const QString MSG_USER_CANCELED = u"Import canceled by user, all changes that occurred during import will now be reverted (other than existing images that were replaced with newer versions)."_s; + static inline const QString MSG_NO_WORK = u"The provided import selections/options resulted in no tasks to perform. Double-check your settings."_s; // Dialog captions - static inline const QString CAPTION_GENERAL_FATAL_ERROR = "Fatal Error!"; - static inline const QString CAPTION_FRONTEND_BROWSE = "Select the root directory of your frontend install..."; - static inline const QString CAPTION_FLASHPOINT_BROWSE = "Select the root directory of your Flashpoint install..."; - static inline const QString CAPTION_PLAYLIST_GAME_MODE_HELP = "Playlist game mode options"; - static inline const QString CAPTION_UPDATE_MODE_HELP = "Update mode options"; - static inline const QString CAPTION_IMAGE_MODE_HELP = "Image mode options"; - static inline const QString CAPTION_TASKLESS_IMPORT = "Nothing to do"; - static inline const QString CAPTION_REVERT = "Reverting changes..."; - static inline const QString CAPTION_CLIFP_ERR = "Error deploying CLIFp"; - static inline const QString CAPTION_CLIFP_DOWNGRADE = "Downgrade CLIFp?"; - static inline const QString CAPTION_IMPORTING = "FP Import"; - static inline const QString CAPTION_TAG_FILTER = "Tag Filter"; + static inline const QString CAPTION_GENERAL_FATAL_ERROR = u"Fatal Error!"_s; + static inline const QString CAPTION_FRONTEND_BROWSE = u"Select the root directory of your frontend install..."_s; + static inline const QString CAPTION_FLASHPOINT_BROWSE = u"Select the root directory of your Flashpoint install..."_s; + static inline const QString CAPTION_PLAYLIST_GAME_MODE_HELP = u"Playlist game mode options"_s; + static inline const QString CAPTION_UPDATE_MODE_HELP = u"Update mode options"_s; + static inline const QString CAPTION_IMAGE_MODE_HELP = u"Image mode options"_s; + static inline const QString CAPTION_TASKLESS_IMPORT = u"Nothing to do"_s; + static inline const QString CAPTION_REVERT = u"Reverting changes..."_s; + static inline const QString CAPTION_CLIFP_ERR = u"Error deploying CLIFp"_s; + static inline const QString CAPTION_CLIFP_DOWNGRADE = u"Downgrade CLIFp?"_s; + static inline const QString CAPTION_IMPORTING = u"FP Import"_s; + static inline const QString CAPTION_TAG_FILTER = u"Tag Filter"_s; // Menus - static inline const QString MENU_FE_HELP_OBJ_NAME_TEMPLATE = "action_%1Help"; - static inline const QRegularExpression MENU_FE_HELP_KEY_REGEX = QRegularExpression("action_(?.*?)Help"); + static inline const QString MENU_FE_HELP_OBJ_NAME_TEMPLATE = u"action_%1Help"_s; + static inline const QRegularExpression MENU_FE_HELP_KEY_REGEX = QRegularExpression(u"action_(?.*?)Help"_s); // URLs - static inline const QUrl URL_CLIFP_GITHUB = QUrl("https://github.com/oblivioncth/CLIFp"); - static inline const QUrl URL_OFLIB_GITHUB = QUrl("https://github.com/oblivioncth/FIL"); + static inline const QUrl URL_CLIFP_GITHUB = QUrl(u"https://github.com/oblivioncth/CLIFp"_s); + static inline const QUrl URL_OFLIB_GITHUB = QUrl(u"https://github.com/oblivioncth/FIL"_s); // Flashpoint version check static inline const Qx::VersionNumber TARGET_FP_VERSION_PREFIX = Qx::VersionNumber::fromString(PROJECT_TARGET_FP_VER_PFX_STR);