3#include "PluginService.h"
5#include "RabbitCommonDir.h"
10#include <QCoreApplication>
11#include <QLoggingCategory>
13Q_DECLARE_LOGGING_CATEGORY(Service)
15CPluginService::CPluginService(QObject *parent)
19CPluginService::~CPluginService()
21 qDebug(Service) <<
"CPluginService::~CPluginService";
22 qApp->removeTranslator(&m_Translator);
25int CPluginService::InitTranslator()
27 QString szTranslatorFile = RabbitCommon::CDir::Instance()->GetDirPluginsTranslation(
"plugins/Service")
28 +
"/" +
Name() +
"_" + QLocale::system().name() +
".qm";
29 if(!m_Translator.load(szTranslatorFile))
31 qCritical(Service) <<
"Open translator file fail:" << szTranslatorFile;
34 qApp->installTranslator(&m_Translator);
43const QIcon CPluginService::Icon()
const
45 return QIcon::fromTheme(
"network-wired");
56 m_Service = QSharedPointer<CService>(
NewService());
61void CPluginService::Stop()
virtual const QString DisplayName() const
The plugin display name.
virtual CService * NewService()=0
New service.
virtual void Start()
Start a Service.
virtual const QString Id() const
ID. Default: Protocol() + "_" + Name()
virtual const QString Name() const =0
This name must be the same as the project name (${PROJECT_NAME}).
virtual const QString Protocol() const =0
Plugin Protocol.