1#include "ConnecterTerminal.h"
3#include "ConnectThreadTerminal.h"
12 #include "QUIWidget/QUIWidget.h"
15#include <QLoggingCategory>
17Q_DECLARE_LOGGING_CATEGORY(Terminal)
28 m_pConsole->setAutoClose(
true);
31 check = connect(m_pConsole, SIGNAL(titleChanged()),
32 this, SLOT(slotTerminalTitleChanged()));
34 check = connect(m_pConsole, SIGNAL(finished()),
35 this, SIGNAL(sigDisconnected()));
37 check = connect(m_pConsole, SIGNAL(sigZoomReset()),
38 this, SLOT(slotZoomReset()));
42CConnecterTerminal::~CConnecterTerminal()
44 qDebug(Terminal) <<
"CConnecterTerminal::~CConnecterTerminal()";
48 m_pConsole->deleteLater();
84int CConnecterTerminal::Connect()
88 nRet = SetParameter();
93 bool check = connect(m_pThread, SIGNAL(finished()),
94 m_pThread, SLOT(deleteLater()));
113int CConnecterTerminal::DisConnect()
117 if(m_bThread && m_pThread)
121 nRet = OnDisConnect();
126int CConnecterTerminal::SetParameter()
132 if(!pPara)
return -1;
133#if QTERMWIDGET_VERSION >= QT_VERSION_CHECK(0, 9, 0)
134 m_pConsole->setTerminalSizeHint(pPara->GetSizeHint());
135 m_pConsole->setBidiEnabled(pPara->GetDirectional());
136 m_pConsole->disableBracketedPasteMode(pPara->GetDisableBracketedPasteMode());
138 m_pConsole->setTerminalFont(pPara->GetFont());
139 m_pConsole->setKeyboardCursorShape(pPara->GetCursorShape());
140 m_pConsole->setColorScheme(pPara->GetColorScheme());
141 m_pConsole->setScrollBarPosition(pPara->GetScrollBarPosition());
142 m_pConsole->setFlowControlEnabled(pPara->GetFlowControl());
143 m_pConsole->setFlowControlWarningEnabled(pPara->GetFlowControlWarning());
144 m_pConsole->setMotionAfterPasting(pPara->GetMotionAfterPasting());
145 m_pConsole->setTerminalOpacity(1.0 - pPara->GetTransparency() / 100.0);
146 m_pConsole->setTerminalBackgroundImage(pPara->GetBackgroupImage());
148 m_pConsole->setKeyBindings(pPara->GetKeyBindings());
149 m_pConsole->setTextCodec(QTextCodec::codecForName(pPara->GetTextCodec().toStdString().c_str()));
150 m_pConsole->setHistorySize(pPara->GetHistorySize());
159void CConnecterTerminal::slotTerminalTitleChanged()
161 m_pConsole->setWindowTitle(m_pConsole->title());
162 slotSetServerName(m_pConsole->title());
165void CConnecterTerminal::slotZoomReset()
167 if(!m_pConsole)
return;
170 m_pConsole->setTerminalFont(pPara->GetFont());
178int CConnecterTerminal::OnDisConnect()
183QString CConnecterTerminal::ServerName()
186 if(!GetParameter()->GetShowServerName()
187 || CConnecter::ServerName().isEmpty())
189 if(!GetParameter()->GetHost().isEmpty())
190 return GetParameter()->GetHost() +
":"
191 + QString::number(GetParameter()->GetPort());
193 return CConnecter::ServerName();
196CConnect* CConnecterTerminal::InstanceConnect()
virtual int OnConnect()
OnConnect.
virtual qint16 Version() override
Version.
virtual int Save(QSettings &set) override
Save parameters.
QWidget * GetViewer() override
Get Viewer.
virtual int Load(QSettings &set) override
Load parameters.
void sigUpdateName(const QString &szName)
void sigConnected()
Successful connection signal.
void sigDisconnected()
Successful disconnection signal.
virtual const QString Name()
Name.
the parameters of connecter interface.
virtual int Save(QString szFile=QString(), bool bForce=true)
Save to file.
virtual int Load(QString szFile=QString())
Load from file.