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