# # # patch "guitone/res/dialogs/about.ui" # from [f5b384830d112e1b60ca92f1e89f0e4fdc5218f9] # to [a62ebd990b1f8f514d9050f87bc138ac922da549] # # patch "guitone/res/dialogs/ancestry_graph.ui" # from [7e7f4aa6d5b1dc185e0b0ac8f5a05b5ed4c3bcf3] # to [7f8e37dcafde0006b6c22221ba89b1ec12ee5ae6] # # patch "guitone/res/dialogs/databaseview.ui" # from [59d4f9cc9dcc44a936c7fe573013a83f71afd569] # to [5c602f2ec0c304cd3c454d21fb0385fbf293113f] # # patch "guitone/res/dialogs/file_diff.ui" # from [461cfac4a7157098a892c2ce1f3e5100f5fd6318] # to [617e65923c434029b2a4b9de4871bd84b1be47c3] # # patch "guitone/res/dialogs/generate_keypair.ui" # from [e128bf1309c9ba6f8cc4cc0f6ae5c79e963b0892] # to [a6f3ef8c02360b57fdde7f9373c9c2eb5a65c50e] # # patch "guitone/res/dialogs/key_management.ui" # from [11be469f0548a6d971dc0ca88e2fe9357681e21e] # to [4c08bf879026fb65debf068ad45d2856fcf98298] # # patch "guitone/res/dialogs/preferences.ui" # from [459bc28645032f061fb7755b79e49d42e4a7a4c8] # to [2db8a53259024f638fe93f7b9a7124c9cfc89e41] # # patch "guitone/res/dialogs/revision_diff.ui" # from [c2d6932f4262a673b95c1588db61492d082e8b17] # to [a3134f5041e9898cee601414966037537bc98c13] # # patch "guitone/res/dialogs/switch_workspace.ui" # from [bbec0961072d0bd0585a39a7b2810f6e3e0b7b3a] # to [62f3b1f71d7c088e6861be1fc50ef49535991d5e] # # patch "guitone/src/main.cpp" # from [92d2ce54c77084266ffe867f28d04cd8fc09af24] # to [cffb74b6626f7626668299252902b5d5cb3b2d96] # # patch "guitone/src/util/TreeBuilder.cpp" # from [50b1c3098b3c8782247f12e129f9a3e6d965899a] # to [1aca5e633d77f2b720c5ffd05acab21fcf29917a] # # patch "guitone/src/util/TreeBuilder.h" # from [3cd7b826e492b8bd22cc4f7d8eed1ac239c09b97] # to [e060d7fe445bc817c3e3f80b30c2d25b9504640d] # # patch "guitone/src/view/Guitone.cpp" # from [114f06c308044636c911d3f71daa5eb5fa8fe14f] # to [4167997c18304c1e1caf47adeca40f0bc96c8d6b] # ============================================================ --- guitone/res/dialogs/about.ui f5b384830d112e1b60ca92f1e89f0e4fdc5218f9 +++ guitone/res/dialogs/about.ui a62ebd990b1f8f514d9050f87bc138ac922da549 @@ -24,6 +24,9 @@ About guitone + + :/guitone-icon.svg + 9 ============================================================ --- guitone/res/dialogs/ancestry_graph.ui 7e7f4aa6d5b1dc185e0b0ac8f5a05b5ed4c3bcf3 +++ guitone/res/dialogs/ancestry_graph.ui 7f8e37dcafde0006b6c22221ba89b1ec12ee5ae6 @@ -15,6 +15,9 @@ Ancestry Graph + + :/guitone-icon.svg + 9 @@ -54,7 +57,9 @@ - + + + buttonBox ============================================================ --- guitone/res/dialogs/databaseview.ui 59d4f9cc9dcc44a936c7fe573013a83f71afd569 +++ guitone/res/dialogs/databaseview.ui 5c602f2ec0c304cd3c454d21fb0385fbf293113f @@ -12,6 +12,9 @@ Database + + :/guitone-icon.svg + 9 ============================================================ --- guitone/res/dialogs/file_diff.ui 461cfac4a7157098a892c2ce1f3e5100f5fd6318 +++ guitone/res/dialogs/file_diff.ui 617e65923c434029b2a4b9de4871bd84b1be47c3 @@ -12,6 +12,9 @@ File differences of "%1" + + :/guitone-icon.svg + 9 @@ -130,7 +133,9 @@
../DiffStatusView.h
- + + + closeButton ============================================================ --- guitone/res/dialogs/generate_keypair.ui e128bf1309c9ba6f8cc4cc0f6ae5c79e963b0892 +++ guitone/res/dialogs/generate_keypair.ui a6f3ef8c02360b57fdde7f9373c9c2eb5a65c50e @@ -32,6 +32,9 @@ Generate new Keypair + + :/guitone-icon.svg + false @@ -135,7 +138,9 @@
- + + + buttonBox ============================================================ --- guitone/res/dialogs/key_management.ui 11be469f0548a6d971dc0ca88e2fe9357681e21e +++ guitone/res/dialogs/key_management.ui 4c08bf879026fb65debf068ad45d2856fcf98298 @@ -12,6 +12,9 @@ Key Management + + :/guitone-icon.svg + 9 @@ -96,7 +99,9 @@ closeButton generateKey - + + + closeButton ============================================================ --- guitone/res/dialogs/preferences.ui 459bc28645032f061fb7755b79e49d42e4a7a4c8 +++ guitone/res/dialogs/preferences.ui 2db8a53259024f638fe93f7b9a7124c9cfc89e41 @@ -23,6 +23,9 @@ Preferences + + :/guitone-icon.svg + false ============================================================ --- guitone/res/dialogs/revision_diff.ui c2d6932f4262a673b95c1588db61492d082e8b17 +++ guitone/res/dialogs/revision_diff.ui a3134f5041e9898cee601414966037537bc98c13 @@ -12,6 +12,9 @@ Differences in %1 between %2 and %3 + + :/guitone-icon.svg + 9 @@ -71,7 +74,9 @@
../DiffView.h
- + + + closeButton ============================================================ --- guitone/res/dialogs/switch_workspace.ui bbec0961072d0bd0585a39a7b2810f6e3e0b7b3a +++ guitone/res/dialogs/switch_workspace.ui 62f3b1f71d7c088e6861be1fc50ef49535991d5e @@ -1,7 +1,4 @@ - - - SwitchWorkspaceRevision @@ -15,6 +12,9 @@ Switch Workspace Revision + + :/guitone-icon.svg + 9 @@ -136,22 +136,17 @@ - + Splitter + QSplitter +
../Splitter.h
+
+ TreeView QTreeView
../TreeView.h
- 0 -
- - Splitter - QSplitter -
../Splitter.h
- 0 - -
selectorBox @@ -162,7 +157,9 @@ okButton cancelButton - + + + okButton ============================================================ --- guitone/src/main.cpp 92d2ce54c77084266ffe867f28d04cd8fc09af24 +++ guitone/src/main.cpp cffb74b6626f7626668299252902b5d5cb3b2d96 @@ -49,6 +49,7 @@ int main(int argc, char** argv) mainWnd->show(); + app.setWindowIcon(QIcon(":guitone-icon.svg")); app.connect(&app, SIGNAL(lastWindowClosed()), mainWnd, SLOT(quit())); return app.exec(); } ============================================================ --- guitone/src/util/TreeBuilder.cpp 50b1c3098b3c8782247f12e129f9a3e6d965899a +++ guitone/src/util/TreeBuilder.cpp 1aca5e633d77f2b720c5ffd05acab21fcf29917a @@ -19,10 +19,14 @@ ***************************************************************************/ #include "TreeBuilder.h" +#include +#include + TreeBuilder::TreeBuilder(QStandardItem *root, QObject *parent) : QObject(parent) { TreeBuilder::root = root; + dot = '.'; } QStandardItem* TreeBuilder::add(const QString &branch) @@ -53,8 +57,6 @@ void TreeBuilder::addData(QStandardItem child->setData(branch, Qt::ToolTipRole); } -// FIXME: Bug with one character level - QStandardItem* TreeBuilder::add(const QString &branch, QStandardItem *parent) { if(branch == "") return NULL; @@ -65,24 +67,44 @@ QStandardItem* TreeBuilder::add(const QS int pos = overlap(parent->child(index)->data().toString(), branch) + 1; if(pos) { - if(pos == parent->child(index)->data().toString().length()) + // Store the child data as we need multiple times + QString tmp = parent->child(index)->data().toString(); + + if(pos == tmp.length()) { + // The child contains the branch. return add(branch.mid(pos), parent->child(index)); } else { + // We found a splitting point. Going to splitt the tree. + + // Get the old childs rows + QList row = parent->child(index)->takeColumn(0); + + // Delete the old child + parent->removeRow(index); + + // Create a new parent to replace the old child QStandardItem *newparent = new QStandardItem(); newparent->setData(branch.left(pos)); + + // Add the new parent to the parent parent->appendRow(newparent); + addData(newparent); + + // Add the old child to the new parent QStandardItem* ret; + ret = add(tmp.mid(pos), newparent); - ret = add(parent->child(index)->data().toString().mid(pos), newparent); - QList row = parent->takeRow(index); - row.removeFirst(); - ret->appendRow(row); + // Append the old childs rows to the newly added old child + QListIterator iterator(row); + while(iterator.hasNext()) + ret->appendRow(iterator.next()); + // Add the new child to the new parent add(branch.mid(pos), newparent); - addData(newparent); + return newparent; } } @@ -99,12 +121,13 @@ int TreeBuilder::overlap(const QString & { const QChar *ac = a.data(); const QChar *bc = b.data(); - QChar dot('.'); int len = 0; int max = qMax(a.length(), b.length()); while(len < max && ac[len] == bc[len]) len++; - while(len >= 0 && ac[len] != dot) + // Important: It only is a splitting point if both a and b have a dot at + // this point! + while(len >= 0 && (ac[len] != dot || bc[len] != dot)) len--; return len; } @@ -113,7 +136,18 @@ void TreeBuilder::addList(const QString { QStringList branchList = branches.split("\n"); - QStringListIterator iterator(branchList); + //Code for testing the algorithmn + srand( (unsigned)time( NULL ) ); + + while(int c = branchList.count()) + add(branchList.takeAt(rand() % c)); + + // FIXME: Replace the code above with the code below once it is clear that the algorithmn + // is working. Don't for get to remove the #includes. + + /*QStringListIterator iterator(branchList); while(iterator.hasNext()) add(iterator.next()); + */ + root->sortChildren(0); } ============================================================ --- guitone/src/util/TreeBuilder.h 3cd7b826e492b8bd22cc4f7d8eed1ac239c09b97 +++ guitone/src/util/TreeBuilder.h e060d7fe445bc817c3e3f80b30c2d25b9504640d @@ -37,6 +37,7 @@ private: void addData(QStandardItem *item); int overlap(const QString &a, const QString &b); QStandardItem *root; + QChar dot; }; #endif //TREEBUILDER_H ============================================================ --- guitone/src/view/Guitone.cpp 114f06c308044636c911d3f71daa5eb5fa8fe14f +++ guitone/src/view/Guitone.cpp 4167997c18304c1e1caf47adeca40f0bc96c8d6b @@ -109,7 +109,7 @@ void Guitone::buildMenu() void Guitone::buildMenu() { QAction * act; - + menu = menuBar()->addMenu(tr("&File")); menu->addAction( tr("&Open Workspace"),