-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainwindow.h
58 lines (48 loc) · 1.44 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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QMenu>
#include <QAction>
#include <vector>
#include <string>
#include <QTimer>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
public slots:
void restoreWindow();
protected:
void closeEvent(QCloseEvent *event) override;
void changeEvent(QEvent *event) override;
bool event(QEvent *event) override;
void moveEvent(QMoveEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void paintEvent(QPaintEvent *event) override;
private slots:
void handleEnableButton();
void handleDisableButton();
void handleOpenEditorDialog();
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
void exitButtonClicked();
private:
Ui::MainWindow *ui;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
QAction *restoreAction;
QAction *quitAction;
std::vector<std::string> read_lines(const QString &filename) const;
bool is_ip_address(const std::string &str) const;
void block_sites(const std::vector<std::string> &sites) const;
void unblock_sites(const std::vector<std::string> &sites) const;
void drawNotch(QPainter &painter);
void renderLayoutElements();
};
#endif // MAINWINDOW_H