retracer.cpp
settingsdialog.cpp
shaderssourcewidget.cpp
+ tracedialog.cpp
vertexdatainterpreter.cpp
)
ui/mainwindow.ui
ui/retracerdialog.ui
ui/settings.ui
+ ui/tracedialog.ui
ui/shaderssourcewidget.ui
)
#include "retracer.h"
#include "settingsdialog.h"
#include "shaderssourcewidget.h"
+#include "tracedialog.h"
#include "ui_retracerdialog.h"
#include "vertexdatainterpreter.h"
initConnections();
}
+void MainWindow::createTrace()
+{
+ TraceDialog dialog;
+
+ if (dialog.exec() == QDialog::Accepted) {
+ qDebug()<< "App : " <<dialog.applicationPath();
+ qDebug()<< " Arguments: "<<dialog.arguments();
+ }
+}
+
void MainWindow::openTrace()
{
QString fileName =
m_vdataInterpreter, SLOT(setStartingOffset(int)));
+ connect(m_ui.actionNew, SIGNAL(triggered()),
+ this, SLOT(createTrace()));
connect(m_ui.actionOpen, SIGNAL(triggered()),
this, SLOT(openTrace()));
connect(m_ui.actionQuit, SIGNAL(triggered()),
private slots:
void callItemSelected(const QModelIndex &index);
+ void createTrace();
void openTrace();
void filterTrace();
void replayStart();
<qresource>
<file>resources/application-exit.png</file>
<file>resources/dialog-information.png</file>
+ <file>resources/document-new.png</file>
<file>resources/document-open.png</file>
<file>resources/media-playback-start.png</file>
<file>resources/media-playback-stop.png</file>
--- /dev/null
+#include "tracedialog.h"
+
+#include <QDebug>
+#include <QFileDialog>
+#include <QMessageBox>
+
+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"
--- /dev/null
+#ifndef TRACEDIALOG_H
+#define TRACEDIALOG_H
+
+#include "ui_tracedialog.h"
+#include <QDialog>
+
+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
<x>0</x>
<y>0</y>
<width>787</width>
- <height>758</height>
+ <height>756</height>
</rect>
</property>
<property name="windowTitle">
<height>21</height>
</rect>
</property>
- <widget class="QMenu" name="menuFile">
- <property name="title">
- <string>&File</string>
- </property>
- <addaction name="actionOpen"/>
- <addaction name="separator"/>
- <addaction name="actionQuit"/>
- </widget>
<widget class="QMenu" name="menu_Trace">
<property name="title">
<string>&Trace</string>
<addaction name="separator"/>
<addaction name="actionOptions"/>
</widget>
+ <widget class="QMenu" name="menuFile">
+ <property name="title">
+ <string>&File</string>
+ </property>
+ <addaction name="actionNew"/>
+ <addaction name="actionOpen"/>
+ <addaction name="separator"/>
+ <addaction name="actionQuit"/>
+ </widget>
<addaction name="menuFile"/>
<addaction name="menu_Trace"/>
</widget>
<string>Options</string>
</property>
</action>
+ <action name="actionNew">
+ <property name="icon">
+ <iconset resource="../qapitrace.qrc">
+ <normaloff>:/resources/document-new.png</normaloff>:/resources/document-new.png</iconset>
+ </property>
+ <property name="text">
+ <string>New</string>
+ </property>
+ </action>
<zorder>stateDock</zorder>
<zorder>vertexDataDock</zorder>
</widget>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>TraceDialog</class>
+ <widget class="QDialog" name="TraceDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>401</width>
+ <height>95</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Application:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="applicationEdit">
+ <property name="placeholderText">
+ <string>Application to trace</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="browseButton">
+ <property name="text">
+ <string>Browse</string>
+ </property>
+ <property name="flat">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Arguments:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="argumentsEdit">
+ <property name="placeholderText">
+ <string>Separate arguments with ";"</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>TraceDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>TraceDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>