-
Notifications
You must be signed in to change notification settings - Fork 91
/
lightscreenwindow.h
155 lines (133 loc) · 4.26 KB
/
lightscreenwindow.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) Christian Kaiser
*
* 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 2
* 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef LIGHTSCREENWINDOW_H
#define LIGHTSCREENWINDOW_H
#include <QMainWindow>
#include <QPointer>
#include <QSystemTrayIcon>
#include <updater/updater.h>
#include <tools/screenshot.h>
#include <dialogs/previewdialog.h>
#include "ui_lightscreenwindow.h"
class Updater;
class QSettings;
class QProgressBar;
class QWinTaskbarButton;
class UGlobalHotkeys;
class LightscreenWindow : public QMainWindow
{
Q_OBJECT
public:
enum Action {
ShowMainWindow = 5,
OpenScreenshotFolder = 6
};
Q_ENUM(Action)
LightscreenWindow(QWidget *parent = 0);
~LightscreenWindow();
public slots:
void action(int mode = 3);
void areaHotkey();
void checkForUpdates();
void cleanup(const Screenshot::Options &options);
void closeToTrayWarning();
bool closingWithoutTray();
void createUploadMenu();
void goToFolder();
void messageClicked();
void executeArgument(const QString &message);
void executeArguments(const QStringList &arguments);
void notify(const Screenshot::Result &result);
void preview(Screenshot *screenshot);
void quit();
void restoreNotification();
void setStatus(QString status = "");
void screenshotAction(Screenshot::Mode mode = Screenshot::None);
void screenshotActionTriggered(QAction *action);
void screenHotkey();
void showHotkeyError(const QStringList &hotkeys);
void showHistoryDialog();
void showOptions();
void showScreenshotMessage(const Screenshot::Result &result, const QString &fileName);
void showUploaderError(const QString &error);
void showUploaderMessage(const QString &fileName, const QString &url);
void toggleVisibility();
void updateStatus();
void updaterDone(bool result);
void upload(const QString &fileName);
void uploadCancel();
void uploadLast();
void uploadProgress(int progress);
void windowHotkey();
void windowPickerHotkey();
private slots:
void applySettings();
signals:
void uploading(bool uploading);
void finished();
private:
void connectHotkeys();
void createTrayIcon();
#ifdef Q_OS_WIN
bool winEvent(MSG *message, long *result);
#endif
// Convenience function
QSettings *settings() const;
protected:
bool event(QEvent *event);
private:
bool mDoCache;
bool mHideTrigger;
bool mReviveMain;
bool mWasVisible;
int mLastMessage;
Screenshot::Mode mLastMode;
QString mLastScreenshot;
QPointer<QSystemTrayIcon> mTrayIcon;
QPointer<PreviewDialog> mPreviewDialog;
QPointer<Updater> mUpdater;
Ui::LightscreenWindowClass ui;
QPointer<UGlobalHotkeys> mGlobalHotkeys;
bool mHasTaskbarButton;
#ifdef Q_OS_WIN
QPointer<QWinTaskbarButton> mTaskbarButton;
#else
class QWinTaskbarProgressDummy
{
public:
void setVisible(bool v) { Q_UNUSED(v) }
void setPaused(bool p) { Q_UNUSED(p) }
void resume() {}
void stop() {}
void reset() {}
void setRange(int m, int m2) { Q_UNUSED(m) Q_UNUSED(m2) }
void setValue(int v) { Q_UNUSED(v) }
};
class QWinTaskbarDummy : public QObject
{
public:
void setOverlayIcon(QIcon i) { Q_UNUSED(i) }
void clearOverlayIcon() {}
QWinTaskbarProgressDummy *progress() { return 0; }
void setWindow(QWindow *w) { Q_UNUSED(w) }
};
QWinTaskbarDummy *mTaskbarButton;
#endif
};
#endif // LIGHTSCREENWINDOW_H