-
Notifications
You must be signed in to change notification settings - Fork 5
/
util.h
156 lines (121 loc) · 4.75 KB
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
Copyright 2011-2012 Heikki Holstila <[email protected]>
This file is part of FingerTerm.
FingerTerm is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
FingerTerm is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FingerTerm. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UTIL_H
#define UTIL_H
#include <QtCore>
class Terminal;
class TextRender;
class QQuickView;
class Util : public QObject
{
Q_OBJECT
Q_PROPERTY(QString windowTitle READ windowTitle NOTIFY windowTitleChanged)
Q_PROPERTY(int windowOrientation READ windowOrientation WRITE setWindowOrientation NOTIFY windowOrientationChanged)
Q_PROPERTY(bool canPaste READ canPaste NOTIFY clipboardOrSelectionChanged)
Q_PROPERTY(bool terminalHasSelection READ terminalHasSelection NOTIFY clipboardOrSelectionChanged)
Q_PROPERTY(QString fontFamily READ fontFamily CONSTANT)
Q_PROPERTY(int uiFontSize READ uiFontSize CONSTANT)
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
Q_PROPERTY(int dragMode READ dragMode WRITE setDragMode NOTIFY dragModeChanged)
Q_PROPERTY(int keyboardMode READ keyboardMode WRITE setKeyboardMode NOTIFY keyboardModeChanged)
Q_PROPERTY(int keyboardFadeOutDelay READ keyboardFadeOutDelay WRITE setKeyboardFadeOutDelay NOTIFY keyboardFadeOutDelayChanged)
Q_PROPERTY(QString keyboardLayout READ keyboardLayout WRITE setKeyboardLayout NOTIFY keyboardLayoutChanged)
Q_PROPERTY(int extraLinesFromCursor READ extraLinesFromCursor CONSTANT)
Q_PROPERTY(QString charset READ charset CONSTANT)
Q_PROPERTY(int keyboardMargins READ keyboardMargins CONSTANT)
Q_PROPERTY(bool showVisualKeyPressFeedback READ showVisualKeyPressFeedback CONSTANT)
Q_PROPERTY(int orientationMode READ orientationMode WRITE setOrientationMode NOTIFY orientationModeChanged)
Q_PROPERTY(bool showWelcomeScreen READ showWelcomeScreen WRITE setShowWelcomeScreen NOTIFY showWelcomeScreenChanged)
Q_ENUMS(KeyboardMode)
Q_ENUMS(DragMode)
Q_ENUMS(OrientationMode)
public:
enum KeyboardMode {
KeyboardOff,
KeyboardFade,
KeyboardMove
};
enum DragMode {
DragOff,
DragGestures,
DragScroll,
DragSelect
};
enum OrientationMode {
OrientationAuto,
OrientationLandscape,
OrientationPortrait
};
explicit Util(QSettings* settings, QObject *parent = 0);
virtual ~Util();
void setWindow(QQuickView* win);
void setWindowTitle(QString title);
QString windowTitle();
int windowOrientation();
void setWindowOrientation(int orientation);
void setTerm(Terminal* term);
Q_INVOKABLE void openNewWindow();
Q_INVOKABLE QString versionString();
Q_INVOKABLE QString configPath();
QVariant settingsValue(QString key, const QVariant &defaultValue = QVariant());
void setSettingsValue(QString key, QVariant value);
int uiFontSize();
int fontSize();
void setFontSize(int size);
Q_INVOKABLE void keyPressFeedback();
Q_INVOKABLE void keyReleaseFeedback();
Q_INVOKABLE void notifyText(QString text);
Q_INVOKABLE void copyTextToClipboard(QString str);
bool canPaste();
bool terminalHasSelection();
void bellAlert();
QString fontFamily();
int dragMode();
void setDragMode(int mode);
int keyboardMode();
void setKeyboardMode(int mode);
int keyboardFadeOutDelay();
void setKeyboardFadeOutDelay(int delay);
QString keyboardLayout();
void setKeyboardLayout(const QString &layout);
int extraLinesFromCursor();
QString charset();
int keyboardMargins();
bool showVisualKeyPressFeedback();
int orientationMode();
void setOrientationMode(int mode);
bool showWelcomeScreen();
void setShowWelcomeScreen(bool value);
signals:
void visualBell();
void notify(QString msg);
void clipboardOrSelectionChanged();
void windowTitleChanged();
void windowOrientationChanged();
void fontSizeChanged();
void dragModeChanged();
void keyboardModeChanged();
void keyboardFadeOutDelayChanged();
void keyboardLayoutChanged();
void orientationModeChanged();
void showWelcomeScreenChanged();
private:
Q_DISABLE_COPY(Util)
QString iCurrentWinTitle;
QSettings* iSettings;
QQuickView* iWindow;
Terminal* iTerm;
};
#endif // UTIL_H