diff --git a/src/Controller.cpp b/src/Controller.cpp index 27286be..ea3bb73 100644 --- a/src/Controller.cpp +++ b/src/Controller.cpp @@ -110,12 +110,12 @@ void Controller::setupLevel(int id) emit setupLevelThreadSignal(id); } +// GUI Threads int Controller::checkGameDirectory(int id) { return model.checkGameDirectory(id); } -// GUI Thread void Controller::getList(QVector* list) { model.getList(list); diff --git a/src/TombRaiderLinuxLauncher.cpp b/src/TombRaiderLinuxLauncher.cpp index 079bcdc..0baea63 100644 --- a/src/TombRaiderLinuxLauncher.cpp +++ b/src/TombRaiderLinuxLauncher.cpp @@ -14,19 +14,17 @@ * along with this program. If not, see . */ + +#include "TombRaiderLinuxLauncher.h" #include #include #include -#include -#include -#include -#include -#include -#include #include #include -#include "TombRaiderLinuxLauncher.h" +#include +#include +#include #include "ui_TombRaiderLinuxLauncher.h" TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent) @@ -69,8 +67,67 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent) ui->pushButtonLink->setEnabled(false); ui->pushButtonInfo->setEnabled(false); ui->pushButtonDownload->setEnabled(false); + QWidget* filter_p = ui->filter; + QPushButton* filterButton_p = ui->filterButton; + filter_p->setVisible(false); + + connect(ui->filterButton, &QPushButton::clicked, + [filter_p, filterButton_p]() + { + bool isVisible = !filter_p->isVisible(); + filter_p->setVisible(isVisible); + + QIcon arrowDownIcon(":/icons/down-arrow.svg"); + QIcon arrowUpIcon(":/icons/up-arrow.svg"); + if (isVisible) + { + filterButton_p->setIcon(arrowUpIcon); + } + else + { + filterButton_p->setIcon(arrowDownIcon); + } + filterButton_p->setIconSize(QSize(16, 16)); + }); + + // Get the system palette + QPalette systemPalette = ui->filterButton->palette(); + + // Get system colors for different roles + QColor normalColor = systemPalette.color(QPalette::Button); + QColor hoverColor = systemPalette.color(QPalette::Highlight); + QColor textColor = systemPalette.color(QPalette::ButtonText); + QColor borderColor = systemPalette.color(QPalette::Mid); + + // Convert colors to strings + QString normalColorStr = normalColor.name(); + QString hoverColorStr = hoverColor.name(); + QString textColorStr = textColor.name(); + QString borderColorStr = borderColor.name(); + + // Setup button style + ui->filterButton->setStyleSheet( + QString( + "QPushButton {" + " background-color: %1;" + " color: %2;" + " border: 1px solid %4;" + " padding: 10px;" + "}" + "QPushButton:hover {" + " background-color: %3;" + "}") + .arg(normalColorStr, textColorStr, hoverColorStr, borderColorStr)); + + + QIcon arrowDownIcon(":/icons/down-arrow.svg"); + QIcon arrowUpIcon(":/icons/up-arrow.svg"); + + filterButton_p->setIcon(arrowDownIcon); + filterButton_p->setIconSize(QSize(16, 16)); // Read settings + QString value = settings.value("setup").toString(); if (value != "yes") setup(); @@ -104,7 +161,7 @@ void TombRaiderLinuxLauncher::askGame(int id) void TombRaiderLinuxLauncher::generateList() { const QString& directoryPath = settings.value("levelPath").toString(); - const QString& pictures = ":/pictures/pictures/"; + const QString& pictures = ":/pictures/"; QDir info(directoryPath); QFileInfoList entryInfoList = info.entryInfoList(); @@ -144,6 +201,7 @@ void TombRaiderLinuxLauncher::generateList() QVector list; controller.getList(&list); + sortListItemsByTitle(&list); const size_t s = list.size(); for (int i = 0; i < s; i++) { @@ -154,6 +212,25 @@ void TombRaiderLinuxLauncher::generateList() ui->listWidgetModds->addItem(wi); } } +/* +struct ListItemData { + QString title; + QString author; + QString type; + QString classIn; + QString releaseDate; + QString difficulty; + QString duration; +}; +*/ +void TombRaiderLinuxLauncher::sortListItemsByTitle(QVector* list) +{ + std::sort(list->begin(), list->end(), + [](const ListItemData& a, const ListItemData& b) + { + return a.title.toLower() < b.title.toLower(); + }); +} void TombRaiderLinuxLauncher::readSavedSettings() { @@ -335,6 +412,8 @@ void TombRaiderLinuxLauncher::walkthroughClicked() void TombRaiderLinuxLauncher::backClicked() { + ui->infoWebEngineView->setHtml(""); + ui->walkthroughWebEngineView->setHtml(""); if (ui->stackedWidget->currentWidget() == ui->stackedWidget->findChild("info")) { diff --git a/src/TombRaiderLinuxLauncher.h b/src/TombRaiderLinuxLauncher.h index 78ccb01..5684ec1 100644 --- a/src/TombRaiderLinuxLauncher.h +++ b/src/TombRaiderLinuxLauncher.h @@ -93,6 +93,10 @@ class TombRaiderLinuxLauncher : public QMainWindow * */ void readSavedSettings(); + /** + * + */ + void sortListItemsByTitle(QVector* list); Controller& controller = Controller::getInstance(); QSettings settings; diff --git a/src/TombRaiderLinuxLauncher.ui b/src/TombRaiderLinuxLauncher.ui index 260dd24..d10b0aa 100644 --- a/src/TombRaiderLinuxLauncher.ui +++ b/src/TombRaiderLinuxLauncher.ui @@ -53,6 +53,598 @@ + + + + + 0 + 70 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 1 + 1 + + + + Qt::LeftToRight + + + + 0 + + + QLayout::SetDefaultConstraint + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + <html><head/><body><p><span style=" font-size:12pt;">search</span></p></body></html> + + + + + + + + + + + Level + + + + + Author + + + + + + + + + 100 + 16777215 + + + + + 12 + + + + Go + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 45 + + + + + 45 + 16777215 + + + + <html><head/><body><p><span style=" font-size:12pt;">Class</span></p></body></html> + + + + + + + + - All - + + + + + Alien/Space + + + + + Atlantis + + + + + Base/Lab + + + + + Cambodia + + + + + Castle + + + + + Cave/Cat + + + + + City + + + + + Coastal + + + + + Cold/Snowy + + + + + Desert + + + + + Easter + + + + + Egypt + + + + + Fantasy/Surreal + + + + + Home + + + + + Ireland + + + + + Joke + + + + + Jungle + + + + + Kids + + + + + Library + + + + + Mystery/Horror + + + + + nc + + + + + Nordic/Celtic + + + + + Oriental + + + + + Persia + + + + + Pirates + + + + + Remake + + + + + Rome/Greece + + + + + Ship + + + + + Shooter + + + + + South America + + + + + South Pacific + + + + + Steampunk + + + + + Train + + + + + Venice + + + + + Wild West + + + + + Xmas + + + + + Young Lara + + + + + + + + + 61 + 16777215 + + + + <html><head/><body><p><span style=" font-size:12pt;">Difficulty</span></p></body></html> + + + + + + + + - All - + + + + + easy + + + + + medium + + + + + challenging + + + + + very challenging + + + + + + + + + 44 + 16777215 + + + + <html><head/><body><p><span style=" font-size:12pt;">Type</span></p></body></html> + + + + + + + + - All - + + + + + TR1 + + + + + TR2 + + + + + TR3 + + + + + TR4 + + + + + TR5 + + + + + TEN + + + + + + + + + 61 + 16777215 + + + + <html><head/><body><p><span style=" font-size:12pt;">Duration</span></p></body></html> + + + + + + + + - All - + + + + + short + + + + + medium + + + + + long + + + + + very long + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 12 + + + + Original games first + + + true + + + + + + + + 12 + + + + Duration + + + + + + + + 12 + + + + Class + + + + + + + + 12 + + + + Level name + + + true + + + + + + + + 12 + + + + Difficulty + + + + + + + + 12 + + + + Author + + + + + + + + 12 + + + + Type + + + + + + + + + + + + @@ -140,6 +732,19 @@ + + + + + 16777215 + 32 + + + + Filter/Sort + + + @@ -404,640 +1009,6 @@ - - - Filter/Sort - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 1 - 1 - - - - - 525 - 675 - - - - - - - - - - - - - Qt::PlainText - - - :/pictures/pictures/Lara2.jpg - - - true - - - - - - - - 1 - 1 - - - - Qt::LeftToRight - - - - QLayout::SetDefaultConstraint - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - <html><head/><body><p align="center"><span style=" font-size:12pt;">Filter the level list</span></p></body></html> - - - - - - - - - - - - - <html><head/><body><p><span style=" font-size:12pt;">search</span></p></body></html> - - - - - - - - - - - Level - - - - - User - - - - - - - - - 100 - 16777215 - - - - - 12 - - - - Go - - - - - - - - - - - - - - 0 - 45 - - - - - 45 - 16777215 - - - - <html><head/><body><p><span style=" font-size:12pt;">Class</span></p></body></html> - - - - - - - - - All - - - - - - Alien/Space - - - - - Atlantis - - - - - Base/Lab - - - - - Cambodia - - - - - Castle - - - - - Cave/Cat - - - - - City - - - - - Coastal - - - - - Cold/Snowy - - - - - Desert - - - - - Easter - - - - - Egypt - - - - - Fantasy/Surreal - - - - - Home - - - - - Ireland - - - - - Joke - - - - - Jungle - - - - - Kids - - - - - Library - - - - - Mystery/Horror - - - - - nc - - - - - Nordic/Celtic - - - - - Oriental - - - - - Persia - - - - - Pirates - - - - - Remake - - - - - Rome/Greece - - - - - Ship - - - - - Shooter - - - - - South America - - - - - South Pacific - - - - - Steampunk - - - - - Train - - - - - Venice - - - - - Wild West - - - - - Xmas - - - - - Young Lara - - - - - - - - - 61 - 16777215 - - - - <html><head/><body><p><span style=" font-size:12pt;">Difficulty</span></p></body></html> - - - - - - - - - All - - - - - - easy - - - - - medium - - - - - challenging - - - - - very challenging - - - - - - - - - 44 - 16777215 - - - - <html><head/><body><p><span style=" font-size:12pt;">Type</span></p></body></html> - - - - - - - - - All - - - - - - TR1 - - - - - TR2 - - - - - TR3 - - - - - TR4 - - - - - TR5 - - - - - TEN - - - - - - - - - 61 - 16777215 - - - - <html><head/><body><p><span style=" font-size:12pt;">Duration</span></p></body></html> - - - - - - - - - All - - - - - - short - - - - - medium - - - - - long - - - - - very long - - - - - - - - - - - - - - <html><head/><body><p align="center"><span style=" font-size:12pt;">Sort the level list</span></p></body></html> - - - - - - - - - - - - - - 12 - - - - Duration - - - - - - - - 12 - - - - Difficulty - - - - - - - - 12 - - - - Original games first - - - true - - - - - - - - 12 - - - - Class - - - - - - - - 12 - - - - Author - - - - - - - - 12 - - - - Type - - - - - - - - 12 - - - - Level name - - - true - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Qt::Horizontal - - - - 60 - 20 - - - - - - Modding @@ -1056,18 +1027,15 @@ 0 - - - 0 + + + QFrame::Raised - - - - - - - - + + + + + @@ -1095,40 +1063,130 @@ 0 - + - - - true - - - 500 - - - - GAMEDIR - - - - - RESOURCEDIR - - - - - Paths - - - - - ~/.steam/root/steamapps/common/TombRaider (III) - - - - - ~/.local/share/TombRaider3ModderGames - - + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + <html><head/><body><p align="center"><span style=" font-size:20pt;">Level</span></p></body></html> + + + + + + + + + + + + + Save + + + + + + + Reset + + + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + <html><head/><body><p align="center"><span style=" font-size:20pt;">Global</span></p></body></html> + + + + + + + true + + + false + + + 500 + + + true + + + false + + + + GAMEDIR + + + + + RESOURCEDIR + + + + + Paths + + + + + + + + + + + + + + + + + + + + + Save + + + + + + + Reset + + + + + + + @@ -1136,7 +1194,7 @@ - + @@ -1153,12 +1211,12 @@ - <html><head/><body><p><img src=":/pictures/pictures/Lara.jpg" width="454" height="616"/></p></body></html> + <html><head/><body><p><img src=":/pictures/Lara.jpg" width="454" height="616"/></p></body></html> - + Qt::Vertical @@ -1174,7 +1232,7 @@ - + @@ -1199,7 +1257,7 @@ - + <html><head/><body><p align="center">The path must be without escape sequences. </p><p align="center">For example “TombRaider\ \(III\)/” should be “TombRaider (III)/”</p><p align="center">and it should be a full path. That is it should start with “/”.</p><p align="center"><br/>Ex. /home/lara/.steam/steam/steamapps/common/TombRaider (III)/</p></body></html> @@ -1228,7 +1286,7 @@ - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> @@ -1251,7 +1309,7 @@ li.checked::marker { content: "\2612"; } - + Qt::Vertical @@ -1290,7 +1348,7 @@ li.checked::marker { content: "\2612"; } 0 - + QFrame::NoFrame @@ -1316,7 +1374,7 @@ p, li { white-space: pre-wrap; } <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">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.</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">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.</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Thank you for using the Tomb Raider Linux Launcher!</p> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/pictures/pictures/Lara3.jpg" width="400" height="350" /></p></body></html> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/pictures/Lara3.jpg" width="400" height="350" /></p></body></html> diff --git a/src/icons/down-arrow.svg b/src/icons/down-arrow.svg new file mode 100644 index 0000000..031316d --- /dev/null +++ b/src/icons/down-arrow.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/icons/up-arrow.svg b/src/icons/up-arrow.svg new file mode 100644 index 0000000..148fdb1 --- /dev/null +++ b/src/icons/up-arrow.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/resources.qrc b/src/resources.qrc index 8776245..26dd0aa 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -1,14 +1,16 @@ - - pictures/Lara.jpg - pictures/Lara2.jpg - pictures/Lara3.jpg - pictures/Tomb_Raider_I.jpg - pictures/Tomb_Raider_II.jpg - pictures/Tomb_Raider_III.jpg - pictures/Tomb_Raider_IIII.jpg - pictures/Tomb_Raider_IIIII.jpg - pictures/Tomb_Raider_III_LA.jpg - pictures/Tomb_Raider_III_unkown.jpg - + + icons/down-arrow.svg + icons/up-arrow.svg + pictures/Lara.jpg + pictures/Lara2.jpg + pictures/Lara3.jpg + pictures/Tomb_Raider_I.jpg + pictures/Tomb_Raider_II.jpg + pictures/Tomb_Raider_III.jpg + pictures/Tomb_Raider_IIII.jpg + pictures/Tomb_Raider_IIIII.jpg + pictures/Tomb_Raider_III_LA.jpg + pictures/Tomb_Raider_III_unkown.jpg +