Update mussa to build on ubuntu 10.04 with qt 4.6.2 +boost 1.40.0.1
[mussa.git] / qui / MussaWindow.hpp
1 #ifndef _MUSSAWINDOW_H_
2 #define _MUSSAWINDOW_H_
3
4 #include <list>
5 #include <boost/shared_ptr.hpp>
6
7 #include <QCloseEvent>
8 #include <QDir>
9 #include <QMainWindow>
10 #include <QPixmap>
11 #include <QProgressDialog>
12 #include <QSpinBox>
13 #include <QToolBar>
14 #include <QProcess>
15
16 #include "qui/MussaAlignedWindow.hpp"
17 #include "qui/motif_editor/MotifEditor.hpp"
18 #include "qui/mussa_setup_dialog/MussaSetupDialog.hpp"
19 #include "qui/seqbrowser/SequenceBrowserWidget.hpp"
20 #include "qui/subanalysis/SubanalysisWindow.hpp"
21 #include "qui/ThresholdWidget.hpp"
22 #include "qui/ZoomWidget.hpp"
23
24
25 class QAction;
26 class QLabel;
27 class QStringList;
28 class Mussa;
29 class QAssistantClient;
30 class MussaWindow;
31
32 typedef boost::shared_ptr<MussaWindow> MussaWindowRef;
33
34 class MussaWindow : public QMainWindow
35 {
36   Q_OBJECT
37
38 public: 
39   MussaWindow(MussaRef analysis, QWidget *parent=0);
40
41 public:
42   //! reset any attached window
43   void clear();
44
45   //! switch to a new analysis
46   void setAnalysis(MussaRef new_analysis);
47
48   //! ask the user what to do if we're going to lose data
49   //! returns true if getting rid of this analysis is safe
50   bool isClearingAnalysisSafe();
51
52 public slots:
53   //! display an about box, contemplating the politics of the author list
54   void about();
55
56   //! \defgroup AnalysisFunctions Components related to running analyses
57   //\@{
58   //! open a window to collect the information needed to create a new analysis
59   void createNewAnalysis();
60   //! launch a sub analysis
61   void createSubAnalysis();
62   //! save an analysis
63   void saveAnalysis();
64   //! save an analysis after prompting for new name
65   void saveAnalysisAs();
66   //! set the window modified flag
67   void updateAnalysisModified(bool);
68   //! try to conver the mussa analysis_path to a title
69   void updateTitle();
70   //\@}
71
72   //! \defgroup MotifHandling Handling of motif lists
73   //\@{
74   //! load motifs
75   void editMotifs();
76   void loadMotifList();
77   void saveMotifList();
78   void toggleMotifs();
79   //\@}
80
81   //! load a mussa parameter file (which specifies an analysis to run)
82   void loadMupa();
83   //! load a previously run analysis
84   void loadSavedAnalysis();
85   //! set the soft threshold used by the Nway_Path algorithm
86   void setSoftThreshold(int thres);
87   //! update progress bar
88   void updateProgress(const QString& description, int cur, int max);
89
90   //! open a new mussa window so one can compare analyses
91   void newMussaWindow();
92
93   void showMussaToolbar();
94   //! display how many base pairs were copied on the status bar
95   void showBasePairsCopied(size_t);
96
97
98   //! open new window showing our alignment
99   void viewMussaAlignment();
100
101   //! display mussagl manual
102   void showManual();
103
104   void assistantError(const QString message);
105
106 signals:
107   void changedAnnotations();
108   void changedMotifs();
109
110 protected:
111   //! shared_ptr to our analysis
112   MussaRef analysis;
113   //! the default directory we should loand and save from
114   boost::shared_ptr<QDir> default_dir;
115   std::list<MussaAlignedWindowRef> aligned_windows;
116   MotifEditor *motif_editor;
117   MussaSetupDialog *setup_analysis_dialog;
118   SubanalysisWindowRef subanalysis_window;
119
120   // display our wonderful mussa output
121   SequenceBrowserWidget *browser;
122   QToolBar *mussaViewTB;
123   ZoomWidget *zoom;
124   ThresholdWidget *threshold;
125   QProgressDialog *progress_dialog;
126
127   QAction *aboutAction;
128   QAction *closeAction;
129   QAction *createNewAnalysisAction;
130   QAction *createSubAnalysisAction;
131   QAction *saveAnalysisAction;
132   QAction *saveAnalysisAsAction;
133   QAction *editMotifsAction;
134   QAction *loadMotifListAction;
135   QAction *loadMupaAction;
136   QAction *loadSavedAnalysisAction;
137   QAction *mussaManualAssistantAction;
138   QAction *newMussaWindowAction;
139   QAction *saveMotifListAction;
140   QAction *showMussaViewToolbarAction;
141   QAction *toggleMotifsAction;
142   QAction *saveBrowserPixmapAction;
143   QAction *whatsThisAction;
144   QAction *viewMussaAlignmentAction;
145
146   //QAssistantClient *manualAssistant;
147   QProcess *assistantProcess;
148
149   //! initialze the actions
150   void setupActions();
151   //! handle close events (AKA prompt if we should save)
152   void closeEvent(QCloseEvent *event);
153   //! initialize this windows menu object
154   void setupMainMenu();
155   //! initialize all of our widgets
156   void setupWidgets();
157   //! initialize assistant client
158   void setupAssistant();
159   //! stub function to fill in QActions
160   void NotImplementedBox();
161
162 protected slots:  
163   //! update the SequenceBrowser with our analysis
164   void updateAnalysis();
165   //! update the view of conserved windows
166   void updateLinks();
167   //! update annotations?
168   void updateAnnotations();
169 };
170
171 #endif