Changeset View
Changeset View
Standalone View
Standalone View
app/main.cpp
Show All 32 Lines | |||||
33 | #include <KAboutData> | 33 | #include <KAboutData> | ||
34 | #include <KActionCollection> | 34 | #include <KActionCollection> | ||
35 | #include <KIO/CopyJob> | 35 | #include <KIO/CopyJob> | ||
36 | #include <KLocalizedString> | 36 | #include <KLocalizedString> | ||
37 | 37 | | |||
38 | // Local | 38 | // Local | ||
39 | #include <lib/about.h> | 39 | #include <lib/about.h> | ||
40 | #include <lib/imageformats/imageformats.h> | 40 | #include <lib/imageformats/imageformats.h> | ||
41 | #include <lib/gwenviewconfig.h> | ||||
41 | #include "mainwindow.h" | 42 | #include "mainwindow.h" | ||
42 | 43 | | |||
43 | #ifdef HAVE_FITS | 44 | #ifdef HAVE_FITS | ||
44 | // This hack is needed to include the fitsplugin moc file in main.cpp | 45 | // This hack is needed to include the fitsplugin moc file in main.cpp | ||
45 | // Otherwise the linker complains about: undefined reference to `qt_static_plugin_FitsPlugin()' | 46 | // Otherwise the linker complains about: undefined reference to `qt_static_plugin_FitsPlugin()' | ||
46 | // This symbol is defined in the moc file, but it is not a visible symbol after libgwenview is linked. | 47 | // This symbol is defined in the moc file, but it is not a visible symbol after libgwenview is linked. | ||
47 | // If Q_IMPORT_PLUGIN(FitsPlugin) is moved to the library, gwenview crashes on the first call to FitsPlugin() | 48 | // If Q_IMPORT_PLUGIN(FitsPlugin) is moved to the library, gwenview crashes on the first call to FitsPlugin() | ||
48 | // when the vtable is looked up in the plugin registration. | 49 | // when the vtable is looked up in the plugin registration. | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 123 | { | |||
133 | aboutData->setOrganizationDomain(QByteArray("kde.org")); | 134 | aboutData->setOrganizationDomain(QByteArray("kde.org")); | ||
134 | KAboutData::setApplicationData(*aboutData); | 135 | KAboutData::setApplicationData(*aboutData); | ||
135 | QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("gwenview"), app.windowIcon())); | 136 | QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("gwenview"), app.windowIcon())); | ||
136 | 137 | | |||
137 | QCommandLineParser parser; | 138 | QCommandLineParser parser; | ||
138 | aboutData.data()->setupCommandLine(&parser); | 139 | aboutData.data()->setupCommandLine(&parser); | ||
139 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("f") << QStringLiteral("fullscreen"), | 140 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("f") << QStringLiteral("fullscreen"), | ||
140 | i18n("Start in fullscreen mode"))); | 141 | i18n("Start in fullscreen mode"))); | ||
142 | parser.addOption(QCommandLineOption(QStringLiteral("no-fullscreen"), | ||||
143 | i18n("Start in normal (non-fullscreen) mode"))); | ||||
141 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("slideshow"), | 144 | parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("s") << QStringLiteral("slideshow"), | ||
142 | i18n("Start in slideshow mode"))); | 145 | i18n("Start in slideshow mode"))); | ||
143 | parser.addHelpOption(); | 146 | parser.addHelpOption(); | ||
144 | parser.addVersionOption(); | 147 | parser.addVersionOption(); | ||
145 | parser.addPositionalArgument("url", i18n("A starting file or folders")); | 148 | parser.addPositionalArgument("url", i18n("A starting file or folders")); | ||
146 | parser.process(app); | 149 | parser.process(app); | ||
147 | aboutData.data()->processCommandLine(&parser); | 150 | aboutData.data()->processCommandLine(&parser); | ||
148 | 151 | | |||
149 | //KF5 TODO | 152 | //KF5 TODO | ||
150 | //Gwenview::ImageFormats::registerPlugins(); | 153 | //Gwenview::ImageFormats::registerPlugins(); | ||
151 | 154 | | |||
155 | bool fullscreen = false; | ||||
156 | if (parser.isSet(QStringLiteral("fullscreen"))) { | ||||
157 | fullscreen = true; | ||||
158 | } else if (parser.isSet(QStringLiteral("no-fullscreen"))) { | ||||
159 | fullscreen = false; | ||||
160 | } else if (Gwenview::GwenviewConfig::rememberFullScreenMode()) { | ||||
161 | fullscreen = Gwenview::GwenviewConfig::fullScreenModeActive(); | ||||
162 | } | ||||
163 | | ||||
152 | // startHelper must live for the whole life of the application | 164 | // startHelper must live for the whole life of the application | ||
153 | StartHelper startHelper(parser.positionalArguments(), | 165 | StartHelper startHelper(parser.positionalArguments(), | ||
154 | parser.isSet(QStringLiteral("f")), | 166 | fullscreen, | ||
155 | parser.isSet(QStringLiteral("s"))); | 167 | parser.isSet(QStringLiteral("slideshow"))); | ||
156 | if (app.isSessionRestored()) { | 168 | if (app.isSessionRestored()) { | ||
157 | kRestoreMainWindows<Gwenview::MainWindow>(); | 169 | kRestoreMainWindows<Gwenview::MainWindow>(); | ||
158 | } else { | 170 | } else { | ||
159 | startHelper.createMainWindow(); | 171 | startHelper.createMainWindow(); | ||
160 | } | 172 | } | ||
161 | 173 | | |||
162 | // Workaround for QTBUG-38613 | 174 | // Workaround for QTBUG-38613 | ||
163 | // Another solution would be to port BalooSemanticInfoBackend::refreshAllTags | 175 | // Another solution would be to port BalooSemanticInfoBackend::refreshAllTags | ||
Show All 9 Lines |