From 3438a524eb988749c39d849cb0127996d6656471 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 10 Apr 2011 22:56:31 -0400 Subject: [PATCH] Add a trace dialog. --- gui/CMakeLists.txt | 2 + gui/mainwindow.cpp | 13 ++++ gui/mainwindow.h | 1 + gui/qapitrace.qrc | 1 + gui/resources/document-new.png | Bin 0 -> 1410 bytes gui/tracedialog.cpp | 68 ++++++++++++++++++++ gui/tracedialog.h | 25 ++++++++ gui/ui/mainwindow.ui | 28 ++++++--- gui/ui/tracedialog.ui | 110 +++++++++++++++++++++++++++++++++ 9 files changed, 239 insertions(+), 9 deletions(-) create mode 100644 gui/resources/document-new.png create mode 100644 gui/tracedialog.cpp create mode 100644 gui/tracedialog.h create mode 100644 gui/ui/tracedialog.ui diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index 8da0f61..068ffa3 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -15,6 +15,7 @@ set(qapitrace_SRCS retracer.cpp settingsdialog.cpp shaderssourcewidget.cpp + tracedialog.cpp vertexdatainterpreter.cpp ) @@ -27,6 +28,7 @@ set(qapitrace_UIS ui/mainwindow.ui ui/retracerdialog.ui ui/settings.ui + ui/tracedialog.ui ui/shaderssourcewidget.ui ) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index ff9f05c..e2d58b6 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -9,6 +9,7 @@ #include "retracer.h" #include "settingsdialog.h" #include "shaderssourcewidget.h" +#include "tracedialog.h" #include "ui_retracerdialog.h" #include "vertexdatainterpreter.h" @@ -37,6 +38,16 @@ MainWindow::MainWindow() initConnections(); } +void MainWindow::createTrace() +{ + TraceDialog dialog; + + if (dialog.exec() == QDialog::Accepted) { + qDebug()<< "App : " < resources/application-exit.png resources/dialog-information.png + resources/document-new.png resources/document-open.png resources/media-playback-start.png resources/media-playback-stop.png diff --git a/gui/resources/document-new.png b/gui/resources/document-new.png new file mode 100644 index 0000000000000000000000000000000000000000..3d0f5cc1d53daab4519aade073a1499cfb39a14c GIT binary patch literal 1410 zcmV-|1%3L7P)d@#lewNb zXJ&WYI2k>eOb(&+gT>zaaG3vJYwdMLlTz|uB6`I#D%g!d3nrB~DMMqNBp0ZnOKy?_ zP(XtMLWp{xo`v8?V>i1fXI*P;t82rH8)&F#00D#3gNyne^fg=_y!@UxEPmiu+U55$ zV=zk!t3?&zz8ut zHqODVA%s4`Mn$I zmG~F?d8mh2;s&=9;)!wcB$E%wl0cUb11iB;X}r0{5c8V=kP=O5kOc&`aSFf%`0*BL0rm{2%jv-5^MDU% zgzDphfExlHFo)rn9TI>ydju6h7)isJ4$dYZ2{=hCqyj2lqHwzP8S#v%It=;M6gJhy9Zqi1zoP8V*|P5o#+8)F;k*x7LmxCF#yj*^#<65_>7 ztXZ>$#>Ph4?zIsLg^0)FszN@WkGfzT&CShpZ0Yz5h{_xQ#amE_StcwzYe@YQ*4EY% z2n1NQYSnY^IGs*hE*F527cXwWnmLpbwLVkT$cd@U?J(yQD2kW9qzNl3*}@C+7_bV% ze4-Zdf@n6IeQpI14yQc>!ZMDtC}Av<$tcluI*nl%PtGa;;%PGmB<)tfwrHN5kP_8( zT}?nF63MLz^?MbSRmPY5J9~isk_MFc9D*fKS(~OwDwQG}9%f`@7>~!x(we0>9ZuP~ zZ{P9LU!VF+N|`NXps0B178DHRGFMp-4Gpn={W>xkQ<>R&pzHKECysxl#BE(dn0Mx_ z+2_kYK0bll?U@lj&~xP6$=;*y=4apb6xc`IdR6{dEXMToG{InSM!ffMce_R0UInn% z3QG&pWC54kB|E$JpZ@CTv0|CqA48kwR0VRO${whxGe6(A|Jb*x=Xr7a2GnO%O@gK8 zr9L{s;Q)t*;c&+ec71W=yHo16%Y}T3LpcNMSvU!x-y&|;fXXHWg!mu%7iW_sYDk^+ QD*ylh07*qoM6N<$f;iQC6#xJL literal 0 HcmV?d00001 diff --git a/gui/tracedialog.cpp b/gui/tracedialog.cpp new file mode 100644 index 0000000..a25c7ac --- /dev/null +++ b/gui/tracedialog.cpp @@ -0,0 +1,68 @@ +#include "tracedialog.h" + +#include +#include +#include + +TraceDialog::TraceDialog(QWidget *parent) + : QDialog(parent) +{ + setupUi(this); + + connect(browseButton, SIGNAL(clicked()), + this, SLOT(browse())); +} + +QString TraceDialog::applicationPath() const +{ + return applicationEdit->text(); +} + +QStringList TraceDialog::arguments() const +{ + QStringList args = + argumentsEdit->text().split(';'); + return args; +} + +void TraceDialog::browse() +{ + QString fileName = + QFileDialog::getOpenFileName( + this, + tr("Find the application"), + QDir::currentPath()); + + if (isFileOk(fileName)) { + applicationEdit->setText(fileName); + } +} + +void TraceDialog::accept() +{ + if (isFileOk(applicationEdit->text())) { + QDialog::accept(); + } +} + +bool TraceDialog::isFileOk(const QString &fileName) +{ + QFileInfo fi(fileName); + + if (!fi.exists()) { + QMessageBox::warning(this, tr("File Missing"), + tr("File '%1' doesn't exist.") + .arg(fi.fileName())); + return false; + } + if (!fi.isExecutable()) { + QMessageBox::warning(this, tr("Application Not Runnable"), + tr("File '%1' can't be executed.") + .arg(fi.fileName())); + return false; + } + + return true; +} + +#include "tracedialog.moc" diff --git a/gui/tracedialog.h b/gui/tracedialog.h new file mode 100644 index 0000000..d5e502d --- /dev/null +++ b/gui/tracedialog.h @@ -0,0 +1,25 @@ +#ifndef TRACEDIALOG_H +#define TRACEDIALOG_H + +#include "ui_tracedialog.h" +#include + +class TraceDialog : public QDialog, public Ui_TraceDialog +{ + Q_OBJECT +public: + TraceDialog(QWidget *parent = 0); + + void accept(); + + QString applicationPath() const; + QStringList arguments() const; + +private slots: + void browse(); + +private: + bool isFileOk(const QString &fileName); +}; + +#endif diff --git a/gui/ui/mainwindow.ui b/gui/ui/mainwindow.ui index 89b5836..574bfa2 100644 --- a/gui/ui/mainwindow.ui +++ b/gui/ui/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 787 - 758 + 756 @@ -48,14 +48,6 @@ 21 - - - &File - - - - - &Trace @@ -66,6 +58,15 @@ + + + &File + + + + + + @@ -437,6 +438,15 @@ Options + + + + :/resources/document-new.png:/resources/document-new.png + + + New + + stateDock vertexDataDock diff --git a/gui/ui/tracedialog.ui b/gui/ui/tracedialog.ui new file mode 100644 index 0000000..149881f --- /dev/null +++ b/gui/ui/tracedialog.ui @@ -0,0 +1,110 @@ + + + TraceDialog + + + + 0 + 0 + 401 + 95 + + + + Dialog + + + + + + + + Application: + + + + + + + Application to trace + + + + + + + Browse + + + false + + + + + + + + + + + Arguments: + + + + + + + Separate arguments with ";" + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + TraceDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + TraceDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + -- 2.43.0