@@ -20,6 +20,13 @@ CommandLineParser::CommandLineParser(const QString& type) : m_processStatus(0) {
2020 m_parser.setApplicationDescription (" Tomb Raider Linux Launcher" );
2121 m_parser.addHelpOption ();
2222
23+ // Fullscreen ------------
24+ QStringList fullscreenName;
25+ fullscreenName << " f" << " fullscreen" ;
26+ QCommandLineOption fullscreenOption (fullscreenName);
27+ fullscreenOption.setDescription (" Start in fullscreen" );
28+ m_parser.addOption (fullscreenOption);
29+
2330 // Original ------------
2431 QStringList showOriginalName;
2532 showOriginalName << " so" << " showOriginal" ;
@@ -38,9 +45,10 @@ CommandLineParser::CommandLineParser(const QString& type) : m_processStatus(0) {
3845 QStringList filterByClassName;
3946 filterByClassName << " fc" << " filterByClass" ;
4047 QCommandLineOption filterByClassOption (filterByClassName);
41- const QString filterByClassDesc =
42- " \n Filter levels by class. Allowed values:\n "
43- + m_class_options.join (" , " ) + " \n " ;
48+ const QString filterByClassDesc = QString (" %1%2%3" ).arg (
49+ " \n Filter levels by class. Allowed values:\n " ,
50+ m_class_options.join (" , " ),
51+ " \n " );
4452 filterByClassOption.setDescription (filterByClassDesc);
4553 filterByClassOption.setValueName (" class" );
4654 m_parser.addOption (filterByClassOption);
@@ -49,9 +57,10 @@ CommandLineParser::CommandLineParser(const QString& type) : m_processStatus(0) {
4957 QStringList filterByTypeName;
5058 filterByTypeName << " ft" << " filterByType" ;
5159 QCommandLineOption filterByTypeOption (filterByTypeName);
52- const QString filterByTypeDesc =
53- " Filter levels by TR game type. Allowed values:\n "
54- + m_type_options.join (" , " ) + " \n " ;
60+ const QString filterByTypeDesc = QString (" %1%2%3" ).arg (
61+ " Filter levels by TR game type. Allowed values:\n " ,
62+ m_type_options.join (" , " ),
63+ " \n " );
5564 filterByTypeOption.setDescription (filterByTypeDesc);
5665 filterByTypeOption.setValueName (" type" );
5766 m_parser.addOption (filterByTypeOption);
@@ -60,9 +69,10 @@ CommandLineParser::CommandLineParser(const QString& type) : m_processStatus(0) {
6069 QStringList filterByDifficultyName;
6170 filterByDifficultyName << " fd" << " filterByDifficulty" ;
6271 QCommandLineOption filterByDifficultyOption (filterByDifficultyName);
63- const QString filterByDifficultyDesc =
64- " Filter levels by difficulty. Allowed values:\n "
65- + m_type_options.join (" , " ) + " \n " ;
72+ const QString filterByDifficultyDesc = QString (" %1%2%3" ).arg (
73+ " Filter levels by difficulty. Allowed values:\n " ,
74+ m_type_options.join (" , " ),
75+ " \n " );
6676 filterByDifficultyOption.setDescription (filterByDifficultyDesc);
6777 filterByDifficultyOption.setValueName (" difficulty" );
6878 m_parser.addOption (filterByDifficultyOption);
@@ -72,9 +82,10 @@ CommandLineParser::CommandLineParser(const QString& type) : m_processStatus(0) {
7282 filterByDurationName << " fr" << " filterByDuration" ;
7383 QCommandLineOption filterByDurationOption (filterByDurationName);
7484
75- const QString filterByDurationDesc =
76- " Filter levels by duration. Allowed values:\n "
77- + m_type_options.join (" , " ) + " \n " ;
85+ const QString filterByDurationDesc = QString (" %1%2%3" ).arg (
86+ " Filter levels by duration. Allowed values:\n " ,
87+ m_type_options.join (" , " ),
88+ " \n " );
7889 filterByDurationOption.setDescription (filterByDurationDesc);
7990 filterByDurationOption.setValueName (" duration" );
8091 m_parser.addOption (filterByDurationOption);
@@ -111,17 +122,19 @@ CommandLineParser::CommandLineParser(const QString& type) : m_processStatus(0) {
111122 QStringList widescreenName;
112123 widescreenName << " w" << " widescreen" ;
113124 QCommandLineOption widescreenOption (widescreenName);
114- const QString widescreenDesc = " Set widescreen bit on original games,"
115- + QString (" probably not useful for TRLE" );
125+ const QString widescreenDesc = QString (" %1%2" ).arg (
126+ " Set widescreen bit on original games," ,
127+ " probably not useful for TRLE" );
116128 widescreenOption.setDescription (widescreenDesc);
117129 widescreenOption.setDefaultValue (" PATH" );
118130 m_parser.addOption (widescreenOption);
119131
120132 QStringList binaryName;
121133 binaryName << " b" << " binary" ;
122134 QCommandLineOption binaryOption (binaryName);
123- const QString binaryDesc = " Print PE Header Information,"
124- + QString (" to record Tomb Raider and TRLE binaries" );
135+ const QString binaryDesc = QString (" %1%2" ).arg (
136+ " Print PE Header Information," ,
137+ " to record Tomb Raider and TRLE binaries" );
125138 binaryOption.setDescription (binaryDesc);
126139 binaryOption.setDefaultValue (" PATH" );
127140 m_parser.addOption (binaryOption);
@@ -135,6 +148,10 @@ StartupSetting CommandLineParser::process(const QStringList& arguments) {
135148 m_parser.process (arguments);
136149
137150 StartupSetting settings;
151+
152+ if (m_parser.isSet (" fullscreen" ) == true ) {
153+ settings.fullscreen = true ;
154+ }
138155
139156 if (m_parser.isSet (" showInstalled" ) == true ) {
140157 settings.installed = true ;
@@ -149,7 +166,7 @@ StartupSetting CommandLineParser::process(const QStringList& arguments) {
149166 QString value = m_parser.value (" filterByClass" );
150167 int idx = m_class_options.indexOf (value, Qt::CaseInsensitive);
151168 if (idx != -1 ) {
152- settings.class_id = static_cast <quint8>(idx+ 1 );
169+ settings.class_id = static_cast <quint8>(idx + 1 );
153170 } else {
154171 qCritical ().noquote () << " Invalid class value:" << value
155172 << " \n Allowed:" << m_class_options.join (" , " );
@@ -162,7 +179,7 @@ StartupSetting CommandLineParser::process(const QStringList& arguments) {
162179 QString value = m_parser.value (" filterByType" );
163180 int idx = m_type_options.indexOf (value, Qt::CaseInsensitive);
164181 if (idx != -1 ) {
165- settings.type_id = static_cast <quint8>(idx);
182+ settings.type_id = static_cast <quint8>(idx + 1 );
166183 } else {
167184 qCritical ().noquote () << " Invalid type value:" << value
168185 << " \n Allowed:" << m_type_options.join (" , " );
@@ -175,7 +192,7 @@ StartupSetting CommandLineParser::process(const QStringList& arguments) {
175192 QString value = m_parser.value (" filterByDifficulty" );
176193 int idx = m_difficulty_options.indexOf (value, Qt::CaseInsensitive);
177194 if (idx != -1 ) {
178- settings.difficulty_id = static_cast <quint8>(idx);
195+ settings.difficulty_id = static_cast <quint8>(idx + 1 );
179196 } else {
180197 qCritical ().noquote () << " Invalid difficulty value:" << value
181198 << " \n Allowed:" << m_difficulty_options.join (" , " );
@@ -188,7 +205,7 @@ StartupSetting CommandLineParser::process(const QStringList& arguments) {
188205 QString value = m_parser.value (" filterByDuration" );
189206 int idx = m_duration_options.indexOf (value, Qt::CaseInsensitive);
190207 if (idx != -1 ) {
191- settings.duration_id = static_cast <quint8>(idx);
208+ settings.duration_id = static_cast <quint8>(idx + 1 );
192209 } else {
193210 qCritical ().noquote () << " Invalid duration value:" << value
194211 << " \n Allowed:" << m_duration_options.join (" , " );
@@ -208,7 +225,7 @@ StartupSetting CommandLineParser::process(const QStringList& arguments) {
208225
209226 QStringList setSorts;
210227 for (const QString &opt : sortOptions) {
211- if (m_parser.isSet (opt)) {
228+ if (m_parser.isSet (opt) == true ) {
212229 setSorts << opt;
213230 }
214231 }
0 commit comments