]> git.cworth.org Git - apitrace/commitdiff
Don't clear the trace when the file selection has been cancelled.
authorZack Rusin <zack@kde.org>
Thu, 28 Apr 2011 01:33:57 +0000 (21:33 -0400)
committerZack Rusin <zack@kde.org>
Thu, 28 Apr 2011 01:33:57 +0000 (21:33 -0400)
gui/mainwindow.cpp

index 441697518e247cbf04a55ab1f76917b847964b4d..877c93d41b5fc1259882cc2d70d80e7966be9032 100644 (file)
@@ -74,9 +74,9 @@ void MainWindow::openTrace()
             QDir::homePath(),
             tr("Trace Files (*.trace)"));
 
-    qDebug()<< "File name : " <<fileName;
-
-    newTraceFile(fileName);
+    if (!fileName.isEmpty() && QFile::exists(fileName)) {
+        newTraceFile(fileName);
+    }
 }
 
 void MainWindow::loadTrace(const QString &fileName)
@@ -86,9 +86,7 @@ void MainWindow::loadTrace(const QString &fileName)
                              tr("File '%1' doesn't exist.").arg(fileName));
         return;
     }
-    qDebug()<< "Loading  : " <<fileName;
 
-    m_progressBar->setValue(0);
     newTraceFile(fileName);
 }
 
@@ -177,6 +175,9 @@ void MainWindow::replayStop()
 
 void MainWindow::newTraceFile(const QString &fileName)
 {
+    qDebug()<< "Loading  : " <<fileName;
+
+    m_progressBar->setValue(0);
     m_trace->setFileName(fileName);
 
     if (fileName.isEmpty()) {