mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Using global QSettings object, should save some writes to disk.
- instead of creating new QSettings objects whenever we want to save some data, we are using global QSettings object that is keeping its data in memory and writing to disk only when really needed
This commit is contained in:
parent
53d0c256c5
commit
999f0ef702
@ -50,6 +50,7 @@
|
||||
#include "mainapplication.h"
|
||||
#include "networkmanager.h"
|
||||
#include "qupzilla.h"
|
||||
#include "settings.h"
|
||||
|
||||
AdBlockManager* AdBlockManager::s_adBlockManager = 0;
|
||||
|
||||
@ -105,7 +106,7 @@ void AdBlockManager::load()
|
||||
}
|
||||
m_loaded = true;
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("AdBlock");
|
||||
m_enabled = settings.value("enabled", m_enabled).toBool();
|
||||
QDateTime lastUpdate = settings.value("lastUpdate", QDateTime()).toDateTime();
|
||||
@ -122,7 +123,7 @@ void AdBlockManager::load()
|
||||
|
||||
void AdBlockManager::rulesUpdated()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("AdBlock");
|
||||
settings.setValue("lastUpdate", QDateTime::currentDateTime());
|
||||
|
||||
@ -136,7 +137,7 @@ void AdBlockManager::save()
|
||||
}
|
||||
m_subscription->saveRules();
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup(QLatin1String("AdBlock"));
|
||||
settings.setValue(QLatin1String("enabled"), m_enabled);
|
||||
settings.endGroup();
|
||||
|
@ -47,8 +47,6 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QWeakPointer>
|
||||
|
||||
class QUrl;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "databasewriter.h"
|
||||
#include "speeddial.h"
|
||||
#include "webpage.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#define DEFAULT_CHECK_UPDATES true
|
||||
@ -183,7 +184,9 @@ MainApplication::MainApplication(const QList<CommandLineOptions::ActionPair> &cm
|
||||
u.checkProfile();
|
||||
connectDatabase();
|
||||
|
||||
QSettings settings2(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings::createSettings(m_activeProfil + "settings.ini");
|
||||
|
||||
Settings settings2;
|
||||
settings2.beginGroup("SessionRestore");
|
||||
if (settings2.value("isRunning", false).toBool()) {
|
||||
settings2.setValue("isCrashed", true);
|
||||
@ -241,7 +244,7 @@ void MainApplication::postLaunch()
|
||||
|
||||
void MainApplication::loadSettings()
|
||||
{
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Themes");
|
||||
QString activeTheme = settings.value("activeTheme", DEFAULT_THEME_NAME).toString();
|
||||
settings.endGroup();
|
||||
@ -494,7 +497,7 @@ void MainApplication::connectDatabase()
|
||||
void MainApplication::translateApp()
|
||||
{
|
||||
QLocale locale;
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Language");
|
||||
QString file = settings.value("language", locale.name() + ".qm").toString();
|
||||
QString shortLoc = file.left(2);
|
||||
@ -535,7 +538,7 @@ void MainApplication::quitApplication()
|
||||
saveStateSlot();
|
||||
}
|
||||
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SessionRestore");
|
||||
settings.setValue("isRunning", false);
|
||||
settings.setValue("isCrashed", false);
|
||||
@ -560,6 +563,8 @@ void MainApplication::quitApplication()
|
||||
QFile::remove(getActiveProfilPath() + "WebpageIcons.db");
|
||||
m_iconProvider->saveIconsToDatabase();
|
||||
|
||||
Settings::syncSettings();
|
||||
|
||||
// qDebug() << "Quitting application...";
|
||||
quit();
|
||||
}
|
||||
@ -688,7 +693,7 @@ bool MainApplication::saveStateSlot()
|
||||
return false;
|
||||
}
|
||||
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SessionRestore");
|
||||
settings.setValue("restoreSession", false);
|
||||
|
||||
@ -732,7 +737,7 @@ bool MainApplication::restoreStateSlot(QupZilla* window)
|
||||
}
|
||||
|
||||
m_isRestoring = true;
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
int afterStart = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
|
||||
settings.beginGroup("SessionRestore");
|
||||
if (!settings.value("restoreSession", false).toBool()) {
|
||||
|
@ -17,12 +17,11 @@
|
||||
* ============================================================ */
|
||||
#ifndef MAINAPPLICATION_H
|
||||
#define MAINAPPLICATION_H
|
||||
#define mApp MainApplication::getInstance()
|
||||
#define mStyle MainApplication::appStyle
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QWebSettings>
|
||||
#define mApp MainApplication::getInstance()
|
||||
|
||||
#include <QUrl>
|
||||
#include <QWebSettings>
|
||||
#include <QWeakPointer>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QWebSecurityOrigin>
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "globalfunctions.h"
|
||||
#include "webhistorywrapper.h"
|
||||
#include "enhancedmenu.h"
|
||||
#include "settings.h"
|
||||
|
||||
const QString QupZilla::VERSION = "1.1.5";
|
||||
const QString QupZilla::BUILDTIME = __DATE__" "__TIME__;
|
||||
@ -90,9 +91,9 @@ QupZilla::QupZilla(StartBehaviour behaviour, QUrl startUrl)
|
||||
, m_startingUrl(startUrl)
|
||||
, m_startBehaviour(behaviour)
|
||||
, m_menuBookmarksAction(0)
|
||||
#ifdef Q_WS_MAC
|
||||
#ifdef Q_WS_MAC
|
||||
, m_macMenuBar(new QMenuBar())
|
||||
#endif
|
||||
#endif
|
||||
, m_actionPrivateBrowsing(0)
|
||||
, m_statusBarMessage(new StatusBarMessage(this))
|
||||
, m_sideBarWidth(0)
|
||||
@ -129,7 +130,7 @@ void QupZilla::postLaunch()
|
||||
}
|
||||
}
|
||||
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-URL-Settings");
|
||||
int afterLaunch = settings.value("afterLaunch", 1).toInt();
|
||||
settings.endGroup();
|
||||
@ -204,7 +205,7 @@ void QupZilla::setupUi()
|
||||
int locationBarWidth;
|
||||
int websearchBarWidth;
|
||||
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Browser-View-Settings");
|
||||
if (settings.value("WindowMaximised", false).toBool()) {
|
||||
resize(800, 550);
|
||||
@ -459,7 +460,7 @@ void QupZilla::setupMenu()
|
||||
|
||||
void QupZilla::loadSettings()
|
||||
{
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
|
||||
//Url settings
|
||||
settings.beginGroup("Web-URL-Settings");
|
||||
@ -1095,7 +1096,7 @@ void QupZilla::showBookmarksToolbar()
|
||||
bool status = m_bookmarksToolbar->isVisible();
|
||||
m_bookmarksToolbar->setVisible(!status);
|
||||
|
||||
QSettings settings(activeProfil() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.setValue("Browser-View-Settings/showBookmarksToolbar", !status);
|
||||
}
|
||||
|
||||
@ -1155,7 +1156,7 @@ void QupZilla::showNavigationToolbar()
|
||||
bool status = m_navigationBar->isVisible();
|
||||
m_navigationBar->setVisible(!status);
|
||||
|
||||
QSettings settings(activeProfil() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.setValue("Browser-View-Settings/showNavigationToolbar", !status);
|
||||
}
|
||||
|
||||
@ -1168,7 +1169,7 @@ void QupZilla::showMenubar()
|
||||
menuBar()->setVisible(!menuBar()->isVisible());
|
||||
m_navigationBar->buttonSuperMenu()->setVisible(!menuBar()->isVisible());
|
||||
|
||||
QSettings settings(activeProfil() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.setValue("Browser-View-Settings/showMenubar", menuBar()->isVisible());
|
||||
}
|
||||
|
||||
@ -1177,7 +1178,7 @@ void QupZilla::showStatusbar()
|
||||
bool status = statusBar()->isVisible();
|
||||
statusBar()->setVisible(!status);
|
||||
|
||||
QSettings settings(activeProfil() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.setValue("Browser-View-Settings/showStatusbar", !status);
|
||||
}
|
||||
|
||||
@ -1346,7 +1347,7 @@ void QupZilla::startPrivate(bool state)
|
||||
{
|
||||
static bool askedThisSession = false;
|
||||
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
bool askNow = settings.value("Browser-View-Settings/AskOnPrivate", true).toBool();
|
||||
|
||||
if (state && askNow && !askedThisSession) {
|
||||
@ -1519,7 +1520,7 @@ bool QupZilla::quitApp()
|
||||
saveSideBarWidth();
|
||||
}
|
||||
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
int afterLaunch = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
|
||||
bool askOnClose = settings.value("Browser-Tabs-Settings/AskOnClosing", false).toBool();
|
||||
|
||||
|
45
src/app/settings.cpp
Normal file
45
src/app/settings.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "settings.h"
|
||||
|
||||
QSettings* Settings::m_settings = 0;
|
||||
|
||||
Settings::Settings(QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void Settings::createSettings(const QString &fileName)
|
||||
{
|
||||
m_settings = new QSettings(fileName, QSettings::IniFormat);
|
||||
}
|
||||
|
||||
void Settings::syncSettings()
|
||||
{
|
||||
m_settings->sync();
|
||||
}
|
||||
|
||||
void Settings::setValue(const QString &key, const QVariant &defaultValue)
|
||||
{
|
||||
m_settings->setValue(key, defaultValue);
|
||||
}
|
||||
|
||||
QVariant Settings::value(const QString &key, const QVariant &defaultValue)
|
||||
{
|
||||
return m_settings->value(key, defaultValue);
|
||||
}
|
||||
|
||||
void Settings::beginGroup(const QString &prefix)
|
||||
{
|
||||
m_settings->beginGroup(prefix);
|
||||
}
|
||||
|
||||
void Settings::endGroup()
|
||||
{
|
||||
m_settings->endGroup();
|
||||
}
|
||||
|
||||
Settings::~Settings()
|
||||
{
|
||||
if (!m_settings->group().isEmpty()) {
|
||||
m_settings->endGroup();
|
||||
}
|
||||
}
|
32
src/app/settings.h
Normal file
32
src/app/settings.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
|
||||
class Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Settings(QObject* parent = 0);
|
||||
~Settings();
|
||||
|
||||
static void createSettings(const QString &fileName);
|
||||
static void syncSettings();
|
||||
|
||||
void setValue(const QString &key, const QVariant &defaultValue = QVariant());
|
||||
QVariant value(const QString &key, const QVariant &defaultValue = QVariant());
|
||||
|
||||
void beginGroup(const QString &prefix);
|
||||
void endGroup();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
static QSettings* m_settings;
|
||||
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
@ -21,6 +21,7 @@
|
||||
#include "mainapplication.h"
|
||||
#include "autofillnotification.h"
|
||||
#include "databasewriter.h"
|
||||
#include "settings.h"
|
||||
|
||||
AutoFillModel::AutoFillModel(QupZilla* mainClass, QObject* parent)
|
||||
: QObject(parent)
|
||||
@ -32,7 +33,7 @@ AutoFillModel::AutoFillModel(QupZilla* mainClass, QObject* parent)
|
||||
|
||||
void AutoFillModel::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
m_isStoring = settings.value("SavePasswordsOnSites", true).toBool();
|
||||
settings.endGroup();
|
||||
|
@ -16,6 +16,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#include "bookmarksmodel.h"
|
||||
#include "settings.h"
|
||||
#include "mainapplication.h"
|
||||
#include "webview.h"
|
||||
#include "iconprovider.h"
|
||||
@ -34,7 +35,7 @@ BookmarksModel::BookmarksModel(QObject* parent)
|
||||
|
||||
void BookmarksModel::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
m_showMostVisited = settings.value("showMostVisited", true).toBool();
|
||||
settings.endGroup();
|
||||
@ -42,7 +43,7 @@ void BookmarksModel::loadSettings()
|
||||
|
||||
void BookmarksModel::setShowingMostVisited(bool state)
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
settings.setValue("showMostVisited", state);
|
||||
settings.endGroup();
|
||||
|
@ -23,10 +23,10 @@
|
||||
#define _bookmarksUnsorted BookmarksModel::toTranslatedFolder("unsorted")
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
#include <QUrl>
|
||||
#include <QSettings>
|
||||
#include <QSqlQuery>
|
||||
#include <QIcon>
|
||||
#include <QSqlQuery>
|
||||
|
||||
class WebView;
|
||||
class BookmarksModel : public QObject
|
||||
@ -105,10 +105,10 @@ public slots:
|
||||
|
||||
private:
|
||||
bool m_showMostVisited;
|
||||
|
||||
};
|
||||
|
||||
typedef BookmarksModel::Bookmark Bookmark;
|
||||
|
||||
Q_DECLARE_METATYPE(BookmarksModel::Bookmark)
|
||||
|
||||
#endif // BOOKMARKSMODEL_H
|
||||
|
@ -17,6 +17,7 @@
|
||||
* ============================================================ */
|
||||
#include "cookiejar.h"
|
||||
#include "qupzilla.h"
|
||||
#include "settings.h"
|
||||
//#define COOKIE_DEBUG
|
||||
|
||||
//TODO: black/white listing
|
||||
@ -30,7 +31,7 @@ CookieJar::CookieJar(QupZilla* mainClass, QObject* parent)
|
||||
|
||||
void CookieJar::loadSettings()
|
||||
{
|
||||
QSettings settings(m_activeProfil + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
m_allowCookies = settings.value("allowCookies", true).toBool();
|
||||
m_allowCookiesFromDomain = settings.value("allowCookiesFromVisitedDomainOnly", false).toBool();
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QNetworkCookieJar>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QFile>
|
||||
|
||||
class QupZilla;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "desktopnotificationsfactory.h"
|
||||
#include "desktopnotification.h"
|
||||
#include "mainapplication.h"
|
||||
#include "settings.h"
|
||||
|
||||
DesktopNotificationsFactory::DesktopNotificationsFactory(QObject* parent)
|
||||
: QObject(parent)
|
||||
@ -28,7 +29,7 @@ DesktopNotificationsFactory::DesktopNotificationsFactory(QObject* parent)
|
||||
|
||||
void DesktopNotificationsFactory::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Notifications");
|
||||
m_enabled = settings.value("Enabled", true).toBool();
|
||||
m_timeout = settings.value("Timeout", 6000).toInt();
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <QDBusInterface>
|
||||
#endif
|
||||
#include <QStringList>
|
||||
#include <QSettings>
|
||||
#include <QPoint>
|
||||
#include <QTimer>
|
||||
#include <QWeakPointer>
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "downloaditem.h"
|
||||
#include "downloadmanager.h"
|
||||
#include "globalfunctions.h"
|
||||
#include "settings.h"
|
||||
|
||||
DownloadFileHelper::DownloadFileHelper(const QString &lastDownloadPath, const QString &downloadPath, bool useNativeDialog, WebPage* page)
|
||||
: QObject()
|
||||
@ -173,7 +174,7 @@ void DownloadFileHelper::fileNameChoosed(const QString &name, bool fileNameAutoG
|
||||
m_lastDownloadPath = m_path;
|
||||
}
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("DownloadManager");
|
||||
settings.setValue("lastDownloadPath", m_lastDownloadPath);
|
||||
settings.endGroup();
|
||||
|
@ -27,12 +27,12 @@
|
||||
#include "globalfunctions.h"
|
||||
#include "webpage.h"
|
||||
#include "downloadfilehelper.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#define DEFAULT_USE_NATIVE_DIALOG false
|
||||
#else
|
||||
#define DEFAULT_USE_NATIVE_DIALOG true
|
||||
|
||||
#endif
|
||||
|
||||
DownloadManager::DownloadManager(QWidget* parent)
|
||||
@ -65,7 +65,7 @@ DownloadManager::DownloadManager(QWidget* parent)
|
||||
|
||||
void DownloadManager::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("DownloadManager");
|
||||
m_downloadPath = settings.value("defaultDownloadPath", "").toString();
|
||||
m_lastDownloadPath = settings.value("lastDownloadPath", QDir::homePath() + "/").toString();
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QCloseEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
#include <QNetworkReply>
|
||||
#include <QListWidgetItem>
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "qupzilla.h"
|
||||
#include "iconprovider.h"
|
||||
#include "databasewriter.h"
|
||||
#include "settings.h"
|
||||
|
||||
HistoryModel::HistoryModel(QupZilla* mainClass)
|
||||
: QObject()
|
||||
@ -40,7 +41,7 @@ HistoryModel::HistoryModel(QupZilla* mainClass)
|
||||
|
||||
void HistoryModel::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
m_isSaving = settings.value("allowHistory", true).toBool();
|
||||
settings.endGroup();
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QHeaderView>
|
||||
#include <QStandardItem>
|
||||
#include <QUrl>
|
||||
#include <QSettings>
|
||||
#include <QAction>
|
||||
#include <QToolButton>
|
||||
#include <QMenu>
|
||||
|
@ -17,6 +17,7 @@
|
||||
* ============================================================ */
|
||||
#include "locationbarsettings.h"
|
||||
#include "mainapplication.h"
|
||||
#include "settings.h"
|
||||
|
||||
LocationBarSettings* LocationBarSettings::s_instance = 0;
|
||||
bool LocationBarSettings::selectAllOnDoubleClick = false;
|
||||
@ -38,9 +39,10 @@ LocationBarSettings* LocationBarSettings::instance()
|
||||
|
||||
void LocationBarSettings::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("AddressBar");
|
||||
selectAllOnDoubleClick = settings.value("SelectAllTextOnDoubleClick", true).toBool();
|
||||
selectAllOnClick = settings.value("SelectAllTextOnClick", false).toBool();
|
||||
addCountryWithAlt = settings.value("AddCountryDomainWithAltKey", true).toBool();
|
||||
settings.endGroup();
|
||||
}
|
||||
|
@ -18,8 +18,6 @@
|
||||
#ifndef LOCATIONBARSETTINGS_H
|
||||
#define LOCATIONBARSETTINGS_H
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
class LocationBarSettings
|
||||
{
|
||||
public:
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "globalfunctions.h"
|
||||
#include "acceptlanguage.h"
|
||||
#include "cabundleupdater.h"
|
||||
#include "settings.h"
|
||||
|
||||
QString fileNameForCert(const QSslCertificate &cert)
|
||||
{
|
||||
@ -59,7 +60,7 @@ NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent)
|
||||
|
||||
void NetworkManager::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-Browser-Settings");
|
||||
|
||||
if (settings.value("AllowLocalCache", true).toBool()) {
|
||||
@ -397,7 +398,7 @@ void NetworkManager::addLocalCertificate(const QSslCertificate &cert)
|
||||
|
||||
void NetworkManager::saveCertificates()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SSL-Configuration");
|
||||
settings.setValue("CACertPaths", m_certPaths);
|
||||
settings.setValue("IgnoreAllSSLWarnings", m_ignoreAllWarnings);
|
||||
@ -406,7 +407,7 @@ void NetworkManager::saveCertificates()
|
||||
|
||||
void NetworkManager::loadCertificates()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SSL-Configuration");
|
||||
m_certPaths = settings.value("CACertPaths", QStringList()).toStringList();
|
||||
m_ignoreAllWarnings = settings.value("IgnoreAllSSLWarnings", false).toBool();
|
||||
|
@ -17,6 +17,7 @@
|
||||
* ============================================================ */
|
||||
#include "networkproxyfactory.h"
|
||||
#include "mainapplication.h"
|
||||
#include "settings.h"
|
||||
|
||||
NetworkProxyFactory::NetworkProxyFactory()
|
||||
: QNetworkProxyFactory()
|
||||
@ -26,7 +27,7 @@ NetworkProxyFactory::NetworkProxyFactory()
|
||||
|
||||
void NetworkProxyFactory::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Web-Proxy");
|
||||
m_proxyPreference = ProxyPreference(settings.value("UseProxy", SystemProxy).toInt());
|
||||
m_proxyType = QNetworkProxy::ProxyType(settings.value("ProxyType", QNetworkProxy::HttpProxy).toInt());
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <QNetworkProxyFactory>
|
||||
#include <QUrl>
|
||||
#include <QStringList>
|
||||
#include <QSettings>
|
||||
|
||||
class NetworkProxyFactory : public QNetworkProxyFactory
|
||||
{
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "opensearchreader.h"
|
||||
#include "opensearchengine.h"
|
||||
#include "databasewriter.h"
|
||||
#include "settings.h"
|
||||
|
||||
#define ENSURE_LOADED if (!m_settingsLoaded) loadSettings();
|
||||
|
||||
@ -40,7 +41,7 @@ SearchEnginesManager::SearchEnginesManager()
|
||||
, m_settingsLoaded(false)
|
||||
, m_saveScheduled(false)
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SearchEngines");
|
||||
m_startingEngineName = settings.value("activeEngine", "Google").toString();
|
||||
settings.endGroup();
|
||||
@ -310,7 +311,7 @@ QList<SearchEngine> SearchEnginesManager::allEngines()
|
||||
|
||||
void SearchEnginesManager::saveSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SearchEngines");
|
||||
settings.setValue("activeEngine", m_activeEngine.name);
|
||||
settings.endGroup();
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <QVariant>
|
||||
#include <QNetworkReply>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
#include "opensearchengine.h"
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "mainapplication.h"
|
||||
#include "downloaditem.h"
|
||||
#include "globalfunctions.h"
|
||||
#include "settings.h"
|
||||
|
||||
BrowsingLibrary::BrowsingLibrary(QupZilla* mainClass, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
@ -35,7 +36,7 @@ BrowsingLibrary::BrowsingLibrary(QupZilla* mainClass, QWidget* parent)
|
||||
, m_rssLoaded(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("BrowsingLibrary");
|
||||
resize(settings.value("size", QSize(760, 470)).toSize());
|
||||
settings.endGroup();
|
||||
@ -152,7 +153,7 @@ void BrowsingLibrary::optimizeDatabase()
|
||||
|
||||
void BrowsingLibrary::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("BrowsingLibrary");
|
||||
settings.setValue("size", size());
|
||||
settings.endGroup();
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "plugininterface.h"
|
||||
#include "mainapplication.h"
|
||||
#include "speeddial.h"
|
||||
#include "settings.h"
|
||||
|
||||
PluginProxy::PluginProxy()
|
||||
: Plugins()
|
||||
@ -90,7 +91,7 @@ QNetworkReply* PluginProxy::createNetworkRequest(QNetworkAccessManager::Operatio
|
||||
|
||||
void PluginProxy::c2f_loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("ClickToFlash");
|
||||
c2f_whitelist = settings.value("whitelist", QStringList()).toStringList();
|
||||
c2f_enabled = settings.value("Enabled", true).toBool();
|
||||
@ -99,7 +100,7 @@ void PluginProxy::c2f_loadSettings()
|
||||
|
||||
void PluginProxy::c2f_saveSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("ClickToFlash");
|
||||
settings.setValue("whitelist", c2f_whitelist);
|
||||
settings.setValue("Enabled", c2f_enabled);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "pluginproxy.h"
|
||||
#include "plugininterface.h"
|
||||
#include "mainapplication.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef PORTABLE_BUILD
|
||||
#define DEFAULT_ENABLE_PLUGINS false
|
||||
@ -35,7 +36,7 @@ void Plugins::loadSettings()
|
||||
{
|
||||
m_allowedPluginFileNames.clear();
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Plugin-Settings");
|
||||
m_pluginsEnabled = settings.value("EnablePlugins", DEFAULT_ENABLE_PLUGINS).toBool();
|
||||
m_allowedPluginFileNames = settings.value("AllowedPlugins", QStringList()).toStringList();
|
||||
|
@ -22,8 +22,8 @@
|
||||
#include <QtPlugin>
|
||||
#include <QPluginLoader>
|
||||
#include <QDir>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QSettings>
|
||||
#include <iostream>
|
||||
|
||||
class PluginInterface;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "speeddial.h"
|
||||
#include "mainapplication.h"
|
||||
#include "pagethumbnailer.h"
|
||||
#include "settings.h"
|
||||
|
||||
SpeedDial::SpeedDial(QObject* parent)
|
||||
: QObject(parent)
|
||||
@ -30,7 +31,7 @@ void SpeedDial::loadSettings()
|
||||
{
|
||||
m_loaded = true;
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SpeedDial");
|
||||
m_allPages = settings.value("pages", "").toString();
|
||||
m_bgImg = settings.value("background", "").toString();
|
||||
@ -59,7 +60,7 @@ void SpeedDial::saveSettings()
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("SpeedDial");
|
||||
settings.setValue("pages", m_allPages);
|
||||
settings.setValue("background", m_bgImg);
|
||||
|
@ -19,12 +19,11 @@
|
||||
#define SPEEDDIAL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSettings>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QWebFrame>
|
||||
#include <QWeakPointer>
|
||||
#include <QDebug>
|
||||
|
||||
class PageThumbnailer;
|
||||
class SpeedDial : public QObject
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "ui_acceptlanguage.h"
|
||||
#include "ui_addacceptlanguage.h"
|
||||
#include "mainapplication.h"
|
||||
#include <QDebug>
|
||||
#include "settings.h"
|
||||
|
||||
QStringList AcceptLanguage::defaultLanguage()
|
||||
{
|
||||
@ -74,7 +74,7 @@ AcceptLanguage::AcceptLanguage(QWidget* parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Language");
|
||||
QStringList langs = settings.value("acceptLanguage", defaultLanguage()).toStringList();
|
||||
|
||||
@ -204,7 +204,7 @@ void AcceptLanguage::accept()
|
||||
langs.append(code);
|
||||
}
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Language");
|
||||
settings.setValue("acceptLanguage", langs);
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QLocale>
|
||||
#include <QSettings>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "pluginproxy.h"
|
||||
#include "mainapplication.h"
|
||||
#include "plugininterface.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef PORTABLE_BUILD
|
||||
#define DEFAULT_ENABLE_PLUGINS false
|
||||
@ -40,7 +41,7 @@ PluginsList::PluginsList(QWidget* parent)
|
||||
connect(ui->butLoad, SIGNAL(clicked()), this, SLOT(reloadPlugins()));
|
||||
connect(ui->allowAppPlugins, SIGNAL(clicked(bool)), this, SLOT(allowAppPluginsChanged(bool)));
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Plugin-Settings");
|
||||
ui->allowAppPlugins->setChecked(settings.value("EnablePlugins", DEFAULT_ENABLE_PLUGINS).toBool());
|
||||
settings.endGroup();
|
||||
@ -86,7 +87,7 @@ void PluginsList::removeWhitelist()
|
||||
|
||||
void PluginsList::save()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Plugin-Settings");
|
||||
settings.setValue("EnablePlugins", ui->allowAppPlugins->isChecked());
|
||||
settings.endGroup();
|
||||
@ -96,7 +97,7 @@ void PluginsList::save()
|
||||
|
||||
void PluginsList::allowAppPluginsChanged(bool state)
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Plugin-Settings");
|
||||
settings.setValue("EnablePlugins", state);
|
||||
settings.endGroup();
|
||||
@ -106,7 +107,7 @@ void PluginsList::allowAppPluginsChanged(bool state)
|
||||
|
||||
void PluginsList::allowC2FChanged(bool state)
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("ClickToFlash");
|
||||
settings.setValue("Enable", state);
|
||||
settings.endGroup();
|
||||
@ -191,7 +192,7 @@ void PluginsList::reloadPlugins()
|
||||
allowedPlugins.append(ui->list->item(i)->toolTip());
|
||||
}
|
||||
}
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Plugin-Settings");
|
||||
settings.setValue("AllowedPlugins", allowedPlugins);
|
||||
settings.endGroup();
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "acceptlanguage.h"
|
||||
#include "globalfunctions.h"
|
||||
#include "autofillmodel.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#define DEFAULT_CHECK_UPDATES true
|
||||
@ -114,7 +115,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
ui->listWidget->item(10)->setIcon(QIcon::fromTheme("applications-system", QIcon(":/icons/preferences/applications-system.png")));
|
||||
#endif
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
//GENERAL URLs
|
||||
settings.beginGroup("Web-URL-Settings");
|
||||
m_homepage = settings.value("homepage", "qupzilla:start").toString();
|
||||
@ -620,7 +621,7 @@ void Preferences::startProfileIndexChanged(QString index)
|
||||
|
||||
void Preferences::saveSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
//GENERAL URLs
|
||||
settings.beginGroup("Web-URL-Settings");
|
||||
settings.setValue("homepage", ui->homepage->text());
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QSslCertificate>
|
||||
#include <QDateTime>
|
||||
#include <QSettings>
|
||||
#include <QFileDialog>
|
||||
#include <QCloseEvent>
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ui_thememanager.h"
|
||||
#include "mainapplication.h"
|
||||
#include "globalfunctions.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#define DEFAULT_THEME_NAME "windows"
|
||||
@ -32,7 +33,7 @@ ThemeManager::ThemeManager(QWidget* parent)
|
||||
{
|
||||
ui->setupUi(parent);
|
||||
ui->license->hide();
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Themes");
|
||||
m_activeTheme = settings.value("activeTheme", DEFAULT_THEME_NAME).toString();
|
||||
settings.endGroup();
|
||||
@ -153,7 +154,7 @@ ThemeManager::Theme ThemeManager::parseTheme(const QString &name)
|
||||
|
||||
void ThemeManager::save()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Themes");
|
||||
settings.setValue("activeTheme", ui->listWidget->currentItem()->data(Qt::UserRole));
|
||||
settings.endGroup();
|
||||
|
@ -19,7 +19,6 @@
|
||||
#define THEMEMANAGER_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
#include <QListWidgetItem>
|
||||
#include <QHash>
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "bookmarkssidebar.h"
|
||||
#include "historysidebar.h"
|
||||
#include "qupzilla.h"
|
||||
#include "settings.h"
|
||||
|
||||
SideBar::SideBar(QupZilla* mainClass, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
@ -45,7 +46,7 @@ void SideBar::showBookmarks()
|
||||
setWidget(bar);
|
||||
m_activeWidget = Bookmarks;
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.setValue("Browser-View-Settings/SideBar", "Bookmarks");
|
||||
}
|
||||
|
||||
@ -56,7 +57,7 @@ void SideBar::showHistory()
|
||||
setWidget(bar);
|
||||
m_activeWidget = History;
|
||||
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.setValue("Browser-View-Settings/SideBar", "History");
|
||||
}
|
||||
|
||||
@ -76,7 +77,7 @@ void SideBar::setWidget(QWidget* widget)
|
||||
|
||||
void SideBar::close()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.setValue("Browser-View-Settings/SideBar", "None");
|
||||
|
||||
p_QupZilla->saveSideBarWidth();
|
||||
|
@ -187,7 +187,8 @@ SOURCES += main.cpp\
|
||||
navigation/goicon.cpp \
|
||||
rss/rssicon.cpp \
|
||||
navigation/downicon.cpp \
|
||||
network/cabundleupdater.cpp
|
||||
network/cabundleupdater.cpp \
|
||||
app/settings.cpp
|
||||
|
||||
HEADERS += \
|
||||
3rdparty/qtwin.h \
|
||||
@ -311,7 +312,8 @@ HEADERS += \
|
||||
navigation/goicon.h \
|
||||
rss/rssicon.h \
|
||||
navigation/downicon.h \
|
||||
network/cabundleupdater.h
|
||||
network/cabundleupdater.h \
|
||||
app/settings.h
|
||||
|
||||
FORMS += \
|
||||
preferences/autofillmanager.ui \
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "webtab.h"
|
||||
#include "iconprovider.h"
|
||||
#include "toolbutton.h"
|
||||
#include "settings.h"
|
||||
|
||||
#define MAXIMUM_TAB_WIDTH 250
|
||||
#define MINIMUM_TAB_WIDTH 50
|
||||
@ -58,7 +59,7 @@ TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
|
||||
|
||||
void TabBar::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Browser-Tabs-Settings");
|
||||
|
||||
setMovable(settings.value("makeTabsMovable", true).toBool());
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QStyle>
|
||||
#include <QSettings>
|
||||
|
||||
class QupZilla;
|
||||
class TabWidget;
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "toolbutton.h"
|
||||
#include "locationbar.h"
|
||||
#include "websearchbar.h"
|
||||
#include "settings.h"
|
||||
|
||||
class NewTabButton : public QToolButton
|
||||
{
|
||||
@ -148,7 +149,7 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
|
||||
|
||||
void TabWidget::loadSettings()
|
||||
{
|
||||
QSettings settings(mApp->getActiveProfilPath() + "settings.ini", QSettings::IniFormat);
|
||||
Settings settings;
|
||||
settings.beginGroup("Browser-Tabs-Settings");
|
||||
m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool();
|
||||
settings.endGroup();
|
||||
|
Loading…
Reference in New Issue
Block a user