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/QTabWidget>
00033
00034 # include "wscout_gui_trace.hh"
00035
00036 namespace wscout
00037 {
00038
00039 namespace gui
00040 {
00041
00043 class MainWindow : public QMainWindow
00044 {
00045 Q_OBJECT
00046
00047 enum
00048 {
00049 status_bar_vmargin = 1,
00050 status_bar_hmargin = 4
00051 };
00052
00053 public:
00055 MainWindow();
00056
00058 MainWindow(const MainWindow&);
00059
00060 public slots:
00062 bool open();
00063
00065 bool openTrace(const QString&);
00066
00068 bool openInNewWindow() const;
00069
00071 MainWindow* duplicateWindow() const;
00072
00074 MainWindow* newWindow(bool show = true) const;
00075
00081 void closeTab();
00082
00084 void filter();
00085
00087 void stepTab(int);
00088
00090 void prevTab();
00091
00093 void nextTab();
00094
00096 void begin();
00097
00098
00100 void end();
00101
00103 void forward();
00104
00106 void backward();
00107
00109 void about();
00110
00111 private slots:
00112 void updateTrace();
00113 void updatePosition(int);
00114 void FinderEditingFinished();
00115
00116 private:
00117 struct NewProgressDialog
00118 {
00119 NewProgressDialog(QProgressDialog**, QMainWindow*);
00120
00121 void operator () (std::streampos, std::streampos);
00122 private:
00123 QProgressDialog** d_;
00124 QMainWindow* w_;
00125 };
00126
00127 struct UpdateProgressDialog
00128 {
00129 UpdateProgressDialog(QProgressDialog**);
00130
00131 const std::string* operator () (std::streampos);
00132 private:
00133 QProgressDialog** d_;
00134 };
00135
00136 Trace* trace();
00137
00138 void initWidgets();
00139 void setupMenuBar();
00140 void setupToolBar();
00141 void setupCentralWidget();
00142 void setupStatusBar();
00143 static MainWindow* setupNewWindow(MainWindow* w, bool show);
00144
00145 QTabWidget tabs_;
00146 QLabel trace_name_;
00147 QLabel trace_size_;
00148 QLabel position_;
00149 QComboBox step_;
00150 QSpinBox finder_;
00151 QShortcut focus_finder_;
00152 std::vector<QAction*> trace_related_actions_;
00153 std::vector<QAction*> tabs_related_actions_;
00154 };
00155
00156 }
00157
00158 }
00159
00160 #endif // ! WSCOUT_GUI_MAIN_WINDOW_HH_