Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
FrmParameterTerminalBehavior.cpp
1#include "FrmParameterTerminalBehavior.h"
2#include "ui_FrmParameterTerminalBehavior.h"
3#include <QLoggingCategory>
4
5Q_DECLARE_LOGGING_CATEGORY(Terminal)
6
7CFrmParameterTerminalBehavior::CFrmParameterTerminalBehavior(CParameterTerminal *pPara, QWidget *parent) :
8 QWidget(parent),
10 m_pPara(pPara)
11{
12 ui->setupUi(this);
13
14 //qDebug(Terminal) << "KeyBindings" << QTermWidget::availableKeyBindings();
15 ui->cbKeyBinding->addItems(QTermWidget::availableKeyBindings());
16 ui->cbKeyBinding->setCurrentText(pPara->GetKeyBindings());
17
18 foreach(auto c, QTextCodec::availableCodecs())
19 {
20 ui->cbTextCodecs->addItem(QString(c));
21 }
22 ui->cbTextCodecs->setCurrentText(pPara->GetTextCodec());
23 if(0 > m_pPara->GetHistorySize())
24 {
25 ui->cbHistoryUnlimited->setChecked(true);
26 ui->sbHistorySize->setValue(1000);
27 }
28 else
29 {
30 ui->cbHistorySize->setChecked(true);
31 ui->sbHistorySize->setValue(pPara->GetHistorySize());
32 }
33}
34
35CFrmParameterTerminalBehavior::~CFrmParameterTerminalBehavior()
36{
37 delete ui;
38}
39
40int CFrmParameterTerminalBehavior::AcceptSettings()
41{
42 if(!m_pPara) return -1;
43
44 m_pPara->SetKeyBindings(ui->cbKeyBinding->currentText());
45 m_pPara->SetTextCodec(ui->cbTextCodecs->currentText());
46 if(ui->cbHistoryUnlimited->isChecked())
47 m_pPara->SetHistorySize(-1);
48 else
49 m_pPara->SetHistorySize(ui->sbHistorySize->value());
50
51 return 0;
52}