-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
67 lines (56 loc) · 1.46 KB
/
mainwindow.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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QBuffer>
#include<QScreen>
#include <QDesktopWidget>
#include <QSystemTrayIcon>
#include <QCloseEvent>
#include <QEvent>
#include <QSettings>
#include "imagedownloader.h"
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
void resizeEvent(QResizeEvent *re);
void changeEvent(QEvent *event);
void closeEvent(QCloseEvent *event);
void init(uint screenId);
~MainWindow();
private slots:
void timerFunc();
void resting();
void close();
void closeOneTime();
void on_activatedSysTrayIcon(QSystemTrayIcon::ActivationReason reason);
private:
uint restTime = 10;//60 * 5; // 休息时间s
int workTime = 1000 * 60 * 60; // 工作时间毫秒
bool isInit = false;
bool isResting = false;
int screenId = 0;
uint restTimestamp;
QByteArray imageData;
QColor currentBackgroundColor;
Ui::MainWindow *ui;
QTimer* _Timer;
QScreen* screen;
QSystemTrayIcon* systemIcon;
bool tip_hide = false;
QSettings *settings;
void maxWindow();
QColor createRandomColor();
void setBackgroundColor();
void setBackgroundImage();
void changeLabel(QString labelTxt);
QString refreshTime();
void createTrayIcon();
void stopResting();
};
#endif // MAINWINDOW_H