Skip to content

Commit

Permalink
Use u""_s where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Jul 22, 2023
1 parent 269da20 commit 646e7bf
Show file tree
Hide file tree
Showing 51 changed files with 457 additions and 458 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ endif()

include(OB/FetchQx)
ob_fetch_qx(
REF "036444f02843050c2d19fa6eddf4a270d8a485b8"
REF "e46b448cf6c60c75095c1e243a5684a0ff1ec911"
COMPONENTS
${CLIFP_QX_COMPONENTS}
)

# Fetch libfp (build and import from source)
include(OB/Fetchlibfp)
ob_fetch_libfp("737939552cd4c6ac320e9470d2ecf48288acf485")
ob_fetch_libfp("7663b1eff2813dfa54efee1aaad32f501ea58fba")

# Fetch QI-QMP (build and import from source)
include(OB/FetchQI-QMP)
ob_fetch_qi_qmp("ae12edd5c9f4b3856e7f7a9c7564e463de7d867e")
ob_fetch_qi_qmp("b99be49cd0ec71f9c3c398676be147cb68452bb9")

# Fetch QuaZip (build and import from source)
include(OB/FetchQuaZip)
Expand Down
10 changes: 5 additions & 5 deletions app/src/command/c-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Qx::Error CLink::perform()
Q_ASSERT(std::holds_alternative<Fp::Game>(entry_v));

Fp::Game parent = std::get<Fp::Game>(entry_v);
shortcutName = Qx::kosherizeFileName(parent.title() + " (" + addApp.name() + ")");
shortcutName = Qx::kosherizeFileName(parent.title() + u" ("_s + addApp.name() + u")"_s);
}
else
qCritical("Invalid variant state for std::variant<Fp::Game, Fp::AddApp>.");
Expand Down Expand Up @@ -110,8 +110,8 @@ Qx::Error CLink::perform()
// Prompt user for path
Core::SaveFileRequest sfr{
.caption = DIAG_CAPTION,
.dir = QDir::homePath() + "/Desktop/" + shortcutName,
.filter = "Shortcuts (*. " + shortcutExtension() + ")"
.dir = QDir::homePath() + u"/Desktop/"_s + shortcutName,
.filter = u"Shortcuts (*. "_s + shortcutExtension() + u")"_s
};
QString selectedPath = mCore.requestSaveFilePath(sfr);

