Changeset View
Changeset View
Standalone View
Standalone View
src/SpectacleCore.cpp
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 55 | { | |||
---|---|---|---|---|---|
83 | // set up the export manager | 83 | // set up the export manager | ||
84 | auto lExportManager = ExportManager::instance(); | 84 | auto lExportManager = ExportManager::instance(); | ||
85 | lExportManager->setCaptureMode(theCaptureMode); | 85 | lExportManager->setCaptureMode(theCaptureMode); | ||
86 | connect(lExportManager, &ExportManager::errorMessage, this, &SpectacleCore::showErrorMessage); | 86 | connect(lExportManager, &ExportManager::errorMessage, this, &SpectacleCore::showErrorMessage); | ||
87 | connect(lExportManager, &ExportManager::imageSaved, this, &SpectacleCore::doCopyPath); | 87 | connect(lExportManager, &ExportManager::imageSaved, this, &SpectacleCore::doCopyPath); | ||
88 | connect(lExportManager, &ExportManager::forceNotify, this, &SpectacleCore::doNotify); | 88 | connect(lExportManager, &ExportManager::forceNotify, this, &SpectacleCore::doNotify); | ||
89 | connect(mPlatform.get(), &Platform::windowTitleChanged, lExportManager, &ExportManager::setWindowTitle); | 89 | connect(mPlatform.get(), &Platform::windowTitleChanged, lExportManager, &ExportManager::setWindowTitle); | ||
90 | 90 | | |||
91 | setUpShortcuts(); | ||||
aprcela: Here.
When commented out, spectacle runs but it doesn't show the according shortcut in the main… | |||||
92 | | ||||
91 | switch (theStartMode) { | 93 | switch (theStartMode) { | ||
92 | case StartMode::DBus: | 94 | case StartMode::DBus: | ||
93 | break; | 95 | break; | ||
94 | case StartMode::Background: { | 96 | case StartMode::Background: { | ||
95 | auto lMsec = (KWindowSystem::compositingActive() ? 200 : 50) + theDelayMsec; | 97 | auto lMsec = (KWindowSystem::compositingActive() ? 200 : 50) + theDelayMsec; | ||
96 | auto lShutterMode = lImmediateAvailable ? Platform::ShutterMode::Immediate : Platform::ShutterMode::OnClick; | 98 | auto lShutterMode = lImmediateAvailable ? Platform::ShutterMode::Immediate : Platform::ShutterMode::OnClick; | ||
97 | auto lIncludePointer = lGuiConfig.readEntry("includePointer", true); | 99 | auto lIncludePointer = lGuiConfig.readEntry("includePointer", true); | ||
98 | auto lIncludeDecorations = lGuiConfig.readEntry("includeDecorations", true); | 100 | auto lIncludeDecorations = lGuiConfig.readEntry("includeDecorations", true); | ||
99 | const Platform::GrabMode lCaptureMode = toPlatformGrabMode(theCaptureMode); | 101 | const Platform::GrabMode lCaptureMode = toPlatformGrabMode(theCaptureMode); | ||
100 | QTimer::singleShot(lMsec, this, [ this, lCaptureMode, lShutterMode, lIncludePointer, lIncludeDecorations ]() { | 102 | QTimer::singleShot(lMsec, this, [ this, lCaptureMode, lShutterMode, lIncludePointer, lIncludeDecorations ]() { | ||
101 | mPlatform->doGrab(lShutterMode, lCaptureMode, lIncludePointer, lIncludeDecorations); | 103 | mPlatform->doGrab(lShutterMode, lCaptureMode, lIncludePointer, lIncludeDecorations); | ||
102 | }); | 104 | }); | ||
103 | } | 105 | } | ||
104 | break; | 106 | break; | ||
105 | case StartMode::Gui: | 107 | case StartMode::Gui: | ||
106 | initGui(lGuiConfig.readEntry("includePointer", true), lGuiConfig.readEntry("includeDecorations", true)); | 108 | initGui(lGuiConfig.readEntry("includePointer", true), lGuiConfig.readEntry("includeDecorations", true)); | ||
107 | break; | 109 | break; | ||
108 | } | 110 | } | ||
109 | setUpShortcuts(); | | |||
110 | } | 111 | } | ||
111 | 112 | | |||
112 | void SpectacleCore::setUpShortcuts() | 113 | void SpectacleCore::setUpShortcuts() | ||
113 | { | 114 | { | ||
114 | SpectacleConfig* config = SpectacleConfig::instance(); | 115 | SpectacleConfig* config = SpectacleConfig::instance(); | ||
115 | 116 | | |||
116 | QAction* openAction = config->shortCutActions->action(QStringLiteral("_launch")); | 117 | QAction* openAction = config->shortCutActions->action(QStringLiteral("_launch")); | ||
117 | KGlobalAccel::self()->setGlobalShortcut(openAction, Qt::Key_Print); | 118 | KGlobalAccel::self()->setGlobalShortcut(openAction, Qt::Key_Print); | ||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Line(s) | 270 | { | |||
286 | } | 287 | } | ||
287 | } | 288 | } | ||
288 | 289 | | |||
289 | void SpectacleCore::doNotify(const QUrl &theSavedAt) | 290 | void SpectacleCore::doNotify(const QUrl &theSavedAt) | ||
290 | { | 291 | { | ||
291 | KNotification *lNotify = new KNotification(QStringLiteral("newScreenshotSaved")); | 292 | KNotification *lNotify = new KNotification(QStringLiteral("newScreenshotSaved")); | ||
292 | 293 | | |||
293 | switch(ExportManager::instance()->captureMode()) { | 294 | switch(ExportManager::instance()->captureMode()) { | ||
294 | case Spectacle::CaptureMode::AllScreens: | 295 | case Spectacle::CaptureMode::EntireScreen: | ||
295 | lNotify->setTitle(i18nc("The entire screen area was captured, heading", "Full Screen Captured")); | 296 | lNotify->setTitle(i18nc("The entire screen area was captured, heading", "Full Screen Captured")); | ||
296 | break; | 297 | break; | ||
297 | case Spectacle::CaptureMode::CurrentScreen: | 298 | case Spectacle::CaptureMode::CurrentScreen: | ||
298 | lNotify->setTitle(i18nc("The current screen was captured, heading", "Current Screen Captured")); | 299 | lNotify->setTitle(i18nc("The current screen was captured, heading", "Current Screen Captured")); | ||
299 | break; | 300 | break; | ||
300 | case Spectacle::CaptureMode::ActiveWindow: | 301 | case Spectacle::CaptureMode::ActiveWindow: | ||
301 | lNotify->setTitle(i18nc("The active window was captured, heading", "Active Window Captured")); | 302 | lNotify->setTitle(i18nc("The active window was captured, heading", "Active Window Captured")); | ||
302 | break; | 303 | break; | ||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | |||||
363 | 364 | | |||
364 | // Private | 365 | // Private | ||
365 | 366 | | |||
366 | Platform::GrabMode SpectacleCore::toPlatformGrabMode(Spectacle::CaptureMode theCaptureMode) | 367 | Platform::GrabMode SpectacleCore::toPlatformGrabMode(Spectacle::CaptureMode theCaptureMode) | ||
367 | { | 368 | { | ||
368 | switch(theCaptureMode) { | 369 | switch(theCaptureMode) { | ||
369 | case Spectacle::CaptureMode::InvalidChoice: | 370 | case Spectacle::CaptureMode::InvalidChoice: | ||
370 | return Platform::GrabMode::InvalidChoice; | 371 | return Platform::GrabMode::InvalidChoice; | ||
371 | case Spectacle::CaptureMode::AllScreens: | 372 | case Spectacle::CaptureMode::EntireScreen: | ||
372 | case Spectacle::CaptureMode::RectangularRegion: | 373 | case Spectacle::CaptureMode::RectangularRegion: | ||
373 | return Platform::GrabMode::AllScreens; | 374 | return Platform::GrabMode::AllScreens; | ||
374 | case Spectacle::CaptureMode::TransientWithParent: | 375 | case Spectacle::CaptureMode::TransientWithParent: | ||
375 | return Platform::GrabMode::TransientWithParent; | 376 | return Platform::GrabMode::TransientWithParent; | ||
376 | case Spectacle::CaptureMode::CurrentScreen: | 377 | case Spectacle::CaptureMode::CurrentScreen: | ||
377 | return Platform::GrabMode::CurrentScreen; | 378 | return Platform::GrabMode::CurrentScreen; | ||
378 | case Spectacle::CaptureMode::ActiveWindow: | 379 | case Spectacle::CaptureMode::ActiveWindow: | ||
379 | return Platform::GrabMode::ActiveWindow; | 380 | return Platform::GrabMode::ActiveWindow; | ||
Show All 24 Lines |
Here.
When commented out, spectacle runs but it doesn't show the according shortcut in the main window's 'Area' dropdown menu.