Skip to content

Commit

Permalink
String touchup
Browse files Browse the repository at this point in the history
Largely using u""_s where possible.
  • Loading branch information
oblivioncth committed Jul 23, 2023
1 parent 13993eb commit fb76e75
Show file tree
Hide file tree
Showing 26 changed files with 321 additions and 317 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions app/src/clifp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)); }
12 changes: 6 additions & 6 deletions app/src/clifp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions app/src/frontend/attractmode/am-data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -188,7 +188,7 @@ bool ConfigDoc::Writer::writeSourceDoc()
{
// Write config doc "header"
mStreamWriter.writeLine(static_cast<ConfigDoc*>(mSourceDocument)->versionedTagline());
mStreamWriter.writeLine("#");
mStreamWriter.writeLine(u"#"_s);

if(mStreamWriter.hasError())
return false;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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); }
Expand Down
34 changes: 17 additions & 17 deletions app/src/frontend/attractmode/am-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
};
};

Expand Down
50 changes: 25 additions & 25 deletions app/src/frontend/attractmode/am-install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ 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;

for(const QFileInfo& platformFile : qAsConst(existingList))
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;
Expand Down Expand Up @@ -143,7 +143,7 @@ QString Install::imageDestinationPath(Fp::ImageType imageType, const Fe::Game* g
std::shared_ptr<Fe::PlatformDoc::Reader> Install::preparePlatformDocCheckout(std::unique_ptr<Fe::PlatformDoc>& 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
Expand All @@ -158,7 +158,7 @@ std::shared_ptr<Fe::PlatformDoc::Reader> Install::preparePlatformDocCheckout(std
std::shared_ptr<Fe::PlaylistDoc::Reader> Install::preparePlaylistDocCheckout(std::unique_ptr<Fe::PlaylistDoc>& 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<PlaylistInterface>(this, taglistPath, translatedName, DocKey{});
Expand Down Expand Up @@ -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)
Expand All @@ -355,26 +355,26 @@ 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
if(details.imageMode == Fe::ImageMode::Copy || details.imageMode == Fe::ImageMode::Link)
{
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);
}

Expand Down Expand Up @@ -408,10 +408,10 @@ Qx::Error Install::preImageProcessing(QList<ImageMap>& 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();
}
}
Expand All @@ -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("");
Expand All @@ -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
Expand All @@ -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());

Expand All @@ -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;
}

Expand All @@ -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());
}
Expand All @@ -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()));

Expand Down
Loading

0 comments on commit fb76e75

Please sign in to comment.