# # # add_file "guitone/src/util/TreeBuilder.cpp" # content [34967a320368a1959472126b6a4468cf9ca55ccb] # # add_file "guitone/src/util/TreeBuilder.h" # content [4950399cb259f614b5f4aea4b44b457bc0c4a549] # # add_file "guitone/src/view/dialogs/DatabaseView.cpp" # content [54a9922ec60f2fa3cae678a6d80f00fee4b41676] # # add_file "guitone/src/view/dialogs/DatabaseView.h" # content [cde102d0cfd4322202b29d4475a867e2646d6028] # # add_file "init-vc.bat" # content [1e64a000e52c1d0e48058bdc1a6d469ba1e9a287] # # patch "guitone/guitone.pro" # from [4c2dd9753ce1a6aab8f48bcffe1655e75eb52aa4] # to [3d2d29bd96e6f527b896970c453d06d0285564d8] # # patch "guitone/res/i18n/guitone_de.qm" # from [da39a3ee5e6b4b0d3255bfef95601890afd80709] # to [db255f4e2d0d28817b98a65bce027da50ed8d1f8] # # patch "guitone/res/i18n/guitone_de.ts" # from [cd01f4ad90ac9d24ae030cffd9c4b6d3f3367aeb] # to [8168393c75a857a69f39ac5042f0913dc00793ef] # ============================================================ --- guitone/src/util/TreeBuilder.cpp 34967a320368a1959472126b6a4468cf9ca55ccb +++ guitone/src/util/TreeBuilder.cpp 34967a320368a1959472126b6a4468cf9ca55ccb @@ -0,0 +1,111 @@ +/*************************************************************************** +* Copyright (C) 2006 by Jean-Louis Fuchs * +* address@hidden * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ + +#include "TreeBuilder.h" + +TreeBuilder::TreeBuilder(QTreeWidgetItem *root, QObject *parent) : QObject(parent) +{ + TreeBuilder::root = root; +} + +QTreeWidgetItem* TreeBuilder::add(const QString &branch) +{ + if(branch != ";") + return add(branch, root); + else + return NULL; +} + +void TreeBuilder::addData(QTreeWidgetItem *child) +{ + QString branch; + QTreeWidgetItem* item = child; + while(item) + { + branch = item->text(0) + branch; + item = item->parent(); + } + if(branch.right(1) == ".") + branch = branch + "*"; + else + branch = branch.mid(0, branch.length() - 1); + child->setData(0, Qt::ToolTipRole, branch.mid(1)); +} + +QTreeWidgetItem* TreeBuilder::add(const QString &branch, QTreeWidgetItem *parent) +{ + if(branch == "") return NULL; + + int len = parent->childCount(); + for(int index = 0; index < len; index++) + { + int pos = overlap(parent->child(index)->text(0), branch) + 1; + if(pos) + { + if(pos == parent->child(index)->text(0).length()) + { + return add(branch.mid(pos), parent->child(index)); + } + else + { + QTreeWidgetItem *newparent = new QTreeWidgetItem(parent); + newparent->setText(0, branch.left(pos)); + parent->addChild(newparent); + QTreeWidgetItem* ret; + + ret = add(parent->child(index)->text(0).mid(pos), newparent); + ret->addChildren(parent->child(index)->takeChildren()); + add(branch.mid(pos), newparent); + delete parent->takeChild(index); + addData(newparent); + return newparent; + } + } + } + + QTreeWidgetItem *it = new QTreeWidgetItem(parent); + it->setText(0, branch); + parent->addChild(it); + addData(it); + return it; +} + +int TreeBuilder::overlap(const QString &a, const QString &b) +{ + 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) + len--; + return len; +} + +void TreeBuilder::addList(const QString &branches) +{ + QStringList branchList = branches.split("\n"); + + QStringListIterator iterator(branchList); + while(iterator.hasNext()) + add(iterator.next() + ";"); +} ============================================================ --- guitone/src/util/TreeBuilder.h 4950399cb259f614b5f4aea4b44b457bc0c4a549 +++ guitone/src/util/TreeBuilder.h 4950399cb259f614b5f4aea4b44b457bc0c4a549 @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jean-Louis Fuchs * + * address@hidden * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef TREEBUILDER_H +#define TREEBUILDER_H + +#include + +class TreeBuilder : public QObject +{ + Q_OBJECT + +public: + TreeBuilder(QTreeWidgetItem *root, QObject *parent = 0); + QTreeWidgetItem* add(const QString &branch); + QTreeWidgetItem* add(const QString &branch, QTreeWidgetItem *parent); + void addList(const QString &branches); + +private: + void addData(QTreeWidgetItem *item); + int overlap(const QString &a, const QString &b); + QTreeWidgetItem *root; +}; + +#endif //TREEBUILDER_H ============================================================ --- guitone/src/view/dialogs/DatabaseView.cpp 54a9922ec60f2fa3cae678a6d80f00fee4b41676 +++ guitone/src/view/dialogs/DatabaseView.cpp 54a9922ec60f2fa3cae678a6d80f00fee4b41676 @@ -0,0 +1,99 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jean-Louis Fuchs * + * address@hidden * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + +#include "DatabaseView.h" + +DatabaseView::DatabaseView(QWidget *parent) : QDialog(parent) +{ + setupUi(this); + this->setWindowFlags(this->windowFlags() | Qt::WindowMaximizeButtonHint); + this->setWindowFlags(this->windowFlags() | Qt::WindowMinimizeButtonHint); + setupSplitterGUI(parent); + + + initTreeWidget(); + readBranches(); +} + +DatabaseView::~DatabaseView() +{ + delete root; + delete builder; +} + +void DatabaseView::branchSelectionChanged() +{ + QString branch = branches.selectedItems()[0]->data(0, Qt::ToolTipRole).toString(); + + readChangesets(branch); +} + +void DatabaseView::initTreeWidget() +{ + root = new QTreeWidgetItem(&branches); + root->setText(0, "*"); + + connect(&branches, SIGNAL(itemSelectionChanged()), this, SLOT(branchSelectionChanged())); + + branches.setAnimated(true); + branches.setRootIsDecorated(false); + branches.setColumnCount(1); + branches.setHeaderLabel("Branches"); + + branches.insertTopLevelItem(0, root); + + builder = new TreeBuilder(root, this); + root->setExpanded(true); +} + +void DatabaseView::readChangesets(const QString &branch) +{ + qDebug() << branch; +} + + +void DatabaseView::readBranches() +{ + int ret; + mtn = Monotone::singleton(this); + //mtn->setup(&QDir::current()); + + mtn->executeCommand(QStringList() << "branches", ret); + builder->addList(mtn->getDataAndReset()); +} + +void DatabaseView::setupSplitterGUI(QWidget *parent) +{ + QSplitter *splitterOuter = new QSplitter(parent); + QSplitter *splitterInner = new QSplitter(Qt::Vertical, parent); + splitterOuter->addWidget(&branches); + + splitterInner->addWidget(&changesets); + splitterInner->addWidget(&changesetView); + + splitterOuter->addWidget(splitterInner); + this->Content->layout()->addWidget(splitterOuter); + + splitterOuter->setSizes(QList() << 200 << 422); + splitterInner->setSizes(QList() << 200 << 400); + + changesetView.setSource(QUrl("qrc:/ui/quando.html")); +} ============================================================ --- guitone/src/view/dialogs/DatabaseView.h cde102d0cfd4322202b29d4475a867e2646d6028 +++ guitone/src/view/dialogs/DatabaseView.h cde102d0cfd4322202b29d4475a867e2646d6028 @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (C) 2006 by Jean-Louis Fuchs * + * address@hidden * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef DATABASEVIEW_H +#define DATABASEVIEW_H + +#include "ui_databaseview.h" +#include +#include "..\..\monotone\Monotone.h" +#include "..\..\util\TreeBuilder.h" + +class DatabaseView : public QDialog, private Ui::DatabaseView +{ + Q_OBJECT + +public: + DatabaseView(QWidget *parent = 0); + QListWidget changesets; + QTreeWidget branches; + QTextBrowser changesetView; + ~DatabaseView(); + +public slots: + void branchSelectionChanged(); + +private: + void setupSplitterGUI(QWidget *parent); + void readBranches(); + void initTreeWidget(); + void readChangesets(const QString &branch); + Monotone *mtn; + QTreeWidgetItem *root; + TreeBuilder *builder; +}; + +#endif //DATABASEVIEW_H ============================================================ --- init-vc.bat 1e64a000e52c1d0e48058bdc1a6d469ba1e9a287 +++ init-vc.bat 1e64a000e52c1d0e48058bdc1a6d469ba1e9a287 @@ -0,0 +1,6 @@ +qmake guitone.pro +cd guitone +qmake -t vcapp guitone.pro +lupdate guitone.pro +lrelease guitone.pro +cd .. ============================================================ --- guitone/guitone.pro 4c2dd9753ce1a6aab8f48bcffe1655e75eb52aa4 +++ guitone/guitone.pro 3d2d29bd96e6f527b896970c453d06d0285564d8 @@ -19,6 +19,7 @@ HEADERS += src/view/Guitone.h \ src/view/dialogs/KeyManagement.h \ src/view/dialogs/GenerateKeypair.h \ src/view/dialogs/About.h \ + src/view/dialogs/DatabaseView.h \ src/monotone/Monotone.h \ src/model/AutomateCommand.h \ src/model/Inventory.h \ @@ -38,7 +39,8 @@ HEADERS += src/view/Guitone.h \ src/util/Settings.h \ src/util/DiffParser.h \ src/util/SignalWaiter.h \ - src/util/OpenFile.h + src/util/OpenFile.h \ + src/util/TreeBuilder.h SOURCES += src/view/Guitone.cpp \ src/view/TreeView.cpp \ src/view/Splitter.cpp \ @@ -53,6 +55,7 @@ SOURCES += src/view/Guitone.cpp \ src/view/dialogs/KeyManagement.cpp \ src/view/dialogs/GenerateKeypair.cpp \ src/view/dialogs/About.cpp \ + src/view/dialogs/DatabaseView.cpp \ src/monotone/Monotone.cpp \ src/model/AutomateCommand.cpp \ src/model/Inventory.cpp \ @@ -73,6 +76,7 @@ SOURCES += src/view/Guitone.cpp \ src/util/DiffParser.cpp \ src/util/SignalWaiter.cpp \ src/util/OpenFile.cpp \ + src/util/TreeBuilder.cpp \ src/main.cpp FORMS += res/dialogs/switch_workspace.ui \ res/dialogs/preferences.ui \ @@ -81,7 +85,8 @@ FORMS += res/dialogs/switch_workspace. res/dialogs/revision_diff.ui \ res/dialogs/key_management.ui \ res/dialogs/generate_keypair.ui \ - res/dialogs/about.ui + res/dialogs/about.ui \ + res/dialogs/databaseview.ui UI_DIR = src/view/dialogs OBJECTS_DIR = tmp MOC_DIR = tmp ============================================================ # guitone/res/i18n/guitone_de.qm is binary ============================================================ --- guitone/res/i18n/guitone_de.ts cd01f4ad90ac9d24ae030cffd9c4b6d3f3367aeb +++ guitone/res/i18n/guitone_de.ts 8168393c75a857a69f39ac5042f0913dc00793ef @@ -42,37 +42,37 @@ Attributes - + added hinzugefügt - + dropped entfernt - + changed verändert - + unchanged unverändert - + Key Schlüssel - + Value Wert - + State Status @@ -80,7 +80,7 @@ Branches - + Branch Name Zweig-Name @@ -88,52 +88,52 @@ Certs - + ok OK - + bad schlecht - + unknown unbekannt - + trusted vertrauenswürdig - + untrusted nicht vertrauenswürdig - + Key Schlüssel - + Name Name - + Value Wert - + Signature Signatur - + Trust Vertrauen @@ -141,27 +141,55 @@ ContentDiff - + %1 (binary) %1 (binär) - + %1 (%2 hunks) %1 (%2 Bereiche) - + Line Zeile - + File/Content Datei/Inhalt + DatabaseView + + + Database + Datenbank + + + + Update All Branches + + + + + All Changesets + + + + + 50 More Changesets + + + + + Done + + + + FileDiffDialog @@ -274,15 +302,15 @@ File is binary. - Datei ist eine Binärdatei. + Datei ist eine Binärdatei. - + Line Zeile - + Content Inhalt @@ -295,7 +323,7 @@ guitone - ein Frontend für monotone - + &File &Datei @@ -305,7 +333,7 @@ Arbeitsbereich &importieren - + &Quit &Beenden @@ -315,17 +343,17 @@ Bereit - + Select your workspace... Wählen Sie Ihren Arbeitsbereich aus... - + Loading aborted Laden abgebrochen - + Invalid workspace Ungültiger Arbeitsbereich @@ -345,7 +373,7 @@ Das Inventar konnte nicht gelesen werden. Vielleicht läuft noch ein anderer Prozess? - + Loading workspace... Lade Arbeitsbereich... @@ -362,7 +390,7 @@ STRG+Q - + The chosen directory is no monotone workspace! Das gewählte Verzeichnis ist kein monotone-Arbeitsverzeichnis! @@ -372,7 +400,7 @@ &Importiere Arbeitsbereich - + Critical Monotone Error Kritischer monotone-Fehler @@ -383,7 +411,7 @@ STRG+I - + &View &Ansicht @@ -398,32 +426,32 @@ Ignorierte Dateien a&nzeigen - + &Recent Workspaces &Vorherige Arbeitsbereiche - + &Open Workspace Arbeitsbereich &öffnen - + &%1 %2 &%1 %2 - + No previous workspaces available. Keine vorherigen Arbeitsbereiche verfügbar. - + &Workspace A&rbeitsbereich - + &Switch revision Auf andere &Revision aktualisieren @@ -438,12 +466,12 @@ &Schlüsselverwaltung - + About &Qt Über &Qt - + &Help &Hilfe @@ -458,22 +486,22 @@ &Historiengraph anzeigen - + &Preferences... &Einstellungen... - + &Key Management &Schlüsselverwaltung - + Unable to execute command Konnte Kommando nicht ausführen - + Unable to execute '%1' - maybe another command is still running? Konnte '%1' nicht ausführen - eventuell läuft noch ein anderes Kommando? @@ -493,7 +521,7 @@ Der Pfad zur ausführbaren Datei von monotone ist entweder ungültig oder zeigt auf eine ältere Version von monotone. Guitone benötigt monotone Version %1 oder ein monotone mit einer Interface-Version %2 oder neuer. - + Hide &ignored files &Ignorierte Dateien verstecken @@ -503,7 +531,7 @@ Zeige nur &geänderte Dateien - + Show &ignored files &Ignorierte Dateien anzeigen @@ -513,67 +541,67 @@ A&lle Dateien anzeigen - + Show Zeige - + &All files &Alle Dateien - + All &changed files Alle &geänderten Dateien - + &Patched files Dateien mit I&nhaltsänderungen - + A&dded files Hin&zugefügte Dateien - + R&emoved files En&tfernte Dateien - + &Renamed files &Umbenannte Dateien - + &Missing files &Fehlende Dateien - + &Unknown files Unbe&kannte Dateien - + I&gnored files I&gnorierte Dateien - + E&xpand tree Baum &aufklappen - + Co&llapse tree Baum zuk&lappen - + About &guitone Über &guitone @@ -881,37 +909,37 @@ Keys - + Database Datenbank - + Keystore Schlüsselspeicher - + Name Name - + Public Hash Öffentliche Prüfsumme - + Private Hash Private Prüfsumme - + Public Locations Öffentliche Speicherorte - + Private Locations Private Speicherorte @@ -976,7 +1004,7 @@ korrekt installiert? Unable to process command '%1': %2 - Das Kommando '%1' konnte nicht abgearbeitet werden: %2 + Das Kommando '%1' konnte nicht abgearbeitet werden: %2 @@ -1265,7 +1293,7 @@ korrekt installiert? Select - + Revision ID Revisions-ID @@ -1366,22 +1394,22 @@ korrekt installiert? Tags - + Name Name - + Revision Revision - + Signer Unterzeichner - + Branches Zweige