Make help a bit more reliable
authorDiane Trout <diane@caltech.edu>
Thu, 12 Oct 2006 00:14:00 +0000 (00:14 +0000)
committerDiane Trout <diane@caltech.edu>
Thu, 12 Oct 2006 00:14:00 +0000 (00:14 +0000)
ticket:120 ticket:49 ticket:98
Brandon figured out how to install QtAssistant on windows I haven't worked it
out for OS X or linux yet (as its noticeably harder).

I'd switched to using pythons webbrowser.open to go to our documentation
pages, except that only works if the python standard library is installed.
However windows lacks such a thing, and so the webbrowser.open code
wouldn't work.

This patch enables the QtAssistant for windows, and uses webbrowser.open
on OS X and Linux.

Also it'll actually open a warning messagebox if something goes wrong
trying to open the help, and display a not very useful error message.

qui/CMakeLists.txt
qui/MussaWindow.cpp

index c32176a607c0ad004b1ba792b46a909dea182fb0..b6c8730992aab3cf1560063aed0b3c23c1e4bfb9 100644 (file)
@@ -83,6 +83,11 @@ ADD_LIBRARY(mussa_qui STATIC ${SOURCES})
 TARGET_LINK_LIBRARIES(mussa_qui 
                         mussa_core)
 
+# currently QTASSISTANT is only properly installed under windows
+IF(QT_QTASSISTANT_FOUND AND WIN32)
+  SET(QUI_CFLAGS "${QUI_CFLAGS} -DQT_QTASSISTANT_FOUND")
+ENDIF(QT_QTASSISTANT_FOUND AND WIN32)
+
 SET_SOURCE_FILES_PROPERTIES(
   ${SOURCES}
   PROPERTIES
index 09cdef5093b76bc884e5599cc03758f10de3b3fc..10dded3cea4b83831f24767f7059be56bac88526 100644 (file)
@@ -576,16 +576,25 @@ void MussaWindow::toggleMotifs()
 
 void MussaWindow::showManual()
 {
-#if QT_QTASSISTANT_FOUND
-  manualAssistant->openAssistant();
+#if defined(QT_QTASSISTANT_FOUND)
+  if (manualAssistant) { 
+    manualAssistant->openAssistant();
+  }
 #else
   try {
     boost::python::object webopen = get_py()["webbrowser.open"];
     webopen("http://woldlab.caltech.edu/~king/mussagl_manual/");
+    return;
   } catch( boost::python::error_already_set ) {
     PyErr_Print();
   }
 #endif //QT_QTASSISTANT_FOUND
+  QMessageBox::warning(this,
+                       tr("Unhelpful Help"),
+                       tr("Error loading help"),
+                       QMessageBox::Ok,
+                       QMessageBox::NoButton,
+                       QMessageBox::NoButton);
 }
 
 void MussaWindow::assistantError(QString message)