1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 
4 #include <QMainWindow>
5 #include <QModelIndex>
6 #include <uglobalhotkeys.h>
7 #include <QSystemTrayIcon>
8 #include <QMenu>
9 #include <QNetworkAccessManager>
10 #include <QNetworkRequest>
11 #include <QNetworkReply>
12 #include <memory>
13 
14 #ifdef Q_OS_OSX
15     #define VERSION_URL "https://nerdur.com/todour-latest_mac.php"
16 #elif defined Q_OS_WIN
17     #define VERSION_URL "https://nerdur.com/todour-latest_windows.php"
18 #else
19     #define VERSION_URL "https://nerdur.com/todour-latest.php"
20 #endif
21 
22 
23 namespace Ui {
24 class MainWindow;
25 }
26 
27 class MainWindow : public QMainWindow
28 {
29     Q_OBJECT
30 
31 public:
32     explicit MainWindow(QWidget *parent = 0);
33     void parse_todotxt();
34     void addTodo(QString &s);
35     ~MainWindow();
36 
37 public slots:
38     void fileModified(const QString& str);
39     void requestReceived(QNetworkReply* reply);
40     void undo();
41     void redo();
42 
43 private slots:
44     void on_lineEdit_2_textEdited(const QString &arg1);
45 
46     void on_actionSettings_triggered();
47 
48     void on_actionAbout_triggered();
49 
50     void on_pushButton_clicked();
51 
52     void on_lineEdit_returnPressed();
53 
54     void on_pushButton_2_clicked();
55 
56     void on_pushButton_3_clicked();
57 
58     void on_pushButton_4_clicked();
59 
60     void dataInModelChanged(QModelIndex i1,QModelIndex i2);
61 
62     void on_btn_Alphabetical_toggled(bool checked);
63 
64     void on_lineEdit_2_returnPressed();
65 
66     void on_hotkey();
67 
68     void on_context_lock_toggled(bool checked);
69 
70 
71     void on_cb_threshold_inactive_stateChanged(int arg1);
72 
73     void iconActivated(QSystemTrayIcon::ActivationReason reason);
74     void cleanup(); // Need to have a quit slot of my own to save settings and so on.
75 
76 
77     void on_pb_closeVersionBar_clicked();
78 
79     void on_actionCheck_for_updates_triggered();
80 
81     void on_tableView_customContextMenuRequested(const QPoint &pos);
82 
83     void on_actionQuit_triggered();
84 
85     void on_actionUndo_triggered();
86 
87     void on_actionRedo_triggered();
88 
89     void on_actionShow_All_changed();
90 
91     void on_actionStay_On_Top_changed();
92 
93 private:
94     void setFileWatch();
95     void requestPage(QString &s);
96     void setTray();
97     void clearFileWatch();
98     void closeEvent(QCloseEvent *ev);
99     Ui::MainWindow *ui;
100     void saveTableSelection();
101     void resetTableSelection();
102     void updateSearchResults();
103     void updateTitle();
104     void setFontSize();
105     void stayOnTop();
106     QString baseTitle;
107     UGlobalHotkeys *hotkey;
108     void setHotkey();
109     QSystemTrayIcon *trayicon = NULL;
110     QMenu *traymenu=NULL;
111     QAction *minimizeAction;
112     QAction *maximizeAction;
113     QAction *restoreAction;
114     QAction *quitAction;
115 };
116 
117 #endif // MAINWINDOW_H
118