display number of basepairs copied
[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   //! try to conver the mussa analysis_path to a title
61   void updateTitle();
62   //\@}
63
64   //! \defgroup MotifHandling Handling of motif lists
65   //\@{
66   //! load motifs
67   void editMotifs();
68   void loadMotifList();
69   void saveMotifList();
70   void toggleMotifs();
71   //\@}
72
73   //! load a mussa parameter file (which specifies an analysis to run)
74   void loadMupa();
75   //! load a previously run analysis
76   void loadSavedAnalysis();
77   //! set the soft threshold used by the Nway_Path algorithm
78   void setSoftThreshold(int thres);
79   //! update progress bar
80   void updateProgress(const std::string& description, int cur, int max);
81
82   //! open a new mussa window so one can compare analyses
83   void newMussaWindow();
84
85   void showMussaToolbar();
86   //! display how many base pairs were copied on the status bar
87   void showBasePairsCopied(size_t);
88
89
90   //! open new window showing our alignment
91   void viewMussaAlignment();
92
93   //! display mussagl manual
94   void showManual();
95
96   void assistantError(const QString message);
97
98 signals:
99   void changedAnnotations();
100   void changedMotifs();
101
102 protected:
103   //! shared_ptr to our analysis
104   MussaRef analysis;
105   //! the default directory we should loand and save from
106   boost::shared_ptr<QDir> default_dir;
107   std::list<boost::shared_ptr<MussaAlignedWindow> > aligned_windows;
108   MotifEditor *motif_editor;
109   MussaSetupDialog *setup_analysis_dialog;
110   SubanalysisWindowRef subanalysis_window;
111
112   // display our wonderful mussa output
113   SequenceBrowserWidget *browser;
114   QToolBar *mussaViewTB;
115   ZoomWidget *zoom;
116   ThresholdWidget *threshold;
117   QProgressDialog *progress_dialog;
118
119   QAction *aboutAction;
120   QAction *closeAction;
121   QAction *createNewAnalysisAction;
122   QAction *createSubAnalysisAction;
123   QAction *saveAnalysisAction;
124   QAction *saveAnalysisAsAction;
125   QAction *editMotifsAction;
126   QAction *loadMotifListAction;
127   QAction *loadMupaAction;
128   QAction *loadSavedAnalysisAction;
129   QAction *mussaManualAssistantAction;
130   QAction *newMussaWindowAction;
131   QAction *saveMotifListAction;
132   QAction *showMussaViewToolbarAction;
133   QAction *toggleMotifsAction;
134   QAction *saveBrowserPixmapAction;
135   QAction *whatsThisAction;
136   QAction *viewMussaAlignmentAction;
137
138   QAssistantClient *manualAssistant;
139
140   //! initialze the actions
141   void setupActions();
142   //! handle close events (AKA prompt if we should save)
143   void closeEvent(QCloseEvent *event);
144   //! initialize this windows menu object
145   void setupMainMenu();
146   //! initialize assistant client
147   void setupAssistant();
148   //! stub function to fill in QActions
149   void NotImplementedBox();
150
151 protected slots:  
152   //! update the SequenceBrowser with our analysis
153   void updateAnalysis();
154   //! update the view of conserved windows
155   void updateLinks();
156   //! update annotations?
157   void updateAnnotations();
158 };
159
160 #endif