Browse Source

Fixed warning state of newly added modules in the settings panel.

Sascha Zelzer 12 years ago
parent
commit
6943b6ef55

+ 10 - 2
Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerModulesSettings.cpp

@@ -39,6 +39,7 @@ ctkCmdLineModuleExplorerModulesSettings::ctkCmdLineModuleExplorerModulesSettings
   : ui(new Ui::ctkCmdLineModuleExplorerModulesSettings)
   , ModuleManager(moduleManager)
   , ShowXmlAction(new ctkCmdLineModuleExplorerShowXmlAction(this))
+  , ModulesRegistered(false)
 {
   ui->setupUi(this);
 
@@ -91,7 +92,9 @@ void ctkCmdLineModuleExplorerModulesSettings::applySettings()
   sync.addFuture(future2);
   sync.waitForFinished();
 
+  this->ModulesRegistered = true;
   this->pathsAdded(addedModules);
+  this->ModulesRegistered = false;
 
   this->unsetCursor();
 
@@ -122,17 +125,22 @@ void ctkCmdLineModuleExplorerModulesSettings::pathsAdded(const QStringList &path
               item->icon().pixmap(item->icon().availableSizes().front()),
               QApplication::style()->standardPixmap(QStyle::SP_MessageBoxWarning));
       }
-      item->setIcon(this->WarningIcon);
 
       QString toolTip = path + "\n\n" + tr("Warning") + ":\n\n";
       if (moduleRef)
       {
+        item->setIcon(this->WarningIcon);
         toolTip += moduleRef.xmlValidationErrorString();
       }
-      else
+      else if (this->ModulesRegistered)
       {
+        item->setIcon(this->WarningIcon);
         toolTip += tr("No XML output available.");
       }
+      else
+      {
+        toolTip = path;
+      }
       item->setToolTip(toolTip);
     }
   }

+ 2 - 0
Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerModulesSettings.h

@@ -54,6 +54,8 @@ private:
   ctkCmdLineModuleManager* ModuleManager;
   ctkCmdLineModuleExplorerShowXmlAction* ShowXmlAction;
   QIcon WarningIcon;
+
+  bool ModulesRegistered;
 };
 
 #endif // CTKCMDLINEMODULEEXPLORERMODULESSETTINGS_H