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_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 }
00129
00130 }
00131
00132 # include "wscout_gui_filter_dialog.hxx"
00133
00134 #endif // ! WSCOUT_GUI_FILTER_DIALOG_HH_