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

[AdBlockManager] Use Q_GLOBAL_STATIC for AdBlockManager

This commit is contained in:
nowrep 2014-03-09 12:54:23 +01:00
parent a3c3dead87
commit 985db8a35d
2 changed files with 9 additions and 14 deletions

View File

@ -38,7 +38,7 @@
#include <QElapsedTimer>
#endif
AdBlockManager* AdBlockManager::s_adBlockManager = 0;
Q_GLOBAL_STATIC(AdBlockManager, qz_adblock_manager)
AdBlockManager::AdBlockManager(QObject* parent)
: QObject(parent)
@ -49,13 +49,14 @@ AdBlockManager::AdBlockManager(QObject* parent)
load();
}
AdBlockManager::~AdBlockManager()
{
qDeleteAll(m_subscriptions);
}
AdBlockManager* AdBlockManager::instance()
{
if (!s_adBlockManager) {
s_adBlockManager = new AdBlockManager(mApp->networkManager());
}
return s_adBlockManager;
return qz_adblock_manager();
}
void AdBlockManager::setEnabled(bool enabled)
@ -433,8 +434,3 @@ void AdBlockManager::showRule()
}
}
}
AdBlockManager::~AdBlockManager()
{
qDeleteAll(m_subscriptions);
}

View File

@ -40,8 +40,6 @@ public:
AdBlockManager(QObject* parent = 0);
~AdBlockManager();
static AdBlockManager* instance();
void load();
void save();
@ -68,6 +66,8 @@ public:
AdBlockCustomList* customList() const;
static AdBlockManager* instance();
signals:
void enabledChanged(bool enabled);
@ -81,7 +81,6 @@ public slots:
private:
inline bool canBeBlocked(const QUrl &url) const;
static AdBlockManager* s_adBlockManager;
bool m_loaded;
bool m_enabled;