소스 검색

Use weak validation mode and display error messages in tooltip.

Sascha Zelzer 13 년 전
부모
커밋
13f295d1fd

+ 1 - 1
Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerMainWindow.cpp

@@ -51,7 +51,7 @@ ctkCLModuleExplorerMainWindow::ctkCLModuleExplorerMainWindow(QWidget *parent) :
   QMainWindow(parent),
   ui(new Ui::ctkCmdLineModuleExplorerMainWindow),
   defaultModuleFrontendFactory(NULL),
-  moduleManager(ctkCmdLineModuleManager::STRICT_VALIDATION, QDesktopServices::storageLocation(QDesktopServices::CacheLocation)),
+  moduleManager(ctkCmdLineModuleManager::WEAK_VALIDATION, QDesktopServices::storageLocation(QDesktopServices::CacheLocation)),
   directoryWatcher(&moduleManager)
 {
   ui->setupUi(this);

+ 9 - 0
Applications/ctkCommandLineModuleExplorer/ctkCmdLineModuleExplorerTreeWidget.cpp

@@ -29,6 +29,8 @@
 #include <QContextMenuEvent>
 #include <QMenu>
 #include <QDebug>
+#include <QUrl>
+#include <QApplication>
 
 QString ctkCmdLineModuleExplorerTreeWidget::CATEGORY_UNKNOWN = "Uncategorized";
 
@@ -67,6 +69,13 @@ private:
   {
     this->setText(0, ModuleRef.description().title() + " [" + ModuleRef.backend()->name() + "]");
     this->setData(0, Qt::UserRole, QVariant::fromValue(ModuleRef));
+    QString toolTip = ModuleRef.location().toString();
+    if (!ModuleRef.xmlValidationErrorString().isEmpty())
+    {
+      this->setIcon(0, QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning));
+      toolTip += "\n\nWarning:\n\n" + ModuleRef.xmlValidationErrorString();
+    }
+    this->setToolTip(0, toolTip);
   }
 
   ctkCmdLineModuleReference ModuleRef;