Skip to content

Commit 19381f8

Browse files
authored
Fix and hug all trees (#2)
* use type for GameFileTree * clean-up some down the memory lane * use QSet<QString> for child names on every node besides Qlist for child pointers * fix subDir matching * make first test * test work it fail still when an zip file have multiple executables * fix levelListProxy index bug, and multiple patterns tree bug * fix relative link to executable * setup nvim lsp better * fix codacy explicit warning
1 parent f14d54f commit 19381f8

22 files changed

+533
-399
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ set(SOURCES_MC
113113
src/Controller.cpp
114114
src/Data.hpp
115115
src/Data.cpp
116+
src/Dialog.hpp
117+
src/Dialog.cpp
116118
src/FileManager.hpp
117119
src/FileManager.cpp
118120
src/GameFileTree.hpp
@@ -134,6 +136,7 @@ set(SOURCES_MC
134136
src/assert.hpp
135137
src/binary.hpp
136138
src/binary.cpp
139+
src/gameFileTreeData.hpp
137140
src/main.cpp
138141
src/staticData.hpp
139142
)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Ensure the following are installed on your Linux desktop:
2727

2828
- `curl` (7.71.0 or newer)
2929
- `OpenSSL`
30-
- `Qt5`
30+
- `Qt6`
3131

3232
```shell
33-
sudo pacman -S qt5-wayland qt5-webengine qt5-imageformats
33+
sudo pacman -S qt6-wayland qt6-webengine qt6-imageformats
3434
```
3535

3636
### Build

setup_nvim_lsp.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ git config submodule.libs/miniz.ignore all
1818
git config submodule.libs/libbacktrace.ignore all
1919

2020
./build.sh
21+
22+
#clangd complain
23+
cp build/compile_commands.json compile_commands.json
24+
sed -i 's/-mno-direct-extern-access[ ]*//g' compile_commands.json

src/Data.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ ZipData Data::getDownload(const int id) {
225225
result.setURL(query.value("Zip.url").toString());
226226
result.setVersion(query.value("Zip.version").toInt());
227227
result.setType(query.value("Info.type").toInt());
228+
result.setId(id);
228229
result.setRelease(query.value("Zip.release").toString());
229230
} else {
230231
qDebug() << "No results found for Level ID:" << id;

src/Data.hpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,26 @@ struct ZipData {
198198
* @brief This sets the zip file name metadata.
199199
* @param version File version from trcustoms.org
200200
*/
201-
inline void setVersion(const qint64 version) {
201+
inline void setVersion(const quint64 version) {
202202
m_version = version;
203203
}
204204

205205
/**
206-
* @brief This sets the zip file name metadata.
206+
* @brief This sets the level type metadata.
207207
* @param type Level type.
208208
*/
209-
inline void setType(const qint64 type) {
209+
inline void setType(const quint64 type) {
210210
m_type = type;
211211
}
212212

213+
/**
214+
* @brief This sets the id metadata.
215+
* @param type Level is.
216+
*/
217+
inline void setId(const quint64 id) {
218+
m_id = id;
219+
}
220+
213221
/**
214222
* @brief This sets the zip file name metadata.
215223
* @param release date of file release.
@@ -222,8 +230,10 @@ struct ZipData {
222230
float m_mebibyteSize; ///< The archive file size in MiB.
223231
QString m_MD5sum; ///< The archive md5sum.
224232
QString m_URL; ///< The URL of the TRLE level download.
225-
int m_version; ///< The Version of trcustoms archive file.
226-
int m_type; ///< The TRLE type used to identify a executable.
233+
quint64 m_version; ///< The Version of trcustoms archive file.
234+
quint64 m_type; ///< The TRLE type used to identify a executable.
235+
quint64 m_id; ///< The Level id.
236+
QString m_host; ///< The host TRLE or TRCUSTOMS.
227237
QString m_release; ///< The The date of file release from trcustoms.
228238
};
229239

src/Dialog.cpp

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/* TombRaiderLinuxLauncher
2+
* Martin Bångens Copyright (C) 2025
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation, either version 3 of the License, or
6+
* (at your option) any later version.
7+
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*/
13+
14+
#include "../src/Dialog.hpp"
15+
16+
17+
Dialog::Dialog(QWidget *parent)
18+
: QWidget(parent),
19+
m_layout(new QVBoxLayout(this)),
20+
m_label(new QLabel(this)),
21+
m_optionContainer(new QWidget(this)),
22+
m_optionLayout(new QVBoxLayout(m_optionContainer)),
23+
m_buttonGroup(new QButtonGroup(this)),
24+
m_okButton(new QPushButton("OK", this))
25+
{
26+
m_layout->addWidget(m_label);
27+
m_layout->addWidget(m_optionContainer);
28+
m_layout->addWidget(m_okButton);
29+
30+
connect(m_okButton, &QPushButton::clicked, this, [this]() {
31+
emit okClicked();
32+
});
33+
}
34+
35+
void Dialog::setMessage(const QString &text) {
36+
m_label->setText(text);
37+
}
38+
39+
void Dialog::setOptions(const QStringList &options) {
40+
// Clear old options
41+
qDeleteAll(m_buttonGroup->buttons());
42+
QLayoutItem *child;
43+
while ((child = m_optionLayout->takeAt(0)) != nullptr) {
44+
delete child->widget();
45+
delete child;
46+
}
47+
48+
if (options.isEmpty()) {
49+
m_optionContainer->hide();
50+
return;
51+
}
52+
53+
m_optionContainer->show();
54+
for (const QString &opt : options) {
55+
QRadioButton *rb = new QRadioButton(opt);
56+
m_buttonGroup->addButton(rb);
57+
m_optionLayout->addWidget(rb);
58+
}
59+
}
60+
61+
QString Dialog::selectedOption() const {
62+
auto btn = m_buttonGroup->checkedButton();
63+
return btn ? btn->text() : QString();
64+
}
65+

src/Dialog.hpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* TombRaiderLinuxLauncher
2+
* Martin Bångens Copyright (C) 2025
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation, either version 3 of the License, or
6+
* (at your option) any later version.
7+
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*/
13+
14+
#ifndef SRC_DIALOG_HPP_
15+
#define SRC_DIALOG_HPP_
16+
17+
#include <QVBoxLayout>
18+
#include <QLabel>
19+
#include <QPushButton>
20+
#include <QRadioButton>
21+
#include <QButtonGroup>
22+
#include <QWidget>
23+
24+
class Dialog : public QWidget {
25+
Q_OBJECT
26+
27+
public:
28+
explicit Dialog(QWidget* parent);
29+
void setMessage(const QString &text);
30+
void setOptions(const QStringList &options);
31+
QString selectedOption() const;
32+
33+
signals:
34+
void okClicked();
35+
36+
private:
37+
QVBoxLayout* m_layout;
38+
QLabel* m_label;
39+
QWidget* m_optionContainer;
40+
QVBoxLayout* m_optionLayout;
41+
QButtonGroup* m_buttonGroup;
42+
QPushButton* m_okButton;
43+
};
44+
45+
#endif // SRC_DIALOG_HPP_

0 commit comments

Comments
 (0)