quest-wizard/models/dialogues/qw_textdialogue.cpp

49 lines
862 B
C++
Raw Permalink Normal View History

2023-02-09 08:41:24 -05:00
#include "qw_textdialogue.h"
QWTextDialogue::QWTextDialogue(const QStringList &pages)
{
setPages(pages);
}
////////////////////////
bool QWTextDialogue::toNextPage() noexcept
{
const bool has_next = ((it_current_page + 1) != list_pages.end());
if (has_next)
++it_current_page;
return has_next;
}
void QWTextDialogue::resetPage() noexcept
{
it_current_page = list_pages.begin();
}
void QWTextDialogue::setPages(const QStringList &pages) noexcept
{
list_pages = pages;
Q_ASSERT(!list_pages.empty());
it_current_page = list_pages.begin();
}
QStringList QWTextDialogue::pages() const noexcept
{
return list_pages;
}
QString QWTextDialogue::currentText() const noexcept
{
return *it_current_page;
}
////////////////////////
void QWTextDialogue::writeToJson(QJsonObject &savejson)
{
Q_UNUSED(savejson)
}