forked from TechxArtisanStudio/Openterface_QT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.h
138 lines (102 loc) · 4.96 KB
/
global.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
/*
* ========================================================================== *
* *
* This file is part of the Openterface Mini KVM App QT version *
* *
* Copyright (C) 2024 <info@openterface.com> *
* *
* This program 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 version 3. *
* *
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>. *
* *
* ========================================================================== *
*/
#ifndef GLOBAL_H
#define GLOBAL_H
#include <QString>
#include <QFile>
#include <QTextStream>
#include <QDebug>
#include "resources/version.h"
// inline QString getAppVersion() {
// return QString(APP_VERSION);
// }
// #define APP_VERSION getAppVersion()
const int LOG_ = 100; // Add this line
class GlobalVar {
public:
static GlobalVar& instance() {
static GlobalVar instance;
return instance;
}
int getInputWidth() const { return input_width; }
void setInputWidth(int width) { input_width = width; }
int getInputHeight() const { return input_height; }
void setInputHeight(int height) { input_height = height; }
float getInputFps() const { return input_fps; }
void setInputFps(float fps) { input_fps = fps; }
int getCaptureWidth() const { return capture_width; }
void setCaptureWidth(int width) { capture_width = width; }
int getCaptureHeight() const { return capture_height; }
void setCaptureHeight(int height) { capture_height = height; }
int getCaptureFps() const { return capture_fps; }
void setCaptureFps(int fps) { capture_fps = fps; }
int getWinWidth() const { return win_width; }
void setWinWidth(int width) { win_width = width; }
int getWinHeight() const { return win_height; }
void setWinHeight(int height) { win_height = height; }
int getMenuHeight() const { return menu_height; }
void setMenuHeight(int height) { menu_height = height; }
int getTitleHeight() const { return title_height; }
void setTitleHeight(int height) { title_height = height; }
int getStatusbarHeight() const { return statusbar_height; }
void setStatusbarHeight(int height) { statusbar_height = height; }
int getTopbarHeight() const {return title_height + menu_height;}
int getAllbarHeight() const {return title_height + menu_height + statusbar_height ;}
bool isAbsoluteMouseMode() const { return absolute_mouse_mode; }
void setAbsoluteMouseMode(bool mode) { absolute_mouse_mode = mode; }
std::string getCaptureCardFirmwareVersion() const { return captureCardFirmwareVersion; }
void setCaptureCardFirmwareVersion(const std::string& version) { captureCardFirmwareVersion = version; }
bool isSwitchOnTarget() const { return _isSwitchOnTarget; }
void setSwitchOnTarget(bool onTarget) { _isSwitchOnTarget = onTarget; }
bool isToolbarVisible() const { return toolbarVisible; }
void setToolbarVisible(bool visible) { toolbarVisible = visible; }
int getToolbarHeight() const { return toolbarHeight; }
void setToolbarHeight(int height) { toolbarHeight = height; }
private:
GlobalVar() : input_width(1920), input_height(1080), capture_width(1920), capture_height(1080), capture_fps(30) {} // Private constructor
~GlobalVar() {} // Private destructor
// Prevent copying
GlobalVar(const GlobalVar&) = delete;
GlobalVar& operator=(const GlobalVar&) = delete;
// Prevent moving
GlobalVar(GlobalVar&&) = delete;
GlobalVar& operator=(GlobalVar&&) = delete;
// The target device input resolution
int input_width;
int input_height;
float input_fps;
// The capture card capture resolution
int capture_width;
int capture_height;
float capture_fps;
int win_width;
int win_height;
int menu_height;
int title_height;
int statusbar_height;
bool absolute_mouse_mode = true;
std::string captureCardFirmwareVersion;
bool _isSwitchOnTarget = true;
bool toolbarVisible = true;
int toolbarHeight = 0;
};
#endif