@@ -349,44 +349,30 @@ void Livekeys::loadInternalPackages(){
349349
350350 m_engine->setPackageGraph (m_packageGraph);
351351
352- std::vector<std::string> internalPackages = {
353- " editor" ,
354- " editqml" ,
355- " fs" ,
356- " live" ,
357- " lcvcore" ,
358- " lcvfeatures2d" ,
359- " lcvimgproc" ,
360- " lcvphoto" ,
361- " lcvvideo"
362- };
352+ const MLNode& defaults = ApplicationContext::instance ().startupConfiguration ();
353+ if ( defaults.hasKey (" internalPackages" ) ){
354+ const MLNode& internalPackages = defaults[" internalPackages" ];
363355
364- for ( auto it = internalPackages.begin (); it != internalPackages.end (); ++it ){
356+ for ( auto it = internalPackages.asArray (). begin (); it != internalPackages. asArray () .end (); ++it ){
365357
366- std::string packagePath = ApplicationContext::instance ().pluginPath () + " /" + *it ;
358+ std::string packagePath = ApplicationContext::instance ().pluginPath () + " /" + it-> asString () ;
367359
368- if ( Package::existsIn (packagePath) ){
369- PackageGraph::addInternalPackage (Package::createFromPath (packagePath));
360+ if ( Package::existsIn (packagePath) ){
361+ PackageGraph::addInternalPackage (Package::createFromPath (packagePath));
362+ }
370363 }
371364 }
372365
373- std::vector<std::string> qtPackages = {
374- " Qt" ,
375- " QtQml" ,
376- " QtQuick" ,
377- " QtCanvas3D" ,
378- " QtGraphicalEffects" ,
379- " QtMultimedia" ,
380- " QtWebSockets"
381- };
382-
383- for ( auto it = qtPackages.begin (); it != qtPackages.end (); ++it ){
384- Package::Ptr package = Package::createFromNode (*it, " " , {
385- {" name" , *it},
386- {" version" , QT_VERSION_STR},
387- {" documentation" , " editor/loadqtdocs.qml" }
388- });
389- PackageGraph::addInternalPackage (package);
366+ if ( defaults.hasKey (" internalQtPackages" ) ){
367+ const MLNode& qtPackages = defaults[" internalQtPackages" ];
368+ for ( auto it = qtPackages.asArray ().begin (); it != qtPackages.asArray ().end (); ++it ){
369+ Package::Ptr package = Package::createFromNode (it->asString (), " " , {
370+ {" name" , *it},
371+ {" version" , QT_VERSION_STR},
372+ {" documentation" , " editor/loadqtdocs.qml" }
373+ });
374+ PackageGraph::addInternalPackage (package);
375+ }
390376 }
391377}
392378
@@ -416,9 +402,13 @@ void Livekeys::initializeProject(){
416402}
417403
418404void Livekeys::addDefaultLayers (){
419- addLayer (" window" , " :/windowlayer.qml" );
420- addLayer (" workspace" , " :/workspacelayer.qml" );
421- addLayer (" editor" , " :/editorlayer.qml" );
405+ const MLNode& defaults = ApplicationContext::instance ().startupConfiguration ();
406+ if ( defaults.hasKey (" layers" ) ){
407+ const MLNode& layers = defaults[" layers" ];
408+ for ( auto it = layers.begin (); it != layers.end (); ++it ){
409+ addLayer (QString::fromStdString (it.key ()), QString::fromStdString (it.value ().asString ()));
410+ }
411+ }
422412}
423413
424414std::vector<std::string> Livekeys::packageImportPaths () const {
@@ -451,6 +441,37 @@ QQmlPropertyMap *Livekeys::layers(){
451441 return m_layers;
452442}
453443
444+ const MLNode &Livekeys::startupConfiguration (){
445+ static MLNode config = {
446+ {" layers" , {
447+ {" window" , " :/windowlayer.qml" },
448+ {" workspace" , " :/workspacelayer.qml" },
449+ {" editor" , " :/editorlayer.qml" }
450+ }},
451+ {" internalPackages" ,{
452+ " editor" ,
453+ " editqml" ,
454+ " fs" ,
455+ " live" ,
456+ " lcvcore" ,
457+ " lcvfeatures2d" ,
458+ " lcvimgproc" ,
459+ " lcvphoto" ,
460+ " lcvvideo"
461+ }},
462+ {" internalQtPackages" ,{
463+ " Qt" ,
464+ " QtQml" ,
465+ " QtQuick" ,
466+ " QtCanvas3D" ,
467+ " QtGraphicalEffects" ,
468+ " QtMultimedia" ,
469+ " QtWebSockets"
470+ }}
471+ };
472+ return config;
473+ }
474+
454475QObject *Livekeys::layerPlaceholder () const {
455476 if ( !m_layerPlaceholder ){
456477 QList<QObject*> rootObjects = static_cast <QQmlApplicationEngine*>(m_engine->engine ())->rootObjects ();
0 commit comments