connect(m_ui.actionQuit, SIGNAL(triggered()),
this, SLOT(close()));
+ connect(m_ui.actionFind, SIGNAL(triggered()),
+ this, SLOT(slotSearch()));
+ connect(m_ui.actionGo, SIGNAL(triggered()),
+ this, SLOT(slotGoTo()));
+ connect(m_ui.actionGoFrameStart, SIGNAL(triggered()),
+ this, SLOT(slotGoFrameStart()));
+ connect(m_ui.actionGoFrameEnd, SIGNAL(triggered()),
+ this, SLOT(slotGoFrameEnd()));
+
connect(m_ui.actionReplay, SIGNAL(triggered()),
this, SLOT(replayStart()));
connect(m_ui.actionStop, SIGNAL(triggered()),
m_progressBar->hide();
}
+void MainWindow::slotGoFrameStart()
+{
+ ApiTraceFrame *frame = currentFrame();
+ if (!frame || frame->calls.isEmpty()) {
+ return;
+ }
+
+ QList<ApiTraceCall*>::const_iterator itr;
+
+ itr = frame->calls.constBegin();
+ while (itr != frame->calls.constEnd()) {
+ ApiTraceCall *call = *itr;
+ QModelIndex idx = m_proxyModel->indexForCall(call);
+ if (idx.isValid()) {
+ m_ui.callView->setCurrentIndex(idx);
+ break;
+ }
+ ++itr;
+ }
+}
+
+void MainWindow::slotGoFrameEnd()
+{
+ ApiTraceFrame *frame = currentFrame();
+ if (!frame || frame->calls.isEmpty()) {
+ return;
+ }
+ QList<ApiTraceCall*>::const_iterator itr;
+
+ itr = frame->calls.constEnd();
+ do {
+ --itr;
+ ApiTraceCall *call = *itr;
+ QModelIndex idx = m_proxyModel->indexForCall(call);
+ if (idx.isValid()) {
+ m_ui.callView->setCurrentIndex(idx);
+ break;
+ }
+ } while (itr != frame->calls.constBegin());
+}
+
+ApiTraceFrame * MainWindow::currentFrame() const
+{
+ if (m_selectedEvent) {
+ if (m_selectedEvent->type() == ApiTraceEvent::Frame) {
+ return static_cast<ApiTraceFrame*>(m_selectedEvent);
+ } else {
+ Q_ASSERT(m_selectedEvent->type() == ApiTraceEvent::Call);
+ ApiTraceCall *call = static_cast<ApiTraceCall*>(m_selectedEvent);
+ return call->parentFrame();
+ }
+ }
+ return NULL;
+}
+
#include "mainwindow.moc"
void editCall();
void slotStartedSaving();
void slotSaved();
+ void slotGoFrameStart();
+ void slotGoFrameEnd();
private:
void initObjects();
void newTraceFile(const QString &fileName);
void replayTrace(bool dumpState);
void fillStateForFrame();
+ ApiTraceFrame *currentFrame() const;
private:
Ui_MainWindow m_ui;
<file>resources/document-edit.png</file>
<file>resources/document-new.png</file>
<file>resources/document-open.png</file>
+ <file>resources/edit-find.png</file>
<file>resources/edit-undo.png</file>
<file>resources/emblem-locked.png</file>
+ <file>resources/go-bottom.png</file>
<file>resources/go-down-search.png</file>
+ <file>resources/go-jump.png</file>
+ <file>resources/go-top.png</file>
<file>resources/go-up-search.png</file>
<file>resources/media-playback-start.png</file>
<file>resources/media-playback-stop.png</file>
<addaction name="separator"/>
<addaction name="actionOptions"/>
</widget>
+ <widget class="QMenu" name="menuEdit">
+ <property name="title">
+ <string>&Edit</string>
+ </property>
+ <addaction name="actionFind"/>
+ <addaction name="actionGo"/>
+ <addaction name="actionGoFrameStart"/>
+ <addaction name="actionGoFrameEnd"/>
+ </widget>
<addaction name="menuFile"/>
+ <addaction name="menuEdit"/>
<addaction name="menu_Trace"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<string>New</string>
</property>
</action>
+ <action name="actionFind">
+ <property name="icon">
+ <iconset resource="../qapitrace.qrc">
+ <normaloff>:/resources/edit-find.png</normaloff>:/resources/edit-find.png</iconset>
+ </property>
+ <property name="text">
+ <string>Find</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+F</string>
+ </property>
+ </action>
+ <action name="actionGo">
+ <property name="icon">
+ <iconset resource="../qapitrace.qrc">
+ <normaloff>:/resources/go-jump.png</normaloff>:/resources/go-jump.png</iconset>
+ </property>
+ <property name="text">
+ <string>Go to Call</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+G</string>
+ </property>
+ </action>
+ <action name="actionGoFrameStart">
+ <property name="icon">
+ <iconset resource="../qapitrace.qrc">
+ <normaloff>:/resources/go-top.png</normaloff>:/resources/go-top.png</iconset>
+ </property>
+ <property name="text">
+ <string>Go to Frame Start</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+A</string>
+ </property>
+ </action>
+ <action name="actionGoFrameEnd">
+ <property name="icon">
+ <iconset resource="../qapitrace.qrc">
+ <normaloff>:/resources/go-bottom.png</normaloff>:/resources/go-bottom.png</iconset>
+ </property>
+ <property name="text">
+ <string>Go to Frame End</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+E</string>
+ </property>
+ </action>
<zorder>stateDock</zorder>
<zorder>vertexDataDock</zorder>
</widget>