Rabbit Remote Control 0.1.0-bate8
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Slots | Private Member Functions | Private Attributes | List of all members

Operate interface. More...

#include <Operate.h>

Inheritance diagram for COperate:
Inheritance graph
[legend]
Collaboration diagram for COperate:
Collaboration graph
[legend]

Signals

void sigViewerFocusIn (QWidget *pView)
 The view is focus.
 
void sigFullScreen (bool bFullScreen)
 Full screen.
 
void sigUpdateName (const QString &szName)
 
void sigUpdateParameters (COperate *pOperate)
 Update parameters, notify application to save or show parameters.
 
void sigError (const int nError, const QString &szError)
 Triggered when an error is generated.
 
void sigInformation (const QString &szInfo)
 Show information in main windows.
 
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 without blocking the background thread.
 
void sigClipBoardChanged ()
 

Public Member Functions

 COperate (CPlugin *plugin)
 
virtual QWidget * GetViewer ()=0
 Get Viewer.
 
virtual int OpenDialogSettings (QWidget *parent=nullptr)
 Open settings dialog.
 
virtual QMenu * GetMenu (QWidget *parent=nullptr)
 Get menu.
 
Property
virtual const QString Id ()
 
virtual const QString Name ()
 Name.
 
virtual const QString Description ()
 Description.
 
virtual const QString Protocol () const
 
virtual const qint16 Version () const =0
 
virtual const QIcon Icon () const
 
virtual const QString GetTypeName () const
 

Protected Slots

void slotUpdateName ()
 

Protected Member Functions

virtual Q_INVOKABLE int Initial ()
 Initial parameters and resource.
 
virtual Q_INVOKABLE int Clean ()
 Clean parameters and resource.
 
virtual Q_INVOKABLE int SetGlobalParameters (CParameterPlugin *pPara)=0
 Apply the global parameters of the plug-in.
 
Q_INVOKABLE CPluginGetPlugin () const
 Get plugin.
 

Static Protected Member Functions

static QObject * createObject (const QString &className, QObject *parent=NULL)
 Create Object.
 

Protected Attributes

QMenu m_Menu
 
QAction * m_pActionSettings
 

Private Slots

virtual void slotBlockShowWidget (const QString &className, int &nRet, void *pContext)
 Blocks the background thread and displays the window in the foreground thread.
 
virtual void slotBlockShowMessageBox (const QString &szTitle, const QString &szMessage, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton &nRet, bool &checkBox, QString szCheckBoxContext=QString())
 Block background threads and display message dialogs in foreground threads (QMessageBox)
 
virtual void slotBlockInputDialog (const QString &szTitle, const QString &szLable, const QString &szMessage, QString &szText)
 Block background threads and display input dialogs in foreground threads (QInputDialog)
 
virtual void slotSetClipboard (QMimeData *data)
 
virtual void slotSettings ()
 

Private Member Functions

virtual QDialog * OnOpenDialogSettings (QWidget *parent=nullptr)=0
 Open settgins dialog.
 

Private Attributes

CPluginm_pPlugin
 

Load and save settings

QString m_szSettings
 
virtual QString GetSettingsFile ()
 
virtual int SetSettingsFile (const QString &szFile)
 
virtual Q_INVOKABLE int Load (QSettings &set)=0
 Load parameters.
 
virtual Q_INVOKABLE int Save (QSettings &set)=0
 Save parameters.
 
virtual Q_INVOKABLE int Load (QString szFile=QString())
 Load parameters from file.
 
virtual Q_INVOKABLE int Save (QString szFile=QString())
 Save parameters to file.
 

Statistics

CSecurityLevel::Levels m_SecurityLevel
 
virtual CStatsGetStats ()
 Get statistics.
 
virtual CSecurityLevel::Levels GetSecurityLevel () const
 Get Security Level.
 
void sigSecurityLevel ()
 Triggered when the security level changes.
 
void slotSetSecurityLevel (CSecurityLevel::Levels level)
 

Main Workflow

virtual int Start ()=0
 Start.
 
virtual int Stop ()=0
 Stop.
 
void sigRunning ()
 Start success signal.
 
void sigStop ()
 Notify the user to stop.
 
void sigFinished ()
 Successful disconnection signal.
 

Detailed Description

Operate interface.

Note
  • This interface is only used by users. It is implemented by plugins.
  • Its instance is in the main thread.

