mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
41 lines
894 B
C++
41 lines
894 B
C++
#include "globalbroadcaster.h"
|
|
#include <QGlobalStatic>
|
|
#include "utils.hh"
|
|
|
|
Q_GLOBAL_STATIC( GlobalBroadcaster, bdcaster )
|
|
GlobalBroadcaster::GlobalBroadcaster( QObject * parent ) : QObject( parent )
|
|
{
|
|
}
|
|
|
|
GlobalBroadcaster * GlobalBroadcaster::instance()
|
|
{
|
|
return bdcaster;
|
|
}
|
|
void GlobalBroadcaster::setPreference( Config::Preferences * p )
|
|
{
|
|
preference = p;
|
|
}
|
|
Config::Preferences * GlobalBroadcaster::getPreference()
|
|
{
|
|
return preference;
|
|
}
|
|
|
|
void GlobalBroadcaster::addWhitelist(QString url){
|
|
whitelist.push_back(url);
|
|
auto baseUrl=::getHostBase(url);
|
|
whitelist.push_back(baseUrl);
|
|
}
|
|
|
|
bool GlobalBroadcaster::existedInWhitelist(QString url){
|
|
return std::find(whitelist.begin(), whitelist.end(), url) != whitelist.end();
|
|
}
|
|
|
|
void GlobalBroadcaster::setGroupId(int groupId){
|
|
this->groupId = groupId;
|
|
}
|
|
|
|
int GlobalBroadcaster::getGroupId(){
|
|
return groupId;
|
|
}
|
|
// namespace global
|