]> git.cworth.org Git - apitrace/commitdiff
Make thumbnailing an non-automatic action.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 24 Mar 2012 09:27:27 +0000 (09:27 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 24 Mar 2012 09:27:27 +0000 (09:27 +0000)
This allows to avoid performance issues with big traces, and also
give opportunity to the user to change the replay settings.

gui/mainwindow.cpp
gui/mainwindow.h
gui/ui/mainwindow.ui

index 5a90241fdcd0d1d4eddd17aab9a34130e345eaf1..023635197051bcf1023ad1727a53fe0c2821c504 100644 (file)
@@ -182,6 +182,7 @@ void MainWindow::replayStop()
     m_ui.actionStop->setEnabled(false);
     m_ui.actionReplay->setEnabled(true);
     m_ui.actionLookupState->setEnabled(true);
+    m_ui.actionShowThumbnails->setEnabled(true);
 }
 
 void MainWindow::newTraceFile(const QString &fileName)
@@ -194,11 +195,13 @@ void MainWindow::newTraceFile(const QString &fileName)
     if (fileName.isEmpty()) {
         m_ui.actionReplay->setEnabled(false);
         m_ui.actionLookupState->setEnabled(false);
+        m_ui.actionShowThumbnails->setEnabled(false);
         setWindowTitle(tr("QApiTrace"));
     } else {
         QFileInfo info(fileName);
         m_ui.actionReplay->setEnabled(true);
         m_ui.actionLookupState->setEnabled(true);
+        m_ui.actionShowThumbnails->setEnabled(true);
         setWindowTitle(
             tr("QApiTrace - %1").arg(info.fileName()));
     }
@@ -209,6 +212,7 @@ void MainWindow::replayFinished(const QString &output)
     m_ui.actionStop->setEnabled(false);
     m_ui.actionReplay->setEnabled(true);
     m_ui.actionLookupState->setEnabled(true);
+    m_ui.actionShowThumbnails->setEnabled(true);
 
     m_progressBar->hide();
     if (output.length() < 80) {
@@ -230,6 +234,7 @@ void MainWindow::replayError(const QString &message)
     m_ui.actionStop->setEnabled(false);
     m_ui.actionReplay->setEnabled(true);
     m_ui.actionLookupState->setEnabled(true);
+    m_ui.actionShowThumbnails->setEnabled(true);
     m_stateEvent = 0;
     m_nonDefaultsLookupEvent = 0;
 
@@ -262,9 +267,6 @@ void MainWindow::finishedLoadingTrace()
         m_trace->findCallIndex(m_initalCallNum);
         m_initalCallNum = -1;
     }
-
-    // force initial capture of thumbnails
-    replayTrace(false, true);
 }
 
 void MainWindow::replayTrace(bool dumpState, bool dumpThumbnails)
@@ -337,6 +339,11 @@ void MainWindow::lookupState()
     replayTrace(true, false);
 }
 
+void MainWindow::showThumbnails()
+{
+    replayTrace(false, true);
+}
+
 MainWindow::~MainWindow()
 {
     delete m_trace;
@@ -788,6 +795,8 @@ void MainWindow::initConnections()
             this, SLOT(replayStop()));
     connect(m_ui.actionLookupState, SIGNAL(triggered()),
             this, SLOT(lookupState()));
+    connect(m_ui.actionShowThumbnails, SIGNAL(triggered()),
+            this, SLOT(showThumbnails()));
     connect(m_ui.actionOptions, SIGNAL(triggered()),
             this, SLOT(showSettings()));
 
index d898f3ca7e04d0b9d3dd9bb292705006155a7296..76ae5948e042232f884b70e1a14d4130851eb8c6 100644 (file)
@@ -55,6 +55,7 @@ private slots:
     void loadProgess(int percent);
     void finishedLoadingTrace();
     void lookupState();
+    void showThumbnails();
     void showSettings();
     void openHelp(const QUrl &url);
     void showSurfacesMenu(const QPoint &pos);
index 5b48dc28d54c872845d0f57bb3ddaf611b71f25f..52cf49ed85040f7fe2bb4c6eb550667589c24914 100644 (file)
@@ -75,6 +75,7 @@
     <addaction name="actionReplay"/>
     <addaction name="actionStop"/>
     <addaction name="actionLookupState"/>
+    <addaction name="actionShowThumbnails"/>
     <addaction name="separator"/>
     <addaction name="actionOptions"/>
    </widget>
     <string>Ctrl+L</string>
    </property>
   </action>
+  <action name="actionShowThumbnails">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Show &amp;Thumbnails</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+T</string>
+   </property>
+  </action>
   <action name="actionOptions">
    <property name="text">
     <string>Options</string>