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