Warning, file /education/minuet/src/app/uicontroller.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /**************************************************************************** 0002 ** 0003 ** Copyright (C) 2016 by Sandro S. Andrade <sandroandrade@kde.org> 0004 ** 0005 ** This program is free software; you can redistribute it and/or 0006 ** modify it under the terms of the GNU General Public License as 0007 ** published by the Free Software Foundation; either version 2 of 0008 ** the License or (at your option) version 3 or any later version 0009 ** accepted by the membership of KDE e.V. (or its successor approved 0010 ** by the membership of KDE e.V.), which shall act as a proxy 0011 ** defined in Section 14 of version 3 of the license. 0012 ** 0013 ** This program is distributed in the hope that it will be useful, 0014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0016 ** GNU General Public License for more details. 0017 ** 0018 ** You should have received a copy of the GNU General Public License 0019 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 0020 ** 0021 ****************************************************************************/ 0022 0023 #include "uicontroller.h" 0024 0025 #include "core.h" 0026 0027 #include <QStandardPaths> 0028 0029 #include <QQmlApplicationEngine> 0030 #include <QQmlContext> 0031 0032 #ifndef Q_OS_ANDROID 0033 #include <KLocalizedContext> 0034 #endif 0035 0036 namespace Minuet 0037 { 0038 UiController::UiController(QObject *parent) : IUiController(parent) {} 0039 0040 bool UiController::initialize(Core *core) 0041 { 0042 m_errorString.clear(); 0043 auto *engine = new QQmlApplicationEngine(this); 0044 QQmlContext *rootContext = engine->rootContext(); 0045 rootContext->setContextProperty(QStringLiteral("core"), core); 0046 #ifndef Q_OS_ANDROID 0047 rootContext->setContextObject(new KLocalizedContext(engine)); 0048 #else 0049 rootContext->setContextObject(new DummyAndroidLocalizer(engine)); 0050 #endif 0051 engine->load(QUrl(QStringLiteral("qrc:/Main.qml"))); 0052 0053 return true; 0054 } 0055 0056 QString UiController::errorString() const 0057 { 0058 return m_errorString; 0059 } 0060 0061 } 0062 0063 #include "moc_uicontroller.cpp"