Refactored settings.
This commit is contained in:
parent
07c78623b1
commit
3b7c11853d
@ -152,7 +152,6 @@ message(STATUS "[${APP_LOW_NAME}] Obtaining revision number.")
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
# TODO: https://wiki.archlinux.org/index.php/VCS_PKGBUILD_Guidelines#Git
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
Application::Application(const QString &id, int &argc, char **argv)
|
||||
: QtSingleApplication(id, argc, argv) {
|
||||
: QtSingleApplication(id, argc, argv), m_settings(NULL) {
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
|
@ -20,9 +20,13 @@
|
||||
|
||||
#include "qtsingleapplication/qtsingleapplication.h"
|
||||
|
||||
#include "miscellaneous/settings.h"
|
||||
|
||||
#if defined(qApp)
|
||||
#undef qApp
|
||||
#endif
|
||||
|
||||
// Define new qApp macro. Yeaaaaah.
|
||||
#define qApp (Application::instance())
|
||||
|
||||
|
||||
@ -35,10 +39,21 @@ class Application : public QtSingleApplication {
|
||||
explicit Application(const QString &id, int &argc, char **argv);
|
||||
virtual ~Application();
|
||||
|
||||
inline Settings *settings() {
|
||||
if (m_settings == NULL) {
|
||||
m_settings = Settings::setupSettings(this);
|
||||
}
|
||||
|
||||
return m_settings;
|
||||
}
|
||||
|
||||
// Returns pointer to "GOD" application singleton.
|
||||
inline static Application *instance() {
|
||||
return static_cast<Application*>(QCoreApplication::instance());
|
||||
}
|
||||
|
||||
private:
|
||||
Settings *m_settings;
|
||||
};
|
||||
|
||||
#endif // APPLICATION_H
|
||||
|
@ -87,7 +87,7 @@ QVariant FeedsModelCategory::data(int column, int role) const {
|
||||
return m_title;
|
||||
}
|
||||
else if (column == FDS_MODEL_COUNTS_INDEX) {
|
||||
return Settings::instance()->value(APP_CFG_FEEDS,
|
||||
return qApp->settings()->value(APP_CFG_FEEDS,
|
||||
"count_format",
|
||||
"(%unread)").toString()
|
||||
.replace("%unread", QString::number(countOfUnreadMessages()))
|
||||
|
@ -146,7 +146,7 @@ QPair<FeedsModelFeed*, QNetworkReply::NetworkError> FeedsModelFeed::guessFeed(co
|
||||
|
||||
QByteArray feed_contents;
|
||||
if ((result.second = NetworkFactory::downloadFeedFile(url,
|
||||
Settings::instance()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt(),
|
||||
qApp->settings()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt(),
|
||||
feed_contents,
|
||||
!username.isEmpty(),
|
||||
username,
|
||||
@ -255,7 +255,7 @@ QVariant FeedsModelFeed::data(int column, int role) const {
|
||||
return m_title;
|
||||
}
|
||||
else if (column == FDS_MODEL_COUNTS_INDEX) {
|
||||
return Settings::instance()->value(APP_CFG_FEEDS,
|
||||
return qApp->settings()->value(APP_CFG_FEEDS,
|
||||
"count_format",
|
||||
"(%unread)").toString()
|
||||
.replace("%unread", QString::number(countOfUnreadMessages()))
|
||||
@ -348,7 +348,7 @@ QVariant FeedsModelFeed::data(int column, int role) const {
|
||||
|
||||
void FeedsModelFeed::update() {
|
||||
QByteArray feed_contents;
|
||||
int download_timeout = Settings::instance()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt();
|
||||
int download_timeout = qApp->settings()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt();
|
||||
QNetworkReply::NetworkError download_result = NetworkFactory::downloadFeedFile(url(),
|
||||
download_timeout,
|
||||
feed_contents,
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/settings.h"
|
||||
#include "application.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@ -26,8 +27,8 @@
|
||||
DynamicShortcuts::DynamicShortcuts() {
|
||||
}
|
||||
|
||||
void DynamicShortcuts::save(const QList<QAction *> actions) {
|
||||
Settings *settings = Settings::instance();
|
||||
void DynamicShortcuts::save(const QList<QAction*> actions) {
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
foreach (QAction *action, actions) {
|
||||
settings->setValue(APP_CFG_CUTS,
|
||||
@ -36,8 +37,8 @@ void DynamicShortcuts::save(const QList<QAction *> actions) {
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicShortcuts::load(const QList<QAction *> actions) {
|
||||
Settings *settings = Settings::instance();
|
||||
void DynamicShortcuts::load(const QList<QAction*> actions) {
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
foreach (QAction *action, actions) {
|
||||
QString shortcut_for_action = settings->value(APP_CFG_CUTS,
|
||||
|
@ -76,7 +76,7 @@ FeedMessageViewer::~FeedMessageViewer() {
|
||||
}
|
||||
|
||||
void FeedMessageViewer::saveSize() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
m_feedsView->saveExpandedStates();
|
||||
|
||||
@ -108,7 +108,7 @@ void FeedMessageViewer::saveSize() {
|
||||
}
|
||||
|
||||
void FeedMessageViewer::loadSize() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
int default_msg_section_size = m_messagesView->header()->defaultSectionSize();
|
||||
|
||||
m_feedsView->loadExpandedStates();
|
||||
@ -436,7 +436,7 @@ void FeedMessageViewer::vacuumDatabase() {
|
||||
}
|
||||
|
||||
void FeedMessageViewer::refreshVisualProperties() {
|
||||
Qt::ToolButtonStyle button_style = static_cast<Qt::ToolButtonStyle>(Settings::instance()->value(APP_CFG_GUI,
|
||||
Qt::ToolButtonStyle button_style = static_cast<Qt::ToolButtonStyle>(qApp->settings()->value(APP_CFG_GUI,
|
||||
"toolbar_style",
|
||||
Qt::ToolButtonIconOnly).toInt());
|
||||
|
||||
|
@ -40,12 +40,12 @@ QList<QAction *> FeedsToolBar::changeableActions() const {
|
||||
}
|
||||
|
||||
void FeedsToolBar::saveChangeableActions(const QStringList &actions) {
|
||||
Settings::instance()->setValue(APP_CFG_GUI, "feeds_toolbar", actions.join(","));
|
||||
qApp->settings()->setValue(APP_CFG_GUI, "feeds_toolbar", actions.join(","));
|
||||
loadChangeableActions(actions);
|
||||
}
|
||||
|
||||
void FeedsToolBar::loadChangeableActions() {
|
||||
QStringList action_names = Settings::instance()->value(APP_CFG_GUI,
|
||||
QStringList action_names = qApp->settings()->value(APP_CFG_GUI,
|
||||
"feeds_toolbar",
|
||||
"m_actionUpdateAllFeeds,m_actionMarkAllFeedsRead").toString().split(',',
|
||||
QString::SkipEmptyParts);
|
||||
|
@ -74,9 +74,9 @@ void FeedsView::quit() {
|
||||
void FeedsView::updateAutoUpdateStatus() {
|
||||
// Restore global intervals.
|
||||
// NOTE: Specific per-feed interval are left intact.
|
||||
m_globalAutoUpdateInitialInterval = Settings::instance()->value(APP_CFG_FEEDS, "auto_update_interval", DEFAULT_AUTO_UPDATE_INTERVAL).toInt();
|
||||
m_globalAutoUpdateInitialInterval = qApp->settings()->value(APP_CFG_FEEDS, "auto_update_interval", DEFAULT_AUTO_UPDATE_INTERVAL).toInt();
|
||||
m_globalAutoUpdateRemainingInterval = m_globalAutoUpdateInitialInterval;
|
||||
m_globalAutoUpdateEnabled = Settings::instance()->value(APP_CFG_FEEDS, "auto_update_enabled", false).toBool();
|
||||
m_globalAutoUpdateEnabled = qApp->settings()->value(APP_CFG_FEEDS, "auto_update_enabled", false).toBool();
|
||||
|
||||
// Start global auto-update timer if it is not running yet.
|
||||
// NOTE: The timer must run even if global auto-update
|
||||
@ -117,7 +117,7 @@ FeedsModelFeed *FeedsView::isCurrentIndexFeed() const {
|
||||
}
|
||||
|
||||
void FeedsView::saveExpandedStates() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Iterate all categories and save their expand statuses.
|
||||
foreach (FeedsModelCategory *category, sourceModel()->allCategories().values()) {
|
||||
@ -128,7 +128,7 @@ void FeedsView::saveExpandedStates() {
|
||||
}
|
||||
|
||||
void FeedsView::loadExpandedStates() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Iterate all categories and save their expand statuses.
|
||||
foreach (FeedsModelCategory *category, sourceModel()->allCategories().values()) {
|
||||
@ -159,7 +159,7 @@ void FeedsView::updateAllFeeds() {
|
||||
}
|
||||
|
||||
void FeedsView::updateAllFeedsOnStartup() {
|
||||
if (Settings::instance()->value(APP_CFG_FEEDS, "feeds_update_on_startup", false).toBool()) {
|
||||
if (qApp->settings()->value(APP_CFG_FEEDS, "feeds_update_on_startup", false).toBool()) {
|
||||
qDebug("Requesting update for all feeds on application startup.");
|
||||
QTimer::singleShot(STARTUP_UPDATE_DELAY, this, SLOT(updateAllFeeds()));
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ void FormMain::onAboutToQuit() {
|
||||
qDebug("Cleaning up resources and saving application state.");
|
||||
m_ui->m_tabWidget->feedMessageViewer()->quit();
|
||||
|
||||
if (Settings::instance()->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool()) {
|
||||
if (qApp->settings()->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool()) {
|
||||
m_ui->m_tabWidget->feedMessageViewer()->feedsView()->clearAllReadMessages();
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ void FormMain::setupIcons() {
|
||||
|
||||
void FormMain::loadSize() {
|
||||
QRect screen = qApp->desktop()->screenGeometry();
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Reload main window size & position.
|
||||
resize(settings->value(APP_CFG_GUI, "window_size", size()).toSize());
|
||||
@ -360,7 +360,7 @@ void FormMain::loadSize() {
|
||||
}
|
||||
|
||||
void FormMain::saveSize() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
bool is_fullscreen = isFullScreen();
|
||||
|
||||
if (is_fullscreen) {
|
||||
@ -450,7 +450,7 @@ void FormMain::changeEvent(QEvent *event) {
|
||||
case QEvent::WindowStateChange: {
|
||||
if (this->windowState() & Qt::WindowMinimized &&
|
||||
SystemTrayIcon::isSystemTrayActivated() &&
|
||||
Settings::instance()->value(APP_CFG_GUI,
|
||||
qApp->settings()->value(APP_CFG_GUI,
|
||||
"hide_when_minimized",
|
||||
false).toBool()) {
|
||||
event->ignore();
|
||||
|
@ -198,24 +198,28 @@ void FormSettings::selectBrowserExecutable() {
|
||||
}
|
||||
|
||||
void FormSettings::loadFeedsMessages() {
|
||||
m_ui->m_checkKeppMessagesInTheMiddle->setChecked(Settings::instance()->value(APP_CFG_MESSAGES, "keep_cursor_center", false).toBool());
|
||||
m_ui->m_checkRemoveReadMessagesOnExit->setChecked(Settings::instance()->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool());
|
||||
m_ui->m_checkAutoUpdate->setChecked(Settings::instance()->value(APP_CFG_FEEDS, "auto_update_enabled", false).toBool());
|
||||
m_ui->m_spinAutoUpdateInterval->setValue(Settings::instance()->value(APP_CFG_FEEDS, "auto_update_interval", DEFAULT_AUTO_UPDATE_INTERVAL).toInt());
|
||||
m_ui->m_spinFeedUpdateTimeout->setValue(Settings::instance()->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt());
|
||||
m_ui->m_checkUpdateAllFeedsOnStartup->setChecked(Settings::instance()->value(APP_CFG_FEEDS, "feeds_update_on_startup", false).toBool());
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
m_ui->m_checkKeppMessagesInTheMiddle->setChecked(settings->value(APP_CFG_MESSAGES, "keep_cursor_center", false).toBool());
|
||||
m_ui->m_checkRemoveReadMessagesOnExit->setChecked(settings->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool());
|
||||
m_ui->m_checkAutoUpdate->setChecked(settings->value(APP_CFG_FEEDS, "auto_update_enabled", false).toBool());
|
||||
m_ui->m_spinAutoUpdateInterval->setValue(settings->value(APP_CFG_FEEDS, "auto_update_interval", DEFAULT_AUTO_UPDATE_INTERVAL).toInt());
|
||||
m_ui->m_spinFeedUpdateTimeout->setValue(settings->value(APP_CFG_FEEDS, "feed_update_timeout", DOWNLOAD_TIMEOUT).toInt());
|
||||
m_ui->m_checkUpdateAllFeedsOnStartup->setChecked(settings->value(APP_CFG_FEEDS, "feeds_update_on_startup", false).toBool());
|
||||
m_ui->m_cmbCountsFeedList->addItems(QStringList() << "(%unread)" << "[%unread]" << "%unread/%all" << "%unread-%all" << "[%unread|%all]");
|
||||
m_ui->m_cmbCountsFeedList->setEditText(Settings::instance()->value(APP_CFG_FEEDS, "count_format", "(%unread)").toString());
|
||||
m_ui->m_cmbCountsFeedList->setEditText(settings->value(APP_CFG_FEEDS, "count_format", "(%unread)").toString());
|
||||
}
|
||||
|
||||
void FormSettings::saveFeedsMessages() {
|
||||
Settings::instance()->setValue(APP_CFG_MESSAGES, "keep_cursor_center", m_ui->m_checkKeppMessagesInTheMiddle->isChecked());
|
||||
Settings::instance()->setValue(APP_CFG_MESSAGES, "clear_read_on_exit", m_ui->m_checkRemoveReadMessagesOnExit->isChecked());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "auto_update_enabled", m_ui->m_checkAutoUpdate->isChecked());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "auto_update_interval", m_ui->m_spinAutoUpdateInterval->value());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "feed_update_timeout", m_ui->m_spinFeedUpdateTimeout->value());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "feeds_update_on_startup", m_ui->m_checkUpdateAllFeedsOnStartup->isChecked());
|
||||
Settings::instance()->setValue(APP_CFG_FEEDS, "count_format", m_ui->m_cmbCountsFeedList->currentText());
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
settings->setValue(APP_CFG_MESSAGES, "keep_cursor_center", m_ui->m_checkKeppMessagesInTheMiddle->isChecked());
|
||||
settings->setValue(APP_CFG_MESSAGES, "clear_read_on_exit", m_ui->m_checkRemoveReadMessagesOnExit->isChecked());
|
||||
settings->setValue(APP_CFG_FEEDS, "auto_update_enabled", m_ui->m_checkAutoUpdate->isChecked());
|
||||
settings->setValue(APP_CFG_FEEDS, "auto_update_interval", m_ui->m_spinAutoUpdateInterval->value());
|
||||
settings->setValue(APP_CFG_FEEDS, "feed_update_timeout", m_ui->m_spinFeedUpdateTimeout->value());
|
||||
settings->setValue(APP_CFG_FEEDS, "feeds_update_on_startup", m_ui->m_checkUpdateAllFeedsOnStartup->isChecked());
|
||||
settings->setValue(APP_CFG_FEEDS, "count_format", m_ui->m_cmbCountsFeedList->currentText());
|
||||
|
||||
FormMain::instance()->tabWidget()->feedMessageViewer()->feedsView()->updateAutoUpdateStatus();
|
||||
FormMain::instance()->tabWidget()->feedMessageViewer()->feedsView()->sourceModel()->reloadWholeLayout();
|
||||
@ -326,7 +330,7 @@ void FormSettings::saveSettings() {
|
||||
saveLanguage();
|
||||
saveFeedsMessages();
|
||||
|
||||
Settings::instance()->checkSettings();
|
||||
qApp->settings()->checkSettings();
|
||||
promptForRestart();
|
||||
|
||||
accept();
|
||||
@ -349,7 +353,7 @@ void FormSettings::onProxyTypeChanged(int index) {
|
||||
}
|
||||
|
||||
void FormSettings::loadBrowser() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Load settings of web browser GUI.
|
||||
m_initialSettings.m_webBrowserProgress = QColor(settings->value(APP_CFG_BROWSER,
|
||||
@ -382,7 +386,7 @@ void FormSettings::loadBrowser() {
|
||||
}
|
||||
|
||||
void FormSettings::saveBrowser() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Save settings of GUI of web browser.
|
||||
settings->setValue(APP_CFG_BROWSER,
|
||||
@ -420,10 +424,10 @@ void FormSettings::loadProxy() {
|
||||
m_ui->m_cmbProxyType->addItem(tr("Http"), QNetworkProxy::HttpProxy);
|
||||
|
||||
// Load the settings.
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(Settings::instance()->value(APP_CFG_PROXY,
|
||||
Settings *settings = qApp->settings();
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(settings->value(APP_CFG_PROXY,
|
||||
"proxy_type",
|
||||
QNetworkProxy::NoProxy).toInt());
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
m_ui->m_cmbProxyType->setCurrentIndex(m_ui->m_cmbProxyType->findData(selected_proxy_type));
|
||||
m_ui->m_txtProxyHost->setText(settings->value(APP_CFG_PROXY,
|
||||
@ -437,7 +441,7 @@ void FormSettings::loadProxy() {
|
||||
}
|
||||
|
||||
void FormSettings::saveProxy() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
settings->setValue(APP_CFG_PROXY, "proxy_type",
|
||||
m_ui->m_cmbProxyType->itemData(m_ui->m_cmbProxyType->currentIndex()));
|
||||
@ -479,7 +483,7 @@ void FormSettings::saveLanguage() {
|
||||
return;
|
||||
}
|
||||
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
QString actual_lang = Localization::instance()->loadedLanguage();
|
||||
QString new_lang = m_ui->m_treeLanguages->currentItem()->text(1);
|
||||
|
||||
@ -516,25 +520,26 @@ void FormSettings::loadDataStorage() {
|
||||
tr("SQLite (embedded database)"), APP_DB_SQLITE_DRIVER);
|
||||
|
||||
// Load in-memory database status.
|
||||
m_ui->m_checkSqliteUseInMemoryDatabase->setChecked(Settings::instance()->value(APP_CFG_DB, "use_in_memory_db", false).toBool());
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
m_ui->m_checkSqliteUseInMemoryDatabase->setChecked(settings->value(APP_CFG_DB, "use_in_memory_db", false).toBool());
|
||||
|
||||
if (QSqlDatabase::isDriverAvailable(APP_DB_MYSQL_DRIVER)) {
|
||||
// Load MySQL.
|
||||
m_ui->m_cmbDatabaseDriver->addItem(
|
||||
tr("MySQL/MariaDB (dedicated database)"), APP_DB_MYSQL_DRIVER);
|
||||
m_ui->m_cmbDatabaseDriver->addItem(tr("MySQL/MariaDB (dedicated database)"), APP_DB_MYSQL_DRIVER);
|
||||
|
||||
// Setup placeholders.
|
||||
m_ui->m_txtMysqlHostname->lineEdit()->setPlaceholderText(tr("Hostname of your MySQL server"));
|
||||
m_ui->m_txtMysqlUsername->lineEdit()->setPlaceholderText(tr("Username to login with"));
|
||||
m_ui->m_txtMysqlPassword->lineEdit()->setPlaceholderText(tr("Password for your username"));
|
||||
|
||||
m_ui->m_txtMysqlHostname->lineEdit()->setText(Settings::instance()->value(APP_CFG_DB, "mysql_hostname").toString());
|
||||
m_ui->m_txtMysqlUsername->lineEdit()->setText(Settings::instance()->value(APP_CFG_DB, "mysql_username").toString());
|
||||
m_ui->m_txtMysqlPassword->lineEdit()->setText(Settings::instance()->value(APP_CFG_DB, "mysql_password").toString());
|
||||
m_ui->m_spinMysqlPort->setValue(Settings::instance()->value(APP_CFG_DB, "mysql_port", APP_DB_MYSQL_PORT).toInt());
|
||||
m_ui->m_txtMysqlHostname->lineEdit()->setText(settings->value(APP_CFG_DB, "mysql_hostname").toString());
|
||||
m_ui->m_txtMysqlUsername->lineEdit()->setText(settings->value(APP_CFG_DB, "mysql_username").toString());
|
||||
m_ui->m_txtMysqlPassword->lineEdit()->setText(settings->value(APP_CFG_DB, "mysql_password").toString());
|
||||
m_ui->m_spinMysqlPort->setValue(settings->value(APP_CFG_DB, "mysql_port", APP_DB_MYSQL_PORT).toInt());
|
||||
}
|
||||
|
||||
int index_current_backend = m_ui->m_cmbDatabaseDriver->findData(Settings::instance()->value(APP_CFG_DB,
|
||||
int index_current_backend = m_ui->m_cmbDatabaseDriver->findData(settings->value(APP_CFG_DB,
|
||||
"database_driver",
|
||||
APP_DB_SQLITE_DRIVER).toString());
|
||||
|
||||
@ -545,7 +550,9 @@ void FormSettings::loadDataStorage() {
|
||||
|
||||
void FormSettings::saveDataStorage() {
|
||||
// Setup in-memory database status.
|
||||
bool original_inmemory = Settings::instance()->value(APP_CFG_DB, "use_in_memory_db", false).toBool();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
bool original_inmemory = settings->value(APP_CFG_DB, "use_in_memory_db", false).toBool();
|
||||
bool new_inmemory = m_ui->m_checkSqliteUseInMemoryDatabase->isChecked();
|
||||
|
||||
if (original_inmemory != new_inmemory) {
|
||||
@ -553,21 +560,21 @@ void FormSettings::saveDataStorage() {
|
||||
}
|
||||
|
||||
// Save data storage settings.
|
||||
QString original_db_driver = Settings::instance()->value(APP_CFG_DB, "database_driver", APP_DB_SQLITE_DRIVER).toString();
|
||||
QString original_db_driver = settings->value(APP_CFG_DB, "database_driver", APP_DB_SQLITE_DRIVER).toString();
|
||||
QString selected_db_driver = m_ui->m_cmbDatabaseDriver->itemData(m_ui->m_cmbDatabaseDriver->currentIndex()).toString();
|
||||
|
||||
// Save SQLite.
|
||||
Settings::instance()->setValue(APP_CFG_DB, "use_in_memory_db", new_inmemory);
|
||||
settings->setValue(APP_CFG_DB, "use_in_memory_db", new_inmemory);
|
||||
|
||||
if (QSqlDatabase::isDriverAvailable(APP_DB_MYSQL_DRIVER)) {
|
||||
// Save MySQL.
|
||||
Settings::instance()->setValue(APP_CFG_DB, "mysql_hostname", m_ui->m_txtMysqlHostname->lineEdit()->text());
|
||||
Settings::instance()->setValue(APP_CFG_DB, "mysql_username", m_ui->m_txtMysqlUsername->lineEdit()->text());
|
||||
Settings::instance()->setValue(APP_CFG_DB, "mysql_password", m_ui->m_txtMysqlPassword->lineEdit()->text());
|
||||
Settings::instance()->setValue(APP_CFG_DB, "mysql_port", m_ui->m_spinMysqlPort->value());
|
||||
settings->setValue(APP_CFG_DB, "mysql_hostname", m_ui->m_txtMysqlHostname->lineEdit()->text());
|
||||
settings->setValue(APP_CFG_DB, "mysql_username", m_ui->m_txtMysqlUsername->lineEdit()->text());
|
||||
settings->setValue(APP_CFG_DB, "mysql_password", m_ui->m_txtMysqlPassword->lineEdit()->text());
|
||||
settings->setValue(APP_CFG_DB, "mysql_port", m_ui->m_spinMysqlPort->value());
|
||||
}
|
||||
|
||||
Settings::instance()->setValue(APP_CFG_DB, "database_driver", selected_db_driver);
|
||||
settings->setValue(APP_CFG_DB, "database_driver", selected_db_driver);
|
||||
|
||||
if (original_db_driver != selected_db_driver ||
|
||||
m_initialSettings.m_mysqlDataStorageChanged) {
|
||||
@ -668,7 +675,7 @@ void FormSettings::saveGeneral() {
|
||||
}
|
||||
|
||||
void FormSettings::loadInterface() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Load settings of tray icon.
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
@ -770,7 +777,7 @@ void FormSettings::loadInterface() {
|
||||
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Text under icon"), Qt::ToolButtonTextUnderIcon);
|
||||
m_ui->m_cmbToolbarButtonStyle->addItem(tr("Follow OS style"), Qt::ToolButtonFollowStyle);
|
||||
|
||||
m_ui->m_cmbToolbarButtonStyle->setCurrentIndex(m_ui->m_cmbToolbarButtonStyle->findData(Settings::instance()->value(APP_CFG_GUI,
|
||||
m_ui->m_cmbToolbarButtonStyle->setCurrentIndex(m_ui->m_cmbToolbarButtonStyle->findData(qApp->settings()->value(APP_CFG_GUI,
|
||||
"toolbar_style",
|
||||
Qt::ToolButtonIconOnly).toInt()));
|
||||
|
||||
@ -780,10 +787,10 @@ void FormSettings::loadInterface() {
|
||||
}
|
||||
|
||||
void FormSettings::saveInterface() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Save toolbar.
|
||||
Settings::instance()->setValue(APP_CFG_GUI,
|
||||
settings->setValue(APP_CFG_GUI,
|
||||
"toolbar_style",
|
||||
m_ui->m_cmbToolbarButtonStyle->itemData(m_ui->m_cmbToolbarButtonStyle->currentIndex()));
|
||||
|
||||
@ -791,6 +798,7 @@ void FormSettings::saveInterface() {
|
||||
if (SystemTrayIcon::isSystemTrayAvailable()) {
|
||||
settings->setValue(APP_CFG_GUI, "use_tray_icon",
|
||||
m_ui->m_radioTrayOn->isChecked());
|
||||
|
||||
if (settings->value(APP_CFG_GUI, "use_tray_icon", true).toBool()) {
|
||||
SystemTrayIcon::instance()->show();
|
||||
FormMain::instance()->tabWidget()->feedMessageViewer()->feedsView()->notifyWithCounts();
|
||||
|
@ -50,7 +50,7 @@ QList<QAction*> MessagesToolBar::changeableActions() const {
|
||||
}
|
||||
|
||||
void MessagesToolBar::saveChangeableActions(const QStringList& actions) {
|
||||
Settings::instance()->setValue(APP_CFG_GUI, "messages_toolbar", actions.join(","));
|
||||
qApp->settings()->setValue(APP_CFG_GUI, "messages_toolbar", actions.join(","));
|
||||
loadChangeableActions(actions);
|
||||
|
||||
// If user hidden search messages box, then remove the filter.
|
||||
@ -144,7 +144,7 @@ void MessagesToolBar::initializeHighlighter() {
|
||||
}
|
||||
|
||||
void MessagesToolBar::loadChangeableActions() {
|
||||
QStringList action_names = Settings::instance()->value(APP_CFG_GUI,
|
||||
QStringList action_names = qApp->settings()->value(APP_CFG_GUI,
|
||||
"messages_toolbar",
|
||||
"m_actionMarkSelectedMessagesAsRead,m_actionMarkSelectedMessagesAsUnread,m_actionSwitchImportanceOfSelectedMessages,separator,highlighter,spacer,search").toString().split(',',
|
||||
QString::SkipEmptyParts);
|
||||
|
@ -214,7 +214,7 @@ void MessagesView::currentChanged(const QModelIndex ¤t,
|
||||
|
||||
void MessagesView::selectionChanged(const QItemSelection &selected,
|
||||
const QItemSelection &deselected) {
|
||||
if (Settings::instance()->value(APP_CFG_MESSAGES,
|
||||
if (qApp->settings()->value(APP_CFG_MESSAGES,
|
||||
"keep_cursor_center",
|
||||
false).toBool()) {
|
||||
scrollTo(currentIndex(), QAbstractItemView::PositionAtCenter);
|
||||
|
@ -91,7 +91,7 @@ bool SystemTrayIcon::isSystemTrayAvailable() {
|
||||
}
|
||||
|
||||
bool SystemTrayIcon::isSystemTrayActivated() {
|
||||
return SystemTrayIcon::isSystemTrayAvailable() && Settings::instance()->value(APP_CFG_GUI,
|
||||
return SystemTrayIcon::isSystemTrayAvailable() && qApp->settings()->value(APP_CFG_GUI,
|
||||
"use_tray_icon",
|
||||
true).toBool();
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void TabBar::mousePressEvent(QMouseEvent *event) {
|
||||
// Check if user clicked tab with middle button.
|
||||
// NOTE: This needs to be done here because
|
||||
// destination does not know the original event.
|
||||
if (event->button() & Qt::MiddleButton && Settings::instance()->value(APP_CFG_GUI,
|
||||
if (event->button() & Qt::MiddleButton && qApp->settings()->value(APP_CFG_GUI,
|
||||
"tab_close_mid_button",
|
||||
true).toBool()) {
|
||||
if (tabType(tab_index) == TabBar::Closable) {
|
||||
@ -133,7 +133,7 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
// Check if user clicked tab with middle button.
|
||||
// NOTE: This needs to be done here because
|
||||
// destination does not know the original event.
|
||||
if (event->button() & Qt::LeftButton && Settings::instance()->value(APP_CFG_GUI,
|
||||
if (event->button() & Qt::LeftButton && qApp->settings()->value(APP_CFG_GUI,
|
||||
"tab_close_double_button",
|
||||
true).toBool()) {
|
||||
if (tabType(tab_index) == TabBar::Closable) {
|
||||
@ -145,7 +145,7 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
// Check if new tab should be opened with initial web browser.
|
||||
// NOTE: This check could be unnecesary here and should be done in
|
||||
// destination object but we keep it here for consistency.
|
||||
else if (Settings::instance()->value(APP_CFG_GUI,
|
||||
else if (qApp->settings()->value(APP_CFG_GUI,
|
||||
"tab_new_double_button",
|
||||
true).toBool()) {
|
||||
emit emptySpaceDoubleClicked();
|
||||
|
@ -86,7 +86,7 @@ void TabWidget::openMainMenu() {
|
||||
}
|
||||
|
||||
void TabWidget::checkTabBarVisibility() {
|
||||
bool should_be_visible = count() > 1 || !Settings::instance()->value(APP_CFG_GUI,
|
||||
bool should_be_visible = count() > 1 || !qApp->settings()->value(APP_CFG_GUI,
|
||||
"hide_tabbar_one_tab",
|
||||
true).toBool();
|
||||
|
||||
@ -272,7 +272,7 @@ int TabWidget::addLinkedBrowser(const QString &initial_url) {
|
||||
}
|
||||
|
||||
int TabWidget::addLinkedBrowser(const QUrl &initial_url) {
|
||||
return addBrowser(Settings::instance()->value(APP_CFG_BROWSER,
|
||||
return addBrowser(qApp->settings()->value(APP_CFG_BROWSER,
|
||||
"queue_tabs",
|
||||
true).toBool(),
|
||||
false,
|
||||
|
@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
|
||||
DynamicShortcuts::load(main_window.allActions().values());
|
||||
|
||||
// Display main window.
|
||||
if (Settings::instance()->value(APP_CFG_GUI, "start_hidden",
|
||||
if (qApp->settings()->value(APP_CFG_GUI, "start_hidden",
|
||||
false).toBool() &&
|
||||
SystemTrayIcon::isSystemTrayActivated()) {
|
||||
qDebug("Hiding the main window when the application is starting.");
|
||||
|
@ -97,7 +97,7 @@ QString DatabaseFactory::mysqlInterpretErrorCode(MySQLError error_code) {
|
||||
}
|
||||
|
||||
void DatabaseFactory::sqliteAssemblyDatabaseFilePath() {
|
||||
if (Settings::instance()->type() == Settings::Portable) {
|
||||
if (qApp->settings()->type() == Settings::Portable) {
|
||||
m_sqliteDatabaseFilePath = qApp->applicationDirPath() +
|
||||
QDir::separator() +
|
||||
QString(APP_DB_SQLITE_PATH);
|
||||
@ -330,7 +330,7 @@ void DatabaseFactory::sqliteSaveMemoryDatabase() {
|
||||
}
|
||||
|
||||
void DatabaseFactory::determineDriver() {
|
||||
QString db_driver = Settings::instance()->value(APP_CFG_DB,
|
||||
QString db_driver = qApp->settings()->value(APP_CFG_DB,
|
||||
"database_driver",
|
||||
APP_DB_SQLITE_DRIVER).toString();
|
||||
|
||||
@ -344,7 +344,7 @@ void DatabaseFactory::determineDriver() {
|
||||
else {
|
||||
// User wants to use SQLite, which is always available. Check if file-based
|
||||
// or in-memory database will be used.
|
||||
if (Settings::instance()->value(APP_CFG_DB, "use_in_memory_db", false).toBool()) {
|
||||
if (qApp->settings()->value(APP_CFG_DB, "use_in_memory_db", false).toBool()) {
|
||||
// Use in-memory SQLite database.
|
||||
m_activeDatabaseDriver = SQLITE_MEMORY;
|
||||
|
||||
@ -382,10 +382,10 @@ QSqlDatabase DatabaseFactory::mysqlConnection(const QString &connection_name) {
|
||||
// yet, add it and set it up.
|
||||
database = QSqlDatabase::addDatabase(APP_DB_MYSQL_DRIVER, connection_name);
|
||||
|
||||
database.setHostName(Settings::instance()->value(APP_CFG_DB, "mysql_hostname").toString());
|
||||
database.setPort(Settings::instance()->value(APP_CFG_DB, "mysql_port", APP_DB_MYSQL_PORT).toInt());
|
||||
database.setUserName(Settings::instance()->value(APP_CFG_DB, "mysql_username").toString());
|
||||
database.setPassword(Settings::instance()->value(APP_CFG_DB, "mysql_password").toString());
|
||||
database.setHostName(qApp->settings()->value(APP_CFG_DB, "mysql_hostname").toString());
|
||||
database.setPort(qApp->settings()->value(APP_CFG_DB, "mysql_port", APP_DB_MYSQL_PORT).toInt());
|
||||
database.setUserName(qApp->settings()->value(APP_CFG_DB, "mysql_username").toString());
|
||||
database.setPassword(qApp->settings()->value(APP_CFG_DB, "mysql_password").toString());
|
||||
database.setDatabaseName(APP_LOW_NAME);
|
||||
}
|
||||
|
||||
@ -408,10 +408,10 @@ QSqlDatabase DatabaseFactory::mysqlInitializeDatabase(const QString &connection_
|
||||
QSqlDatabase database = QSqlDatabase::addDatabase(APP_DB_MYSQL_DRIVER,
|
||||
connection_name);
|
||||
|
||||
database.setHostName(Settings::instance()->value(APP_CFG_DB, "mysql_hostname").toString());
|
||||
database.setPort(Settings::instance()->value(APP_CFG_DB, "mysql_port", APP_DB_MYSQL_PORT).toInt());
|
||||
database.setUserName(Settings::instance()->value(APP_CFG_DB, "mysql_username").toString());
|
||||
database.setPassword(Settings::instance()->value(APP_CFG_DB, "mysql_password").toString());
|
||||
database.setHostName(qApp->settings()->value(APP_CFG_DB, "mysql_hostname").toString());
|
||||
database.setPort(qApp->settings()->value(APP_CFG_DB, "mysql_port", APP_DB_MYSQL_PORT).toInt());
|
||||
database.setUserName(qApp->settings()->value(APP_CFG_DB, "mysql_username").toString());
|
||||
database.setPassword(qApp->settings()->value(APP_CFG_DB, "mysql_password").toString());
|
||||
|
||||
if (!database.open()) {
|
||||
qFatal("MySQL database was NOT opened. Delivered error message: '%s'",
|
||||
|
@ -72,17 +72,15 @@ void IconFactory::setupSearchPaths() {
|
||||
"\'").join(", ")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void IconFactory::setCurrentIconTheme(const QString &theme_name) {
|
||||
Settings::instance()->setValue(APP_CFG_GUI,
|
||||
qApp->settings()->setValue(APP_CFG_GUI,
|
||||
"icon_theme",
|
||||
theme_name);
|
||||
}
|
||||
|
||||
void IconFactory::loadCurrentIconTheme() {
|
||||
QStringList installed_themes = installedIconThemes();
|
||||
QString theme_name_from_settings = Settings::instance()->value(APP_CFG_GUI,
|
||||
QString theme_name_from_settings = qApp->settings()->value(APP_CFG_GUI,
|
||||
"icon_theme",
|
||||
APP_THEME_DEFAULT).toString();
|
||||
|
||||
|
@ -47,7 +47,7 @@ Localization *Localization::instance() {
|
||||
}
|
||||
|
||||
QString Localization::desiredLanguage() {
|
||||
return Settings::instance()->value(APP_CFG_GEN,
|
||||
return qApp->settings()->value(APP_CFG_GEN,
|
||||
"language",
|
||||
QLocale::system().name()).toString();
|
||||
}
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include <QWebSettings>
|
||||
|
||||
|
||||
QPointer<Settings> Settings::s_instance;
|
||||
|
||||
Settings::Settings(const QString &file_name, Format format,
|
||||
const Type &status, QObject *parent)
|
||||
: QSettings(file_name, format, parent), m_initializationStatus(status) {
|
||||
@ -45,15 +43,9 @@ QSettings::Status Settings::checkSettings() {
|
||||
return status();
|
||||
}
|
||||
|
||||
Settings *Settings::instance() {
|
||||
if (s_instance.isNull()) {
|
||||
setupSettings();
|
||||
}
|
||||
Settings *Settings::setupSettings(QObject *parent) {
|
||||
Settings *new_settings;
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
QSettings::Status Settings::setupSettings() {
|
||||
// If settings file exists in executable file working directory
|
||||
// (in subdirectory APP_CFG_PATH), then use it (portable settings).
|
||||
// Otherwise use settings file stored in homePath();
|
||||
@ -66,8 +58,8 @@ QSettings::Status Settings::setupSettings() {
|
||||
// Check if portable settings are available.
|
||||
if (QFile(app_path_file).exists()) {
|
||||
// Portable settings are available, use them.
|
||||
s_instance = new Settings(app_path_file, QSettings::IniFormat,
|
||||
Settings::Portable, qApp);
|
||||
new_settings = new Settings(app_path_file, QSettings::IniFormat,
|
||||
Settings::Portable, parent);
|
||||
|
||||
// Construct icon cache in the same path.
|
||||
QString web_path = app_path + QDir::separator() + QString(APP_DB_WEB_PATH);
|
||||
@ -84,8 +76,8 @@ QSettings::Status Settings::setupSettings() {
|
||||
QString(APP_LOW_H_NAME);
|
||||
QString home_path_file = home_path + relative_path;
|
||||
|
||||
s_instance = new Settings(home_path_file, QSettings::IniFormat,
|
||||
Settings::NonPortable, qApp);
|
||||
new_settings = new Settings(home_path_file, QSettings::IniFormat,
|
||||
Settings::NonPortable, parent);
|
||||
|
||||
// Construct icon cache in the same path.
|
||||
QString web_path = home_path + QDir::separator() + QString(APP_DB_WEB_PATH);
|
||||
@ -96,5 +88,5 @@ QSettings::Status Settings::setupSettings() {
|
||||
qPrintable(QDir::toNativeSeparators(home_path_file)));
|
||||
}
|
||||
|
||||
return (*s_instance).checkSettings();
|
||||
return new_settings;
|
||||
}
|
||||
|
@ -33,9 +33,6 @@ class Settings : public QSettings {
|
||||
NonPortable
|
||||
};
|
||||
|
||||
// Singleton getter.
|
||||
static Settings *instance();
|
||||
|
||||
// Destructor.
|
||||
virtual ~Settings();
|
||||
|
||||
@ -60,18 +57,15 @@ class Settings : public QSettings {
|
||||
// Synchronizes settings.
|
||||
QSettings::Status checkSettings();
|
||||
|
||||
// Creates settings file in correct location.
|
||||
static Settings* setupSettings(QObject *parent);
|
||||
|
||||
private:
|
||||
// Constructor.
|
||||
Settings(const QString & file_name, Format format,
|
||||
const Type &type, QObject * parent = 0);
|
||||
|
||||
Type m_initializationStatus;
|
||||
|
||||
// Creates settings file in correct location.
|
||||
static QSettings::Status setupSettings();
|
||||
|
||||
// Private singleton value.
|
||||
static QPointer<Settings> s_instance;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
@ -109,11 +109,11 @@ bool SkinFactory::loadSkinFromData(const Skin &skin) {
|
||||
}
|
||||
|
||||
void SkinFactory::setCurrentSkinName(const QString &skin_name) {
|
||||
Settings::instance()->setValue(APP_CFG_GUI, "skin", skin_name);
|
||||
qApp->settings()->setValue(APP_CFG_GUI, "skin", skin_name);
|
||||
}
|
||||
|
||||
QString SkinFactory::selectedSkinName() {
|
||||
return Settings::instance()->value(APP_CFG_GUI,
|
||||
return qApp->settings()->value(APP_CFG_GUI,
|
||||
"skin",
|
||||
APP_SKIN_DEFAULT).toString();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "definitions/definitions.h"
|
||||
#include "miscellaneous/settings.h"
|
||||
#include "application.h"
|
||||
|
||||
#include <QNetworkProxy>
|
||||
#include <QNetworkReply>
|
||||
@ -38,7 +39,7 @@ BaseNetworkAccessManager::~BaseNetworkAccessManager() {
|
||||
|
||||
void BaseNetworkAccessManager::loadSettings() {
|
||||
QNetworkProxy new_proxy;
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(Settings::instance()->value(APP_CFG_PROXY,
|
||||
QNetworkProxy::ProxyType selected_proxy_type = static_cast<QNetworkProxy::ProxyType>(qApp->settings()->value(APP_CFG_PROXY,
|
||||
"proxy_type",
|
||||
QNetworkProxy::NoProxy).toInt());
|
||||
|
||||
@ -52,7 +53,7 @@ void BaseNetworkAccessManager::loadSettings() {
|
||||
return;
|
||||
}
|
||||
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
// Custom proxy is selected, set it up.
|
||||
new_proxy.setType(selected_proxy_type);
|
||||
|
@ -24,7 +24,7 @@ WebFactory::~WebFactory() {
|
||||
}
|
||||
|
||||
void WebFactory::loadState() {
|
||||
Settings *settings = Settings::instance();
|
||||
Settings *settings = qApp->settings();
|
||||
|
||||
switchJavascript(settings->value(APP_CFG_BROWSER, "enable_javascript", true).toBool(), false);
|
||||
switchImages(settings->value(APP_CFG_BROWSER, "enable_images", true).toBool(), false);
|
||||
@ -32,12 +32,12 @@ void WebFactory::loadState() {
|
||||
}
|
||||
|
||||
bool WebFactory::openUrlInExternalBrowser(const QString &url) {
|
||||
if (Settings::instance()->value(APP_CFG_BROWSER,
|
||||
if (qApp->settings()->value(APP_CFG_BROWSER,
|
||||
"custom_external_browser",
|
||||
false).toBool()) {
|
||||
QString browser = Settings::instance()->value(APP_CFG_BROWSER,
|
||||
QString browser = qApp->settings()->value(APP_CFG_BROWSER,
|
||||
"external_browser_executable").toString();
|
||||
QString arguments = Settings::instance()->value(APP_CFG_BROWSER,
|
||||
QString arguments = qApp->settings()->value(APP_CFG_BROWSER,
|
||||
"external_browser_arguments",
|
||||
"%1").toString();
|
||||
|
||||
@ -50,7 +50,7 @@ bool WebFactory::openUrlInExternalBrowser(const QString &url) {
|
||||
|
||||
void WebFactory::switchJavascript(bool enable, bool save_settings) {
|
||||
if (save_settings) {
|
||||
Settings::instance()->setValue(APP_CFG_BROWSER,
|
||||
qApp->settings()->setValue(APP_CFG_BROWSER,
|
||||
"enable_javascript",
|
||||
enable);
|
||||
}
|
||||
@ -61,7 +61,7 @@ void WebFactory::switchJavascript(bool enable, bool save_settings) {
|
||||
|
||||
void WebFactory::switchPlugins(bool enable, bool save_settings) {
|
||||
if (save_settings) {
|
||||
Settings::instance()->setValue(APP_CFG_BROWSER,
|
||||
qApp->settings()->setValue(APP_CFG_BROWSER,
|
||||
"enable_plugins",
|
||||
enable);
|
||||
}
|
||||
@ -72,7 +72,7 @@ void WebFactory::switchPlugins(bool enable, bool save_settings) {
|
||||
|
||||
void WebFactory::switchImages(bool enable, bool save_settings) {
|
||||
if (save_settings) {
|
||||
Settings::instance()->setValue(APP_CFG_BROWSER,
|
||||
qApp->settings()->setValue(APP_CFG_BROWSER,
|
||||
"enable_images",
|
||||
enable);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ void WebView::mousePressEvent(QMouseEvent *event) {
|
||||
|
||||
void WebView::mouseReleaseEvent(QMouseEvent *event) {
|
||||
if (event->button() & Qt::MiddleButton) {
|
||||
bool are_gestures_enabled = Settings::instance()->value(APP_CFG_BROWSER,
|
||||
bool are_gestures_enabled = qApp->settings()->value(APP_CFG_BROWSER,
|
||||
"gestures_enabled",
|
||||
true).toBool();
|
||||
if (are_gestures_enabled) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user