Expand All @@ -122,8 +122,8 @@ Qx::Error CLink::perform()
}
else
{
if(!selectedPath.endsWith("." + shortcutExtension(), Qt::CaseInsensitive))
selectedPath += "." + shortcutExtension();
if(!selectedPath.endsWith(u"."_s + shortcutExtension(), Qt::CaseInsensitive))
selectedPath += u"."_s + shortcutExtension();

mCore.logEvent(NAME, LOG_EVENT_SEL_PATH.arg(QDir::toNativeSeparators(selectedPath)));
QFileInfo pathInfo(selectedPath);
Expand Down
40 changes: 20 additions & 20 deletions app/src/command/c-link.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class QX_ERROR_TYPE(CLinkError, "CLinkError", 1212)
//-Class Variables-------------------------------------------------------------
private:
static inline const QHash<Type, QString> ERR_STRINGS{
{NoError, QSL("")},
{InvalidPath, QSL("The provided shortcut path is not valid or a location where you do not have permissions to create a shortcut.")},
{IconInstallFailed, QSL("Failed to install icons required for the shortcut.")}
{NoError, u""_s},
{InvalidPath, u"The provided shortcut path is not valid or a location where you do not have permissions to create a shortcut."_s},
{IconInstallFailed, u"Failed to install icons required for the shortcut."_s}
};

//-Instance Variables-------------------------------------------------------------
Expand Down Expand Up @@ -54,37 +54,37 @@ class CLink : public TitleCommand
//-Class Variables------------------------------------------------------------------------------------------------------
private:
// Status
static inline const QString STATUS_LINK = QSL("Linking");
static inline const QString STATUS_LINK = u"Linking"_s;

// General
static inline const QString DIAG_CAPTION = QSL("Select a shortcut destination...");
static inline const QString DIAG_CAPTION = u"Select a shortcut destination..."_s;

// Logging - Messages
static inline const QString LOG_EVENT_FILE_PATH = QSL("Shortcut path provided is for a file");
static inline const QString LOG_EVENT_DIR_PATH = QSL("Shortcut path provided is for a folder");
static inline const QString LOG_EVENT_NO_PATH = QSL("No shortcut path provided, user will be prompted");
static inline const QString LOG_EVENT_SEL_PATH = QSL("Shortcut path selected: %1");
static inline const QString LOG_EVENT_DIAG_CANCEL = QSL("Shortcut path selection canceled.");
static inline const QString LOG_EVENT_CREATED_DIR_PATH = QSL("Created directories for shortcut: %1");
static inline const QString LOG_EVENT_CREATED_SHORTCUT = QSL("Created shortcut to %1 at %2");
static inline const QString LOG_EVENT_FILE_PATH = u"Shortcut path provided is for a file"_s;
static inline const QString LOG_EVENT_DIR_PATH = u"Shortcut path provided is for a folder"_s;
static inline const QString LOG_EVENT_NO_PATH = u"No shortcut path provided, user will be prompted"_s;
static inline const QString LOG_EVENT_SEL_PATH = u"Shortcut path selected: %1"_s;
static inline const QString LOG_EVENT_DIAG_CANCEL = u"Shortcut path selection canceled."_s;
static inline const QString LOG_EVENT_CREATED_DIR_PATH = u"Created directories for shortcut: %1"_s;
static inline const QString LOG_EVENT_CREATED_SHORTCUT = u"Created shortcut to %1 at %2"_s;

// Command line option strings
static inline const QString CL_OPT_PATH_S_NAME = QSL("p");
static inline const QString CL_OPT_PATH_L_NAME = QSL("path");
static inline const QString CL_OPT_PATH_DESC = QSL("Path to new shortcut. Path's ending with "".lnk""//"".desktop"" will be interpreted as a named shortcut file. "
"Any other path will be interpreted as a directory and the title will automatically be used "
"as the filename");
static inline const QString CL_OPT_PATH_S_NAME = u"p"_s;
static inline const QString CL_OPT_PATH_L_NAME = u"path"_s;
static inline const QString CL_OPT_PATH_DESC = u"Path to new shortcut. Path's ending with "".lnk""//"".desktop"" will be interpreted as a named shortcut file. "
"Any other path will be interpreted as a directory and the title will automatically be used "
"as the filename"_s;

// Command line options
static inline const QCommandLineOption CL_OPTION_PATH{{CL_OPT_PATH_S_NAME, CL_OPT_PATH_L_NAME}, CL_OPT_PATH_DESC, "path"}; // Takes value
static inline const QCommandLineOption CL_OPTION_PATH{{CL_OPT_PATH_S_NAME, CL_OPT_PATH_L_NAME}, CL_OPT_PATH_DESC, u"path"s}; // Takes value

static inline const QList<const QCommandLineOption*> CL_OPTIONS_SPECIFIC{&CL_OPTION_PATH};
static inline const QSet<const QCommandLineOption*> CL_OPTIONS_REQUIRED{};

public:
// Meta
static inline const QString NAME = QSL("link");
static inline const QString DESCRIPTION = QSL("Creates a shortcut to a Flashpoint title.");
static inline const QString NAME = u"link"_s;
static inline const QString DESCRIPTION = u"Creates a shortcut to a Flashpoint title."_s;

//-Constructor----------------------------------------------------------------------------------------------------------
public:
Expand Down
8 changes: 4 additions & 4 deletions app/src/command/c-link_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id)
Qx::ApplicationDesktopEntry ade;
ade.setName(name);
ade.setIcon(PROJECT_SHORT_NAME);
QString args = CPlay::NAME + " -" + TitleCommand::CL_OPTION_ID.names().constFirst() + ' ' + id.toString(QUuid::WithoutBraces);
QString args = CPlay::NAME + u" -"_s + TitleCommand::CL_OPTION_ID.names().constFirst() + ' ' + id.toString(QUuid::WithoutBraces);
ade.setExec(CLIFP_DIR_PATH + '/' + CLIFP_CUR_APP_FILENAME + ' ' + args);
ade.setPath(CLIFP_DIR_PATH);
ade.setComment("Generated by " PROJECT_SHORT_NAME " " PROJECT_VERSION_STR);
ade.setComment(u"Generated by "_s PROJECT_SHORT_NAME " " PROJECT_VERSION_STR);

// Create entry
QString filename = QStringLiteral("org.flashpoint.clifp.") + id.toString(QUuid::WithoutBraces) +
QString filename = u"org.flashpoint.clifp."_s + id.toString(QUuid::WithoutBraces) +
'.' + shortcutExtension();
QString fullEntryPath = dir.absoluteFilePath(filename);
Qx::IoOpReport writeReport = Qx::DesktopEntry::writeToDisk(fullEntryPath, &ade);
Expand All @@ -52,4 +52,4 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id)
return CLinkError();
}

