Changeset View
Changeset View
Standalone View
Standalone View
src/Main.cpp
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public License | 14 | * You should have received a copy of the GNU Lesser General Public License | ||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "Config.h" | 20 | #include "Config.h" | ||
21 | #include "SpectacleCommon.h" | | |||
22 | #include "SpectacleCore.h" | 21 | #include "SpectacleCore.h" | ||
23 | #include "SpectacleDBusAdapter.h" | 22 | #include "SpectacleDBusAdapter.h" | ||
23 | #include "BackendInterfaces/ScreenshotInterface.h" | ||||
24 | 24 | | |||
25 | #include <QApplication> | 25 | #include <QApplication> | ||
26 | #include <QCommandLineParser> | 26 | #include <QCommandLineParser> | ||
27 | #include <QDBusConnection> | 27 | #include <QDBusConnection> | ||
28 | 28 | | |||
29 | #include <KAboutData> | 29 | #include <KAboutData> | ||
30 | #include <KDBusService> | 30 | #include <KDBusService> | ||
31 | #include <KLocalizedString> | 31 | #include <KLocalizedString> | ||
32 | 32 | | |||
33 | int main(int argc, char **argv) | 33 | int main(int argc, char **argv) | ||
34 | { | 34 | { | ||
35 | // set up the application | 35 | // set up the application | ||
36 | | ||||
37 | QApplication lApp(argc, argv); | 36 | QApplication lApp(argc, argv); | ||
38 | 37 | | |||
39 | lApp.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); | 38 | lApp.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); | ||
40 | lApp.setAttribute(Qt::AA_UseHighDpiPixmaps, true); | 39 | lApp.setAttribute(Qt::AA_UseHighDpiPixmaps, true); | ||
41 | 40 | | |||
42 | KLocalizedString::setApplicationDomain("spectacle"); | 41 | KLocalizedString::setApplicationDomain("spectacle"); | ||
43 | 42 | | |||
44 | KAboutData aboutData(QStringLiteral("spectacle"), | 43 | KAboutData aboutData(QStringLiteral("spectacle"), | ||
Show All 29 Lines | 59 | lCmdLineParser.addOptions({ | |||
74 | {{QStringLiteral("w"), QStringLiteral("onclick")}, i18n("Wait for a click before taking screenshot. Invalidates delay")} | 73 | {{QStringLiteral("w"), QStringLiteral("onclick")}, i18n("Wait for a click before taking screenshot. Invalidates delay")} | ||
75 | }); | 74 | }); | ||
76 | 75 | | |||
77 | lCmdLineParser.process(lApp); | 76 | lCmdLineParser.process(lApp); | ||
78 | aboutData.processCommandLine(&lCmdLineParser); | 77 | aboutData.processCommandLine(&lCmdLineParser); | ||
79 | 78 | | |||
80 | // extract the capture mode | 79 | // extract the capture mode | ||
81 | 80 | | |||
82 | Spectacle::CaptureMode lCaptureMode = Spectacle::CaptureMode::AllScreens; | 81 | CaptureMode lCaptureMode = CaptureMode::AllScreens; | ||
83 | if (lCmdLineParser.isSet(QStringLiteral("current"))) { | 82 | if (lCmdLineParser.isSet(QStringLiteral("current"))) { | ||
84 | lCaptureMode = Spectacle::CaptureMode::CurrentScreen; | 83 | lCaptureMode = CaptureMode::CurrentScreen; | ||
85 | } else if (lCmdLineParser.isSet(QStringLiteral("activewindow"))) { | 84 | } else if (lCmdLineParser.isSet(QStringLiteral("activewindow"))) { | ||
86 | lCaptureMode = Spectacle::CaptureMode::ActiveWindow; | 85 | lCaptureMode = CaptureMode::ActiveWindow; | ||
87 | } else if (lCmdLineParser.isSet(QStringLiteral("region"))) { | 86 | } else if (lCmdLineParser.isSet(QStringLiteral("region"))) { | ||
88 | lCaptureMode = Spectacle::CaptureMode::RectangularRegion; | 87 | lCaptureMode = CaptureMode::RectangularRegion; | ||
89 | } else if (lCmdLineParser.isSet(QStringLiteral("windowundercursor"))) { | 88 | } else if (lCmdLineParser.isSet(QStringLiteral("windowundercursor"))) { | ||
90 | lCaptureMode = Spectacle::CaptureMode::TransientWithParent; | 89 | lCaptureMode = CaptureMode::TransientWithParent; | ||
91 | } else if (lCmdLineParser.isSet(QStringLiteral("transientonly"))) { | 90 | } else if (lCmdLineParser.isSet(QStringLiteral("transientonly"))) { | ||
92 | lCaptureMode = Spectacle::CaptureMode::WindowUnderCursor; | 91 | lCaptureMode = CaptureMode::WindowUnderCursor; | ||
93 | } | 92 | } | ||
94 | 93 | | |||
95 | // are we running in background or dbus mode? | 94 | // are we running in background or dbus mode? | ||
96 | 95 | | |||
97 | SpectacleCore::StartMode lStartMode = SpectacleCore::StartMode::Gui; | 96 | SpectacleCore::StartMode lStartMode = SpectacleCore::StartMode::Gui; | ||
98 | bool lNotify = true; | 97 | bool lNotify = true; | ||
99 | bool lCopyToClipboard = false; | 98 | bool lCopyToClipboard = false; | ||
100 | qint64 lDelayMsec = 0; | 99 | qint64 lDelayMsec = 0; | ||
▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines |