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