Skip to content

Commit

Permalink
add Walkthrough, with QWebEngineView one can look at youtube walkthro…
Browse files Browse the repository at this point in the history
…ugh video also
  • Loading branch information
noisecode3 committed Jan 22, 2024
1 parent 1a458c5 commit f90a7dd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 11 deletions.
37 changes: 34 additions & 3 deletions src/TombRaiderLinuxLauncher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down Expand Up @@ -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<QWidget*>("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<QWidget*>("walkthrough"));
}
}

void TombRaiderLinuxLauncher::backClicked()
{
ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild<QWidget*>("select"));
if(ui->stackedWidget->currentWidget() == ui->stackedWidget->findChild<QWidget*>("info"))
{
ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild<QWidget*>("select"));
}
else if (ui->stackedWidget->currentWidget() == ui->stackedWidget->findChild<QWidget*>("walkthrough"))
{
ui->stackedWidget->setCurrentWidget(ui->stackedWidget->findChild<QWidget*>("select"));
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
TombRaiderLinuxLauncher::~TombRaiderLinuxLauncher()
Expand Down
4 changes: 4 additions & 0 deletions src/TombRaiderLinuxLauncher.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public slots:
*
*/
void infoClicked();
/**
*
*/
void walkthroughClicked();
/**
*
*/
Expand Down
14 changes: 7 additions & 7 deletions src/TombRaiderLinuxLauncher.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</widget>
</item>
<item>
<widget class="QWidget" name="widget" native="true">
<widget class="QWidget" name="selectBar" native="true">
<property name="minimumSize">
<size>
<width>0</width>
Expand Down Expand Up @@ -107,7 +107,7 @@
<widget class="QWidget" name="info">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QWebEngineView" name="infowebEngineView" native="true">
<widget class="QWebEngineView" name="infoWebEngineView" native="true">
<property name="url" stdset="0">
<url>
<string>about:blank</string>
Expand All @@ -116,7 +116,7 @@
</widget>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true">
<widget class="QWidget" name="infoBar" native="true">
<property name="minimumSize">
<size>
<width>0</width>
Expand Down Expand Up @@ -144,7 +144,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<widget class="QPushButton" name="pushButtonWalkthrough">
<property name="minimumSize">
<size>
<width>0</width>
Expand All @@ -164,7 +164,7 @@
<widget class="QWidget" name="walkthrough">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QWebEngineView" name="webEngineView_2" native="true">
<widget class="QWebEngineView" name="walkthroughWebEngineView" native="true">
<property name="url" stdset="0">
<url>
<string>about:blank</string>
Expand All @@ -173,7 +173,7 @@
</widget>
</item>
<item>
<widget class="QWidget" name="widget_3" native="true">
<widget class="QWidget" name="walkthroughBar" native="true">
<property name="minimumSize">
<size>
<width>0</width>
Expand All @@ -188,7 +188,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="pushButton_4">
<widget class="QPushButton" name="walkthroughBackButton">
<property name="minimumSize">
<size>
<width>0</width>
Expand Down
9 changes: 8 additions & 1 deletion src/worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f90a7dd

Please sign in to comment.