Changeset View
Changeset View
Standalone View
Standalone View
src/Main.cpp
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | 58 | parser.addOptions({ | |||
---|---|---|---|---|---|
63 | {{QStringLiteral("t"), QStringLiteral("transientonly")}, i18n("Capture the window currently under the cursor, excluding parents of pop-up menus")}, | 63 | {{QStringLiteral("t"), QStringLiteral("transientonly")}, i18n("Capture the window currently under the cursor, excluding parents of pop-up menus")}, | ||
64 | {{QStringLiteral("r"), QStringLiteral("region")}, i18n("Capture a rectangular region of the screen")}, | 64 | {{QStringLiteral("r"), QStringLiteral("region")}, i18n("Capture a rectangular region of the screen")}, | ||
65 | {{QStringLiteral("g"), QStringLiteral("gui")}, i18n("Start in GUI mode (default)")}, | 65 | {{QStringLiteral("g"), QStringLiteral("gui")}, i18n("Start in GUI mode (default)")}, | ||
66 | {{QStringLiteral("b"), QStringLiteral("background")}, i18n("Take a screenshot and exit without showing the GUI")}, | 66 | {{QStringLiteral("b"), QStringLiteral("background")}, i18n("Take a screenshot and exit without showing the GUI")}, | ||
67 | {{QStringLiteral("s"), QStringLiteral("dbus")}, i18n("Start in DBus-Activation mode")}, | 67 | {{QStringLiteral("s"), QStringLiteral("dbus")}, i18n("Start in DBus-Activation mode")}, | ||
68 | {{QStringLiteral("n"), QStringLiteral("nonotify")}, i18n("In background mode, do not pop up a notification when the screenshot is taken")}, | 68 | {{QStringLiteral("n"), QStringLiteral("nonotify")}, i18n("In background mode, do not pop up a notification when the screenshot is taken")}, | ||
69 | {{QStringLiteral("o"), QStringLiteral("output")}, i18n("In background mode, save image to specified file"), QStringLiteral("fileName")}, | 69 | {{QStringLiteral("o"), QStringLiteral("output")}, i18n("In background mode, save image to specified file"), QStringLiteral("fileName")}, | ||
70 | {{QStringLiteral("d"), QStringLiteral("delay")}, i18n("In background mode, delay before taking the shot (in milliseconds)"), QStringLiteral("delayMsec")}, | 70 | {{QStringLiteral("d"), QStringLiteral("delay")}, i18n("In background mode, delay before taking the shot (in milliseconds)"), QStringLiteral("delayMsec")}, | ||
71 | {{QStringLiteral("c"), QStringLiteral("clipboard")}, i18n("In background mode, copy screenshot to clipboard")}, | ||||
cfeck: Applications/19.04 branch was already frozen on Mar 21 for new features/translations, see https… | |||||
ngraham: Ah darn, I misread the schedule. :( It won't happen again. | |||||
71 | {{QStringLiteral("w"), QStringLiteral("onclick")}, i18n("Wait for a click before taking screenshot. Invalidates delay")} | 72 | {{QStringLiteral("w"), QStringLiteral("onclick")}, i18n("Wait for a click before taking screenshot. Invalidates delay")} | ||
72 | }); | 73 | }); | ||
73 | 74 | | |||
74 | parser.process(app); | 75 | parser.process(app); | ||
75 | aboutData.processCommandLine(&parser); | 76 | aboutData.processCommandLine(&parser); | ||
76 | 77 | | |||
77 | // extract the capture mode | 78 | // extract the capture mode | ||
78 | 79 | | |||
Show All 9 Lines | |||||
88 | } else if (parser.isSet(QStringLiteral("transientonly"))) { | 89 | } else if (parser.isSet(QStringLiteral("transientonly"))) { | ||
89 | grabMode = ImageGrabber::WindowUnderCursor; | 90 | grabMode = ImageGrabber::WindowUnderCursor; | ||
90 | } | 91 | } | ||
91 | 92 | | |||
92 | // are we running in background or dbus mode? | 93 | // are we running in background or dbus mode? | ||
93 | 94 | | |||
94 | SpectacleCore::StartMode startMode = SpectacleCore::GuiMode; | 95 | SpectacleCore::StartMode startMode = SpectacleCore::GuiMode; | ||
95 | bool notify = true; | 96 | bool notify = true; | ||
97 | bool copyToClipboard = false; | ||||
96 | qint64 delayMsec = 0; | 98 | qint64 delayMsec = 0; | ||
97 | QString fileName = QString(); | 99 | QString fileName = QString(); | ||
98 | 100 | | |||
99 | if (parser.isSet(QStringLiteral("background"))) { | 101 | if (parser.isSet(QStringLiteral("background"))) { | ||
100 | startMode = SpectacleCore::BackgroundMode; | 102 | startMode = SpectacleCore::BackgroundMode; | ||
101 | } else if (parser.isSet(QStringLiteral("dbus"))) { | 103 | } else if (parser.isSet(QStringLiteral("dbus"))) { | ||
102 | startMode = SpectacleCore::DBusMode; | 104 | startMode = SpectacleCore::DBusMode; | ||
103 | } | 105 | } | ||
Show All 15 Lines | 120 | if (ok) { | |||
119 | delayMsec = delayValue; | 121 | delayMsec = delayValue; | ||
120 | } | 122 | } | ||
121 | } | 123 | } | ||
122 | 124 | | |||
123 | if (parser.isSet(QStringLiteral("onclick"))) { | 125 | if (parser.isSet(QStringLiteral("onclick"))) { | ||
124 | delayMsec = -1; | 126 | delayMsec = -1; | ||
125 | } | 127 | } | ||
126 | 128 | | |||
129 | if (parser.isSet(QStringLiteral("clipboard"))) { | ||||
130 | copyToClipboard = true; | ||||
131 | } | ||||
132 | | ||||
127 | app.setQuitOnLastWindowClosed(false); | 133 | app.setQuitOnLastWindowClosed(false); | ||
128 | break; | 134 | break; | ||
129 | 135 | | |||
130 | case SpectacleCore::DBusMode: | 136 | case SpectacleCore::DBusMode: | ||
131 | app.setQuitOnLastWindowClosed(false); | 137 | app.setQuitOnLastWindowClosed(false); | ||
132 | break; | 138 | break; | ||
133 | case SpectacleCore::GuiMode: | 139 | case SpectacleCore::GuiMode: | ||
134 | default: | 140 | default: | ||
135 | break; | 141 | break; | ||
136 | } | 142 | } | ||
137 | 143 | | |||
138 | // release the kraken | 144 | // release the kraken | ||
139 | 145 | | |||
140 | SpectacleCore core(startMode, grabMode, fileName, delayMsec, notify); | 146 | SpectacleCore core(startMode, grabMode, fileName, delayMsec, notify, copyToClipboard); | ||
141 | QObject::connect(&core, &SpectacleCore::allDone, qApp, &QApplication::quit); | 147 | QObject::connect(&core, &SpectacleCore::allDone, qApp, &QApplication::quit); | ||
142 | 148 | | |||
143 | // create the dbus connections | 149 | // create the dbus connections | ||
144 | 150 | | |||
145 | new KDBusService(KDBusService::Multiple, &core); | 151 | new KDBusService(KDBusService::Multiple, &core); | ||
146 | 152 | | |||
147 | SpectacleDBusAdapter *dbusAdapter = new SpectacleDBusAdapter(&core); | 153 | SpectacleDBusAdapter *dbusAdapter = new SpectacleDBusAdapter(&core); | ||
148 | QObject::connect(&core, &SpectacleCore::grabFailed, dbusAdapter, &SpectacleDBusAdapter::ScreenshotFailed); | 154 | QObject::connect(&core, &SpectacleCore::grabFailed, dbusAdapter, &SpectacleDBusAdapter::ScreenshotFailed); | ||
Show All 11 Lines |
Applications/19.04 branch was already frozen on Mar 21 for new features/translations, see https://community.kde.org/Schedules/Applications/19.04_Release_Schedule
Did you ask for an exception?