2018-03-12 11:43:03 +03:30
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QQmlContext>
|
2018-05-10 14:04:01 +03:00
|
|
|
#include <QIcon>
|
2018-05-10 14:24:56 +03:00
|
|
|
#include <QTranslator>
|
2018-03-12 11:43:03 +03:30
|
|
|
|
2018-05-07 19:33:05 +03:00
|
|
|
#include "CPP/cppmanager.h"
|
|
|
|
#include "CPP/mainmanager.h"
|
|
|
|
#include "CPP/outputmanager.h"
|
|
|
|
#include "CPP/pluginmanager.h"
|
|
|
|
#include "CPP/qmlmanager.h"
|
2018-05-26 16:48:58 +03:00
|
|
|
#include "CPP/buildmanager.h"
|
|
|
|
|
2018-03-12 11:43:03 +03:30
|
|
|
|
2018-05-10 14:24:56 +03:00
|
|
|
bool loadTr(QGuiApplication &app){
|
|
|
|
QTranslator translator;
|
|
|
|
|
|
|
|
QString defaultLocale = QLocale::system().name();
|
|
|
|
defaultLocale.truncate(defaultLocale.lastIndexOf('_'));
|
|
|
|
|
|
|
|
if(!translator.load(QString(":/languages/%0").arg(defaultLocale))){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
app.installTranslator(&translator);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-03-12 11:43:03 +03:30
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2018-05-10 12:36:59 +03:00
|
|
|
QGuiApplication app(argc, argv);
|
2018-03-12 11:43:03 +03:30
|
|
|
|
2018-05-10 14:04:01 +03:00
|
|
|
app.setWindowIcon(QIcon("://icon"));
|
|
|
|
|
2018-05-10 14:24:56 +03:00
|
|
|
loadTr(app);
|
|
|
|
|
2018-05-10 12:36:59 +03:00
|
|
|
CppManager C;
|
|
|
|
QmlManager Q;
|
|
|
|
PluginManager P;
|
|
|
|
OutputManager O;
|
2018-05-26 16:48:58 +03:00
|
|
|
BuildManager B;
|
|
|
|
|
2018-05-07 19:33:05 +03:00
|
|
|
|
2018-05-26 16:48:58 +03:00
|
|
|
MainManager M(&C, &Q, &O, &P, &B);
|
2018-03-12 11:43:03 +03:30
|
|
|
|
2018-05-10 12:36:59 +03:00
|
|
|
QQmlApplicationEngine engine;
|
2018-03-12 11:43:03 +03:30
|
|
|
|
2018-05-10 12:36:59 +03:00
|
|
|
auto *R = engine.rootContext();
|
|
|
|
R->setContextProperty("CppManager", &C);
|
|
|
|
R->setContextProperty("QmlManager", &Q);
|
|
|
|
R->setContextProperty("PluginManager", &P);
|
|
|
|
R->setContextProperty("MainManager", &M);
|
|
|
|
R->setContextProperty("OutputManager", &O);
|
2018-05-26 16:48:58 +03:00
|
|
|
R->setContextProperty("BuildManager", &B);
|
|
|
|
|
2018-05-07 19:33:05 +03:00
|
|
|
|
2018-03-12 11:43:03 +03:30
|
|
|
|
2018-05-10 12:36:59 +03:00
|
|
|
engine.load(QUrl(QLatin1String("qrc:/QML/main.qml")));
|
|
|
|
if (engine.rootObjects().isEmpty()) return -1;
|
2018-03-12 11:43:03 +03:30
|
|
|
|
2018-05-10 12:36:59 +03:00
|
|
|
return app.exec();
|
2018-03-12 11:43:03 +03:30
|
|
|
}
|