-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwidget.h
66 lines (57 loc) · 1.89 KB
/
widget.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
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QTimer>
#include <QCursor>
#include <QSystemTrayIcon>
#include <QSettings>
#include <QDir>
#include <QApplication>
#include <QTime>
#include <settingdialog.h>
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE
class Widget : public QWidget {
Q_OBJECT
public:
Widget(QWidget *parent = nullptr);
~Widget();
double distance(const QPoint& lhs, const QPoint& rhs);
double includeAngle(const QPoint& A, const QPoint& B, const QPoint& C);
void setCursorPix(const QPixmap& pix);
void initSysTray(void);
void setAutoRun(bool isAuto);
bool isAutoRun(void);
void writeIni(void);
void readIni(void);
bool isCursorHide(void);
bool isForeFullScreen(void);
int checkCursorPath(void); //检测用户是否设置有效的光标图片路径
HWND topWinFromPoint(const QPoint& pos);
signals:
void cornerDetected(QPoint pos, QTime time);
void slowSpeedDetected(void);
private:
Ui::Widget* ui;
QPixmap cursorPix;
const QString iniPath = QApplication::applicationDirPath() + "/settings.ini";
const QString Reg_AutoRun = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; //HKEY_CURRENT_USER仅仅对当前用户有效,但不需要管理员权限
const QString AppName = "CursorFinder";
const QString AppPath = QDir::toNativeSeparators(QApplication::applicationFilePath());
QSystemTrayIcon* sysTray = nullptr;
QString CursorImgPath = "";
int Gap = 120; //ms
int Dist = 150; //px
int MaxSize = 128; //px
int AnimationTime = 200; //ms
bool isStopWhileFullScreen = true;
QSettings* iniSet;
// QWidget interface
protected:
void paintEvent(QPaintEvent* event) override;
// QWidget interface
protected:
bool nativeEvent(const QByteArray& eventType, void* message, long* result) override;
};
#endif // WIDGET_H