goldendict-ng/globalbroadcaster.h
2022-06-07 21:22:37 +08:00

38 lines
793 B
C++

#ifndef GLOBAL_GLOBALBROADCASTER_H
#define GLOBAL_GLOBALBROADCASTER_H
#include <QObject>
#include <vector>
#include "config.hh"
struct ActiveDictIds
{
QString word;
QStringList dictIds;
};
class GlobalBroadcaster : public QObject
{
Q_OBJECT
private:
Config::Preferences * preference;
std::vector<QString> whitelist;
int groupId;
public:
void setPreference( Config::Preferences * _pre );
Config::Preferences * getPreference();
GlobalBroadcaster( QObject * parent = nullptr );
void addWhitelist(QString host);
bool existedInWhitelist(QString host);
static GlobalBroadcaster * instance();
//store the latest groupId;
void setGroupId(int groupId);
int getGroupId();
signals:
void dictionaryChanges( ActiveDictIds ad );
};
#endif // GLOBAL_GLOBALBROADCASTER_H