-
Notifications
You must be signed in to change notification settings - Fork 2
/
MainWindow.h
155 lines (126 loc) · 4.2 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
===============================================================================
Copyright (C) 2022-2024 Ilya Lyakhovets
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
===============================================================================
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "SyncManager.h"
#include <QMainWindow>
#include <QSystemTrayIcon>
#include <QTimer>
#include <QMovie>
#define SYNCMANAGER_VERSION "1.6.3"
#define SETTINGS_FILENAME "Settings.ini"
#define PROFILES_FILENAME "Profiles.ini"
#define UPDATE_DELAY 40
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class DecoratedStringListModel;
class QItemSelection;
class QMimeData;
class UnhidableMenu;
/*
===========================================================
MainWindow
===========================================================
*/
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
public Q_SLOTS:
void show();
void setTrayVisible(bool visible);
void setLaunchOnStartup(bool enable);
protected:
void closeEvent(QCloseEvent *event) override;
void showEvent(QShowEvent *event) override;
private Q_SLOTS:
void addProfile();
void removeProfile();
void profileClicked(const QItemSelection &selected, const QItemSelection &deselected);
void profileNameChanged(const QModelIndex &index);
void addFolder(const QMimeData *mimeData = nullptr);
void removeFolder();
void pauseSyncing();
void pauseSelected();
void quit();
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
void switchSyncingMode(SyncManager::SyncingMode mode);
void switchDeletionMode(SyncManager::DeletionMode mode);
void increaseSyncTime();
void decreaseSyncTime();
void toggleLaunchOnStartup();
void toggleShowInTray();
void toggleNotification();
void toggleRememberFiles();
void toggleDetectMoved();
void updateSyncTime();
void updateLastSyncTime(SyncProfile *profile);
void updateStatus();
bool updateApp();
void showContextMenu(const QPoint &pos) const;
void sync(int profileNumber = -1);
void saveSettings() const;
void notify(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon icon);
private:
SyncManager manager;
Ui::MainWindow *ui;
DecoratedStringListModel *profileModel;
DecoratedStringListModel *folderModel;
QIcon iconAdd;
QIcon iconDone;
QIcon iconPause;
QIcon iconRemove;
QIcon iconResume;
QIcon iconSettings;
QIcon iconSync;
QIcon iconWarning;
QIcon trayIconDone;
QIcon trayIconIssue;
QIcon trayIconPause;
QIcon trayIconSync;
QIcon trayIconWarning;
QMovie animSync;
QAction *syncNowAction;
QAction *pauseSyncingAction;
QAction *automaticAction;
QAction *manualAction;
QAction *increaseSyncTimeAction;
QAction *syncingTimeAction;
QAction *decreaseSyncTimeAction;
QAction *moveToTrashAction;
QAction *versioningAction;
QAction *deletePermanentlyAction;
QAction *launchOnStartupAction;
QAction *showInTrayAction;
QAction *disableNotificationAction;
QAction *enableRememberFilesAction;
QAction *detectMovedFilesAction;
QAction *showAction;
QAction *quitAction;
QSystemTrayIcon *trayIcon;
QMenu *trayIconMenu;
UnhidableMenu *settingsMenu;
UnhidableMenu *syncingModeMenu;
UnhidableMenu *syncingTimeMenu;
UnhidableMenu *deletionModeMenu;
QTimer updateTimer;
bool showInTray;
bool appInitiated = false;
};
#endif // MAINWINDOW_H