src/wscout_gui_main_window.hh

00001 /*
00002  * WScout - Lightweight PCAP visualizer.
00003  * Copyright (C) 2007  Universite Pierre et Marie Curie - Paris 6
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00018  * MA  02110-1301  USA
00019  *
00020  * Author: Thomas Claveirole <thomas.claveirole@lip6.fr>
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   } // End of namespace gui.
00164 
00165 } // End of namespace wscout.
00166 
00167 #endif // ! WSCOUT_GUI_MAIN_WINDOW_HH_

Generated on Tue Nov 13 13:48:05 2007 for WScout by  doxygen 1.5.3-20071008