BibleTime
btedittextwizard.cpp
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #include "btedittextwizard.h"
14 
15 #include <QByteArray>
16 #include <QDialog>
17 #include "btedittextpage.h"
18 #include "btplainorhtmlpage.h"
19 #include "../../backend/config/btconfig.h"
20 
21 
23 
24 namespace {
25 auto const GeometryKey = QStringLiteral("GUI/EditTextWizard/geometry");
26 auto const HtmlModeKey = QStringLiteral("GUI/EditTextWizard/htmlMode");
27 } // anonymous namespace
28 
29 BtEditTextWizard::BtEditTextWizard(QWidget * parent, Qt::WindowFlags flags)
30  : QWizard(parent, flags)
31  , m_plainOrHtmlPage(new BtPlainOrHtmlPage(this))
32  , m_editTextPage(new BtEditTextPage(*this))
33 {
34  addPage(m_plainOrHtmlPage);
35  addPage(m_editTextPage);
36 
37  retranslateUi();
38  restoreGeometry(btConfig().value<QByteArray>(GeometryKey, QByteArray()));
39  m_plainOrHtmlPage->setHtmlMode(btConfig().value<bool>(HtmlModeKey, true));
40 }
41 
43  btConfig().setValue(GeometryKey, saveGeometry());
45  QDialog::accept();
46 }
47 
49  return m_plainOrHtmlPage->htmlMode();
50 }
51 
52 void BtEditTextWizard::setFont(const QFont& font) {
53  m_editTextPage->setFont(font);
54 }
55 
56 void BtEditTextWizard::setText(const QString &text) {
58 }
59 
60 void BtEditTextWizard::setTitle(const QString& text) {
61  setWindowTitle(text);
62 }
63 
64 QString BtEditTextWizard::text() const {
65  return m_editTextPage->text();
66 }
67 
70 }
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
Definition: btconfig.h:305
void translateQWizardStandardButtons(QWizard *wizard)
void setValue(QString const &key, T const &value)
Sets a value for a key.
Definition: btconfigcore.h:73
void setText(const QString &text)
void setFont(const QFont &font)
QString text() const
QString text() const
BtEditTextWizard(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
void accept() final override
BtPlainOrHtmlPage *const m_plainOrHtmlPage
void setFont(const QFont &font)
void setText(const QString &text)
bool htmlMode() const
BtEditTextPage *const m_editTextPage
void setTitle(const QString &text)
void setHtmlMode(bool html)