# # # patch "guitone/guitone.pro" # from [93ca723e7e38213ddaadf77e761e5369c43041e0] # to [ef1457cf2546701ccecdc0f1ff17939dfc883555] # # patch "guitone/src/model/Graph.cpp" # from [ec732d1b935b12fb8b2af49c3583d38fff18fba8] # to [de74697beaa838c0e632572a499b514b6907cb0e] # # patch "guitone/src/model/Graph.h" # from [039b3072fea6b42191c0ecca526c5b7f5f2ddd24] # to [68dbec1f0fe3ec2ce51504028eb7926d4e82c232] # # patch "guitone/src/view/dialogs/AncestryGraph.cpp" # from [20033bb0cc8154dd7e3555dbde9ba3e7a3e6b7d4] # to [1c5ace2a61f538d3af94f52248b8fec2567b43d5] # # patch "guitone/src/view/dialogs/AncestryGraph.h" # from [89b850efca4e598ff588051fa42f7978d1ecdaac] # to [6470bec34a4fbeb900fca6daefc0e8fdaaba5a88] # # patch "guitone/src/view/dialogs/ui_KeyManagment.h" # from [6f4d50189c605c957aff73cc5da4c740f6b7fff4] # to [73c58ee13876e13397f97b060f0ec4bc612719b6] # # patch "guitone/src/view/dialogs/ui_ancestry_graph.h" # from [5efd971ed95c5ffcc800469b1c6e9fa43f521158] # to [7d7ebe3acf6449cd11fec0e01db71ad1d00bffa4] # # patch "guitone/src/view/dialogs/ui_preferences.h" # from [f4126778baa21a54133d12046632498cc3477788] # to [1cea0d7656eef9387ee0d74c41bac919104d0511] # # patch "guitone/src/view/dialogs/ui_switch_workspace.h" # from [0ec184d42a5f225416e92fba55a4ae8809e093dd] # to [00d61ff24bb16fd78ede1b6480ed984bf3c10904] # ============================================================ --- guitone/guitone.pro 93ca723e7e38213ddaadf77e761e5369c43041e0 +++ guitone/guitone.pro ef1457cf2546701ccecdc0f1ff17939dfc883555 @@ -1,10 +1,10 @@ TARGET = guitone # # Common configuration # TEMPLATE = app TARGET = guitone -CONFIG += qt debug precompile_header +CONFIG += qt debug precompile_header thread HEADERS += src/view/Guitone.h \ src/view/TreeView.h \ src/view/Splitter.h \ ============================================================ --- guitone/src/model/Graph.cpp ec732d1b935b12fb8b2af49c3583d38fff18fba8 +++ guitone/src/model/Graph.cpp de74697beaa838c0e632572a499b514b6907cb0e @@ -21,8 +21,8 @@ #include "Graph.h" #include "../monotone/Monotone.h" -Graph::Graph(QObject *parent) - : AutomateCommand(parent) {} +Graph::Graph(QObject *parent, qan::la::Graph* g ) +: AutomateCommand(parent) { graph = g; } Graph::~Graph() {} @@ -49,8 +49,6 @@ void Graph::parseOutput(AutomateCommand // if not we are the caller, omit the parsing if (caller != this) return; - // clear our data structures - QStringList revisionList = AutomateCommand::data.split("\n"); QMap nodeMap; @@ -64,14 +62,20 @@ void Graph::parseOutput(AutomateCommand QStringList revs = revisionList.at(i).split(" "); Q_ASSERT(revs.size() > 0); QString rev = revs.takeFirst(); - curNode = new qan::la::Node(rev.toStdString(), qan::la::Node::TYPE); - graph.insertNode(*curNode); - + // for whatever reason inserting every node as root node creates a + // big memory hole + curNode = graph->insertNode(rev.toStdString(), -1); + // remember those for the 2nd pass nodeMap[rev] = curNode; parentMap[rev] = revs; + + if (i % 100 == 0) + { + qDebug("added %d nodes", i); + } } - + qDebug("Graph: created nodes"); revisionList.clear(); @@ -89,13 +93,21 @@ void Graph::parseOutput(AutomateCommand { Q_ASSERT(nodeMap.contains(parents.at(x))); parentNode = nodeMap.value(parents.at(x)); - graph.createEdge(*parentNode, *curNode); + if ( parentNode != 0 && curNode != 0 ) + { + qan::la::Edge* edge = graph->createEdge( 0, 0 ); + graph->modifyEdge( *edge, *parentNode, *curNode ); + } } + if (i % 100 == 0) + { + qDebug("added edges for %d nodes", i); + } } qDebug("Graph: created edges"); - graph.generateRootNodes(); + graph->generateRootNodes(); qDebug("Graph: generated root nodes"); @@ -105,6 +117,5 @@ void Graph::parseOutput(AutomateCommand // restore the normal cursor qApp->restoreOverrideCursor(); - // signal that we've finished (whoever listens to that) - emit graphRead(); + emit graphCreated(); } ============================================================ --- guitone/src/model/Graph.h 039b3072fea6b42191c0ecca526c5b7f5f2ddd24 +++ guitone/src/model/Graph.h 68dbec1f0fe3ec2ce51504028eb7926d4e82c232 @@ -28,7 +28,7 @@ public: { Q_OBJECT public: - Graph(QObject*); + Graph(QObject*, qan::la::Graph* graph ); virtual ~Graph(); // needed Qt Model methods @@ -40,18 +40,18 @@ public: inline int rowCount(const QModelIndex&) const { return 0; }; inline int columnCount(const QModelIndex&) const { return 0; }; - qan::la::Graph & getGraph() { return graph; } + qan::la::Graph & getGraph() { return *graph; } public slots: bool readGraph(); signals: - void graphRead(); + void graphCreated(); private: void parseOutput(AutomateCommand*); - qan::la::Graph graph; + qan::la::Graph* graph; }; #endif ============================================================ --- guitone/src/view/dialogs/AncestryGraph.cpp 20033bb0cc8154dd7e3555dbde9ba3e7a3e6b7d4 +++ guitone/src/view/dialogs/AncestryGraph.cpp 1c5ace2a61f538d3af94f52248b8fec2567b43d5 @@ -40,8 +40,9 @@ AncestryGraph::AncestryGraph(QWidget* pa // wrap the item model class around // we need to define this object on the heap, otherwise the connection // with the monotone class does not work - Graph *graph = new Graph(this); + Graph *graph = new Graph(this, new qan::la::Graph( ) ); graph->readGraph(); + graphItemModel = new qan::can::GraphItemModel(graph->getGraph()); graphItemView = new qan::can::GraphItemView(graphFrame); @@ -52,11 +53,23 @@ AncestryGraph::AncestryGraph(QWidget* pa QColor(255, 255, 255), QColor(240, 240, 240) ); - - graphItemView->setModel(graphItemModel); - - qan::utl::ProgressVoid progress; - graphItemView->layoutGraph(progress); + + // layout the graph if all nodes have been created + connect(graph, SIGNAL(graphCreated()), + this, SLOT(layoutGraph())); } AncestryGraph::~AncestryGraph() {} + +void AncestryGraph::layoutGraph( ) +{ + qDebug("layouting Graph"); + + qan::la::VectorF origin( 2 ); origin( 0 ) = 10.f; origin( 1 ) = 10.f; + qan::la::VectorF spacing( 2 ); spacing( 0 ) = 120.f; spacing( 1 ) = 55.f; + qan::la::Layout* layout = new qan::la::DirectedTree( origin, spacing, qan::la::DirectedTree::HORIZONTAL ); + + qan::utl::ProgressVoid progress; + graphItemView->layoutGraph(progress); + qDebug("layouting finished"); +} ============================================================ --- guitone/src/view/dialogs/AncestryGraph.h 89b850efca4e598ff588051fa42f7978d1ecdaac +++ guitone/src/view/dialogs/AncestryGraph.h 6470bec34a4fbeb900fca6daefc0e8fdaaba5a88 @@ -24,6 +24,7 @@ #include "ui_ancestry_graph.h" #include "can/canGraphItemView.h" #include "can/canGraphItemModel.h" +#include "la/laLayout.h" class AncestryGraph : public QDialog, private Ui::AncestryGraph { @@ -36,6 +37,11 @@ private: private: qan::can::GraphItemView *graphItemView; qan::can::GraphItemModel *graphItemModel; + qan::la::Layout* layout; + +protected slots: + + void layoutGraph( ); }; #endif ============================================================ --- guitone/src/view/dialogs/ui_KeyManagment.h 6f4d50189c605c957aff73cc5da4c740f6b7fff4 +++ guitone/src/view/dialogs/ui_KeyManagment.h 73c58ee13876e13397f97b060f0ec4bc612719b6 @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'KeyManagment.ui' ** -** Created: Wed Oct 11 01:00:11 2006 +** Created: Thu Oct 19 17:27:01 2006 ** by: Qt User Interface Compiler version 4.2.0 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ============================================================ --- guitone/src/view/dialogs/ui_ancestry_graph.h 5efd971ed95c5ffcc800469b1c6e9fa43f521158 +++ guitone/src/view/dialogs/ui_ancestry_graph.h 7d7ebe3acf6449cd11fec0e01db71ad1d00bffa4 @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'ancestry_graph.ui' ** -** Created: Thu Oct 12 16:34:18 2006 +** Created: Thu Oct 19 17:27:01 2006 ** by: Qt User Interface Compiler version 4.2.0 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ============================================================ --- guitone/src/view/dialogs/ui_preferences.h f4126778baa21a54133d12046632498cc3477788 +++ guitone/src/view/dialogs/ui_preferences.h 1cea0d7656eef9387ee0d74c41bac919104d0511 @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'preferences.ui' ** -** Created: Wed Oct 11 01:00:11 2006 +** Created: Thu Oct 19 17:27:01 2006 ** by: Qt User Interface Compiler version 4.2.0 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ============================================================ --- guitone/src/view/dialogs/ui_switch_workspace.h 0ec184d42a5f225416e92fba55a4ae8809e093dd +++ guitone/src/view/dialogs/ui_switch_workspace.h 00d61ff24bb16fd78ede1b6480ed984bf3c10904 @@ -1,7 +1,7 @@ /******************************************************************************** ** Form generated from reading ui file 'switch_workspace.ui' ** -** Created: Wed Oct 11 01:00:11 2006 +** Created: Thu Oct 19 17:27:01 2006 ** by: Qt User Interface Compiler version 4.2.0 ** ** WARNING! All changes made in this file will be lost when recompiling ui file!