Class diagram:

Sequen diagram:

Basic implementations of the following types have been provided:

See also
CPlugin

Definition at line 50 of file Operate.h.

Constructor & Destructor Documentation

◆ ~COperate()

COperate::~COperate ( )
virtual

Definition at line 31 of file Operate.cpp.

Member Function Documentation

◆ Clean()

int COperate::Clean ( )
protectedvirtual

◆ createObject()

QObject * COperate::createObject ( const QString &  className,
QObject *  parent = NULL 
)
staticprotected

Create Object.

Parameters
classNameclass name
parent
Returns
Created object

Definition at line 252 of file Operate.cpp.

◆ Description()

const QString COperate::Description ( )
virtual

Description.

{
QString szDescription;
if(!Name().isEmpty())
szDescription = tr("Name: ") + Name() + "\n";
if(!GetTypeName().isEmpty())
szDescription += tr("Type: ") + GetTypeName() + "\n";
if(!Protocol().isEmpty()) {
szDescription += tr("Protocol: ") + Protocol();
#ifdef DEBUG
if(!GetPlugin()->DisplayName().isEmpty())
szDescription += " - " + GetPlugin()->DisplayName();
#endif
szDescription += "\n";
}
if(!ServerName().isEmpty())
szDescription += tr("Server name: ") + ServerName() + "\n";
if(GetParameter()) {
if(!GetParameter()->m_Net.GetHost().isEmpty())
szDescription += tr("Server address: ") + GetParameter()->m_Net.GetHost() + ":"
+ QString::number(GetParameter()->m_Net.GetPort()) + "\n";
QString szProxy(tr("Proxy") + " ");
auto &proxy = GetParameter()->m_Proxy;
switch(proxy.GetUsedType()) {
case CParameterProxy::TYPE::SSHTunnel:
{
auto &sshNet = proxy.m_SSH.m_Net;
szProxy += "(" + tr("SSH tunnel") + "): " + sshNet.GetHost() + ":"
+ QString::number(sshNet.GetPort());
break;
}
case CParameterProxy::TYPE::SockesV5:
{
auto &sockesV5 = proxy.m_SockesV5;
szProxy += "(" + tr("Sockes v5") + "): " + sockesV5.GetHost() + ":"
+ QString::number(sockesV5.GetPort());
break;
}
default:
szProxy.clear();
break;
}
if(!szProxy.isEmpty())
szDescription += szProxy + "\n";
}
if(!(GetSecurityLevel() & CSecurityLevel::Level::No)) {
szDescription += tr("Security level: ");
if(!sl.GetUnicodeIcon().isEmpty())
szDescription += sl.GetUnicodeIcon() + " ";
szDescription += sl.GetString() + "\n";
}
if(!GetPlugin()->Description().isEmpty())
szDescription += tr("Description: ") + GetPlugin()->Description();
return szDescription;
}
virtual const QString Description() override
[The name of the desktop operate]
virtual CSecurityLevel::Levels GetSecurityLevel() const
Get Security Level.
Definition Operate.cpp:129
Q_INVOKABLE CPlugin * GetPlugin() const
Get plugin.
Definition Operate.cpp:219
virtual const QString Name()
Name.
Definition Operate.cpp:46
virtual const QString Description()
Description.
Definition Operate.cpp:51
virtual const QString DisplayName() const
The plugin display name.
Definition Plugin.cpp:76
virtual const QString Description() const =0
Plugin description.
Security level.
Definition Stats.h:79
See also
COperateDesktop::Description()

Reimplemented in COperateFileTransfer, COperateFtpServer, COperateRawStream, COperateSerialPort, COperateSSH, COperateTelnet, CTerminal, COperateDesktop, and COperateTerminal.

Definition at line 51 of file Operate.cpp.

◆ GetMenu()

QMenu * COperate::GetMenu ( QWidget *  parent = nullptr)
virtual

Get menu.

Reimplemented in COperateWebBrowser.

Definition at line 117 of file Operate.cpp.

◆ GetPlugin()

CPlugin * COperate::GetPlugin ( ) const
protected

Get plugin.

See also
CManager::DeleteOperate

Definition at line 219 of file Operate.cpp.

◆ GetSecurityLevel()

CSecurityLevel::Levels COperate::GetSecurityLevel ( ) const
virtual

