82 lines
2.8 KiB
C++
82 lines
2.8 KiB
C++
/*
|
|
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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "bmsinterface.h"
|
|
#include "utility.h"
|
|
#include "translator.h"
|
|
|
|
#include <QApplication>
|
|
#include <QFontDatabase>
|
|
#include <QQmlApplicationEngine>
|
|
|
|
QObject *bmsInterfaceSingletontypeProvider(QQmlEngine */*engine*/, QJSEngine */*scriptEngine*/)
|
|
{
|
|
auto *interface = new BMSInterface();
|
|
interface->bmsConfig()->loadParamsXml("://res/config.xml");
|
|
interface->infoConfig()->loadParamsXml("://res/info.xml");
|
|
return interface;
|
|
}
|
|
|
|
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<BMSInterface>("Cubo", 1, 0, "BmsInterface", bmsInterfaceSingletontypeProvider);
|
|
qmlRegisterSingletonType<Utility>("Cubo", 1, 0, "Utility", utilitySingletontypeProvider);
|
|
qmlRegisterSingletonType<Translator>("Cubo", 1, 0, "Translator", translatorSingletontypeProvider);
|
|
qmlRegisterType<Commands>("Cubo", 1, 0, "Commands");
|
|
qmlRegisterType<ConfigParams>("Cubo", 1, 0, "ConfigParams");
|
|
|
|
engine.addImportPath(QStringLiteral("qrc:/"));
|
|
engine.load(QUrl(QStringLiteral("qrc:/MainWindow.qml")));
|
|
|
|
return app.exec();
|
|
}
|