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/QDialog>
00027 # include <QtGui/QGridLayout>
00028 # include <QtGui/QStyle>
00029 # include <QtGui/QLabel>
00030 # include <QtCore/QProcess>
00031 # include <QtGui/QLineEdit>
00032 # include <QtGui/QPushButton>
00033
00034 namespace wscout
00035 {
00036
00037 namespace gui
00038 {
00039
00041 class FilterDialog: public QDialog
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 QLabel* makeLabel(const QString& s);
00111 void setupFilterRow(QGridLayout& l);
00112 void setupOutputFileNameRow(QGridLayout& l, const QStyle& s);
00113 void setupCommandRow(QGridLayout& l);
00114 void setupButtonsRow(QGridLayout& l, const QStyle& s);
00115
00116 QProcess process_;
00117 QString in_file_name_;
00118 QLineEdit filter_;
00119 QLineEdit out_file_name_;
00120 QLineEdit command_;
00121 QPushButton cancel_;
00122 QPushButton ok_;
00123 QLabel running_;
00124
00125 static QString default_filter_;
00126 static QString default_command_;
00127 };
00128
00129 }
00130
00131 }
00132
00133 #endif // ! WSCOUT_GUI_FILTER_DIALOG_HH_