Update mussa to build on ubuntu 10.04 with qt 4.6.2 +boost 1.40.0.1
[mussa.git] / qui / MussaWindow.hpp
index d748b0d69525f6ccd60a2f01e26c004875ca52f2..bba3106191748925ffb57bc83c77b2ee7878ff3c 100644 (file)
@@ -1,24 +1,53 @@
 #ifndef _MUSSAWINDOW_H_
 #define _MUSSAWINDOW_H_
 
+#include <list>
+#include <boost/shared_ptr.hpp>
+
+#include <QCloseEvent>
+#include <QDir>
 #include <QMainWindow>
 #include <QPixmap>
+#include <QProgressDialog>
 #include <QSpinBox>
 #include <QToolBar>
+#include <QProcess>
 
+#include "qui/MussaAlignedWindow.hpp"
+#include "qui/motif_editor/MotifEditor.hpp"
+#include "qui/mussa_setup_dialog/MussaSetupDialog.hpp"
 #include "qui/seqbrowser/SequenceBrowserWidget.hpp"
+#include "qui/subanalysis/SubanalysisWindow.hpp"
 #include "qui/ThresholdWidget.hpp"
+#include "qui/ZoomWidget.hpp"
+
 
 class QAction;
 class QLabel;
+class QStringList;
 class Mussa;
+class QAssistantClient;
+class MussaWindow;
+
+typedef boost::shared_ptr<MussaWindow> MussaWindowRef;
 
 class MussaWindow : public QMainWindow
 {
   Q_OBJECT
 
 public: 
-  MussaWindow(Mussa* analysis=0, QWidget *parent=0);
+  MussaWindow(MussaRef analysis, QWidget *parent=0);
+
+public:
+  //! reset any attached window
+  void clear();
+
+  //! switch to a new analysis
+  void setAnalysis(MussaRef new_analysis);
+
+  //! ask the user what to do if we're going to lose data
+  //! returns true if getting rid of this analysis is safe
+  bool isClearingAnalysisSafe();
 
 public slots:
   //! display an about box, contemplating the politics of the author list
@@ -30,11 +59,20 @@ public slots:
   void createNewAnalysis();
   //! launch a sub analysis
   void createSubAnalysis();
+  //! save an analysis
+  void saveAnalysis();
+  //! save an analysis after prompting for new name
+  void saveAnalysisAs();
+  //! set the window modified flag
+  void updateAnalysisModified(bool);
+  //! try to conver the mussa analysis_path to a title
+  void updateTitle();
   //\@}
 
   //! \defgroup MotifHandling Handling of motif lists
   //\@{
   //! load motifs
+  void editMotifs();
   void loadMotifList();
   void saveMotifList();
   void toggleMotifs();
@@ -46,28 +84,58 @@ public slots:
   void loadSavedAnalysis();
   //! set the soft threshold used by the Nway_Path algorithm
   void setSoftThreshold(int thres);
+  //! update progress bar
+  void updateProgress(const QString& description, int cur, int max);
+
+  //! open a new mussa window so one can compare analyses
+  void newMussaWindow();
 
   void showMussaToolbar();
+  //! display how many base pairs were copied on the status bar
+  void showBasePairsCopied(size_t);
+
 
   //! open new window showing our alignment
   void viewMussaAlignment();
-  
+
+  //! display mussagl manual
+  void showManual();
+
+  void assistantError(const QString message);
+
+signals:
+  void changedAnnotations();
+  void changedMotifs();
+
 protected:
-  Mussa *analysis;
+  //! shared_ptr to our analysis
+  MussaRef analysis;
+  //! the default directory we should loand and save from
+  boost::shared_ptr<QDir> default_dir;
+  std::list<MussaAlignedWindowRef> aligned_windows;
+  MotifEditor *motif_editor;
+  MussaSetupDialog *setup_analysis_dialog;
+  SubanalysisWindowRef subanalysis_window;
+
   // display our wonderful mussa output
-  SequenceBrowserWidget browser;
-  QToolBar mussaViewTB;
-  QSpinBox zoomBox;
-  ThresholdWidget threshold;
-  QLabel zoomLabel;
+  SequenceBrowserWidget *browser;
+  QToolBar *mussaViewTB;
+  ZoomWidget *zoom;
+  ThresholdWidget *threshold;
+  QProgressDialog *progress_dialog;
 
   QAction *aboutAction;
   QAction *closeAction;
   QAction *createNewAnalysisAction;
   QAction *createSubAnalysisAction;
+  QAction *saveAnalysisAction;
+  QAction *saveAnalysisAsAction;
+  QAction *editMotifsAction;
   QAction *loadMotifListAction;
   QAction *loadMupaAction;
   QAction *loadSavedAnalysisAction;
+  QAction *mussaManualAssistantAction;
+  QAction *newMussaWindowAction;
   QAction *saveMotifListAction;
   QAction *showMussaViewToolbarAction;
   QAction *toggleMotifsAction;
@@ -75,16 +143,29 @@ protected:
   QAction *whatsThisAction;
   QAction *viewMussaAlignmentAction;
 
+  //QAssistantClient *manualAssistant;
+  QProcess *assistantProcess;
+
   //! initialze the actions
   void setupActions();
+  //! handle close events (AKA prompt if we should save)
+  void closeEvent(QCloseEvent *event);
   //! initialize this windows menu object
   void setupMainMenu();
+  //! initialize all of our widgets
+  void setupWidgets();
+  //! initialize assistant client
+  void setupAssistant();
   //! stub function to fill in QActions
   void NotImplementedBox();
+
+protected slots:  
   //! update the SequenceBrowser with our analysis
   void updateAnalysis();
   //! update the view of conserved windows
   void updateLinks();
+  //! update annotations?
+  void updateAnnotations();
 };
 
 #endif