Skip to content

Commit f2a22f1

Browse files
committed
add some ComboBox and LineInput widget for setting custom runners later
1 parent 5bc0903 commit f2a22f1

File tree

3 files changed

+206
-10
lines changed

3 files changed

+206
-10
lines changed

src/TombRaiderLinuxLauncher.cpp

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent)
2323
ui->setupUi(this);
2424

2525
// Button signal connections
26+
// List tab
2627
connect(ui->pushButtonLink, SIGNAL(clicked()), this, SLOT(linkClicked()));
2728
connect(ui->pushButtonDownload, SIGNAL(clicked()),
2829
this, SLOT(downloadClicked()));
@@ -36,6 +37,16 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent)
3637
connect(ui->listWidgetModds, SIGNAL(itemSelectionChanged()),
3738
this, SLOT(onListItemSelected()));
3839

40+
// Settings tab
41+
connect(ui->commandLinkButtonGSSave, SIGNAL(clicked()),
42+
this, SLOT(GlobalSaveClicked()));
43+
connect(ui->commandLinkButtonGSReset, SIGNAL(clicked()),
44+
this, SLOT(GlobalResetClicked()));
45+
connect(ui->commandLinkButtonLSSave, SIGNAL(clicked()),
46+
this, SLOT(LevelSaveClicked()));
47+
connect(ui->commandLinkButtonLSReset, SIGNAL(clicked()),
48+
this, SLOT(LevelResetClicked()));
49+
3950
// Progress bar signal connection
4051
connect(&Controller::getInstance(), SIGNAL(controllerTickSignal()),
4152
this, SLOT(workTick()));
@@ -314,8 +325,10 @@ void TombRaiderLinuxLauncher::sortByReleaseDate() {
314325

315326
void TombRaiderLinuxLauncher::readSavedSettings() {
316327
const QString gamePathValue = m_settings.value("gamePath").toString();
328+
ui->tableWidgetSetup->item(0, 0)->setText(gamePathValue);
317329
qDebug() << "Read game path value:" << gamePathValue;
318330
const QString levelPathValue = m_settings.value("levelPath").toString();
331+
ui->tableWidgetSetup->item(1, 0)->setText(levelPathValue);
319332
qDebug() << "Read level path value:" << levelPathValue;
320333
controller.setup(levelPathValue, gamePathValue);
321334
}
@@ -379,7 +392,7 @@ void TombRaiderLinuxLauncher::levelDirSelected(QListWidgetItem *selectedItem) {
379392
ui->pushButtonLink->setEnabled(false);
380393
ui->pushButtonInfo->setEnabled(true);
381394
ui->pushButtonDownload->setEnabled(true);
382-
} else if (state == -1) {
395+
} else {
383396
ui->pushButtonLink->setEnabled(false);
384397
ui->pushButtonInfo->setEnabled(false);
385398
ui->pushButtonDownload->setEnabled(false);
@@ -393,9 +406,23 @@ void TombRaiderLinuxLauncher::onListItemSelected() {
393406
int id = selectedItem->data(Qt::UserRole).toInt();
394407
if (id < 0) { // its the original game
395408
originalSelected(selectedItem);
396-
} else if (id > 0) { // do not know what to do with 0
409+
} else {
397410
levelDirSelected(selectedItem);
398411
}
412+
ui->lineEditCustomCommand->setEnabled(true);
413+
ui->lineEditCustomCommand->setText(
414+
m_settings.value(QString("level%1/CustomCommand")
415+
.arg(id)).toString());
416+
ui->lineEditEnvironmentVariables->setEnabled(true);
417+
ui->lineEditEnvironmentVariables->setText(
418+
m_settings.value(QString("level%1/EnvironmentVariables")
419+
.arg(id)).toString());
420+
ui->comboBoxRunnerType->setEnabled(true);
421+
ui->comboBoxRunnerType->setCurrentIndex(
422+
m_settings.value(QString("level%1/RunnerType")
423+
.arg(id)).toInt());
424+
ui->commandLinkButtonLSSave->setEnabled(true);
425+
ui->commandLinkButtonLSReset->setEnabled(true);
399426
}
400427
}
401428

@@ -557,6 +584,32 @@ void TombRaiderLinuxLauncher::downloadError(int status) {
557584
msgBox.exec();
558585
}
559586

587+
void TombRaiderLinuxLauncher::GlobalSaveClicked() {
588+
m_settings.setValue("gamePath" , ui->tableWidgetSetup->item(0, 0)->text());
589+
m_settings.setValue("levelPath" , ui->tableWidgetSetup->item(1, 0)->text());
590+
}
591+
void TombRaiderLinuxLauncher::GlobalResetClicked() {
592+
ui->tableWidgetSetup->item(0, 0)->setText(
593+
m_settings.value("gamePath").toString());
594+
ui->tableWidgetSetup->item(1, 0)->setText(
595+
m_settings.value("levelPath").toString());
596+
}
597+
598+
void TombRaiderLinuxLauncher::LevelSaveClicked() {
599+
int id = ui->listWidgetModds->currentItem()->data(Qt::UserRole).toInt();
600+
601+
m_settings.setValue(QString("level%1/CustomCommand")
602+
.arg(id), ui->lineEditCustomCommand->text());
603+
604+
m_settings.setValue(QString("level%1/EnvironmentVariables")
605+
.arg(id), ui->lineEditEnvironmentVariables->text());
606+
607+
m_settings.setValue(QString("level%1/RunnerType")
608+
.arg(id), ui->comboBoxRunnerType->currentIndex());
609+
}
610+
void TombRaiderLinuxLauncher::LevelResetClicked() {
611+
}
612+
560613
TombRaiderLinuxLauncher::~TombRaiderLinuxLauncher() {
561614
delete ui;
562615
}

src/TombRaiderLinuxLauncher.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ class TombRaiderLinuxLauncher : public QMainWindow {
116116
*/
117117
void sortByReleaseDate();
118118

119+
void GlobalSaveClicked();
120+
void GlobalResetClicked();
121+
void LevelSaveClicked();
122+
void LevelResetClicked();
123+
119124
private:
120125
/**
121126
*

src/TombRaiderLinuxLauncher.ui

Lines changed: 146 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,20 +1093,158 @@
10931093
</widget>
10941094
</item>
10951095
<item>
1096-
<widget class="QGraphicsView" name="graphicsViewLevelSetup"/>
1096+
<widget class="QFrame" name="frameLevelSetupSettings">
1097+
<property name="sizePolicy">
1098+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
1099+
<horstretch>0</horstretch>
1100+
<verstretch>0</verstretch>
1101+
</sizepolicy>
1102+
</property>
1103+
<property name="frameShape">
1104+
<enum>QFrame::StyledPanel</enum>
1105+
</property>
1106+
<property name="frameShadow">
1107+
<enum>QFrame::Raised</enum>
1108+
</property>
1109+
<layout class="QVBoxLayout" name="verticalLayout_14">
1110+
<item>
1111+
<widget class="QWidget" name="widgetCustomCommand" native="true">
1112+
<layout class="QHBoxLayout" name="horizontalLayout_17">
1113+
<item>
1114+
<widget class="QLabel" name="labelCustomCommand">
1115+
<property name="text">
1116+
<string>Custom Command</string>
1117+
</property>
1118+
</widget>
1119+
</item>
1120+
<item>
1121+
<widget class="QLineEdit" name="lineEditCustomCommand">
1122+
<property name="enabled">
1123+
<bool>false</bool>
1124+
</property>
1125+
</widget>
1126+
</item>
1127+
</layout>
1128+
</widget>
1129+
</item>
1130+
<item>
1131+
<widget class="QWidget" name="widgetEnvironmentVariables" native="true">
1132+
<layout class="QHBoxLayout" name="horizontalLayout_12">
1133+
<item>
1134+
<widget class="QLabel" name="labelEnvironmentVariables">
1135+
<property name="text">
1136+
<string>Environment Variables</string>
1137+
</property>
1138+
</widget>
1139+
</item>
1140+
<item>
1141+
<widget class="QLineEdit" name="lineEditEnvironmentVariables">
1142+
<property name="enabled">
1143+
<bool>false</bool>
1144+
</property>
1145+
</widget>
1146+
</item>
1147+
</layout>
1148+
</widget>
1149+
</item>
1150+
<item>
1151+
<widget class="QWidget" name="widgetRunnerType" native="true">
1152+
<layout class="QHBoxLayout" name="horizontalLayout_13">
1153+
<item>
1154+
<widget class="QLabel" name="labelRunnerType">
1155+
<property name="text">
1156+
<string>Runner Type</string>
1157+
</property>
1158+
</widget>
1159+
</item>
1160+
<item>
1161+
<widget class="QComboBox" name="comboBoxRunnerType">
1162+
<property name="enabled">
1163+
<bool>false</bool>
1164+
</property>
1165+
<property name="minimumSize">
1166+
<size>
1167+
<width>120</width>
1168+
<height>0</height>
1169+
</size>
1170+
</property>
1171+
<item>
1172+
<property name="text">
1173+
<string>Link and exit</string>
1174+
</property>
1175+
</item>
1176+
<item>
1177+
<property name="text">
1178+
<string>Just link</string>
1179+
</property>
1180+
</item>
1181+
<item>
1182+
<property name="text">
1183+
<string>Wine</string>
1184+
</property>
1185+
</item>
1186+
<item>
1187+
<property name="text">
1188+
<string>Lutris</string>
1189+
</property>
1190+
</item>
1191+
<item>
1192+
<property name="text">
1193+
<string>Steam</string>
1194+
</property>
1195+
</item>
1196+
</widget>
1197+
</item>
1198+
<item>
1199+
<spacer name="horizontalSpacerRunnerType">
1200+
<property name="orientation">
1201+
<enum>Qt::Horizontal</enum>
1202+
</property>
1203+
<property name="sizeHint" stdset="0">
1204+
<size>
1205+
<width>40</width>
1206+
<height>20</height>
1207+
</size>
1208+
</property>
1209+
</spacer>
1210+
</item>
1211+
</layout>
1212+
</widget>
1213+
</item>
1214+
<item>
1215+
<spacer name="verticalSpacerLevelSetup">
1216+
<property name="orientation">
1217+
<enum>Qt::Vertical</enum>
1218+
</property>
1219+
<property name="sizeHint" stdset="0">
1220+
<size>
1221+
<width>20</width>
1222+
<height>40</height>
1223+
</size>
1224+
</property>
1225+
</spacer>
1226+
</item>
1227+
</layout>
1228+
</widget>
10971229
</item>
10981230
<item>
10991231
<widget class="QWidget" name="levelControl" native="true">
11001232
<layout class="QHBoxLayout" name="horizontalLayout_14">
11011233
<item>
11021234
<widget class="QCommandLinkButton" name="commandLinkButtonLSSave">
1235+
<property name="enabled">
1236+
<bool>false</bool>
1237+
</property>
11031238
<property name="text">
11041239
<string>Save</string>
11051240
</property>
11061241
</widget>
11071242
</item>
11081243
<item>
11091244
<widget class="QCommandLinkButton" name="commandLinkButtonLSReset">
1245+
<property name="enabled">
1246+
<bool>false</bool>
1247+
</property>
11101248
<property name="text">
11111249
<string>Reset</string>
11121250
</property>
@@ -1379,13 +1517,13 @@ li.checked::marker { content: &quot;\2612&quot;; }
13791517
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
13801518
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
13811519
p, li { white-space: pre-wrap; }
1382-
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
1383-
&lt;h3 style=&quot; margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:large; font-weight:600;&quot;&gt;About&lt;/span&gt;&lt;/h3&gt;
1384-
&lt;h4 style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:medium; font-weight:600;&quot;&gt;Tomb Raider Linux Launcher&lt;/span&gt;&lt;/h4&gt;
1385-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Welcome to the &lt;span style=&quot; font-weight:600;&quot;&gt;Tomb Raider Linux Launcher&lt;/span&gt;! This application is designed to provide a streamlined and convenient way to launch your favorite Tomb Raider games on Linux. Currently, the launcher supports Tomb Raider 1-5 and trle.net but not TEN at the moment.&lt;/p&gt;
1386-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Our aim is to enhance your gaming experience by offering a user-friendly interface that simplifies game management and launching. The launcher is still a work in progress, and we are actively working on adding support for more games and improving functionality.&lt;/p&gt;
1387-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Stay tuned for updates and new features as we continue to develop and refine the Tomb Raider Linux Launcher. Your feedback and suggestions are always welcome to help us create the best possible tool for Tomb Raider fans.&lt;/p&gt;
1388-
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Thank you for using the Tomb Raider Linux Launcher!&lt;/p&gt;
1520+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Liberation Sans'; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
1521+
&lt;h3 style=&quot; margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:large; font-weight:600;&quot;&gt;About&lt;/span&gt;&lt;/h3&gt;
1522+
&lt;h4 style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:medium; font-weight:600;&quot;&gt;Tomb Raider Linux Launcher&lt;/span&gt;&lt;/h4&gt;
1523+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Welcome to the &lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-weight:600;&quot;&gt;Tomb Raider Linux Launcher&lt;/span&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;! This application is designed to provide a streamlined and convenient way to launch your favorite Tomb Raider games on Linux. Currently, the launcher supports Tomb Raider 1-5 and trle.net but not TEN at the moment.&lt;/span&gt;&lt;/p&gt;
1524+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Our aim is to enhance your gaming experience by offering a user-friendly interface that simplifies game management and launching. The launcher is still a work in progress, and we are actively working on adding support for more games and improving functionality.&lt;/span&gt;&lt;/p&gt;
1525+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Stay tuned for updates and new features as we continue to develop and refine the Tomb Raider Linux Launcher. Your feedback and suggestions are always welcome to help us create the best possible tool for Tomb Raider fans.&lt;/span&gt;&lt;/p&gt;
1526+
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Thank you for using the Tomb Raider Linux Launcher!&lt;/span&gt;&lt;/p&gt;
13891527
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/pictures/Lara3.jpg&quot; width=&quot;400&quot; height=&quot;350&quot; /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
13901528
</property>
13911529
</widget>

0 commit comments

Comments
 (0)