-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.hpp
96 lines (64 loc) · 2.46 KB
/
MainWindow.hpp
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
//
// Created by liuqichen on 2/13/23.
//
#ifndef LUMID_MAINWINDOW_H
#define LUMID_MAINWINDOW_H
#include <QPushButton>
#include <QTimer>
#include <QWidget>
#include <QxtGlobalShortcut>
#include "Wrappers.hpp"
#define POS_FROM_LEFT_EDGE 50
#define VERTICAL_POS_FACTOR 0.75
#define SLEEP_MULTIPLIER .03
#define STAY_TIME_LONG 6.5
#define STAY_TIME_SHORT 3
#define STRIDE 10
#define MAIN_WINDOW_X 400
#define MAIN_WINDOW_Y 500
using namespace Wrappers;
class MainWindow : public QWidget {
public:
MainWindow();
QTimer m_Timer;
PreferencesWindow *m_PreferencesWindow;
static void onExit();
void showOnTopLeft();
void setStride(int stride);
// todo make pass by ptr or ref
void setShortcuts(QKeySequence *increase, QKeySequence *decrease);
void bindShortcut(QxtGlobalShortcut *increase, QxtGlobalShortcut *decrease);
private:
Q_OBJECT
int posX;
int posY;
bool other_sliders_hidden = true;
int stride = 10;
SlidersHBoxLayout m_MainLayout;
ShowAllAndFocusButton hideButton;
QTimer click_tmr;
std::unique_ptr<QxtGlobalShortcut> increaseShortcut = std::make_unique<QxtGlobalShortcut>(Qt::Key_F6);
std::unique_ptr<QxtGlobalShortcut> decreaseShortcut = std::make_unique<QxtGlobalShortcut>(Qt::Key_F5);
int displayCount{};
BrightnessSlider *generalSlider();
std::vector<std::unique_ptr<SliderWithLabelsLayout>> sliderLayouts;
std::unique_ptr<QTimer> generalSliderTimer;
std::vector<std::tuple<std::string, std::string, int>> info;
void hideOtherSliders();
void initAllLayouts();
void addLayouts();
// void closeEvent(QCloseEvent *event) override;
static void switchVisibility(SliderWithLabelsLayout *layout, bool visible);
void
initLayout(SliderWithLabelsLayout *layout, std::vector<std::tuple<std::string, std::string, int>> info, int index,
bool visible);
bool eventFilter(QObject *obj, QEvent *event) override;
void shortCutsKeyPressed(BrightnessSlider *slider, int stride);
void performHideAndChangeButtonText(const std::string &buttonText,
const std::string &windowTitle,
bool currentHidden,
QPushButton *button,
SlidersHBoxLayout *layout,
std::vector<std::unique_ptr<SliderWithLabelsLayout>> *subLayoutsVex);
};
#endif // SLIDER_SLIDER_H