1 /***************************************************************************
2 * Copyright (C) 2005-2018 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
25 # include <sys/types.h>
26 # include <sys/stat.h>
27 #endif /* HAVE_UMASK */
29 #include <QCoreApplication>
33 # include "coreapplication.h"
34 #elif defined BUILD_QTUI
35 # include "aboutdata.h"
36 # include "qtuiapplication.h"
37 #elif defined BUILD_MONO
38 # include "aboutdata.h"
39 # include "monoapplication.h"
42 #error "Something is wrong - you need to #define a build mode!"
45 // We don't want quasselcore to depend on KDE
46 #if defined HAVE_KF5 && defined BUILD_CORE
51 # include <KCoreAddons/KAboutData>
52 # include <KCoreAddons/Kdelibs4ConfigMigrator>
58 int main(int argc, char **argv)
60 // We need to explicitly initialize the required resources when linking statically
65 Q_INIT_RESOURCE(pics);
66 Q_INIT_RESOURCE(hicolor_icons);
70 Q_INIT_RESOURCE(i18n);
72 Q_INIT_RESOURCE(data);
73 Q_INIT_RESOURCE(icons);
74 # ifdef WITH_BUNDLED_ICONS
75 Q_INIT_RESOURCE(iconthemes);
80 // Set umask so files are created with restricted permissions
82 umask(S_IRWXG | S_IRWXO);
85 // Instantiate early, so log messages are handled
88 Quassel::setupBuildInfo();
89 QCoreApplication::setApplicationName(Quassel::buildInfo().applicationName);
90 QCoreApplication::setApplicationVersion(Quassel::buildInfo().plainVersionString);
91 QCoreApplication::setOrganizationName(Quassel::buildInfo().organizationName);
92 QCoreApplication::setOrganizationDomain(Quassel::buildInfo().organizationDomain);
94 // Migrate settings from KDE4 to KF5 if appropriate
96 Kdelibs4ConfigMigrator migrator(QCoreApplication::applicationName());
97 migrator.setConfigFiles(QStringList() << "quasselrc" << "quassel.notifyrc");
101 //Setup the High-DPI settings
102 # if QT_VERSION >= 0x050600 && defined(Q_OS_WIN)
103 QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //Added in Qt 5.6
105 QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
107 // Instantiate application
108 #if defined BUILD_CORE
109 CoreApplication app(argc, argv);
110 const auto runMode = Quassel::RunMode::CoreOnly;
111 #elif defined BUILD_QTUI
112 QtUiApplication app(argc, argv);
113 const auto runMode = Quassel::RunMode::ClientOnly;
114 #elif defined BUILD_MONO
115 MonolithicApplication app(argc, argv);
116 const auto runMode = Quassel::RunMode::Monolithic;
120 Quassel::instance()->init(runMode);
124 AboutData::setQuasselPersons(&aboutData);
125 KAboutData::setApplicationData(aboutData.kAboutData());
128 // Initialize the application
131 catch (ExitException e) {
132 if (!e.errorString.isEmpty()) {
133 qCritical() << e.errorString;