change default_dir to a QDir
[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=0, 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
87   //! open new window showing our alignment
88   void viewMussaAlignment();
89
90   //! display mussagl manual
91   void showManual();
92
93   void assistantError(const QString message);
94
95 signals:
96   void changedAnnotations();
97   void changedMotifs();
98
99 protected:
100   //! shared_ptr to our analysis
101   MussaRef analysis;
102   //! the default directory we should loand and save from
103   QDir default_dir;
104   std::list<boost::shared_ptr<MussaAlignedWindow> > aligned_windows;
105   MotifEditor *motif_editor;
106   MussaSetupDialog *setup_analysis_dialog;
107   SubanalysisWindowRef subanalysis_window;
108
109   // display our wonderful mussa output
110   SequenceBrowserWidget *browser;
111   QToolBar *mussaViewTB;
112   ZoomWidget *zoom;
113   ThresholdWidget *threshold;
114   QProgressDialog *progress_dialog;
115
116   QAction *aboutAction;
117   QAction *closeAction;
118   QAction *createNewAnalysisAction;
119   QAction *createSubAnalysisAction;
120   QAction *saveAnalysisAction;
121   QAction *saveAnalysisAsAction;
122   QAction *editMotifsAction;
123   QAction *loadMotifListAction;
124   QAction *loadMupaAction;
125   QAction *loadSavedAnalysisAction;
126   QAction *mussaManualAssistantAction;
127   QAction *newMussaWindowAction;
128   QAction *saveMotifListAction;
129   QAction *showMussaViewToolbarAction;
130   QAction *toggleMotifsAction;
131   QAction *saveBrowserPixmapAction;
132   QAction *whatsThisAction;
133   QAction *viewMussaAlignmentAction;
134
135   QAssistantClient *manualAssistant;
136
137   //! initialze the actions
138   void setupActions();
139   //! handle close events (AKA prompt if we should save)
140   void closeEvent(QCloseEvent *event);
141   //! initialize this windows menu object
142   void setupMainMenu();
143   //! initialize assistant client
144   void setupAssistant();
145   //! stub function to fill in QActions
146   void NotImplementedBox();
147
148 protected slots:  
149   //! update the SequenceBrowser with our analysis
150   void updateAnalysis();
151   //! update the view of conserved windows
152   void updateLinks();
153   //! update annotations?
154   void updateAnnotations();
155 };
156
157 #endif