#include "FluApp.h" #include #include #include #include #include #include #include #include FluApp::FluApp(QObject *parent):QObject{parent}{ httpInterceptor(nullptr); } FluApp::~FluApp(){ } void FluApp::init(QQuickWindow *window){ this->_application = window; } void FluApp::run(){ navigate(initialRoute()); } void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegister* fluRegister){ if(!routes().contains(route)){ qCritical()<<"No route found "<property("_route").toString(); if(r == route){ win = pair.second; break; } } if(win){ int launchMode = win->property("launchMode").toInt(); if(launchMode == 1){ win->setProperty("argument",argument); win->show(); win->raise(); win->requestActivate(); return; }else if(launchMode == 2){ win->close(); } } win = qobject_cast(component.createWithInitialProperties(properties)); if(fluRegister){ fluRegister->to(win); } win->setColor(QColor(Qt::transparent)); } void FluApp::exit(int retCode){ for (const auto& pair : _windows.toStdMap()) { removeWindow(pair.second); } qApp->exit(retCode); } void FluApp::addWindow(QQuickWindow* window){ _windows.insert(window->winId(),window); } void FluApp::removeWindow(QQuickWindow* window){ if(window){ _windows.remove(window->winId()); window->deleteLater(); window = nullptr; } }