00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef WSCOUT_GUI_MAIN_WINDOW_HH_
00024 # define WSCOUT_GUI_MAIN_WINDOW_HH_
00025
00026 # include <QtGui/QMainWindow>
00027 # include <QtGui/QLabel>
00028 # include <QtGui/QProgressDialog>
00029 # include <QtGui/QSpinBox>
00030 # include <QtGui/QShortcut>
00031 # include <QtGui/QComboBox>
00032 # include <QtGui/QCheckBox>
00033 # include <QtGui/QTabWidget>
00034
00035 # include "wscout_gui_trace.hh"
00036
00037 namespace wscout
00038 {
00039
00040 namespace gui
00041 {
00042
00044 class MainWindow : public QMainWindow
00045 {
00046 Q_OBJECT
00047
00048 enum
00049 {
00050 status_bar_vmargin = 1,
00051 status_bar_hmargin = 4
00052 };
00053
00054 public:
00056 MainWindow();
00057
00059 MainWindow(const MainWindow&);
00060
00061 public slots:
00063 bool open(const QString& directoryHint = QString ());
00064
00066 bool openTrace(const QString&);
00067
00069 bool openInNewWindow() const;
00070
00072 MainWindow* duplicateWindow() const;
00073
00075 MainWindow* newWindow(bool show = true) const;
00076
00082 void closeTab();
00083
00085 void filter();
00086
00088 void stepTab(int);
00089
00091 void prevTab();
00092
00094 void nextTab();
00095
00097 void begin();
00098
00099
00101 void end();
00102
00104 void forward();
00105
00107 void backward();
00108
00110 void about();
00111
00112 private slots:
00113 void updateTrace();
00114 void updatePosition(int);
00115 void FinderEditingFinished();
00116 void swapContent(int);
00117
00118 private:
00119 struct NewProgressDialog
00120 {
00121 NewProgressDialog(QProgressDialog**, QMainWindow*);
00122
00123 void operator () (std::streampos, std::streampos);
00124 private:
00125 QProgressDialog** d_;
00126 QMainWindow* w_;
00127 };
00128
00129 struct UpdateProgressDialog
00130 {
00131 UpdateProgressDialog(QProgressDialog**);
00132
00133 const std::string* operator () (std::streampos);
00134 private:
00135 QProgressDialog** d_;
00136 };
00137
00138 void addTrace(Trace*);
00139 Trace* trace();
00140 const Trace* trace() const;
00141 QString openDirectoryHint() const;
00142
00143 void initWidgets();
00144 void setupMenuBar();
00145 void setupToolBar();
00146 void setupCentralWidget();
00147 void setupStatusBar();
00148 static MainWindow* setupNewWindow(MainWindow* w, bool show);
00149
00150 QTabWidget tabs_;
00151 QLabel trace_name_;
00152 QLabel trace_size_;
00153 QLabel position_;
00154 QComboBox step_;
00155 QSpinBox finder_;
00156 QCheckBox swap_;
00157 QShortcut focus_finder_;
00158 QShortcut swap_shortcut_;
00159 std::vector<QAction*> trace_related_actions_;
00160 std::vector<QAction*> tabs_related_actions_;
00161 };
00162
00163 }
00164
00165 }
00166
00167 #endif // ! WSCOUT_GUI_MAIN_WINDOW_HH_