summaryrefslogtreecommitdiff
path: root/src/frontend/tips/bttipdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/tips/bttipdialog.cpp')
-rw-r--r--src/frontend/tips/bttipdialog.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/frontend/tips/bttipdialog.cpp b/src/frontend/tips/bttipdialog.cpp
index 5c4052d..75b7a6d 100644
--- a/src/frontend/tips/bttipdialog.cpp
+++ b/src/frontend/tips/bttipdialog.cpp
@@ -2,18 +2,13 @@
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
-* Copyright 1999-2011 by the BibleTime developers.
+* Copyright 1999-2014 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/
#include "bttipdialog.h"
-#include "backend/config/cbtconfig.h"
-#include "util/cresmgr.h"
-#include "util/dialogutil.h"
-#include "util/directory.h"
-
#include <QCheckBox>
#include <QDesktopServices>
#include <QDialogButtonBox>
@@ -21,6 +16,13 @@
#include <QPushButton>
#include <QVBoxLayout>
#include <QWebView>
+#include "backend/config/btconfig.h"
+#include "bibletimeapp.h"
+#include "util/cresmgr.h"
+#include "frontend/messagedialog.h"
+#include "util/directory.h"
+#include "util/geticon.h"
+#include "util/htmlescape.h"
namespace {
@@ -52,20 +54,20 @@ inline QString make_icon(const QString &icon) {
namespace DU = util::directory;
QString fileName = DU::getIconDir().filePath(icon);
QString iconUrl = QUrl::fromLocalFile(fileName).toString();
- return "<img src=\"" + iconUrl + "\" width=\"32\" />";
+ return "<img src=\"" + util::htmlEscape(iconUrl) + "\" width=\"32\" />";
}
+const QString LastTipNumberKey = "GUI/lastTipNumber";
+
} // anonymous namespace
BtTipDialog::BtTipDialog(QWidget *parent, Qt::WindowFlags wflags)
: QDialog(parent, wflags)
{
- namespace DU = util::directory;
-
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowTitle(tr("Tip Of The Day"));
- setWindowIcon(DU::getIcon(CResMgr::mainMenu::help::tipOfTheDay::icon));
+ setWindowIcon(util::getIcon(CResMgr::mainMenu::help::tipOfTheDay::icon));
resize(450, 240);
QVBoxLayout *mainLayout = new QVBoxLayout;
@@ -79,14 +81,14 @@ BtTipDialog::BtTipDialog(QWidget *parent, Qt::WindowFlags wflags)
m_showTipsCheckBox = new QCheckBox;
m_showTipsCheckBox->setText(tr("Show tips at startup"));
- bool showTips = CBTConfig::get(CBTConfig::showTipAtStartup);
+ bool showTips = btConfig().value<bool>("GUI/showTipAtStartup", true);
m_showTipsCheckBox->setChecked(showTips);
hLayout->addWidget(m_showTipsCheckBox);
m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Close,
Qt::Horizontal,
this);
- util::prepareDialogBox(m_buttonBox);
+ message::prepareDialogBox(m_buttonBox);
QPushButton *nextButton;
nextButton = m_buttonBox->addButton(tr("Next Tip"),
@@ -113,7 +115,7 @@ BtTipDialog::BtTipDialog(QWidget *parent, Qt::WindowFlags wflags)
this, SLOT(linkClicked(const QUrl&)));
Q_ASSERT(ok);
- m_tipNumber = CBTConfig::get(CBTConfig::tipNumber);
+ m_tipNumber = btConfig().value<int>(LastTipNumberKey, 0);
initTips();
displayTip();
}
@@ -183,7 +185,7 @@ void BtTipDialog::displayTip() {
}
void BtTipDialog::startupBoxChanged(bool checked) {
- CBTConfig::set(CBTConfig::showTipAtStartup, checked);
+ btConfig().setValue("GUI/showTipAtStartup", checked);
}
void BtTipDialog::nextTip() {
@@ -191,7 +193,7 @@ void BtTipDialog::nextTip() {
if (m_tipNumber >= m_tips.count()) {
m_tipNumber = 0;
}
- CBTConfig::set(CBTConfig::tipNumber, m_tipNumber);
+ btConfig().setValue(LastTipNumberKey, m_tipNumber);
displayTip();
}