warn the user if we're going to replace an analysis
[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   Mussa *analysis;
97   std::list<boost::shared_ptr<MussaAlignedWindow> > aligned_windows;
98   MotifEditor *motif_editor;
99   MussaSetupDialog setup_analysis_dialog;
100   SubanalysisWindow subanalysis_window;
101
102   // display our wonderful mussa output
103   SequenceBrowserWidget browser;
104   QToolBar mussaViewTB;
105   ZoomWidget zoom;
106   ThresholdWidget threshold;
107   QProgressDialog *progress_dialog;
108
109   QAction *aboutAction;
110   QAction *closeAction;
111   QAction *createNewAnalysisAction;
112   QAction *createSubAnalysisAction;
113   QAction *saveAnalysisAction;
114   QAction *saveAnalysisAsAction;
115   QAction *editMotifsAction;
116   QAction *loadMotifListAction;
117   QAction *loadMupaAction;
118   QAction *loadSavedAnalysisAction;
119   QAction *mussaManualAssistantAction;
120   QAction *newMussaWindowAction;
121   QAction *saveMotifListAction;
122   QAction *showMussaViewToolbarAction;
123   QAction *toggleMotifsAction;
124   QAction *saveBrowserPixmapAction;
125   QAction *whatsThisAction;
126   QAction *viewMussaAlignmentAction;
127
128   QAssistantClient *manualAssistant;
129
130   //! initialze the actions
131   void setupActions();
132   //! handle close events (AKA prompt if we should save)
133   void closeEvent(QCloseEvent *event);
134   //! initialize this windows menu object
135   void setupMainMenu();
136   //! initialize assistant client
137   void setupAssistant();
138   //! stub function to fill in QActions
139   void NotImplementedBox();
140
141 protected slots:  
142   //! update the SequenceBrowser with our analysis
143   void updateAnalysis();
144   //! update the view of conserved windows
145   void updateLinks();
146   //! update annotations?
147   void updateAnnotations();
148 };
149
150 #endif