diff --git a/src/main.cpp b/src/main.cpp index 7b152b4..636e9c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,55 +1,55 @@ /* * Copyright 2013-2017 Andreas Cord-Landwehr * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ #include "application.h" #include "mainwindow.h" #include "version.h" #include "artikulate_debug.h" #include #include #include - +#include #include int main(int argc, char **argv) { Application app(argc, argv); KLocalizedString::setApplicationDomain("artikulate"); ResourceRepository repository; repository.reloadCourses(); app.installResourceRepository(&repository); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("artikulate"))); KAboutData aboutData(QStringLiteral("artikulate"), i18nc("@title Displayed program name", "Artikulate"), ARTIKULATE_VERSION_STRING, i18nc("@title KAboutData: short program description", "Artikulate Pronunciation Trainer"), KAboutLicense::GPL_V2, i18nc("@info:credit", "(c) 2013-2019 The Artikulate Developers"), i18nc("@title Short program description", "Train your pronunciation in a foreign language.")); aboutData.setProgramLogo(app.windowIcon()); aboutData.addAuthor(i18nc("@info:credit Developer name", "Andreas Cord-Landwehr"), i18nc("@info:credit Role", "Original Author"), QStringLiteral("cordlandwehr@kde.org")); aboutData.addAuthor(i18nc("@info:credit Developer name", "Samikshan Bairagya"), i18nc("@info:credit Role", "Developer"), QStringLiteral("samikshan@gmail.com")); aboutData.addAuthor(i18nc("@info:credit Developer name", "Oindrila Gupta"), i18nc("@info:credit Role", "Developer and Course Data"), QStringLiteral("edu@kde.org")); aboutData.addAuthor(i18nc("@info:credit Developer name", "Magdalena Konkiewicz"), i18nc("@info:credit Role", "Developer and Course Data"), QStringLiteral("edu@kde.org")); aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails")); KAboutData::setApplicationData(aboutData); QCommandLineParser parser; aboutData.setupCommandLine(&parser); parser.process(app); aboutData.processCommandLine(&parser); KCrash::initialize(); new MainWindow(); return app.exec(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index df139d7..334cd00 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,86 +1,76 @@ /* * Copyright 2013-2015 Andreas Cord-Landwehr * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ #include "mainwindow.h" #include "application.h" #include "artikulate_debug.h" -#include "core/editorsession.h" -#include "core/resourcerepository.h" -#include "core/resources/courseresource.h" #include "core/trainingsession.h" -#include "liblearnerprofile/src/learner.h" #include "liblearnerprofile/src/profilemanager.h" #include "libsound/src/outputdevicecontroller.h" -#include "models/languagemodel.h" #include "settings.h" #include -#include -#include #include #include -#include -#include #include -#include #include #include using namespace LearnerProfile; MainWindow::MainWindow() : m_profileManager(this) , m_trainingSession(&m_profileManager, this) { rootContext()->setContextObject(new KLocalizedContext(this)); // load saved sound settings OutputDeviceController::self().setVolume(Settings::audioOutputVolume()); // set view rootContext()->setContextProperty(QStringLiteral("g_trainingSession"), &m_trainingSession); rootContext()->setContextProperty(QStringLiteral("g_profileManager"), &m_profileManager); rootContext()->setContextProperty(QStringLiteral("g_artikulateAboutData"), QVariant::fromValue(KAboutData::applicationData())); // set starting screen load(QUrl(QStringLiteral("qrc:/artikulate/qml/Main.qml"))); // create training profile if none exists: if (!m_profileManager.activeProfile()) { m_profileManager.addProfile(i18n("Unnamed Identity")); } // connect to QML signals; connect(rootObjects().constFirst(), SIGNAL(ghnsCourseDataStatusChanged()), this, SLOT(updateCourseResources())); } MainWindow::~MainWindow() { // save current settings for case of closing Settings::self()->save(); m_profileManager.sync(); } void MainWindow::updateCourseResources() { artikulateApp->resourceRepository()->reloadCourses(); } void MainWindow::updateKcfgUseContributorResources() { rootContext()->setContextProperty(QStringLiteral("kcfg_UseContributorResources"), Settings::useCourseRepository()); } void MainWindow::configLearnerProfile() { qCritical() << "Not implemented"; // FIXME } bool MainWindow::queryClose() { Settings::self()->save(); // FIXME make sure all learner data is written to database return true; }