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/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   } // End of namespace gui.
00157 
00158 } // End of namespace wscout.
00159 
00160 #endif // ! WSCOUT_GUI_MAIN_WINDOW_HH_

Generated on Wed Sep 12 16:02:49 2007 for WScout by  doxygen 1.5.3