Get Security Level.

Returns
See also
CSecurityLevel

Definition at line 129 of file Operate.cpp.

◆ GetSettingsFile()

QString COperate::GetSettingsFile ( )
virtual

Definition at line 143 of file Operate.cpp.

◆ GetStats()

CStats * COperate::GetStats ( )
virtual

Get statistics.

If so, its derived class needs to overload this function to provide statistical information.

Returns
Statistics pointer

Reimplemented in CTerminal, COperateVnc, and COperateTerminal.

Definition at line 124 of file Operate.cpp.

◆ GetTypeName()

const QString COperate::GetTypeName ( ) const
virtual

Definition at line 86 of file Operate.cpp.

◆ GetViewer()

virtual QWidget * COperate::GetViewer ( )
pure virtual

Get Viewer.

Returns
QWidget*: the ownership is a instance of this class or its derivative class
Note
If you implement the view yourself, you need to disable the view at the beginning and allow the view after sigRun.
See also
sigRunning CFrmViewer::CFrmViewer

Implemented in COperateFileTransfer, COperateFtpServer, CScreenCapture, COperateWakeOnLan, COperateWebBrowser, COperateDesktop, and COperateTerminal.

◆ Icon()

const QIcon COperate::Icon ( ) const
virtual

Definition at line 92 of file Operate.cpp.

◆ Id()

const QString COperate::Id ( )
virtual

Definition at line 36 of file Operate.cpp.

◆ Initial()

int COperate::Initial ( )
protectedvirtual

◆ Load() [1/2]

virtual Q_INVOKABLE int COperate::Load ( QSettings &  set)
protectedpure virtual

◆ Load() [2/2]

int COperate::Load ( QString  szFile = QString())
protectedvirtual

Load parameters from file.

Note
Call after Initial()
See also
CManger::LoadOperate Initial()

Definition at line 164 of file Operate.cpp.

◆ Name()

const QString COperate::Name ( )
virtual

Name.

const QString COperateDesktop::Name()
{
QString szName;
// Show the name of parameter
if(GetParameter() && !(GetParameter()->GetName().isEmpty()))
szName += GetParameter()->GetName();
else {
// Show the prefix of protocol
if(GetParameter() && GetParameter()->GetGlobalParameters()
&& (GetParameter()->GetGlobalParameters()->GetNameStyles()
& CParameterPlugin::NameStyle::Protocol)
&& !Protocol().isEmpty())
szName = Protocol() + ":";
// Show the server name
szName += ServerName();
}
// Show the prefix of security level
QString szSecurityLevel;
if((GetParameter()->GetGlobalParameters()->GetNameStyles()
& CParameterPlugin::NameStyle::SecurityLevel)
&& !(GetSecurityLevel() & CSecurityLevel::Level::No)
&& !sl.GetUnicodeIcon().isEmpty())
szSecurityLevel = sl.GetUnicodeIcon().left(2);
return szSecurityLevel + szName;
}
virtual const QString Name() override
[The name of the desktop operate]
See also
COperateDesktop::Name()

Reimplemented in COperateFileTransfer, COperateFtpServer, COperateRawStream, COperateSerialPort, COperateSSH, COperateTelnet, CTerminal, COperateWakeOnLan, COperateWebBrowser, COperateDesktop, and COperateTerminal.

Definition at line 46 of file Operate.cpp.

◆ OnOpenDialogSettings()

virtual QDialog * COperate::OnOpenDialogSettings ( QWidget *  parent = nullptr)
privatepure virtual

Open settgins dialog.

Parameters
parentthe parent windows of the dialog of return
Returns
QDialog*: then QDialog must be allocated in heap memory, the ownership is caller.
See also
OpenDialogSettings

Implemented in COperateFileTransfer, COperateFreeRDP, COperateFtpServer, COperateLibVNCServer, COperatePlayer, COperateRawStream, CScreenCapture, COperateSerialPort, COperateSSH, COperateTelnet, CTerminal, COperateWakeOnLan, COperateWebBrowser, and COperateVnc.

◆ OpenDialogSettings()

int COperate::OpenDialogSettings ( QWidget *  parent = nullptr)
virtual

Open settings dialog.

Parameters
parent
Returns
DialogCode
  • QDialog::Accepted
  • QDialog::Rejected
  • -1: error
