@@ -560,7 +560,7 @@ void ConfigManager::on_buttonBox_accepted()
560560 on_configList_itemDoubleClicked (ui->configList ->selectedItems ().first ());
561561}
562562
563- bool ConfigManager::isConfigured ()
563+ bool ConfigManager::isConfigured (PGE_JsEngine *js )
564564{
565565 QString settingsFile = DataConfig::buildLocalConfigPath (m_currentConfigPath);
566566 if (!QFile::exists (settingsFile))
@@ -576,9 +576,20 @@ bool ConfigManager::isConfigured()
576576 QString path = settings.value (" application-path" , QString ()).toString ();
577577 settings.endGroup ();
578578
579+ PGE_JsEngine loc_js;
580+ bool js_valid = js != nullptr ;
581+ if (!js)
582+ {
583+ js = &loc_js;
584+ js_valid = configure_loadScript (js);
585+ }
586+
579587 // When directory got moved or deleted, config pack should be marked as not configured because got broken
580588 ret &= !path.isEmpty () && QFileInfo (path).isDir () && QDir (path).exists ();
581589
590+ if (js_valid && js->hasFunction (" isValidIntegration" ))
591+ ret &= js->call <bool >(" isValidIntegration" , nullptr , path);
592+
582593 return ret;
583594}
584595
@@ -715,18 +726,8 @@ bool ConfigManager::runConfigureTool()
715726 if (ConfStatus::configIsIntegrational)
716727 {
717728 PGE_JsEngine js;
718- // QString cpDirName = QDir(m_currentConfigPath).dirName();
719- QString cpSetupFile = DataConfig::buildLocalConfigPath (m_currentConfigPath);
720-
721- js.bindProxy (new PGE_JS_Common (parentW), " PGE" );
722- js.bindProxy (new PGE_JS_File (m_currentConfigPath, cpSetupFile, parentW), " FileIO" );
723- js.bindProxy (new PGE_JS_INI (parentW), " INI" );
724- js.bindProxy (new PGE_JS_System (parentW), " System" );
725729
726- bool successfulLoaded = false ;
727- js.loadFileByExpcetedResult <void >(ConfStatus::configConfigureTool, &successfulLoaded);
728-
729- if (successfulLoaded)
730+ if (configure_loadScript (&js))
730731 {
731732 setEnabled (false );
732733 if (!js.call <bool >(" onConfigure" , nullptr ))
@@ -735,7 +736,7 @@ bool ConfigManager::runConfigureTool()
735736 return false ;
736737 }
737738 setEnabled (true );
738- if (!isConfigured ())
739+ if (!isConfigured (&js ))
739740 return false ;
740741 return true ;
741742 }
@@ -761,3 +762,24 @@ bool ConfigManager::runConfigureTool()
761762 return false ;
762763 }
763764}
765+
766+ bool ConfigManager::configure_loadScript (PGE_JsEngine *js)
767+ {
768+ QWidget *parentW = qobject_cast<QWidget *>(parent ());
769+ if (!parentW || isVisible ())
770+ parentW = this ;
771+
772+ bool successfulLoaded = false ;
773+
774+ // QString cpDirName = QDir(m_currentConfigPath).dirName();
775+ QString cpSetupFile = DataConfig::buildLocalConfigPath (m_currentConfigPath);
776+
777+ js->bindProxy (new PGE_JS_Common (parentW), " PGE" );
778+ js->bindProxy (new PGE_JS_File (m_currentConfigPath, cpSetupFile, parentW), " FileIO" );
779+ js->bindProxy (new PGE_JS_INI (parentW), " INI" );
780+ js->bindProxy (new PGE_JS_System (parentW), " System" );
781+
782+ js->loadFileByExpcetedResult <void >(ConfStatus::configConfigureTool, &successfulLoaded);
783+
784+ return successfulLoaded;
785+ }
0 commit comments