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
插件名,这个名一定要与工程名(${PROJECT_NAME})相同。 翻译文件(${PROJECT_NAME}_*.ts))名与其相关。
virtual const QString Protocol() const =0
Plugin Protocol