3
3
4
4
#include " flameshot.h"
5
5
#include " flameshotdaemon.h"
6
- #if defined(Q_OS_MACOS)
7
- #include " external/QHotkey/QHotkey"
8
- #endif
9
6
10
7
#include " abstractlogger.h"
11
8
#include " screenshotsaver.h"
31
28
#include < QTimer>
32
29
#include < QVersionNumber>
33
30
34
- #if defined(Q_OS_MACOS)
35
- #include < QScreen>
36
- #endif
37
31
38
32
Flameshot::Flameshot ()
39
33
: m_captureWindow(nullptr )
40
34
, m_haveExternalWidget(false )
41
- #if defined(Q_OS_MACOS)
42
- , m_HotkeyScreenshotCapture(nullptr )
43
- , m_HotkeyScreenshotHistory(nullptr )
44
- #endif
45
35
{
46
36
QString StyleSheet = CaptureButton::globalStyleSheet ();
47
37
qApp->setStyleSheet (StyleSheet);
48
38
49
- #if defined(Q_OS_MACOS)
50
- // Try to take a test screenshot, MacOS will request a "Screen Recording"
51
- // permissions on the first run. Otherwise it will be hidden under the
52
- // CaptureWidget
53
- QScreen* currentScreen = QGuiAppCurrentScreen ().currentScreen ();
54
- currentScreen->grabWindow (QApplication::desktop ()->winId (), 0 , 0 , 1 , 1 );
55
-
56
- // set global shortcuts for MacOS
57
- m_HotkeyScreenshotCapture = new QHotkey (
58
- QKeySequence (ConfigHandler ().shortcut (" TAKE_SCREENSHOT" )), true , this );
59
- QObject::connect (m_HotkeyScreenshotCapture,
60
- &QHotkey::activated,
61
- qApp,
62
- [this ]() { gui (); });
63
- m_HotkeyScreenshotHistory = new QHotkey (
64
- QKeySequence (ConfigHandler ().shortcut (" SCREENSHOT_HISTORY" )), true , this );
65
- QObject::connect (m_HotkeyScreenshotHistory,
66
- &QHotkey::activated,
67
- qApp,
68
- [this ]() { history (); });
69
- #endif
39
+
70
40
}
71
41
72
42
Flameshot* Flameshot::instance ()
@@ -187,10 +157,7 @@ void Flameshot::launcher()
187
157
m_launcherWindow = new CaptureLauncher ();
188
158
}
189
159
m_launcherWindow->show ();
190
- #if defined(Q_OS_MACOS)
191
- m_launcherWindow->activateWindow ();
192
- m_launcherWindow->raise ();
193
- #endif
160
+
194
161
}
195
162
196
163
void Flameshot::config ()
@@ -209,10 +176,7 @@ void Flameshot::info()
209
176
{
210
177
if (m_infoWindow == nullptr ) {
211
178
m_infoWindow = new InfoWindow ();
212
- #if defined(Q_OS_MACOS)
213
- m_infoWindow->activateWindow ();
214
- m_infoWindow->raise ();
215
- #endif
179
+
216
180
}
217
181
}
218
182
@@ -228,10 +192,6 @@ void Flameshot::history()
228
192
}
229
193
historyWidget->show ();
230
194
231
- #if defined(Q_OS_MACOS)
232
- historyWidget->activateWindow ();
233
- historyWidget->raise ();
234
- #endif
235
195
}
236
196
237
197
QVersionNumber Flameshot::getVersion ()
@@ -240,16 +200,6 @@ QVersionNumber Flameshot::getVersion()
240
200
QStringLiteral (APP_VERSION).replace (" v" , " " ));
241
201
}
242
202
243
- void Flameshot::setOrigin (Origin origin)
244
- {
245
- m_origin = origin;
246
- }
247
-
248
- Flameshot::Origin Flameshot::origin ()
249
- {
250
- return m_origin;
251
- }
252
-
253
203
/* *
254
204
* @brief Prompt the user to resolve config errors if necessary.
255
205
* @return Whether errors were resolved.
@@ -265,9 +215,6 @@ bool Flameshot::resolveAnyConfigErrors()
265
215
resolver, &ConfigResolver::rejected, [resolver, &resolved]() {
266
216
resolved = false ;
267
217
resolver->deleteLater ();
268
- if (origin () == CLI) {
269
- exit (1 );
270
- }
271
218
});
272
219
QObject::connect (
273
220
resolver, &ConfigResolver::accepted, [resolver, &resolved]() {
0 commit comments