src/wscout_gui_filter_dialog.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_FILTER_DIALOG_HH_
00024 # define WSCOUT_GUI_FILTER_DIALOG_HH_
00025 
00026 # include <QtGui/QStyle>
00027 # include <QtGui/QLabel>
00028 # include <QtCore/QProcess>
00029 # include <QtGui/QLineEdit>
00030 # include <QtGui/QPushButton>
00031 
00032 # include "wscout_gui_dialog.hh"
00033 
00034 namespace wscout
00035 {
00036 
00037   namespace gui
00038   {
00039 
00041     class FilterDialog: public Dialog
00042     {
00043       Q_OBJECT
00044 
00046       Q_PROPERTY(QString inputFileName
00047                  READ inputFileName WRITE setInputFileName)
00048 
00049       
00050       Q_PROPERTY(QString outputFileName
00051                  READ outputFileName WRITE setOutputFileName)
00052 
00053       
00054       enum { out_file_width = 25 };
00055 
00056     public:
00057 
00059       FilterDialog(QWidget* parent = 0);
00060       ~FilterDialog();
00061 
00063 
00064       QString           inputFileName() const;
00065       void              setInputFileName(const QString&);
00067 
00069 
00070       QString           outputFileName() const;
00071       void              setOutputFileName(const QString&);
00073 
00075       static void       setDefaultFilter(const QString&);
00076 
00078       static void       setDefaultCommand(const QString&);
00079 
00082       static QString    getFilteredTraceName(QWidget* parent,
00083                                              const QString& input,
00084                                              const QString& title = QString (),
00085                                              const QString& default_out =
00086                                                               QString ());
00087 
00088     public slots:
00090       void              okClicked();
00091 
00093       void              cancelClicked();
00094 
00095     protected slots:
00097       void              processError(QProcess::ProcessError);
00098 
00100       void              processFinished(int, QProcess::ExitStatus);
00101 
00103       void              openOutputFileNameDialog();
00104 
00105     private:
00106       std::string       commandLine() const;
00107       QString           prettyCommandLine() const;
00108       QString           prettyProcessOutput();
00109 
00110       void              setupFilterRow(QGridLayout& l);
00111       void              setupOutputFileNameRow(QGridLayout& l, const QStyle& s);
00112       void              setupCommandRow(QGridLayout& l);
00113       void              setupButtonsRow(QGridLayout& l, const QStyle& s);
00114 
00115       QProcess          process_;
00116       QString           in_file_name_;
00117       QLineEdit         filter_;
00118       QLineEdit         out_file_name_;
00119       QLineEdit         command_;
00120       QPushButton       cancel_;
00121       QPushButton       ok_;
00122       QLabel            running_;
00123 
00124       static QString    default_filter_;
00125       static QString    default_command_;
00126     };
00127 
00128   } // End of namespace gui.
00129 
00130 } // End of namespace wscout.
00131 
00132 # include "wscout_gui_filter_dialog.hxx"
00133 
00134 #endif // ! WSCOUT_GUI_FILTER_DIALOG_HH_

Generated on Wed Jan 30 19:02:27 2008 for WScout by  doxygen 1.5.4