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