]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/main.cpp
Add the icon.
[PrivacyBrowserPC.git] / src / main.cpp
1 /*
2  * Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
3  *
4  * This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
5  *
6  * Privacy Browser PC is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Privacy Browser PC is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Privacy Browser PC.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 // Application headers.
21 #include "mainwindow.h"
22 #include "privacybrowserpcdebug.h"  // TODO.  Rename.
23
24 // KDE Frameworks headers.
25 #include <KAboutData>
26 #include <KCrash>
27 #include <KDBusService>
28 #include <KLocalizedString>  // TODO.  This may not be needed.
29
30 // Qt headers.
31 #include <QApplication>  // TODO.  Probably not needed.  Appears to be included in a sub header.
32 #include <QCommandLineParser>
33 #include <QIcon>  // TODO.  Probably not needed.  Appears to be included in a sub header.
34 #include <QLoggingCategory>  // Probably not needed at all.
35
36 int main(int argc, char *argv[])
37 {
38     // Create the application.
39     QApplication application(argc, argv);
40
41     // Set the localization application domain.
42     KLocalizedString::setApplicationDomain("privacybrowser");
43
44     // Initialize KCrash.
45     KCrash::initialize();
46
47     // Instantiate about data.
48     KAboutData aboutData(QStringLiteral("privacybrowser"), i18n("Privacy Browser"), QStringLiteral("0.1"));
49
50     // Add the author information.
51     aboutData.addAuthor(i18n("Soren Stoutner"),i18n("Principal developer"), QStringLiteral("soren@stoutner.com"), QStringLiteral("https://www.stoutner.com/"));
52
53     // Populate additional about data info.  TODO, OrLaterVersions does not work.  The solution is probably to use a custom license file.
54     aboutData.setBugAddress("https://redmine.stoutner.com/projects/privacy-browser/issues");  // TODO.  Update the URL.
55     aboutData.setCopyrightStatement(i18n("Copyright © 2022 Soren Stoutner <soren@stoutner.com>"));
56     aboutData.setDesktopFileName(QStringLiteral("com.stoutner.privacybrowser"));
57     aboutData.setHomepage(QStringLiteral("https://www.stoutner.com/privacy-browser-pc/"));
58     aboutData.setLicense(KAboutLicense::GPL_V3, KAboutLicense::OrLaterVersions);
59     aboutData.setOrganizationDomain("stoutner.com");
60     aboutData.setShortDescription(i18n("A web browser that respects your privacy."));
61
62     // Set the application data.
63     KAboutData::setApplicationData(aboutData);
64
65     // Set the window icon.
66     application.setWindowIcon(QIcon::fromTheme(QStringLiteral("privacybrowser"), QIcon(":/icons/privacy_browser.svg")));
67
68     // Create a command line parser.
69     QCommandLineParser commandLineParser;
70
71     // Process the command line through about data (this adds --license and --author).
72     aboutData.setupCommandLine(&commandLineParser);
73
74     // Process the application command line options (this adds --version, --help, and --help-all).
75     commandLineParser.process(application);
76
77     // Make it so.
78     aboutData.processCommandLine(&commandLineParser);
79
80     // TODO.
81     KDBusService appDBusService(KDBusService::Multiple | KDBusService::NoExitOnFailure);
82
83     // Create the main window.
84     MainWindow *mainWindowPointer = new MainWindow;
85
86     // Show the main window.
87     mainWindowPointer->show();
88
89     // Return the application.
90     return application.exec();
91 }