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