mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-13 10:32:11 +01:00
[AdBlockManager] Use Q_GLOBAL_STATIC for AdBlockManager
This commit is contained in:
parent
a3c3dead87
commit
985db8a35d
|
@ -38,7 +38,7 @@
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AdBlockManager* AdBlockManager::s_adBlockManager = 0;
|
Q_GLOBAL_STATIC(AdBlockManager, qz_adblock_manager)
|
||||||
|
|
||||||
AdBlockManager::AdBlockManager(QObject* parent)
|
AdBlockManager::AdBlockManager(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
|
@ -49,13 +49,14 @@ AdBlockManager::AdBlockManager(QObject* parent)
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdBlockManager::~AdBlockManager()
|
||||||
|
{
|
||||||
|
qDeleteAll(m_subscriptions);
|
||||||
|
}
|
||||||
|
|
||||||
AdBlockManager* AdBlockManager::instance()
|
AdBlockManager* AdBlockManager::instance()
|
||||||
{
|
{
|
||||||
if (!s_adBlockManager) {
|
return qz_adblock_manager();
|
||||||
s_adBlockManager = new AdBlockManager(mApp->networkManager());
|
|
||||||
}
|
|
||||||
|
|
||||||
return s_adBlockManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdBlockManager::setEnabled(bool enabled)
|
void AdBlockManager::setEnabled(bool enabled)
|
||||||
|
@ -433,8 +434,3 @@ void AdBlockManager::showRule()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AdBlockManager::~AdBlockManager()
|
|
||||||
{
|
|
||||||
qDeleteAll(m_subscriptions);
|
|
||||||
}
|
|
||||||
|
|
|
@ -40,8 +40,6 @@ public:
|
||||||
AdBlockManager(QObject* parent = 0);
|
AdBlockManager(QObject* parent = 0);
|
||||||
~AdBlockManager();
|
~AdBlockManager();
|
||||||
|
|
||||||
static AdBlockManager* instance();
|
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
|
@ -68,6 +66,8 @@ public:
|
||||||
|
|
||||||
AdBlockCustomList* customList() const;
|
AdBlockCustomList* customList() const;
|
||||||
|
|
||||||
|
static AdBlockManager* instance();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void enabledChanged(bool enabled);
|
void enabledChanged(bool enabled);
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline bool canBeBlocked(const QUrl &url) const;
|
inline bool canBeBlocked(const QUrl &url) const;
|
||||||
static AdBlockManager* s_adBlockManager;
|
|
||||||
|
|
||||||
bool m_loaded;
|
bool m_loaded;
|
||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user