-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.cpp
161 lines (138 loc) · 7.68 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// SPDX-FileCopyrightText: 2003-2014 Jesper K. Pedersen <[email protected]>
// SPDX-FileCopyrightText: 2003 Lukáš Tinkl <[email protected]>
// SPDX-FileCopyrightText: 2003 Simon Hausmann <[email protected]>
// SPDX-FileCopyrightText: 2003 Stephan Binner <[email protected]>
// SPDX-FileCopyrightText: 2005-2007 Dirk Mueller <[email protected]>
// SPDX-FileCopyrightText: 2006-2008 Tuomas Suutari <[email protected]>
// SPDX-FileCopyrightText: 2007-2011 Jan Kundrát <[email protected]>
// SPDX-FileCopyrightText: 2007 Chusslove Illich <[email protected]>
// SPDX-FileCopyrightText: 2009 Andrew Coles <[email protected]>
// SPDX-FileCopyrightText: 2009 Christoph Feck <[email protected]>
// SPDX-FileCopyrightText: 2010-2012 Miika Turkia <[email protected]>
// SPDX-FileCopyrightText: 2012-2025 Johannes Zarl-Zierl <[email protected]>
// SPDX-FileCopyrightText: 2018-2024 Tobias Leupold <[email protected]>
// SPDX-FileCopyrightText: 2018 Antoni Bella Pérez <[email protected]>
// SPDX-FileCopyrightText: 2019 Alexander Potashev <[email protected]>
//
// SPDX-License-Identifier: GPL-2.0-or-later
#include <MainWindow/Options.h>
#include <MainWindow/SplashScreen.h>
#include <MainWindow/Window.h>
#ifdef KPA_ENABLE_REMOTECONTROL
#include <RemoteControl/RemoteInterface.h>
#endif
#include <kpabase/SettingsData.h>
#include <kpabase/version.h>
#include <KAboutData>
#include <KColorScheme>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KSharedConfig>
#include <QApplication>
#include <QCommandLineOption>
#include <QCommandLineParser>
#include <QDebug>
#include <QLocale>
#include <QLoggingCategory>
#include <QTemporaryFile>
Q_DECLARE_LOGGING_CATEGORY(MainLog)
Q_LOGGING_CATEGORY(MainLog, "kphotoalbum", QtWarningMsg)
namespace
{
const auto STYLE = QStringLiteral(
"Viewer--TaggedArea {"
"border: none;"
"background-color: none;"
"}"
"Viewer--TaggedArea:hover, Viewer--TaggedArea[selected=\"true\"] {"
"border: 1px solid rgba(0, 255, 0, 99);"
"background-color: rgba(255, 255, 255, 30);"
"}"
"Viewer--TaggedArea[highlighted=\"true\"] {"
"border: 1px solid rgba(255, 128, 0, 99);"
"background-color: rgba(255, 255, 255, 30);"
"}"
"AnnotationDialog--ResizableFrame {"
"color: rgb(255, 0, 0);"
"}"
"AnnotationDialog--ResizableFrame:hover {"
"background-color: rgba(255, 255, 255, 30);"
"}"
"AnnotationDialog--ResizableFrame[associated=true] {"
"color: rgb(0, 255, 0);"
"}");
}
int main(int argc, char **argv)
{
KLocalizedString::setApplicationDomain("kphotoalbum");
QApplication app(argc, argv);
KAboutData aboutData(
QStringLiteral("kphotoalbum"), // component name
i18n("KPhotoAlbum"), // display name
QStringLiteral(KPA_VERSION),
i18n("KDE Photo Album"), // short description
KAboutLicense::GPL_V3,
i18n("Copyright (C) 2003-2024 The KPhotoAlbum Development Team"), // copyright statement
QString(), // other text
QStringLiteral("https://www.kphotoalbum.org") // homepage
);
aboutData.setOrganizationDomain("kde.org");
aboutData.setDesktopFileName(QStringLiteral("org.kde.kphotoalbum"));
// maintainer is expected to be the first entry
// Note: I like to sort by name, grouped by active/inactive;
// Jesper gets ranked with the active authors for obvious reasons
aboutData.addAuthor(i18n("Johannes Zarl-Zierl"), i18n("Development, Maintainer"), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Robert Krawitz"), i18n("Development, Optimization"), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Tobias Leupold"), i18n("Development, Releases, Website"), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Jesper K. Pedersen"), i18n("Former Maintainer, Project Creator"), QStringLiteral("[email protected]"));
// not currently active:
aboutData.addAuthor(i18n("Hassan Ibraheem"), QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Jan Kundrát"), QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Andreas Neustifter"), QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Tuomas Suutari"), QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Miika Turkia"), QString(), QStringLiteral("[email protected]"));
aboutData.addAuthor(i18n("Henner Zeller"), QString(), QStringLiteral("[email protected]"));
// sort alphabetically:
aboutData.addCredit(i18n("Marco Caldarelli"), i18n("Patch for making it possible to reread Exif info using a nice dialog."), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Jean-Michel FAYARD"), i18n("(.) Patch with folder info made available through the browser. (.) Patch for adding a check box for \"and/or\" searches in the search page."), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Matthias Füssel"), i18n("Geo Position page in browser and various bug fixes"), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Wes Hardaker"), i18n("Some very useful features to improve workflow"), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Reimar Imhof"), i18n("Patch to sort items in option listboxes"), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Christoph Moseler"), i18n("Numerous patches for lots of bugs plus patches for a few new features"), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Teemu Rytilahti"),
i18n("Theme support for HTML generation"), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Thomas Schwarzgruber"), i18n("Patch to sort images in the thumbnail view, plus reading time info out of Exif images for existing images"), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Clytie Siddall"), i18n("Tremendous help with the English text in the application."), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Will Stephenson"), i18n("Developing an Icon for KPhotoAlbum"), QStringLiteral("[email protected]"));
aboutData.addCredit(i18n("Marcel Wiesweg"), i18n("Patch which speed up loading of thumbnails plus preview in image property dialog."), QStringLiteral("[email protected]"));
// initialize the commandline parser
QCommandLineParser *parser = MainWindow::Options::the()->parser();
KAboutData::setApplicationData(aboutData);
aboutData.setupCommandLine(parser);
parser->process(app);
aboutData.processCommandLine(parser);
const QString schemePath = KSharedConfig::openConfig()->group(QLatin1String("General")).readEntry(QStringLiteral("colorScheme"), QString());
qCDebug(MainLog) << "Loading color scheme from " << (schemePath.isEmpty() ? QStringLiteral("system default") : schemePath);
app.setPalette(KColorScheme::createApplicationPalette(KSharedConfig::openConfig(schemePath)));
if (app.styleSheet().isEmpty())
app.setStyleSheet(STYLE);
app.setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles);
qDebug() << "kphotoalbumrc:" << KConfig::mainConfigName();
new MainWindow::SplashScreen();
// a KXmlGuiWindow per-default is created with the Qt::WA_DeleteOnClose attribute set
// -> don't delete the view directly!
MainWindow::Window *view = nullptr;
try {
view = new MainWindow::Window(nullptr);
} catch (int retVal) {
// MainWindow ctor throws if no config is loaded
return retVal;
}
view->show();
#ifdef KPA_ENABLE_REMOTECONTROL
(void)RemoteControl::RemoteInterface::instance();
#endif
int code = QApplication::exec();
return code;
}
// vi:expandtab:tabstop=4 shiftwidth=4: