Rabbit Remote Control 0.0.33
Loading...
Searching...
No Matches
Connecter.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CCONNECTER_H
4#define CCONNECTER_H
5
6#pragma once
7
8#include <QObject>
9#include <QDir>
10#include <QtPlugin>
11#include <QDataStream>
12#include <QDialog>
13#include <QIcon>
14#include <QMimeData>
15#include <QSettings>
16#include <QMessageBox>
17#include <QMenu>
18
19#include "client_export.h"
20#include "ParameterClient.h"
21
22class CPluginClient;
23
61class CLIENT_EXPORT CConnecter : public QObject
62{
63 Q_OBJECT
64
65public:
87 explicit CConnecter(CPluginClient *plugin);
88 virtual ~CConnecter();
89
91 virtual const QString Id();
93 virtual const QString Name();
95 virtual const QString Description();
97 virtual const QString Protocol() const;
99 virtual qint16 Version() = 0;
101 virtual const QIcon Icon() const;
102
115 virtual QWidget* GetViewer() = 0;
133 virtual int OpenDialogSettings(QWidget* parent = nullptr);
137 virtual QMenu* GetMenu(QWidget* parent = nullptr);
138
139public Q_SLOTS:
154 virtual int Connect() = 0;
170 virtual int DisConnect() = 0;
171
172Q_SIGNALS:
209 void sigUpdateName(const QString& szName);
227 void sigError(const int nError, const QString &szError);
240 void sigInformation(const QString& szInfo);
255 void sigShowMessageBox(const QString& title, const QString& message,
256 const QMessageBox::Icon& icon = QMessageBox::Information);
257
258protected:
264 Q_INVOKABLE virtual int Initial();
269 Q_INVOKABLE virtual int Clean();
276 Q_INVOKABLE virtual int SetParameterClient(CParameterClient* pPara);
277
291 virtual int SetParameter(CParameter* p);
292 CParameter* GetParameter();
293
294protected:
295 Q_INVOKABLE CPluginClient* GetPlugClient() const;
296
297 static QObject* createObject(const QString &className, QObject* parent = NULL);
298
299private:
316 virtual QDialog* OnOpenDialogSettings(QWidget* parent = nullptr) = 0;
317
318public:
319 /* \~chinese 得到配置文件名
320 * \~english Get settings file name
321 */
322 virtual QString GetSettingsFile();
323 /* \~chinese 设置配置文件名
324 * \~english Set settings file name
325 */
326 virtual int SetSettingsFile(const QString &szFile);
327private:
328 QString m_szSettings;
329protected:
334 virtual int Load(QSettings &set);
339 virtual int Save(QSettings &set);
346 Q_INVOKABLE virtual int Load(QString szFile = QString());
355 Q_INVOKABLE virtual int Save(QString szFile = QString());
356
357private Q_SLOTS:
358 void slotShowServerName();
359 void slotUpdateName();
360
378 virtual void slotBlockShowWidget(const QString& className, int &nRet, void* pContext);
389 virtual void slotBlockShowMessageBox(const QString& szTitle,
390 const QString& szMessage,
391 QMessageBox::StandardButtons buttons,
392 QMessageBox::StandardButton& nRet,
393 bool &checkBox,
394 QString szCheckBoxContext = QString());
400 virtual void slotBlockInputDialog(const QString& szTitle,
401 const QString& szLable,
402 const QString& szMessage,
403 QString& szText
404 );
405
406private Q_SLOTS:
409 virtual void slotSetClipboard(QMimeData *data);
410private:
411Q_SIGNALS:
412 void sigClipBoardChanged();
413
414protected:
415 QMenu m_Menu;
416 QAction* m_pSettings;
417private Q_SLOTS:
418 virtual void slotSettings();
419
420private:
421 CPluginClient* m_pPluginClient;
422
423 // The owner is a derived class of this class
424 CParameter* m_pParameter;
425};
426
427#endif // CCONNECTER_H
Connecter interface.
Definition Connecter.h:62
void sigUpdateName(const QString &szName)
virtual int DisConnect()=0
Close connect.
void sigConnected()
Successful connection signal.
virtual QDialog * OnOpenDialogSettings(QWidget *parent=nullptr)=0
Open settgins dialog.
CConnecter(CPluginClient *plugin)
virtual qint16 Version()=0
Version.
virtual QWidget * GetViewer()=0
Get Viewer.
void sigDisconnected()
Successful disconnection signal.
void sigDisconnect()
Notify the user to disconnect.
void sigError(const int nError, const QString &szError)
Triggered when an error is generated.
void sigShowMessageBox(const QString &title, const QString &message, const QMessageBox::Icon &icon=QMessageBox::Information)
Trigger the display of a message dialog (QMessageBox) in the main thread from a background thread wit...
virtual int Connect()=0
Start connect.
void sigInformation(const QString &szInfo)
Show information in main windows.
void sigUpdateParameters(CConnecter *pConnecter)
Update parameters, notify application to save or show parameters.
The parameters of client.
Parameter interface.
Definition Parameter.h:169
The plugin interface.