File indexing completed on 2023-05-30 10:41:18
0001 /************************************************************************************* 0002 * Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org> * 0003 * * 0004 * This program is free software; you can redistribute it and/or * 0005 * modify it under the terms of the GNU General Public License * 0006 * as published by the Free Software Foundation; either version 2 * 0007 * of the License, or (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the Free Software * 0016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 0017 *************************************************************************************/ 0018 0019 #include <QGuiApplication> 0020 #ifdef Q_OS_ANDROID 0021 #include <QQuickStyle> 0022 #else 0023 #include <QApplication> 0024 #endif 0025 0026 #include <KLocalizedContext> 0027 #include <KLocalizedString> 0028 #include <KAboutData> 0029 0030 #include <QCommandLineParser> 0031 #include <QQmlApplicationEngine> 0032 #include <QQmlContext> 0033 #include <QStandardPaths> 0034 0035 #include "kalgebramobile.h" 0036 #include "kalgebra_version.h" 0037 0038 Q_DECL_EXPORT int main(int argc, char *argv[]) 0039 { 0040 #ifdef Q_OS_ANDROID 0041 QQuickStyle::setStyle("Material"); 0042 #endif 0043 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 0044 QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 0045 #endif 0046 #ifdef Q_OS_ANDROID 0047 QGuiApplication app(argc, argv); 0048 #else 0049 QApplication app(argc, argv); 0050 #endif 0051 KLocalizedString::setApplicationDomain("kalgebramobile"); 0052 KAboutData about(QStringLiteral("kalgebramobile"), QStringLiteral("KAlgebra"), QStringLiteral(KALGEBRA_VERSION_STRING), i18n("A portable calculator"), 0053 KAboutLicense::GPL, i18n("(C) 2006-2020 Aleix Pol i Gonzalez")); 0054 about.addAuthor(i18n("Aleix Pol i Gonzalez"), QString(), QStringLiteral("aleixpol@kde.org")); 0055 about.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails")); 0056 KAboutData::setApplicationData(about); 0057 0058 { 0059 QCommandLineParser parser; 0060 about.setupCommandLine(&parser); 0061 parser.process(app); 0062 about.processCommandLine(&parser); 0063 } 0064 0065 KAlgebraMobile widget; 0066 0067 QQmlApplicationEngine engine; 0068 0069 qmlRegisterSingletonInstance("org.kde.kalgebra.mobile", 1, 0, "App", &widget); 0070 engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); 0071 engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); 0072 return app.exec(); 0073 }