forked from RunnanZhang/MagicAssistant
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicAssistant.h
More file actions
127 lines (89 loc) · 2.86 KB
/
MagicAssistant.h
File metadata and controls
127 lines (89 loc) · 2.86 KB
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
#ifndef MAGICASSISTANT_H
#define MAGICASSISTANT_H
#include <QWidget>
#include <QSystemTrayIcon>
#include <QMap>
namespace Ui {
class MagicAssistant;
}
class ToolBar;
class QSystemTrayIcon;
class MagicAssistant : public QWidget
{
Q_OBJECT
public:
explicit MagicAssistant(QWidget *parent = 0);
~MagicAssistant();
protected:
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *);
void enterEvent(QEvent *event);
bool nativeEvent(const QByteArray &eventType, void *message, long *result);
private slots:
void trayActivated(QSystemTrayIcon::ActivationReason reason);
///< \note 设置开机自动启动.
void autoStart(bool is_start);
///< \note 用于定时器刷新状态,toolbar是否显示.
void updateState();
///< \note 打开程序所在位置.
void openInExplorer();
///< \note 屏幕截图设置.是否压缩图片.
void screenshotSetting(bool is_compressed);
///< \note 执行启动程序.
void execProcess(QString path);
///< \note 打开Cmd.
void openCommand();
///< \note 查询当天比分.
void showTodayScore();
///< \note 查询剩余时间.
void showRestTime();
///< \note 打开项目工程目录.
void openProjectDir();
///< \note 全屏截图.
void screenShot();
///< \note 定时关机.
void shutdown();
private:
///< \note 初始化托盘相关.
void initTray();
///< \note 初始化位置.
void initGeometry();
///< \note 初始化菜单.
void initMenu();
///< \note 初始化全局热键.
void initHotKey();
///< \note toolbar功能槽函数的连接.
void initToolBarFunction();
///< \note 显示toolbar.
void showToolBar();
///< \note 隐藏所有窗体.
void hideAll();
///< \note 显示所有窗体.
void showAll();
///< \note 设置透明度.
void setOpacity(qreal opacity);
private:
Ui::MagicAssistant *ui;
///< \note 用于绘制背景图片.
QPixmap _pixmap;
///< \note 鼠标press时记录,用于移动窗体时使用.
QPoint _start_pos;
///< \note 自定义工具栏.
ToolBar *_toolbar;
///< \note 系统托盘图标.
QSystemTrayIcon *_system_tray;
///< \note 用于记录当前geometry,关闭时写入配置文件供下次启动加载.
QRect _geometry;
///< \note 鼠标进入窗体时打开的定时器,用于检测鼠标位置,移出有效范围内则停止,并隐藏toolbar.
QTimer *_timer;
///< \note 右键菜单.
QMenu *_menu;
///< \note 屏幕截图是否压缩.
bool _is_compressed;
/// @brief quint32 vk id. QString 此快捷键要执行程序的名字.
QMap<quint32, QString> _hotkey;
};
#endif // MAGICASSISTANT_H