Add AA_EnableHighDpiScaling
[kdepim.git] / importwizard / main.cpp
blobb84480106407f42f72e989770c4b313c541a3194
1 /*
2 Copyright (c) 2012-2016 Montel Laurent <montel@kde.org>
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License, version 2, as
6 published by the Free Software Foundation.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License along
14 with this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #include <kaboutdata.h>
19 #include <KDBusService>
20 #include <KLocalizedString>
21 #include <Kdelibs4ConfigMigrator>
22 #include <QApplication>
23 #include <QIcon>
24 #include "importwizard.h"
26 #include "kdepim-version.h"
28 #include <QCommandLineParser>
29 #include <stdio.h>
31 int main(int argc, char *argv[])
33 QApplication app(argc, argv);
34 app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
35 #if QT_VERSION >= 0x050600
36 app.setAttribute(Qt::AA_EnableHighDpiScaling);
37 #endif
38 Kdelibs4ConfigMigrator migrate(QStringLiteral("importwizard"));
39 migrate.setConfigFiles(QStringList() << QStringLiteral("importwizardrc"));
40 migrate.migrate();
42 KLocalizedString::setApplicationDomain("importwizard");
43 //FIXME: "wizards" are "assistents" in new KDE slang
45 KAboutData aboutData(QStringLiteral("importwizard"),
46 i18n("PIM Import Tool"),
47 QStringLiteral(KDEPIM_VERSION),
48 i18n("PIM Import Tool"),
49 KAboutLicense::GPL_V2,
50 i18n("Copyright © 2012-2016 importwizard authors"));
52 aboutData.addAuthor(i18n("Laurent Montel"), i18n("Maintainer"), QStringLiteral("montel@kde.org"));
53 QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("kontact-import-wizard")));
54 aboutData.setOrganizationDomain(QByteArray("kde.org"));
55 aboutData.setProductName(QByteArray("importwizard"));
56 KAboutData::setApplicationData(aboutData);
58 QCommandLineParser parser;
59 parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("mode"), i18n("Mode")));
60 parser.addVersionOption();
61 parser.addHelpOption();
62 aboutData.setupCommandLine(&parser);
63 parser.process(app);
64 aboutData.processCommandLine(&parser);
66 KDBusService service(KDBusService::Unique);
68 ImportWizard::WizardMode mode = ImportWizard::AutoDetect;
69 if (parser.isSet(QStringLiteral("mode"))) {
70 if (!parser.positionalArguments().isEmpty()) {
71 const QString modeStr = parser.positionalArguments().at(0);
72 if (modeStr == QLatin1String("manual")) {
73 mode = ImportWizard::Manual;
78 ImportWizard *wizard = new ImportWizard(mode);
79 wizard->show();
80 const int ret = app.exec();
81 delete wizard;
82 return ret;