1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[CodeCleanup] Get rid of Qz::AppMessage enum

This commit is contained in:
nowrep 2014-03-09 12:49:45 +01:00
parent a61ce67d7c
commit a3c3dead87
14 changed files with 24 additions and 85 deletions

View File

@ -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()
{
}

View File

@ -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);

View File

@ -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");

View File

@ -68,6 +68,9 @@ public:
AdBlockCustomList* customList() const;
signals:
void enabledChanged(bool enabled);
public slots:
void setEnabled(bool enabled);
void showRule();

View File

@ -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

View File

@ -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();

View File

@ -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<BrowserWindow*> 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();

View File

@ -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();

View File

@ -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,

View File

@ -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) {

View File

@ -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;

View File

@ -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();

View File

@ -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);

View File

@ -72,8 +72,6 @@ public:
explicit TabWidget(BrowserWindow* mainclass, QWidget* parent = 0);
~TabWidget();
void loadSettings();
QByteArray saveState();
bool restoreState(const QVector<WebTab::SavedTab> &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);