-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainwindow.h
121 lines (91 loc) · 2.49 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
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QThread>
#include <QMutex>
#include <QMenu>
#include <QDesktopWidget>
#include <QDebug>
#include <Windows.h>
#include <windowsx.h>
#include <QPointer>
#include <Psapi.h>
#include <Qpair>
#include <QFileSystemWatcher>
#include <QSystemTrayIcon>
#include <QDir>
#include <QTimer>
#include <QSettings>
#include "utils.h"
namespace Ui {
class MainWindow;
}
class switch_worker_t : public QObject {
Q_OBJECT
public:
switch_worker_t(HWND parent_window, int hud_index):
parent_window(parent_window),
hud_index(hud_index)
{}
//~switch_worker_t();
public slots:
void work();
void switch_hud();
signals:
void finished();
void remove_pending(HWND window);
void log(QString);
private:
HWND parent_window;
int hud_index;
};
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void changeEvent (QEvent *);
void closeEvent (QCloseEvent *);
public slots:
void log(QString);
private slots:
void on_pushButton_clicked();
void fs_check();
//void directory_changed(const QString &path);
//void file_changed(const QString &path);
void set_hh_path_slot();
void set_hero_name_slot();
void set_hud_index_slot();
void exit_slot();
void show_hide_window();
void tray_activated_slot(QSystemTrayIcon::ActivationReason);
void on_hero_name_edit_editingFinished();
void on_hud_index_edit_editingFinished();
void on_hh_path_button_clicked();
void switch_pending();
void remove_pending_switch(HWND);
private:
void switch_hud(HWND parent_window);
//bool exact_icon_search(QPixmap src, QPixmap icon, int x, int y);
//void region_icon_search(QPixmap src, QPixmap icon, int in_x, int in_y, int in_w, int in_h, int & out_x, int & out_y);
//void send_click (int x, int y, HWND window = NULL, bool translate=true);
void test_switch();
//DWORD get_pid(QString proc_name);
//QVector<cWindow> get_windows (DWORD hud_pid);
QMap<HWND, QThread*> m_pending_switches;
bool search_hh_file (QString path);
Ui::MainWindow *ui;
bool m_showing_window;
int m_tray_info_counter;
QSettings m_settings;
QSystemTrayIcon m_systray;
QMenu m_systray_menu;
QStringList m_old_files;
QString m_username;
QTimer *m_fs_timer;
QPoint m_icon_pos;
QString m_hh_path;
QMutex m_pending_switches_mutex;
};
#endif // MAINWINDOW_H