See also
OnOpenDialogSettings

Definition at line 97 of file Operate.cpp.

◆ Protocol()

const QString COperate::Protocol ( ) const
virtual

Definition at line 81 of file Operate.cpp.

◆ Save() [1/2]

virtual Q_INVOKABLE int COperate::Save ( QSettings &  set)
protectedpure virtual

◆ Save() [2/2]

int COperate::Save ( QString  szFile = QString())
protectedvirtual

Save parameters to file.

Parameters
szFileFile name.
See also
CManger::SaveOperate

Definition at line 177 of file Operate.cpp.

◆ SetGlobalParameters()

int COperate::SetGlobalParameters ( CParameterPlugin pPara)
protectedpure virtual

Apply the global parameters of the plug-in.

Note
Call CParameterOperate::SetGlobalParameters to set the global parameters for the operation parameters, and connect the signals related to the global parameters.
{
if(GetParameter()) {
GetParameter()->SetGlobalParameters(pPara);
if(pPara) {
bool check = connect(pPara, SIGNAL(sigNameStylesChanged()),
this, SLOT(slotUpdateName()));
Q_ASSERT(check);
}
LoadAdaptWindows();
return 0;
} else {
QString szMsg = "There is not parameters! "
"please first create parameters, "
"then call SetParameter() in the ";
szMsg += metaObject()->className() + QString("::")
+ metaObject()->className();
szMsg += QString("() or ") + metaObject()->className()
+ QString("::") + "Initial()";
szMsg += " to set the parameters pointer. "
"Default set CParameterClient for the parameters of operate "
"(CParameterOperate or its derived classes) "
"See CManager::CreateOperate. "
"If you are sure the parameter of operate "
"does not need CParameterClient. "
"Please overload the SetGlobalParameters() in the ";
szMsg += QString(metaObject()->className()) + " . don't set it";
qCritical(log) << szMsg.toStdString().c_str();
Q_ASSERT(false);
}
return -1;
}
virtual int SetGlobalParameters(CParameterPlugin *pPara) override
Set Global Parameters.
Global parameters of plugins.
See also
CManager::CreateOperate CParameterPlugin

Implemented in COperateFileTransfer, COperateFtpServer, CScreenCapture, COperateWakeOnLan, COperateWebBrowser, COperateDesktop, and COperateTerminal.

Definition at line 224 of file Operate.cpp.

◆ SetSettingsFile()

int COperate::SetSettingsFile ( const QString &  szFile)
virtual

Definition at line 158 of file Operate.cpp.

◆ sigFinished

void COperate::sigFinished ( )
signal

Successful disconnection signal.

Triggered only by plugins

See also
Disconnect()

◆ sigFullScreen

void COperate::sigFullScreen ( bool  bFullScreen)
signal

Full screen.

emitted by operate

Parameters
bFullScreen
  • true: Full screen
  • false: Normal

◆ sigInformation

void COperate::sigInformation ( const QString &  szInfo)
signal

Show information in main windows.

Note
It differs from sigShowMessageBox in that sigShowMessageBox is displayed in a dialog box
Parameters
szInfo
See also
sigShowMessageBox MainWindow::slotInformation()

◆ sigRunning

void COperate::sigRunning ( )
signal

Start success signal.

Triggered only by plugins.

  • The application needs to set the view property Enabled to true at this point. enable accept keyboard and mouse event
  • If the plugin implements its own view (non-CFrmView), set the view property Enabled to true. Allows receiving keyboard and mouse events.
See also
MainWindow::slotRunning() GetViewer() CFrmViewer::CFrmViewer

◆ sigSecurityLevel

void COperate::sigSecurityLevel ( )
signal

Triggered when the security level changes.

Its derived classes should not be triggered directly; they need to be triggered using slotSetSecurityLevel.

◆ sigShowMessageBox

void COperate::sigShowMessageBox ( const QString &  title,
const QString &  message,
const QMessageBox::Icon &  icon = QMessageBox::Information 
)
signal

Trigger the display of a message dialog (QMessageBox) in the main thread from a background thread without blocking the background thread.

Note
It differs from sigInformation in that sigInformation is not displayed in a dialog box
See also
sigInformation Connect::SetConnecter MainWindow::slotShowMessageBox

◆ sigStop

void COperate::sigStop ( )
signal

Notify the user to stop.

