From f90a7ddc7a9824e2717463a961a2e1de3c539b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C3=A5ngens?= Date: Mon, 22 Jan 2024 15:55:47 +0100 Subject: [PATCH] add Walkthrough, with QWebEngineView one can look at youtube walkthrough video also --- src/TombRaiderLinuxLauncher.cpp | 37 ++++++++++++++++++++++++++++++--- src/TombRaiderLinuxLauncher.h | 4 ++++ src/TombRaiderLinuxLauncher.ui | 14 ++++++------- src/worker.h | 9 +++++++- 4 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/TombRaiderLinuxLauncher.cpp b/src/TombRaiderLinuxLauncher.cpp index f0cfa97..de91d9e 100644 --- a/src/TombRaiderLinuxLauncher.cpp +++ b/src/TombRaiderLinuxLauncher.cpp @@ -23,7 +23,9 @@ TombRaiderLinuxLauncher::TombRaiderLinuxLauncher(QWidget *parent) connect(ui->pushButtonLink, SIGNAL (clicked()), this, SLOT (linkClicked())); connect(ui->pushButtonDownload, SIGNAL (clicked()), this, SLOT (downloadClicked())); connect(ui->pushButtonInfo, SIGNAL (clicked()), this, SLOT (infoClicked())); + connect(ui->pushButtonWalkthrough, SIGNAL (clicked()), this, SLOT (walkthroughClicked())); connect(ui->infoBackButton, SIGNAL (clicked()), this, SLOT (backClicked())); + connect(ui->walkthroughBackButton, SIGNAL (clicked()), this, SLOT (backClicked())); connect(ui->setOptions, SIGNAL (clicked()), this, SLOT (setOptionsClicked())); connect(ui->listWidgetModds, SIGNAL(itemSelectionChanged()), this, SLOT(onListItemSelected())); @@ -366,15 +368,44 @@ void TombRaiderLinuxLauncher::infoClicked() if (retrievedIdentifier) { LevelData level = poolData.getData(retrievedIdentifier-1); - ui->infowebEngineView->setHtml(level.body); - ui->infowebEngineView->show(); + ui->infoWebEngineView->setHtml(level.body); + ui->infoWebEngineView->show(); ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild("info")); + if(level.walkthrough != "") + { + ui->pushButtonWalkthrough->setEnabled(true); + } + else + { + ui->pushButtonWalkthrough->setEnabled(false); + } + } +} + +void TombRaiderLinuxLauncher::walkthroughClicked() +{ + QListWidgetItem *selectedItem = ui->listWidgetModds->currentItem(); + + int retrievedIdentifier = selectedItem->data(Qt::UserRole).toInt(); + if (retrievedIdentifier) + { + LevelData level = poolData.getData(retrievedIdentifier-1); + ui->walkthroughWebEngineView->setHtml(level.walkthrough); + ui->walkthroughWebEngineView->show(); + ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild("walkthrough")); } } void TombRaiderLinuxLauncher::backClicked() { - ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild("select")); + if(ui->stackedWidget->currentWidget() == ui->stackedWidget->findChild("info")) + { + ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild("select")); + } + else if (ui->stackedWidget->currentWidget() == ui->stackedWidget->findChild("walkthrough")) + { + ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild("select")); + } } /////////////////////////////////////////////////////////////////////////////////////////////////// TombRaiderLinuxLauncher::~TombRaiderLinuxLauncher() diff --git a/src/TombRaiderLinuxLauncher.h b/src/TombRaiderLinuxLauncher.h index 9a47b69..475467d 100644 --- a/src/TombRaiderLinuxLauncher.h +++ b/src/TombRaiderLinuxLauncher.h @@ -39,6 +39,10 @@ public slots: * */ void infoClicked(); + /** + * + */ + void walkthroughClicked(); /** * */ diff --git a/src/TombRaiderLinuxLauncher.ui b/src/TombRaiderLinuxLauncher.ui index 8ca0f78..c0979e7 100644 --- a/src/TombRaiderLinuxLauncher.ui +++ b/src/TombRaiderLinuxLauncher.ui @@ -46,7 +46,7 @@ - + 0 @@ -107,7 +107,7 @@ - + about:blank @@ -116,7 +116,7 @@ - + 0 @@ -144,7 +144,7 @@ - + 0 @@ -164,7 +164,7 @@ - + about:blank @@ -173,7 +173,7 @@ - + 0 @@ -188,7 +188,7 @@ - + 0 diff --git a/src/worker.h b/src/worker.h index cce6ecf..8134d2f 100644 --- a/src/worker.h +++ b/src/worker.h @@ -304,7 +304,14 @@ class Pool PictureData picture(query.value("Picture.name").toString(), query.value("Picture.data").toByteArray()); data.push_back( - LevelData(info, zip, picture, QString(""), QString(""), query.value("Level.body").toString(), QString("")) + LevelData( + info, + zip, + picture, // + QString(""), // replase with list of picurest + QString(""), // + query.value("Level.body").toString(), + query.value("Level.walkthrough").toString()) ); } } else {