Core/Help: Clean up HelpManager interface and users

Change-Id: Ia6edf583f2a002d7c6f4878df670a78614ea087d
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
hjk
2013-08-29 19:00:34 +02:00
parent 975e1be2ab
commit d66369e21d
20 changed files with 197 additions and 231 deletions

View File

@@ -53,6 +53,7 @@
#include <QWebSettings>
#endif
using namespace Core;
using namespace Help::Internal;
GeneralSettingsPage::GeneralSettingsPage()
@@ -78,27 +79,25 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
m_ui->sizeComboBox->setEditable(false);
m_ui->styleComboBox->setEditable(false);
Core::HelpManager *manager = Core::HelpManager::instance();
m_font = qvariant_cast<QFont>(manager->customValue(QLatin1String("font"),
m_font));
m_font = qvariant_cast<QFont>(HelpManager::customValue(QLatin1String("font"), m_font));
updateFontSize();
updateFontStyle();
updateFontFamily();
m_homePage = manager->customValue(QLatin1String("HomePage"), QString())
m_homePage = HelpManager::customValue(QLatin1String("HomePage"), QString())
.toString();
if (m_homePage.isEmpty()) {
m_homePage = manager->customValue(QLatin1String("DefaultHomePage"),
m_homePage = HelpManager::customValue(QLatin1String("DefaultHomePage"),
Help::Constants::AboutBlank).toString();
}
m_ui->homePageLineEdit->setText(m_homePage);
m_startOption = manager->customValue(QLatin1String("StartOption"),
m_startOption = HelpManager::customValue(QLatin1String("StartOption"),
Help::Constants::ShowLastPages).toInt();
m_ui->helpStartComboBox->setCurrentIndex(m_startOption);
m_contextOption = manager->customValue(QLatin1String("ContextHelpOption"),
m_contextOption = HelpManager::customValue(QLatin1String("ContextHelpOption"),
Help::Constants::SideBySideIfPossible).toInt();
m_ui->contextHelpComboBox->setCurrentIndex(m_contextOption);
@@ -120,7 +119,7 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
m_searchKeywords.remove(QLatin1Char('&'));
}
m_returnOnClose = manager->customValue(QLatin1String("ReturnOnClose"),
m_returnOnClose = HelpManager::customValue(QLatin1String("ReturnOnClose"),
false).toBool();
m_ui->m_returnOnClose->setChecked(m_returnOnClose);
@@ -157,10 +156,9 @@ void GeneralSettingsPage::apply()
if (weight >= 0) // Weight < 0 asserts...
newFont.setWeight(weight);
Core::HelpManager *manager = Core::HelpManager::instance();
if (newFont != m_font) {
m_font = newFont;
manager->setCustomValue(QLatin1String("font"), newFont);
HelpManager::setCustomValue(QLatin1String("font"), newFont);
emit fontChanged();
}
@@ -170,19 +168,19 @@ void GeneralSettingsPage::apply()
m_ui->homePageLineEdit->setText(homePage);
if (m_homePage != homePage) {
m_homePage = homePage;
manager->setCustomValue(QLatin1String("HomePage"), homePage);
HelpManager::setCustomValue(QLatin1String("HomePage"), homePage);
}
const int startOption = m_ui->helpStartComboBox->currentIndex();
if (m_startOption != startOption) {
m_startOption = startOption;
manager->setCustomValue(QLatin1String("StartOption"), startOption);
HelpManager::setCustomValue(QLatin1String("StartOption"), startOption);
}
const int helpOption = m_ui->contextHelpComboBox->currentIndex();
if (m_contextOption != helpOption) {
m_contextOption = helpOption;
manager->setCustomValue(QLatin1String("ContextHelpOption"), helpOption);
HelpManager::setCustomValue(QLatin1String("ContextHelpOption"), helpOption);
QSettings *settings = Core::ICore::settings();
settings->beginGroup(QLatin1String(Help::Constants::ID_MODE_HELP));
@@ -195,7 +193,7 @@ void GeneralSettingsPage::apply()
const bool close = m_ui->m_returnOnClose->isChecked();
if (m_returnOnClose != close) {
m_returnOnClose = close;
manager->setCustomValue(QLatin1String("ReturnOnClose"), close);
HelpManager::setCustomValue(QLatin1String("ReturnOnClose"), close);
emit returnOnCloseChanged();
}
}
@@ -214,9 +212,8 @@ void GeneralSettingsPage::setBlankPage()
void GeneralSettingsPage::setDefaultPage()
{
const QString &defaultHomePage = Core::HelpManager::instance()
->customValue(QLatin1String("DefaultHomePage"), QString()).toString();
m_ui->homePageLineEdit->setText(defaultHomePage);
m_ui->homePageLineEdit->setText(
HelpManager::customValue(QLatin1String("DefaultHomePage"), QString()).toString());
}
void GeneralSettingsPage::importBookmarks()