From 9623dafd0781222c06a930a2f312607aaae24277 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 18 Apr 2011 18:03:34 -0400 Subject: [PATCH] Implement an edit menu. fixes #6 --- gui/mainwindow.cpp | 64 ++++++++++++++++++++++++++++++++++++ gui/mainwindow.h | 3 ++ gui/qapitrace.qrc | 4 +++ gui/resources/edit-find.png | Bin 0 -> 1705 bytes gui/resources/go-bottom.png | Bin 0 -> 1607 bytes gui/resources/go-jump.png | Bin 0 -> 734 bytes gui/resources/go-top.png | Bin 0 -> 1547 bytes gui/ui/mainwindow.ui | 58 ++++++++++++++++++++++++++++++++ 8 files changed, 129 insertions(+) create mode 100644 gui/resources/edit-find.png create mode 100644 gui/resources/go-bottom.png create mode 100644 gui/resources/go-jump.png create mode 100644 gui/resources/go-top.png diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index cd63962..f40a144 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -670,6 +670,15 @@ void MainWindow::initConnections() 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()), @@ -934,4 +943,59 @@ void MainWindow::slotSaved() m_progressBar->hide(); } +void MainWindow::slotGoFrameStart() +{ + ApiTraceFrame *frame = currentFrame(); + if (!frame || frame->calls.isEmpty()) { + return; + } + + QList::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::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(m_selectedEvent); + } else { + Q_ASSERT(m_selectedEvent->type() == ApiTraceEvent::Call); + ApiTraceCall *call = static_cast(m_selectedEvent); + return call->parentFrame(); + } + } + return NULL; +} + #include "mainwindow.moc" diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 07a1e91..b16dbb4 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -62,6 +62,8 @@ private slots: void editCall(); void slotStartedSaving(); void slotSaved(); + void slotGoFrameStart(); + void slotGoFrameEnd(); private: void initObjects(); @@ -69,6 +71,7 @@ private: void newTraceFile(const QString &fileName); void replayTrace(bool dumpState); void fillStateForFrame(); + ApiTraceFrame *currentFrame() const; private: Ui_MainWindow m_ui; diff --git a/gui/qapitrace.qrc b/gui/qapitrace.qrc index 6f6597f..4d8223f 100644 --- a/gui/qapitrace.qrc +++ b/gui/qapitrace.qrc @@ -6,9 +6,13 @@ resources/document-edit.png resources/document-new.png resources/document-open.png + resources/edit-find.png resources/edit-undo.png resources/emblem-locked.png + resources/go-bottom.png resources/go-down-search.png + resources/go-jump.png + resources/go-top.png resources/go-up-search.png resources/media-playback-start.png resources/media-playback-stop.png diff --git a/gui/resources/edit-find.png b/gui/resources/edit-find.png new file mode 100644 index 0000000000000000000000000000000000000000..9b3fe6bca06c7147d5dc79a2a2ae506d8fd03c9b GIT binary patch literal 1705 zcmV;a23GlrP)$x}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WR(xKoyQ{+knrG?7+2weK_2= z1#>FOVX;_lum{zP5+EB*UH&!2MDO|*4DQ>4F9!DD)BZi^Y-xhq=?p5B%D^*Qacpet zM1x+xvnV&`R^d$F!&&(`59~(W4LXub|KaD>D3{aepb`JZWHQ~S=6qCCP;fibYCRPe z78W<$2g&Fs2>F*VhA@sWfe<$GRXjrAe@Ea~RCL2hbp@SQ00000NkvXXu0mjf61x&k literal 0 HcmV?d00001 diff --git a/gui/resources/go-bottom.png b/gui/resources/go-bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..a84d54b58ea08292bd5cc73afceb677d6242fd07 GIT binary patch literal 1607 zcmV-N2Dtf&P) zi(dcshembZts6f3+9tU^g#_i_co$4su;fo#cqt|~2+Ai*yRKaUputR+93!i=T;jW+ zXgZ7hrqA9=QQI&AvIZwV$N&J!lsx%Ut<~W@h|h0-C!(TG*hF?uzR!GCUZUB@?3@@Dq$pb9 zz%O_auwP}${F~;k-sv;n=95Whz8srF4`ORX9z0`;usxv^yHcvKJGBl$;zsZ@TM&}f zMrfzdnC57Wo}p)H58KPmh|Y(!qyu)_5-`uoFPeFqbQimpS!@i#rT{ryLi6ArMgAhb z9KQQ%;FsEfKuIh3(qjmbbs$vUMWHdx(HeVZm#7wT2iqYnRpUUxF@&d8V5xmDI2KM_ zbjQ04aP$_t-n8*bCfB9F7U2yl`07YLWgaxzebZ7J>W6Q3Zivv zz~+RcM$gc*w8uU$3wjpzUlIeFbmoVcFrK@@?ePv#Jp?&t5LGb7E>1Z*j?|i~NU!^v z!p12T<7_QTImVjUnc4)y6|TRMN;f2w~^EK z9gDo>HYD}eN$m=2La6+lT)jVZOl zo~hOM+QzH(nCXvqR!*^eJnmp!Yu3?}~=jTr&|fL!!69%$c`nV0&sYipdjD z6BHT;X4hhlzVR7tBTEftCPn_xSa&}6Nqp@Hd5U{1qUMXxH{m|f)HPbj%!V}e=6ji} zb$BB_eiNA;--7Gl{zgMv-;0?|k-sh37?%OtkR)hw42qfA6@3bG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zxy!}|p+ZXzQ^Mpm+0<(iSLqcY&Te@UsXt8Y)ASpnO@&3_CbCXhjf zfuR;Mm@vj9K1PCNGnC#JfKJU<3zzM#ydwkNqAHck9hxz7rk7Cl7V(&<#Gwi#=_Zim zI2e|O3y8fltt6-r*F03X?2V+`84%IGUOayM^rT>hnBb@ScDX znU9nBHAS-Dhy1J*OfE_-X0G-Ae;z|UfBvG>wBUQCWfeqBN_hfQRyZnTPOKI8Z$P2Q z6q+JKp%SRXMa72!%yD5vOtfC?#F@rcbaq~crt9Ut;>8zwTk6l;@+3?tsY>TkpCHA0oD84lWQITqCi(mL>7nDUqRYVO8TMxDgP7 zsAO_+7nW?pAueo(Fs7u-j;w(ZjWMRfb!7PYvVQ&MM#hsG-P + + + &Edit + + + + + + + @@ -454,6 +464,54 @@ New + + + + :/resources/edit-find.png:/resources/edit-find.png + + + Find + + + Ctrl+F + + + + + + :/resources/go-jump.png:/resources/go-jump.png + + + Go to Call + + + Ctrl+G + + + + + + :/resources/go-top.png:/resources/go-top.png + + + Go to Frame Start + + + Ctrl+A + + + + + + :/resources/go-bottom.png:/resources/go-bottom.png + + + Go to Frame End + + + Ctrl+E + + stateDock vertexDataDock -- 2.43.0