diff hgtabwidget.cpp @ 106:729438d70af8

* Retrieve and store current branch and heads; some refactoring
author Chris Cannam
date Thu, 25 Nov 2010 17:54:35 +0000
parents 0bd32aedc6f6
children 8ae3b44c0073
line wrap: on
line diff
--- a/hgtabwidget.cpp	Thu Nov 25 17:21:32 2010 +0000
+++ b/hgtabwidget.cpp	Thu Nov 25 17:54:35 2010 +0000
@@ -34,7 +34,7 @@
 HgTabWidget::HgTabWidget(QWidget *parent,
                          QString remoteRepo,
                          QString workFolderPath) :
-    QTabWidget(parent)
+QTabWidget(parent)
 {
     // Work page
     fileStatusWidget = new FileStatusWidget;
@@ -140,9 +140,9 @@
     if (csets.empty()) return;
     Grapher g(scene);
     try {
-	g.layout(csets);
+        g.layout(csets);
     } catch (std::string s) {
-	std::cerr << "Internal error: Layout failed: " << s << std::endl;
+        std::cerr << "Internal error: Layout failed: " << s << std::endl;
     }
     QGraphicsScene *oldScene = panned->scene();
     panned->setScene(scene);
@@ -157,27 +157,16 @@
     Changesets csets;
     LogList log = LogParser(changeSetsStr).parse();
     foreach (LogEntry e, log) {
-        Changeset *cs = new Changeset();
-        foreach (QString key, e.keys()) {
-	    if (key == "parents") {
-		QStringList parents = e.value(key).split
-		    (" ", QString::SkipEmptyParts);
-		cs->setParents(parents);
-	    } else if (key == "timestamp") {
-		cs->setTimestamp(e.value(key).split(" ")[0].toULongLong());
-	    } else {
-		cs->setProperty(key.toLocal8Bit().data(), e.value(key));
-	    }
-        }
+        Changeset *cs = new Changeset(e);
         csets.push_back(cs);
     }
     for (int i = 0; i+1 < csets.size(); ++i) {
-	Changeset *cs = csets[i];
-	if (cs->parents().empty()) {
-	    QStringList list;
-	    list.push_back(csets[i+1]->id());
-	    cs->setParents(list);
-	}
+        Changeset *cs = csets[i];
+        if (cs->parents().empty()) {
+            QStringList list;
+            list.push_back(csets[i+1]->id());
+            cs->setParents(list);
+        }
     }
     return csets;
 }
@@ -187,3 +176,8 @@
     fileStatusWidget->setLocalPath(workFolderPath);
     fileStatusWidget->setRemoteURL(remoteRepoPath);
 }
+
+void HgTabWidget::setBranch(QString branch)
+{
+    fileStatusWidget->setBranch(branch);
+}