Triggered only by plugins Emit when you need to stop from the plug-in. For example, the peer disconnect or reset the connection or the connection is error. When the applicatioin receive the signal, call Stop() to close connect

◆ sigUpdateName

void COperate::sigUpdateName ( const QString &  szName)
signal
Note
The name or icon is changed. This signal is only triggered by this class. If you need to use its derived class, please use slotUpdateName

◆ sigUpdateParameters

void COperate::sigUpdateParameters ( COperate pOperate)
signal

Update parameters, notify application to save or show parameters.

Note
The plugin don't use it directly. Please use CParameter::sigChanged to emit this signal.
See also
COperateDesktop::SetParameter

◆ sigViewerFocusIn

void COperate::sigViewerFocusIn ( QWidget *  pView)
signal

The view is focus.

Parameters
pView

◆ slotBlockInputDialog

void COperate::slotBlockInputDialog ( const QString &  szTitle,
const QString &  szLable,
const QString &  szMessage,
QString &  szText 
)
privatevirtualslot

Block background threads and display input dialogs in foreground threads (QInputDialog)

See also
CConnecter::sigBlockInputDialog() SetConnecter

Definition at line 342 of file Operate.cpp.

◆ slotBlockShowMessageBox

void COperate::slotBlockShowMessageBox ( const QString &  szTitle,
const QString &  szMessage,
QMessageBox::StandardButtons  buttons,
QMessageBox::StandardButton &  nRet,
bool &  checkBox,
QString  szCheckBoxContext = QString() 
)
privatevirtualslot

Block background threads and display message dialogs in foreground threads (QMessageBox)

See also
CConnect::sigBlockShowMessageBox

Definition at line 321 of file Operate.cpp.

◆ slotBlockShowWidget

void COperate::slotBlockShowWidget ( const QString &  className,
int &  nRet,
void *  pContext 
)
privatevirtualslot

Blocks the background thread and displays the window in the foreground thread.

Parameters
classNameshow windows class name The class must have follower public functions: Q_INVOKABLE void SetContext(void* pContext);
nRetIf className is QDialog derived class, QDialog::exec() return value. Otherwise, ignore
pContextpass context from CConnect::sigBlockShowWidget()
See also
CConnect::sigBlockShowWidget()

Definition at line 282 of file Operate.cpp.

◆ slotSetClipboard

void COperate::slotSetClipboard ( QMimeData *  data)
privatevirtualslot
Note
The slot only is used by CBackendDesktop::SetConnect()

Definition at line 357 of file Operate.cpp.

◆ slotSetSecurityLevel

void COperate::slotSetSecurityLevel ( CSecurityLevel::Levels  level)
protectedslot

Definition at line 134 of file Operate.cpp.

◆ slotSettings

void COperate::slotSettings ( )
privatevirtualslot

Definition at line 212 of file Operate.cpp.

◆ slotUpdateName

void COperate::slotUpdateName ( )
protectedslot

Definition at line 247 of file Operate.cpp.

◆ Start()

virtual int COperate::Start ( )
pure virtual

Start.

Note
Only call by user, The plugin don't call it. When plugin is started, it emit sigRunning()
See also
sigRunning()

Implemented in COperateFileTransfer, COperateFtpServer, and COperateWebBrowser.

◆ Stop()

virtual int COperate::Stop ( )
pure virtual

Stop.

Note
Only call by user, The plugin don't call it. When plugin is stopped, it emit sigFinished(). The caller receive the signal, then delete the object.
See also
sigFinished()

Implemented in COperateFileTransfer, COperateFtpServer, and COperateWebBrowser.

◆ Version()

virtual const qint16 COperate::Version ( ) const
pure virtual

Member Data Documentation

◆ m_Menu

QMenu COperate::m_Menu
protected

Definition at line 470 of file Operate.h.

◆ m_pActionSettings

QAction* COperate::m_pActionSettings
protected

Definition at line 471 of file Operate.h.

◆ m_pPlugin

CPlugin* COperate::m_pPlugin
private

Definition at line 476 of file Operate.h.

◆ m_SecurityLevel

CSecurityLevel::Levels COperate::m_SecurityLevel
private

Definition at line 410 of file Operate.h.

◆ m_szSettings

QString COperate::m_szSettings
private

Definition at line 351 of file Operate.h.


The documentation for this class was generated from the following files: