/* Original copyright 2018 Benjamin Vedder benjamin@vedder.se and the VESC Tool project ( https://github.com/vedderb/vesc_tool ) Now forked to: Danny Bokma github@diebie.nl This file is part of BMS Tool. ENNOID-BMS Tool is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ENNOID-BMS Tool is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "bmsinterface.h" #include "utility.h" #include "translator.h" #include "firmwareupdatehelper.h" #include "currenttablemodel.h" #include #include #include #include QObject *bmsInterfaceSingletontypeProvider(QQmlEngine */*engine*/, QJSEngine */*scriptEngine*/) { auto *bmsInterface = new BMSInterface(); bmsInterface->bmsConfig()->loadParamsXml("://res/config.xml"); bmsInterface->infoConfig()->loadParamsXml("://res/info.xml"); return bmsInterface; } QObject *utilitySingletontypeProvider(QQmlEngine */*engine*/, QJSEngine */*scriptEngine*/) { auto *utility = new Utility(); return utility; } QObject *translatorSingletontypeProvider(QQmlEngine *engine, QJSEngine */*scriptEngine*/) { auto *translator = new Translator(engine); return translator; } int main(int argc, char *argv[]) { Q_INIT_RESOURCE(res); Q_INIT_RESOURCE(translations); Q_INIT_RESOURCE(qml_icons); Q_INIT_RESOURCE(qml_items); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setOrganizationName("Cubo"); QCoreApplication::setOrganizationDomain("Cubo.rus"); QCoreApplication::setApplicationName("Cubo Verde BMS Tool"); QApplication app(argc, argv); QFontDatabase::addApplicationFont("://res/fonts/Artifakt-Element.ttf"); QFont font("Artifakt Element", 16, QFont::Normal); font.setStyleStrategy(QFont::PreferAntialias); app.setFont(font); QQmlApplicationEngine engine; qmlRegisterSingletonType("Cubo", 1, 0, "BmsInterface", bmsInterfaceSingletontypeProvider); qmlRegisterSingletonType("Cubo", 1, 0, "Utility", utilitySingletontypeProvider); qmlRegisterSingletonType("Cubo", 1, 0, "Translator", translatorSingletontypeProvider); qmlRegisterType("Cubo", 1, 0, "Commands"); qmlRegisterType("Cubo", 1, 0, "ConfigParams"); qmlRegisterType("Cubo", 1, 0, "FirmwareUpdateHelper"); qmlRegisterType("Cubo", 1, 0, "CurrentTableModel"); qmlRegisterUncreatableMetaObject(DataTypes::staticMetaObject, "Cubo", 1, 0, "DataTypes", "Error: only enums"); qRegisterMetaType("DataTypes::StateType"); engine.addImportPath(QStringLiteral("qrc:/")); engine.load(QUrl(QStringLiteral("qrc:/MainWindow.qml"))); return app.exec(); }