diff --git a/src/lib/adblock/adblockicon.cpp b/src/lib/adblock/adblockicon.cpp index e8fb7ba62..2c450df7a 100644 --- a/src/lib/adblock/adblockicon.cpp +++ b/src/lib/adblock/adblockicon.cpp @@ -41,6 +41,11 @@ AdBlockIcon::AdBlockIcon(BrowserWindow* window, QWidget* parent) setToolTip(tr("AdBlock lets you block unwanted content on web pages")); connect(this, SIGNAL(clicked(QPoint)), this, SLOT(showMenu(QPoint))); + connect(AdBlockManager::instance(), SIGNAL(enabledChanged(bool)), this, SLOT(setEnabled(bool))); +} + +AdBlockIcon::~AdBlockIcon() +{ } void AdBlockIcon::popupBlocked(const QString &ruleString, const QUrl &url) @@ -225,7 +230,3 @@ void AdBlockIcon::setEnabled(bool enabled) m_enabled = enabled; } - -AdBlockIcon::~AdBlockIcon() -{ -} diff --git a/src/lib/adblock/adblockicon.h b/src/lib/adblock/adblockicon.h index fba1383eb..d8e029b08 100644 --- a/src/lib/adblock/adblockicon.h +++ b/src/lib/adblock/adblockicon.h @@ -37,8 +37,6 @@ public: void popupBlocked(const QString &ruleString, const QUrl &url); QAction* menuAction(); -signals: - public slots: void setEnabled(bool enabled); void createMenu(QMenu* menu = 0); diff --git a/src/lib/adblock/adblockmanager.cpp b/src/lib/adblock/adblockmanager.cpp index 39f49c45a..b08cf952e 100644 --- a/src/lib/adblock/adblockmanager.cpp +++ b/src/lib/adblock/adblockmanager.cpp @@ -65,7 +65,7 @@ void AdBlockManager::setEnabled(bool enabled) } m_enabled = enabled; - mApp->sendMessages(Qz::AM_SetAdBlockIconEnabled, enabled); + emit enabledChanged(enabled); Settings settings; settings.beginGroup("AdBlock"); diff --git a/src/lib/adblock/adblockmanager.h b/src/lib/adblock/adblockmanager.h index bfcbb55c4..48af593e8 100644 --- a/src/lib/adblock/adblockmanager.h +++ b/src/lib/adblock/adblockmanager.h @@ -68,6 +68,9 @@ public: AdBlockCustomList* customList() const; +signals: + void enabledChanged(bool enabled); + public slots: void setEnabled(bool enabled); void showRule(); diff --git a/src/lib/app/browserwindow.cpp b/src/lib/app/browserwindow.cpp index 2177566bc..e52096c4d 100644 --- a/src/lib/app/browserwindow.cpp +++ b/src/lib/app/browserwindow.cpp @@ -111,7 +111,6 @@ const QString BrowserWindow::WEBKITVERSION = qWebKitVersion(); BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, QUrl startUrl) : QMainWindow(0) - , m_historyMenuChanged(true) , m_bookmarksMenuChanged(true) , m_isClosing(false) , m_isStarting(false) @@ -147,7 +146,7 @@ BrowserWindow::BrowserWindow(Qz::BrowserWindowType type, QUrl startUrl) m_hideNavigationTimer->setSingleShot(true); connect(m_hideNavigationTimer, SIGNAL(timeout()), this, SLOT(hideNavigationSlot())); - connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(receiveMessage(Qz::AppMessageType,bool))); + connect(mApp, SIGNAL(reloadSettings()), this, SLOT(loadSettings())); QTimer::singleShot(0, this, SLOT(postLaunch())); @@ -945,38 +944,6 @@ void BrowserWindow::setWindowTitle(const QString &t) QMainWindow::setWindowTitle(title); } -void BrowserWindow::receiveMessage(Qz::AppMessageType mes, bool state) -{ - switch (mes) { - case Qz::AM_SetAdBlockIconEnabled: - m_adblockIcon->setEnabled(state); - break; - - case Qz::AM_CheckPrivateBrowsing: - m_privateBrowsing->setVisible(state); - m_actionPrivateBrowsing->setChecked(state); - weView()->titleChanged(); - break; - - case Qz::AM_ReloadSettings: - loadSettings(); - m_tabWidget->loadSettings(); - break; - - case Qz::AM_HistoryStateChanged: - m_historyMenuChanged = true; - break; - - case Qz::AM_BookmarksChanged: - setBookmarksMenuChanged(true); - break; - - default: - qWarning("Unresolved message sent! This could never happen!"); - break; - } -} - void BrowserWindow::aboutToShowFileMenu() { #ifndef Q_OS_MAC diff --git a/src/lib/app/browserwindow.h b/src/lib/app/browserwindow.h index f2dc01132..e28a831fa 100644 --- a/src/lib/app/browserwindow.h +++ b/src/lib/app/browserwindow.h @@ -64,7 +64,6 @@ public: void openWithTab(WebTab* tab); - void loadSettings(); void saveSideBarWidth(); bool fullScreenNavigationVisible() const; @@ -113,7 +112,6 @@ public: signals: void startingCompleted(); - void message(Qz::AppMessageType mes, bool state); void setWebViewMouseTracking(bool state); public slots: @@ -138,10 +136,11 @@ public slots: void showSource(QWebFrame* frame = 0, const QString &selectedHtml = QString()); void printPage(QWebFrame* frame = 0); void showPageInfo(); - void receiveMessage(Qz::AppMessageType mes, bool state); private slots: + void loadSettings(); void postLaunch(); + void stop(); void reload(); void reloadByPassCache(); diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 01549ddc8..40d5a4bac 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -302,7 +302,6 @@ MainApplication::MainApplication(int &argc, char** argv) BrowserWindow* qupzilla = new BrowserWindow(Qz::BW_FirstAppWindow, startUrl); m_mainWindows.prepend(qupzilla); - connect(qupzilla, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(sendMessages(Qz::AppMessageType,bool))); connect(qupzilla, SIGNAL(startingCompleted()), this, SLOT(restoreCursor())); loadSettings(); @@ -456,11 +455,10 @@ void MainApplication::loadSettings() m_uaManager->loadSettings(); } -void MainApplication::reloadSettings() +void MainApplication::doReloadSettings() { - QTimer::singleShot(0, this, SLOT(loadSettings())); - - emit message(Qz::AM_ReloadSettings, true); + loadSettings(); + emit reloadSettings(); } void MainApplication::restoreCursor() @@ -494,7 +492,6 @@ BrowserWindow* MainApplication::getWindow() void MainApplication::setStateChanged() { m_autoSaver->changeOcurred(); - sendMessages(Qz::AM_HistoryStateChanged, true); } QList MainApplication::mainWindows() @@ -567,11 +564,6 @@ QString MainApplication::currentProfilePath() const return m_activeProfil; } -void MainApplication::sendMessages(Qz::AppMessageType mes, bool state) -{ - emit message(mes, state); -} - void MainApplication::receiveAppMessage(QString message) { QWidget* actWin = getWindow(); diff --git a/src/lib/app/mainapplication.h b/src/lib/app/mainapplication.h index bc31aa3aa..db849cc86 100644 --- a/src/lib/app/mainapplication.h +++ b/src/lib/app/mainapplication.h @@ -69,7 +69,7 @@ public: ~MainApplication(); void connectDatabase(); - void reloadSettings(); + void doReloadSettings(); bool restoreStateSlot(BrowserWindow* window, RestoreData recoveryData); BrowserWindow* makeNewWindow(Qz::BrowserWindowType type, const QUrl &startUrl = QUrl()); void aboutToCloseWindow(BrowserWindow* window); @@ -131,7 +131,6 @@ public: public slots: bool saveStateSlot(); void quitApplication(); - void sendMessages(Qz::AppMessageType mes, bool state); void receiveAppMessage(QString message); void setStateChanged(); void addNewTab(const QUrl &url = QUrl()); @@ -141,7 +140,7 @@ public slots: bool checkDefaultWebBrowser(); signals: - void message(Qz::AppMessageType mes, bool state); + void reloadSettings(); private slots: void loadSettings(); diff --git a/src/lib/app/qzcommon.h b/src/lib/app/qzcommon.h index 28f6c6fff..c5831a348 100644 --- a/src/lib/app/qzcommon.h +++ b/src/lib/app/qzcommon.h @@ -55,14 +55,6 @@ static const QString COPYRIGHT = "2010-2014"; static const QString WWWADDRESS = "http://www.qupzilla.com"; static const QString WIKIADDRESS = "https://github.com/QupZilla/qupzilla/wiki"; -enum AppMessageType { - AM_SetAdBlockIconEnabled, - AM_CheckPrivateBrowsing, - AM_ReloadSettings, - AM_HistoryStateChanged, - AM_BookmarksChanged -}; - enum BrowserWindowType { BW_FirstAppWindow, BW_OtherRestoredWindow, diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index c25840a0f..5be093bc4 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -96,7 +96,7 @@ LocationBar::LocationBar(BrowserWindow* window) connect(down, SIGNAL(clicked(QPoint)), m_completer, SLOT(showMostVisited())); connect(mApp->searchEnginesManager(), SIGNAL(activeEngineChanged()), this, SLOT(updatePlaceHolderText())); connect(mApp->searchEnginesManager(), SIGNAL(defaultEngineChanged()), this, SLOT(updatePlaceHolderText())); - connect(mApp, SIGNAL(message(Qz::AppMessageType,bool)), SLOT(onMessage(Qz::AppMessageType,bool))); + connect(mApp, SIGNAL(reloadSettings()), SLOT(loadSettings())); loadSettings(); clearIcon(); @@ -610,18 +610,6 @@ void LocationBar::loadSettings() settings.endGroup(); } -void LocationBar::onMessage(Qz::AppMessageType msg, bool state) -{ - Q_UNUSED(state) - if (!qzSettings->showLoadingProgress) { - return; - } - - if (msg == Qz::AM_ReloadSettings) { - loadSettings(); - } -} - void LocationBar::hideProgress() { if (qzSettings->showLoadingProgress && m_loadProgress == 100) { diff --git a/src/lib/navigation/locationbar.h b/src/lib/navigation/locationbar.h index 61db4f62d..fdc4405c2 100644 --- a/src/lib/navigation/locationbar.h +++ b/src/lib/navigation/locationbar.h @@ -78,7 +78,7 @@ private slots: void onLoadFinished(); void hideProgress(); - void onMessage(Qz::AppMessageType, bool); + void loadSettings(); private: enum ProgressStyle { @@ -101,8 +101,6 @@ private: void showGoButton(); void hideGoButton(); - void loadSettings(); - LocationCompleter* m_completer; BookmarksIcon* m_bookmarkIcon; diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 33535a136..7b72c096f 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -1078,7 +1078,7 @@ void Preferences::saveSettings() m_themesManager->save(); mApp->cookieJar()->loadSettings(); mApp->history()->loadSettings(); - mApp->reloadSettings(); + mApp->doReloadSettings(); mApp->plugins()->c2f_saveSettings(); mApp->networkManager()->loadSettings(); mApp->desktopNotifications()->loadSettings(); diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index 7d40385fd..e24c5f78b 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -142,6 +142,8 @@ TabWidget::TabWidget(BrowserWindow* window, QWidget* parent) connect(m_tabBar, SIGNAL(showButtons()), this, SLOT(showButtons())); connect(m_tabBar, SIGNAL(hideButtons()), this, SLOT(hideButtons())); + connect(mApp, SIGNAL(reloadSettings()), this, SLOT(loadSettings())); + m_menuTabs = new MenuTabs(m_tabBar); m_buttonListTabs = new ToolButton(m_tabBar); diff --git a/src/lib/webview/tabwidget.h b/src/lib/webview/tabwidget.h index 7547a3a80..887abfb8c 100644 --- a/src/lib/webview/tabwidget.h +++ b/src/lib/webview/tabwidget.h @@ -72,8 +72,6 @@ public: explicit TabWidget(BrowserWindow* mainclass, QWidget* parent = 0); ~TabWidget(); - void loadSettings(); - QByteArray saveState(); bool restoreState(const QVector &tabs, int currentTab); void closeRecoveryTab(); @@ -139,6 +137,8 @@ signals: void changed(); private slots: + void loadSettings(); + void aboutToShowTabsMenu(); void actionChangeIndex(); void tabMoved(int before, int after);