Mussagl Manual QAssistant Patch
authorBrandon King <kingb@caltech.edu>
Fri, 26 May 2006 21:11:49 +0000 (21:11 +0000)
committerBrandon King <kingb@caltech.edu>
Fri, 26 May 2006 21:11:49 +0000 (21:11 +0000)
 * Adds a QAssistant client for Mussagl Manual
 * New menu action -> 'Help > Mussa Manual..'
 * New action icon
 * Updated icon.qrc with new icon
 * CONFIG += assistant added to mussagl.pro

icons.qrc
icons/README.txt
icons/contents.png [new file with mode: 0644]
mussagl.pro
qui/MussaWindow.cpp
qui/MussaWindow.hpp

index 854e7cb647b21f8aa9f39b6c1b0a9c8e3a8c3e1a..359b782c676700a15c754608aaf867cf6279dfdd 100644 (file)
--- a/icons.qrc
+++ b/icons.qrc
@@ -1,6 +1,7 @@
 <!DOCTYPE RCC>
 <RCC version="1.0">
 <qresource>
+   <file>icons/contents.png</file>
    <file>icons/exit.png</file>
    <file>icons/filenew.png</file>
    <file>icons/fileopen.png</file>
index 5ce23742f02b7f963e464cb2f0a5d27002dd88e6..480c4f60748c4b1f3b832ebde58c9e25c9b5c58d 100644 (file)
@@ -4,7 +4,8 @@ SVG. We are currently using the 32x32 pixel images.
 
 Crystal SVG Icons:
 ------------------
+
+ * contents.png 
  * exit.png
  * filenew.png
  * fileopen.png
diff --git a/icons/contents.png b/icons/contents.png
new file mode 100644 (file)
index 0000000..2e86079
Binary files /dev/null and b/icons/contents.png differ
index 74e710367b2ff80b6bb308103ca904098ea42aff..e706791fe5bb4a71c8cb89fac40d23462a9e2ccf 100644 (file)
@@ -3,6 +3,7 @@
 ######################################################################
 
 TEMPLATE = app
+CONFIG += assistant
 TARGET += 
 DEPENDPATH += . \
               alg \
index 2d34414e390eef3bb052f790bb65d37342e041cd..e76e7a1c2860699c2bbd12b0177034c60c8f0757 100644 (file)
@@ -1,4 +1,5 @@
 #include <QAction>
+#include <QAssistantClient>
 #include <QDir>
 #include <QFileDialog>
 #include <QHBoxLayout>
@@ -8,6 +9,7 @@
 #include <QScrollBar>
 #include <QStatusBar>
 #include <QString>
+#include <QStringList>
 #include <QWhatsThis>
 
 #include "qui/MussaWindow.hpp"
@@ -36,16 +38,20 @@ MussaWindow::MussaWindow(Mussa *analysis_, QWidget *parent) :
   loadMotifListAction(0),
   loadMupaAction(0),
   loadSavedAnalysisAction(0),
+  mussaManualAssistantAction(0),
   newMussaWindowAction(0),
   saveMotifListAction(0),
   showMussaViewToolbarAction(0),
   toggleMotifsAction(0),
   saveBrowserPixmapAction(0),
   whatsThisAction(0),
-  viewMussaAlignmentAction(0)
+  viewMussaAlignmentAction(0),
+  manualAssistant(0)
 {
+
   setupActions();
   setupMainMenu();
+  setupAssistant();
 
   //This next setWhatsThis function prevents
   // a segfault when using WhatsThis feature with 
@@ -92,13 +98,17 @@ MussaWindow::~MussaWindow()
   if (loadMotifListAction != 0) delete loadMotifListAction;
   if (loadMupaAction != 0) delete loadMupaAction;
   if (loadSavedAnalysisAction != 0) delete loadSavedAnalysisAction;
+  if (mussaManualAssistantAction != 0) delete mussaManualAssistantAction;
   if (newMussaWindowAction != 0) delete newMussaWindowAction;
+  if (saveBrowserPixmapAction != 0) delete saveBrowserPixmapAction;
   if (saveMotifListAction != 0) delete saveMotifListAction;
   if (showMussaViewToolbarAction != 0) delete showMussaViewToolbarAction;
   if (toggleMotifsAction != 0) delete toggleMotifsAction;
-  if (saveBrowserPixmapAction != 0) delete saveBrowserPixmapAction;
   if (whatsThisAction != 0) delete whatsThisAction;
   if (viewMussaAlignmentAction != 0) delete viewMussaAlignmentAction;
+  
+  if (manualAssistant != 0) delete manualAssistant;
+  
 }
 
 void MussaWindow::setAnalysis(Mussa *new_analysis)
