Beispiel #1
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);
    qmlRegisterType<PieChart>("Charts", 1, 0, "PieChart");
    qmlRegisterType<PieSlice>("Charts", 1, 0, "PieSlice");

    Configuration m_configuration;
    SerialLink m_serialLink;
    MavLinkManager m_mavlink_manager;

    LinkManager m_gLinkManager;

    QtQuick2ApplicationViewer viewer;
    QtQuick2ApplicationViewer splashscreen;

    QString customPath = "Sqlite/OfflineStorage";
    QDir dir;
    if(dir.mkpath(QString(customPath))){
//        qDebug() << "Default path >> "+viewer.engine()->offlineStoragePath();
        viewer.engine()->setOfflineStoragePath(QString(customPath));
//        qDebug() << "New path >> "+viewer.engine()->offlineStoragePath();
    }
    // using as normal
//    viewer.setMainQmlFile(QStringLiteral("qml/gStabiSC/main.qml"));
    // using qml files form resources file, uncomment this to compile all qml file to .exe

    splashscreen.setSource(QUrl("qrc:/qml/gStabiSC/GSplashScreen.qml"));
    splashscreen.setFlags(Qt::FramelessWindowHint);
    splashscreen.setMinimumSize(QSize(1000,500));
    splashscreen.show();


    viewer.setSource(QUrl("qrc:/qml/gStabiSC/GMain.qml"));
    viewer.setTitle(QString("%1 %2").arg(APPLICATION_NAME).arg(APPLICATION_VERSION));
    viewer.setMinimumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));
    viewer.setMaximumSize(QSize(APPLICATION_WIDTH,APPLICATION_HEIGHT));

//    viewer.addImportPath("qrc:/qml/gStabiSC");
//    viewer.addImportPath("qrc:/qml/gStabiSC/Components");
//    viewer.addImportPath("qrc:/qml/gStabiSC/GDashboard");
//    viewer.addImportPath("qrc:/javascript/storage.js");

    viewer.rootContext()->setContextProperty("_configuration",&m_configuration);
    viewer.rootContext()->setContextProperty("_serialLink", &m_serialLink);
    viewer.rootContext()->setContextProperty("_mavlink_manager", &m_mavlink_manager);

    m_gLinkManager.connectLink(&m_serialLink,&m_mavlink_manager);

    QTimer::singleShot(3000, &splashscreen, SLOT(close()));
    QTimer::singleShot(3000, &viewer, SLOT(show()));

    return app.exec();
}
Beispiel #2
0
int main(int argc, char *argv[])
{
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer *viewer = new QtQuick2ApplicationViewer;

    qmlRegisterType<BrowserDbus>("browserdbusinterface",1,0,"BrowserInterface");
    qmlRegisterType<Bookmark>("browserdbusinterface",1,0,"Tmp");

    viewer->setMainQmlFile(QStringLiteral("qml/demoui/main.qml"));
    viewer->setFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint);
    viewer->setGeometry(0, 0, 1024, 80);
    viewer->show();

    QObject::connect((QObject*)viewer->rootObject(), SIGNAL(bookmarksopen(bool)),(QObject*)viewer, SLOT(changeGeometry(bool)));

    return app.exec();
}