11void fillTourStepFields(
const QString &
id,
const QJsonObject &stepObj,
TourStep &step)
13 const QString stepKey = stepObj.value(
"key").toString();
14 const QString rawStepTitle = stepObj.value(
"title").toString();
15 const QString rawBody = stepObj.value(
"body").toString();
17 if (stepKey.isEmpty()) {
18 step.
title = rawStepTitle;
21 const QString keyPrefix =
id + QLatin1Char(
'.') + stepKey + QLatin1Char(
'.');
26 step.
target = stepObj.value(
"target").toString();
27 step.
click = stepObj.value(
"click").toVariant().toStringList();
34 , m_core(&fillTourStepFields,
42 return m_core.loadFromResource(resourcePath);
47 return m_core.currentStepData();
66 if (m_core.goToPreviousStep()) {
73 const auto result = m_core.advance();
74 if (result.reachedEnd) {
78 if (result.advanced) {
85 if (m_core.retranslate()) {
90void TourEngine::emitCurrentStep()
95void TourEngine::markCompleted()
97 m_core.markCompleted();
Discovery and translation lookup for Exercise/Tour step content.
Typed wrappers around QSettings for all application preferences.
static QString translate(const QString &key, const QString &fallbackEnglish)
static void setCompletedTours(const QStringList &ids)
static int tourProgress(const QString &tourId)
Returns -1 if no record.
static void setTourProgress(const QString &tourId, int step)
static QStringList completedTours()
const TourStep & currentStepData() const
Returns the data for the current step.
TourEngine(QObject *parent=nullptr)
void stepChanged(int step, int total, const TourStep &data)
bool loadFromResource(const QString &resourcePath)
QStringList click
Widget/action IDs to activate on step enter.