@@ -155,6 +165,11 @@ void MussaWindow::setupActions()
           this, SLOT(loadSavedAnalysis()));
   loadSavedAnalysisAction->setIcon(QIcon(":/icons/fileopen.png"));
 
+  mussaManualAssistantAction = new QAction(tr("Mussagl Manual..."), this);
+  mussaManualAssistantAction->setIcon(QIcon(":/icons/contents.png"));
+  connect(mussaManualAssistantAction, SIGNAL(triggered()),
+         this, SLOT(showManual()));
+
   newMussaWindowAction = new QAction(tr("&New Mussa Window"), this);
   newMussaWindowAction->setStatusTip("open another mussa window to allow comparing results");
   connect(newMussaWindowAction, SIGNAL(triggered()), 
@@ -197,6 +212,7 @@ void MussaWindow::setupActions()
   whatsThisAction = QWhatsThis::createAction(this);
   whatsThisAction->setIcon(QIcon(":/icons/help.png"));
 
+
 }
 
 void MussaWindow::setupMainMenu()
@@ -225,10 +241,22 @@ void MussaWindow::setupMainMenu()
   newMenu->addAction(showMussaViewToolbarAction);
 
   newMenu = menuBar()->addMenu(tr("&Help"));
+  newMenu->addAction(mussaManualAssistantAction);
   newMenu->addAction(whatsThisAction);
   newMenu->addSeparator();
   newMenu->addAction(aboutAction);
 }
+
+void MussaWindow::setupAssistant()
+{
+  QStringList manualAssistantArgs;
+  manualAssistantArgs = QStringList();
+  manualAssistantArgs << "-profile" << "./doc/manual/mussagl_manual.adp";
+  manualAssistant = new QAssistantClient("assistant", this);
+  manualAssistant->setArguments(manualAssistantArgs);
+  connect(manualAssistant, SIGNAL(error(QString)),
+         this, SLOT(assistantError(QString)));
+}
   
 void MussaWindow::about()
 {
@@ -394,6 +422,16 @@ void MussaWindow::toggleMotifs()
   NotImplementedBox();
 }
 
+void MussaWindow::showManual()
+{
+  manualAssistant->openAssistant();
+}
+
+void MussaWindow::assistantError(QString message)
+{
+  std::cout << "Error922: " << message.toStdString() << "\n";
+}
+
 void MussaWindow::NotImplementedBox()
 {
   QMessageBox::warning(this, QObject::tr("mussa"), QObject::tr("Not implemented yet"));
index d27f6186cc48f1781689e4ad11efa19ca6856e38..2daf115c029a182965e8178acdb8d62c5facaa94 100644 (file)
@@ -18,7 +18,9 @@
 
 class QAction;
 class QLabel;
+class QStringList;
 class Mussa;
+class QAssistantClient;
 
 class MussaWindow : public QMainWindow
 {
@@ -66,6 +68,11 @@ public slots:
   //! open new window showing our alignment
   void viewMussaAlignment();
 
+  //! display mussagl manual
+  void showManual();
+
+  void assistantError(const QString message);
+
 signals:
   void changedAnnotations();
 
@@ -89,6 +96,7 @@ protected:
   QAction *loadMotifListAction;
   QAction *loadMupaAction;
   QAction *loadSavedAnalysisAction;
+  QAction *mussaManualAssistantAction;
   QAction *newMussaWindowAction;
   QAction *saveMotifListAction;
   QAction *showMussaViewToolbarAction;
@@ -97,10 +105,16 @@ protected:
   QAction *whatsThisAction;
   QAction *viewMussaAlignmentAction;
 
+  QAssistantClient *manualAssistant;
+
+  QStringList manualAssistantArgs;
+
   //! initialze the actions
   void setupActions();
   //! initialize this windows menu object
   void setupMainMenu();
+  //! initialize assistant client
+  void setupAssistant();
   //! stub function to fill in QActions
   void NotImplementedBox();