mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[App] First-run tutorial
Took 5 minutes Took 3 minutes Took 2 minutes
This commit is contained in:
parent
44d5138181
commit
3f5dd77457
33 changed files with 1778 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
|||
#include "libcockatrice/card/printing/printing_info.h"
|
||||
#include "libcockatrice/card/set/card_set.h"
|
||||
#include "libcockatrice/utility/card_ref.h"
|
||||
#include "tutorial/tutorial_controller.h"
|
||||
|
||||
#include <QBrush>
|
||||
#include <QDebug>
|
||||
|
|
@ -60,6 +61,7 @@
|
|||
#include <libcockatrice/network/client/remote/remote_client.h>
|
||||
#include <libcockatrice/settings/appearance_settings.h>
|
||||
#include <libcockatrice/settings/paths_settings.h>
|
||||
#include <libcockatrice/utility/qt_utils.h>
|
||||
#include <optional>
|
||||
#include <qlogging.h>
|
||||
#include <qnamespace.h>
|
||||
|
|
@ -95,6 +97,37 @@ HomeWidget::HomeWidget(QWidget *parent, TabSupervisor *_tabSupervisor)
|
|||
&HomeWidget::initializeBackgroundFromSource);
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::homeTabBackgroundShuffleFrequencyChanged,
|
||||
this, &HomeWidget::onBackgroundShuffleFrequencyChanged);
|
||||
|
||||
auto mainWindow = QtUtils::findParentOfType<QMainWindow>(this);
|
||||
|
||||
if (mainWindow) {
|
||||
tutorialController = new TutorialController(mainWindow);
|
||||
} else {
|
||||
tutorialController = new TutorialController(this);
|
||||
}
|
||||
auto sequence = TutorialSequence();
|
||||
sequence.addStep({connectButton, "Connect to a server to play here!"});
|
||||
auto vdeStep = TutorialStep(visualDeckEditorButton, "Create a new deck from cards in the database here!");
|
||||
vdeStep.requiresInteraction = true;
|
||||
vdeStep.allowClickThrough = true;
|
||||
vdeStep.validationHint = "Open the deck editor to try it out!";
|
||||
vdeStep.validationTiming = ValidationTiming::OnSignal;
|
||||
vdeStep.autoAdvanceOnValid = true;
|
||||
vdeStep.validator = []() { return true; };
|
||||
vdeStep.signalSource = visualDeckEditorButton;
|
||||
vdeStep.signalName = SIGNAL(clicked());
|
||||
|
||||
sequence.addStep(vdeStep);
|
||||
sequence.addStep({visualDeckStorageButton, "Browse the decks in your local collection."});
|
||||
sequence.addStep({visualDatabaseDisplayButton, "View the card database here."});
|
||||
sequence.addStep(
|
||||
{edhrecButton, "Browse EDHRec, an external service designed to provide card recommendations for decks."});
|
||||
sequence.addStep({archidektButton, "Browse Archidekt, an external service that allows users to store "
|
||||
"decklists and import them to your local collection."});
|
||||
sequence.addStep({replaybutton, "View replays of your past games here."});
|
||||
sequence.addStep({exitButton, "Exit the application."});
|
||||
tutorialController->addSequence(sequence);
|
||||
|
||||
// Lambda is cleaner to read than overloading this
|
||||
connect(&SettingsCache::instance().appearance(), &AppearanceSettings::homeTabDisplayCardNameChanged, this,
|
||||
[this] { repaint(); });
|
||||
|
|
@ -139,6 +172,16 @@ void HomeWidget::retranslateUi()
|
|||
}
|
||||
}
|
||||
|
||||
void HomeWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
QWidget::showEvent(event);
|
||||
if (!tutorialStarted) {
|
||||
tutorialStarted = true;
|
||||
// Start on next event loop iteration so everything is fully painted
|
||||
QTimer::singleShot(3, tutorialController, [this] { tutorialController->start(); });
|
||||
}
|
||||
}
|
||||
|
||||
void HomeWidget::initializeBackgroundFromSource()
|
||||
{
|
||||
// The featured logo is theme/scheme-derived too; reload it alongside the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue