changeset 608:6f90bb52eee6

Clear history and file states while opening a new remote repo
author Chris Cannam
date Tue, 03 Jul 2012 12:12:42 +0100
parents d35ed7488ccd
children c1451b356097
files src/filestatuswidget.cpp src/filestatuswidget.h src/hgtabwidget.cpp src/hgtabwidget.h src/historywidget.cpp src/historywidget.h src/mainwindow.cpp
diffstat 7 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/filestatuswidget.cpp	Tue Jul 03 11:48:28 2012 +0100
+++ b/src/filestatuswidget.cpp	Tue Jul 03 12:12:42 2012 +0100
@@ -441,6 +441,16 @@
 }
 
 void
+FileStatusWidget::clearWidgets()
+{
+    foreach (FileStates::State s, m_stateListMap.keys()) {
+        QListWidget *w = m_stateListMap[s];
+        w->clear();
+        w->parentWidget()->hide();
+    }
+}
+
+void
 FileStatusWidget::updateWidgets()
 {
     QDateTime lastInteractionTime;
--- a/src/filestatuswidget.h	Tue Jul 03 11:48:28 2012 +0100
+++ b/src/filestatuswidget.h	Tue Jul 03 12:12:42 2012 +0100
@@ -78,6 +78,7 @@
 public slots:
     void clearSelections();
     void updateWidgets();
+    void clearWidgets(); // e.g. while cloning a new repo slowly
 
     void setSearchText(QString text);
 
--- a/src/hgtabwidget.cpp	Tue Jul 03 11:48:28 2012 +0100
+++ b/src/hgtabwidget.cpp	Tue Jul 03 12:12:42 2012 +0100
@@ -144,6 +144,12 @@
     m_historyWidget->setClosedHeadIds(closed);
 }
 
+void HgTabWidget::clearAll()
+{
+    m_fileStatusWidget->clearWidgets();
+    m_historyWidget->clear();
+}
+
 void HgTabWidget::updateFileStates()
 {
     m_fileStatusWidget->updateWidgets();
--- a/src/hgtabwidget.h	Tue Jul 03 11:48:28 2012 +0100
+++ b/src/hgtabwidget.h	Tue Jul 03 12:12:42 2012 +0100
@@ -52,6 +52,7 @@
 
     void setHaveMerge(bool);
 
+    void clearAll();
     void updateFileStates();
     void updateHistory();
 
--- a/src/historywidget.cpp	Tue Jul 03 11:48:28 2012 +0100
+++ b/src/historywidget.cpp	Tue Jul 03 12:12:42 2012 +0100
@@ -205,6 +205,13 @@
     }
 }
 
+void HistoryWidget::clear()
+{
+    QGraphicsScene *oldScene = m_panned->scene();
+    m_panned->setScene(0);
+    delete oldScene;
+}
+
 void HistoryWidget::layoutAll()
 {
     m_refreshNeeded = false;
--- a/src/historywidget.h	Tue Jul 03 11:48:28 2012 +0100
+++ b/src/historywidget.h	Tue Jul 03 12:12:42 2012 +0100
@@ -47,8 +47,6 @@
 
     bool haveNewItems() const { return !m_newIds.empty(); }
 
-    void update();
-
 signals:
     void commit();
     void revert();
@@ -72,7 +70,9 @@
 
 public slots:
     void setSearchText(QString);
-    
+    void update();
+    void clear();
+
 private:
     Changesets m_changesets;
     QStringList m_currentIds;
--- a/src/mainwindow.cpp	Tue Jul 03 11:48:28 2012 +0100
+++ b/src/mainwindow.cpp	Tue Jul 03 12:12:42 2012 +0100
@@ -1218,6 +1218,7 @@
             QMessageBox::critical
                 (this, tr("Could not create target folder"),
                  tr("<qt><b>Could not create target folder</b><br><br>The local target folder \"%1\" does not exist<br>and could not be created.</qt>").arg(xmlEncode(m_workFolderPath)));
+            m_workFolderPath = "";
             return;
         }
     }
@@ -1226,6 +1227,7 @@
     
     updateWorkFolderAndRepoNames();
     m_hgTabs->updateWorkFolderFileList("");
+    m_hgTabs->clearAll();
 
     m_runner->requestAction(HgAction(ACT_CLONEFROMREMOTE, m_workFolderPath, params));
 }