YoudaoTrans/youdaotrans.h

55 lines
1.4 KiB
C++

#ifndef GENERICPLUGIN_H
#define GENERICPLUGIN_H
#include "../WingTool/plugin/iwingtoolplg.h"
#include "settingdialog.h"
#include "youdaoservice.h"
#include <QObject>
#include <QTranslator>
class YoudaoTrans : public IWingToolPlg {
Q_OBJECT
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID IWINGPLUGIN_INTERFACE_IID FILE "YoudaoTrans.json")
#endif // QT_VERSION >= 0x050000
Q_INTERFACES(IWingToolPlg)
public:
YoudaoTrans(QObject *parent = nullptr);
int sdkVersion() override;
QString signature() override;
~YoudaoTrans() override;
bool init(QList<WingPluginInfo> loadedplugin) override;
void unload() override;
QString pluginName() override;
QString pluginAuthor() override;
Catagorys pluginCatagory() override;
uint pluginVersion() override;
QString pluginComment() override;
QString pluginWebsite() override;
QIcon pluginIcon() override;
const QMetaObject *serviceMeta() override;
const QPointer<QObject> serviceHandler() override;
HookIndex getHookSubscribe() override;
bool preInit() override;
QString translatorFile() override;
public slots:
QVariant pluginServicePipe(int serviceID, QList<QVariant> params) override;
void onPluginCenter() override;
void buttonRelease(Qt::MouseButton btn, int x, int y) override;
private:
QTranslator translator;
YoudaoService *trans;
QString lastword;
bool localiztion = true;
};
#endif // GENERICPLUGIN_H