Add an action to show and hide the errors dock.
authorZack Rusin <zack@kde.org>
Wed, 20 Apr 2011 03:35:25 +0000 (23:35 -0400)
committerZack Rusin <zack@kde.org>
Wed, 20 Apr 2011 03:35:25 +0000 (23:35 -0400)
gui/mainwindow.cpp
gui/ui/mainwindow.ui

index a5fbacc..c9489f8 100644 (file)
@@ -202,6 +202,9 @@ void MainWindow::replayFinished(const QString &output)
         statusBar()->showMessage(output);
     }
     m_stateEvent = 0;
+    m_ui.actionShowErrorsDock->setEnabled(m_trace->hasErrors());
+    m_ui.errorsDock->setVisible(m_trace->hasErrors());
+
     statusBar()->showMessage(
         tr("Replaying finished!"), 2000);
 }
@@ -726,6 +729,11 @@ void MainWindow::initConnections()
             SLOT(createdTrace(const QString&)));
     connect(m_traceProcess, SIGNAL(error(const QString&)),
             SLOT(traceError(const QString&)));
+
+    connect(m_ui.errorsDock, SIGNAL(visibilityChanged(bool)),
+            m_ui.actionShowErrorsDock, SLOT(setChecked(bool)));
+    connect(m_ui.actionShowErrorsDock, SIGNAL(triggered(bool)),
+            m_ui.errorsDock, SLOT(setVisible(bool)));
 }
 
 void MainWindow::replayStateFound(const ApiTraceState &state)
@@ -1031,8 +1039,6 @@ void MainWindow::slotRetraceErrors(const QList<RetraceError> &errors)
         item->setData(1, Qt::DisplayRole, type);
         item->setData(2, Qt::DisplayRole, error.message);
     }
-
-    m_ui.errorsDock->setVisible(!errors.isEmpty());
 }
 
 #include "mainwindow.moc"
index 3f15da2..544097e 100644 (file)
     <addaction name="separator"/>
     <addaction name="actionQuit"/>
    </widget>
+   <widget class="QMenu" name="menuEdit">
+    <property name="title">
+     <string>&amp;Edit</string>
+    </property>
+    <addaction name="actionFind"/>
+    <addaction name="actionGo"/>
+    <addaction name="actionGoFrameStart"/>
+    <addaction name="actionGoFrameEnd"/>
+    <addaction name="separator"/>
+    <addaction name="actionShowErrorsDock"/>
+   </widget>
    <widget class="QMenu" name="menu_Trace">
     <property name="title">
      <string>&amp;Trace</string>
     <addaction name="separator"/>
     <addaction name="actionOptions"/>
    </widget>
-   <widget class="QMenu" name="menuEdit">
-    <property name="title">
-     <string>&amp;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"/>
     <string>Ctrl+E</string>
    </property>
   </action>
+  <action name="actionShowErrorsDock">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Show Errors Dock</string>
+   </property>
+  </action>
   <zorder>stateDock</zorder>
   <zorder>vertexDataDock</zorder>
   <zorder>errorsDock</zorder>