goldendict-ng/globalbroadcaster.cpp

35 lines
773 B
C++
Raw Normal View History

#include "globalbroadcaster.h"
#include <QGlobalStatic>
#include "utils.hh"
2022-04-23 08:15:23 +00:00
Q_GLOBAL_STATIC( GlobalBroadcaster, bdcaster )
GlobalBroadcaster::GlobalBroadcaster( QObject * parent ) : QObject( parent )
{
}
2022-04-23 08:15:23 +00:00
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 );
2022-06-07 13:22:37 +00:00
}
bool GlobalBroadcaster::existedInWhitelist( QString url )
{
return std::find( whitelist.begin(), whitelist.end(), url ) != whitelist.end();
2022-06-07 13:22:37 +00:00
}
// namespace global