1#include "ParameterTerminal.h"
6CParameterTerminal::CParameterTerminal()
8 m_Font = QApplication::font();
10 font.setFamily(QStringLiteral(
"Monaco"));
11#elif defined(Q_WS_QWS)
12 font.setFamily(QStringLiteral(
"fixed"));
14 m_Font.setFamily(QStringLiteral(
"Monospace"));
16 m_Font.setStyleHint(QFont::TypeWriter);
17 m_Font.setPointSize(12);
20 m_szColorScheme =
"GreenOnBlack";
21 m_CursorShape = Konsole::Emulation::KeyboardCursorShape::BlockCursor;
22 m_ScrollBarPosition = QTermWidget::ScrollBarRight;
24 m_bFlowControl =
false;
25 m_bFlowControlWarning =
false;
26 m_bMotionAfterPasting =
false;
27 m_bDisableBracketedPasteMode =
false;
28 m_bDirectional =
true;
30#if defined (Q_OS_LINUX)
31 m_szKeyBindings =
"linux";
33 szKeyBindings =
"default";
35 m_szTextCodec =
"UTF-8";
36 m_nHistorySize = 1000;
41 m_Font.fromString(set.value(
"Terminal/Font", m_Font.toString()).toString());
42 SetSizeHint(set.value(
"Terminal/SizeHint", GetSizeHint()).toBool());
43 m_szColorScheme = set.value(
"Terminal/ColorScheme", m_szColorScheme).toString();
44 m_nTransparency = set.value(
"Terminal/Transparency",
45 m_nTransparency).toInt();
46 m_bFlowControl = set.value(
"Terminal/flowControl", m_bFlowControl).toBool();
47 m_bFlowControlWarning = set.value(
"Terminal/flowControlWarning",
48 m_bFlowControlWarning).toBool();
49 m_bMotionAfterPasting = set.value(
"Terminal/motionAfterPasting",
50 m_bMotionAfterPasting).toBool();
51 m_bDirectional = set.value(
"Terminal/Directional", m_bDirectional).toBool();
52 m_bDisableBracketedPasteMode = set.value(
"Terminal/disableBracketedPasteMode",
53 m_bDisableBracketedPasteMode).toBool();
54 m_BackgroupImage = set.value(
"Terminal/BackgroupImage",
55 m_BackgroupImage).toString();
56 m_CursorShape =
static_cast<Konsole::Emulation::KeyboardCursorShape
>(
57 set.value(
"Terminal/cursorShape",
static_cast<int>(m_CursorShape)).toInt());
58 m_ScrollBarPosition =
static_cast<QTermWidget::ScrollBarPosition
>
59 (set.value(
"Terminal/scrollBarPosition",
60 static_cast<int>(m_ScrollBarPosition)).toInt());
61 m_szKeyBindings = set.value(
"Terminal/KeyBindings", m_szKeyBindings).toString();
62 m_szTextCodec = set.value(
"Terminal/TextCodec", m_szTextCodec).toString();
63 m_nHistorySize = set.value(
"Terminal/HistorySize", m_nHistorySize).toInt();
67int CParameterTerminal::Save(QSettings &set)
69 set.setValue(
"Terminal/Font", m_Font.toString());
70 set.setValue(
"Terminal/SizeHint", GetSizeHint());
71 set.setValue(
"Terminal/ColorScheme", m_szColorScheme);
72 set.setValue(
"Terminal/Transparency", m_nTransparency);
73 set.setValue(
"Terminal/flowControl", m_bFlowControl);
74 set.setValue(
"Terminal/flowControlWarning", m_bFlowControlWarning);
75 set.setValue(
"Terminal/motionAfterPasting", m_bMotionAfterPasting);
76 set.setValue(
"Terminal/Directional", m_bDirectional);
77 set.setValue(
"Terminal/disableBracketedPasteMode", m_bDisableBracketedPasteMode);
78 set.setValue(
"Terminal/BackgroupImage", m_BackgroupImage);
79 set.setValue(
"Terminal/cursorShape",
static_cast<int>(m_CursorShape));
80 set.setValue(
"Terminal/scrollBarPosition",
81 static_cast<int>(m_ScrollBarPosition));
82 set.setValue(
"Terminal/KeyBindings", m_szKeyBindings);
83 set.setValue(
"Terminal/TextCodec", m_szTextCodec);
84 set.setValue(
"Terminal/HistorySize", m_nHistorySize);
88int CParameterTerminal::GetHistorySize()
const
90 return m_nHistorySize;
93void CParameterTerminal::SetHistorySize(
int newHistorySize)
95 if(m_nHistorySize == newHistorySize)
97 m_nHistorySize = newHistorySize;
101const QString &CParameterTerminal::GetTextCodec()
const
103 return m_szTextCodec;
106void CParameterTerminal::SetTextCodec(
const QString &newTextCodec)
108 if(m_szTextCodec == newTextCodec)
110 m_szTextCodec = newTextCodec;
114const QString &CParameterTerminal::GetKeyBindings()
const
116 return m_szKeyBindings;
119void CParameterTerminal::SetKeyBindings(
const QString &newSzKeyBindings)
121 if(m_szKeyBindings == newSzKeyBindings)
123 m_szKeyBindings = newSzKeyBindings;
127bool CParameterTerminal::GetDirectional()
const
129 return m_bDirectional;
132void CParameterTerminal::SetDirectional(
bool newBiDirectional)
134 if(m_bDirectional == newBiDirectional)
136 m_bDirectional = newBiDirectional;
140bool CParameterTerminal::GetDisableBracketedPasteMode()
const
142 return m_bDisableBracketedPasteMode;
145void CParameterTerminal::SetDisableBracketedPasteMode(
bool newDisableBracketedPasteMode)
147 if(m_bDisableBracketedPasteMode == newDisableBracketedPasteMode)
149 m_bDisableBracketedPasteMode = newDisableBracketedPasteMode;
153bool CParameterTerminal::GetMotionAfterPasting()
const
155 return m_bMotionAfterPasting;
158void CParameterTerminal::SetMotionAfterPasting(
bool newMotionAfterPasting)
160 if(m_bMotionAfterPasting == newMotionAfterPasting)
162 m_bMotionAfterPasting = newMotionAfterPasting;
166bool CParameterTerminal::GetFlowControlWarning()
const
168 return m_bFlowControlWarning;
171void CParameterTerminal::SetFlowControlWarning(
bool newFlowControlWarning)
173 if(m_bFlowControlWarning == newFlowControlWarning)
175 m_bFlowControlWarning = newFlowControlWarning;
179bool CParameterTerminal::GetFlowControl()
const
181 return m_bFlowControl;
184void CParameterTerminal::SetFlowControl(
bool newFlowControl)
186 if(m_bFlowControl == newFlowControl)
188 m_bFlowControl = newFlowControl;
192const QString &CParameterTerminal::GetBackgroupImage()
const
194 return m_BackgroupImage;
197void CParameterTerminal::SetBackgroupImage(
const QString &newBackgroupImage)
199 if(m_BackgroupImage == newBackgroupImage)
201 m_BackgroupImage = newBackgroupImage;
205int CParameterTerminal::GetTransparency()
const
207 return m_nTransparency;
210void CParameterTerminal::SetTransparency(
int newTermTransparency)
212 if(m_nTransparency == newTermTransparency)
214 m_nTransparency = newTermTransparency;
218QTermWidget::ScrollBarPosition CParameterTerminal::GetScrollBarPosition()
const
220 return m_ScrollBarPosition;
223void CParameterTerminal::SetScrollBarPosition(QTermWidget::ScrollBarPosition newScrollBarPosition)
225 if(m_ScrollBarPosition == newScrollBarPosition)
227 m_ScrollBarPosition = newScrollBarPosition;
231Konsole::Emulation::KeyboardCursorShape CParameterTerminal::GetCursorShape()
const
233 return m_CursorShape;
236void CParameterTerminal::SetCursorShape(Konsole::Emulation::KeyboardCursorShape newCursorShape)
238 if(m_CursorShape == newCursorShape)
240 m_CursorShape = newCursorShape;
244const QString &CParameterTerminal::GetColorScheme()
const
246 return m_szColorScheme;
249void CParameterTerminal::SetColorScheme(
const QString &newColorScheme)
251 if(m_szColorScheme == newColorScheme)
253 m_szColorScheme = newColorScheme;
257bool CParameterTerminal::GetSizeHint()
const
262void CParameterTerminal::SetSizeHint(
bool newSizeHint)
264 if(m_bSizeHint == newSizeHint)
266 m_bSizeHint = newSizeHint;
270const QFont &CParameterTerminal::GetFont()
const
275void CParameterTerminal::SetFont(
const QFont &newFont)
277 if(m_Font == newFont)
virtual int Load(QSettings &set) override
Load from storage.
int SetModified(bool bModified=true)
When setting parameters, if there is a modification, it is called.
virtual int Save(QString szFile=QString(), bool bForce=true)
Save to file.
virtual int Load(QString szFile=QString())
Load from file.