]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blob - src/main.cpp
At the PO template (translation) framework.
[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
23 // KDE Frameworks headers.
24 #include <KAboutData>
25 #include <KCrash>
26 #include <KDBusService>
27
28 // Qt headers.
29 #include <QCommandLineParser>
30 #include <QFile>
31
32 int main(int argc, char *argv[])
33 {
34     // Create the application.
35     QApplication application(argc, argv);
36
37     // Set the localization application domain.
38     KLocalizedString::setApplicationDomain("privacybrowser");
39
40     // Initialize KCrash.
41     KCrash::initialize();
42
43     // Instantiate about data.
44     KAboutData aboutData(QStringLiteral("privacybrowser"), i18n("Privacy Browser"), QStringLiteral("0.1"));
45
46     // Add the author information.
47     aboutData.addAuthor(i18n("Soren Stoutner"),i18n("Principal developer"), QStringLiteral("soren@stoutner.com"), QStringLiteral("https://www.stoutner.com/"));
48
49     // Populate additional about data info.
50     aboutData.setBugAddress("https://redmine.stoutner.com/projects/privacy-browser-pc/issues");
51     aboutData.setCopyrightStatement(i18n("Copyright © 2016-2017,2021-2022 Soren Stoutner <soren@stoutner.com>"));
52     aboutData.setDesktopFileName(QStringLiteral("com.stoutner.privacybrowser"));
53     aboutData.setHomepage(QStringLiteral("https://www.stoutner.com/privacy-browser-pc/"));
54     aboutData.setLicenseTextFile(":/licenses/GPLv3+.txt");
55     aboutData.setOrganizationDomain("stoutner.com");
56     aboutData.setShortDescription(i18n("A web browser that respects your privacy."));
57
58     // Set the application data.
59     KAboutData::setApplicationData(aboutData);
60
61     // Set the window icon.
62     application.setWindowIcon(QIcon::fromTheme(QStringLiteral("privacybrowser"), QIcon(":/icons/privacy_browser.svg")));
63
64     // Create a command line parser.
65     QCommandLineParser commandLineParser;
66
67     // Process the command line through about data (this adds --license and --author).
68     aboutData.setupCommandLine(&commandLineParser);
69
70     // Process the application command line options (this adds --version, --help, and --help-all).
71     commandLineParser.process(application);
72
73     // Make it so.
74     aboutData.processCommandLine(&commandLineParser);
75
76     // Register with D-Bus, allowing multiple instances and allowing the program to run if for some reason the registration fails.
77     KDBusService appDBusService(KDBusService::Multiple | KDBusService::NoExitOnFailure);
78
79     // Create the main window.
80     MainWindow *mainWindowPointer = new MainWindow;
81
82     // Show the main window.
83     mainWindowPointer->show();
84
85     // Return the application.
86     return application.exec();
87 }