QString CLink::shortcutExtension() const { return "desktop"; };
QString CLink::shortcutExtension() const { return u"desktop"_s; };
6 changes: 3 additions & 3 deletions app/src/command/c-link_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id)
{
// Create shortcut properties
Qx::ShortcutProperties sp;
sp.target = CLIFP_DIR_PATH + "/" + CLIFP_CUR_APP_FILENAME;
sp.targetArgs = CPlay::NAME + " -" + TitleCommand::CL_OPTION_ID.names().constFirst() + " " + id.toString(QUuid::WithoutBraces);
sp.target = CLIFP_DIR_PATH + '/' + CLIFP_CUR_APP_FILENAME;
sp.targetArgs = CPlay::NAME + u" -"_s + TitleCommand::CL_OPTION_ID.names().constFirst() + ' ' + id.toString(QUuid::WithoutBraces);
sp.comment = name;

// Create shortcut
Expand All @@ -39,4 +39,4 @@ Qx::Error CLink::createShortcut(const QString& name, const QDir& dir, QUuid id)
return CLinkError();
}

QString CLink::shortcutExtension() const { return "lnk"; };
QString CLink::shortcutExtension() const { return u"lnk"_s; };
2 changes: 1 addition & 1 deletion app/src/command/c-play.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Qx::Error CPlay::enqueueAdditionalApp(const Fp::AddApp& addApp, const QString& p
{
TExtra* extraTask = new TExtra(&mCore);
extraTask->setStage(taskStage);
extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + "/" + addApp.launchCommand()));
extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + '/' + addApp.launchCommand()));

mCore.enqueueSingleTask(extraTask);
}
Expand Down
18 changes: 9 additions & 9 deletions app/src/command/c-play.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ class CPlay : public TitleCommand
//-Class Variables------------------------------------------------------------------------------------------------------
private:
// Status
static inline const QString STATUS_PLAY = QSL("Playing");
static inline const QString STATUS_PLAY = u"Playing"_s;

// Logging - Messages
static inline const QString LOG_EVENT_ENQ_AUTO = QSL("Enqueuing automatic tasks...");
static inline const QString LOG_EVENT_ID_MATCH_TITLE = QSL("ID matches main title: %1");
static inline const QString LOG_EVENT_ID_MATCH_ADDAPP = QSL("ID matches additional app: %1 (Child of %2)");
static inline const QString LOG_EVENT_QUEUE_CLEARED = QSL("Previous queue entries cleared due to auto task being a Message/Extra");
static inline const QString LOG_EVENT_FOUND_AUTORUN = QSL("Found autorun-before additional app: %1");
static inline const QString LOG_EVENT_DATA_PACK_TITLE = QSL("Selected title uses a data pack");
static inline const QString LOG_EVENT_ENQ_AUTO = u"Enqueuing automatic tasks..."_s;
static inline const QString LOG_EVENT_ID_MATCH_TITLE = u"ID matches main title: %1"_s;
static inline const QString LOG_EVENT_ID_MATCH_ADDAPP = u"ID matches additional app: %1 (Child of %2)"_s;
static inline const QString LOG_EVENT_QUEUE_CLEARED = u"Previous queue entries cleared due to auto task being a Message/Extra"_s;
static inline const QString LOG_EVENT_FOUND_AUTORUN = u"Found autorun-before additional app: %1"_s;
static inline const QString LOG_EVENT_DATA_PACK_TITLE = u"Selected title uses a data pack"_s;

public:
// Meta
static inline const QString NAME = QSL("play");
static inline const QString DESCRIPTION = QSL("Launch a title and all of it's support applications, in the same manner as using the GUI");
static inline const QString NAME = u"play"_s;
static inline const QString DESCRIPTION = u"Launch a title and all of it's support applications, in the same manner as using the GUI"_s;

//-Constructor----------------------------------------------------------------------------------------------------------
public:
Expand Down
8 changes: 4 additions & 4 deletions app/src/command/c-prepare.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class CPrepare : public TitleCommand
//-Class Variables------------------------------------------------------------------------------------------------------
private:
// Status
static inline const QString STATUS_PREPARE = QSL("Preparing");
static inline const QString STATUS_PREPARE = u"Preparing"_s;

// Logging - Errors
static inline const QString LOG_WRN_PREP_NOT_DATA_PACK = QSL("The provided ID does not belong to a Data Pack based game (%1). No action will be taken.");
static inline const QString LOG_WRN_PREP_NOT_DATA_PACK = u"The provided ID does not belong to a Data Pack based game (%1). No action will be taken."_s;

public:
// Meta
static inline const QString NAME = QSL("prepare");
static inline const QString DESCRIPTION = QSL("Initializes Flashpoint for playing the provided Data Pack based title by UUID. If the title does not use a Data Pack this command has no effect.");
static inline const QString NAME = u"prepare"_s;
static inline const QString DESCRIPTION = u"Initializes Flashpoint for playing the provided Data Pack based title by UUID. If the title does not use a Data Pack this command has no effect."_s;

//-Constructor----------------------------------------------------------------------------------------------------------
public:
Expand Down
2 changes: 1 addition & 1 deletion app/src/command/c-run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Qx::Error CRun::perform()
QFileInfo inputInfo = QFileInfo(mCore.fpInstall().fullPath() + '/' + inputPath);

TExec* runTask = new TExec(&mCore);
runTask->setIdentifier(NAME + " program");
runTask->setIdentifier(NAME + u" program"_s);
runTask->setStage(Task::Stage::Primary);
runTask->setExecutable(inputInfo.canonicalFilePath());
runTask->setDirectory(inputInfo.canonicalPath());
Expand Down
26 changes: 13 additions & 13 deletions app/src/command/c-run.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class QX_ERROR_TYPE(CRunError, "CRunError", 1215)
//-Class Variables-------------------------------------------------------------
private:
static inline const QHash<Type, QString> ERR_STRINGS{
{NoError, QSL("")},
{MissingApp, QSL("No application to run was provided.")}
{NoError, u""_s},
{MissingApp, u"No application to run was provided."_s}
};

//-Instance Variables-------------------------------------------------------------
Expand Down Expand Up @@ -52,26 +52,26 @@ class CRun : public Command
//-Class Variables------------------------------------------------------------------------------------------------------
private:
// Status
static inline const QString STATUS_RUN = QSL("Running");
static inline const QString STATUS_RUN = u"Running"_s;

// Command line option strings
static inline const QString CL_OPT_APP_S_NAME = QSL("a");
static inline const QString CL_OPT_APP_L_NAME = QSL("app");
static inline const QString CL_OPT_APP_DESC = QSL("Relative (to Flashpoint directory) path of application to launch.");
static inline const QString CL_OPT_APP_S_NAME = u"a"_s;
static inline const QString CL_OPT_APP_L_NAME = u"app"_s;
static inline const QString CL_OPT_APP_DESC = u"Relative (to Flashpoint directory) path of application to launch."_s;

static inline const QString CL_OPT_PARAM_S_NAME = QSL("p");
static inline const QString CL_OPT_PARAM_L_NAME = QSL("param");
static inline const QString CL_OPT_PARAM_DESC = QSL("Command-line parameters to use when starting the application.");
static inline const QString CL_OPT_PARAM_S_NAME = u"p"_s;
static inline const QString CL_OPT_PARAM_L_NAME = u"param"_s;
static inline const QString CL_OPT_PARAM_DESC = u"Command-line parameters to use when starting the application."_s;

// Command line options
static inline const QCommandLineOption CL_OPTION_APP{{CL_OPT_APP_S_NAME, CL_OPT_APP_L_NAME}, CL_OPT_APP_DESC, "application"}; // Takes value
static inline const QCommandLineOption CL_OPTION_PARAM{{CL_OPT_PARAM_S_NAME, CL_OPT_PARAM_L_NAME}, CL_OPT_PARAM_DESC, "parameters"}; // Takes value
static inline const QCommandLineOption CL_OPTION_APP{{CL_OPT_APP_S_NAME, CL_OPT_APP_L_NAME}, CL_OPT_APP_DESC, u"application"_s}; // Takes value
static inline const QCommandLineOption CL_OPTION_PARAM{{CL_OPT_PARAM_S_NAME, CL_OPT_PARAM_L_NAME}, CL_OPT_PARAM_DESC, u"parameters"_s}; // Takes value
static inline const QList<const QCommandLineOption*> CL_OPTIONS_SPECIFIC{&CL_OPTION_APP, &CL_OPTION_PARAM};

public:
// Meta
static inline const QString NAME = QSL("run");
static inline const QString DESCRIPTION = QSL("Start Flashpoint's webserver and then execute the provided application");
static inline const QString NAME = u"run"_s;
static inline const QString DESCRIPTION = u"Start Flashpoint's webserver and then execute the provided application"_s;

//-Constructor----------------------------------------------------------------------------------------------------------
public:
Expand Down
2 changes: 1 addition & 1 deletion app/src/command/c-show.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Qx::Error CShow::perform()
{
TExtra* extraTask = new TExtra(&mCore);
extraTask->setStage(Task::Stage::Primary);
extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + "/" + mParser.value(CL_OPTION_EXTRA)));
extraTask->setDirectory(QDir(mCore.fpInstall().extrasDirectory().absolutePath() + '/' + mParser.value(CL_OPTION_EXTRA)));

mCore.enqueueSingleTask(extraTask);
mCore.setStatus(STATUS_SHOW_EXTRA, extraTask->directory().dirName());
Expand Down
Loading

0 comments on commit 646e7bf

Please sign in to comment.