# # # patch "guitone/guitone.pro" # from [68b3ce576963c3d66b3e381071c0738815e280fc] # to [e4ff029ae4f185ea4fd5fbbaea60c04c167c8d1b] # # patch "guitone/res/dialogs/ancestry_graph.ui" # from [8d9abf4e26fc78dfbca037ff9dbb1cea72959dfd] # to [1c1020f5671406ddcf61222d24b7afd4a0a5d2b6] # # patch "guitone/src/model/Graph.cpp" # from [9de07bc21167aa3019a82f5feca88cdb323e1104] # to [5ae5ab278033da19078df79636d5998341725edd] # # patch "guitone/src/model/Graph.h" # from [dfc025845ba3213b0eb7349adf08ab66157e044b] # to [039b3072fea6b42191c0ecca526c5b7f5f2ddd24] # # patch "guitone/src/view/Guitone.cpp" # from [fa55a14466d1bcaacda65e58a5906435538020af] # to [428fb769b73daf3e313f1f616c06b17354f35faf] # # patch "guitone/src/view/Guitone.h" # from [e5db27aa3fa18109257cce092ff3f8b22c7e6ae1] # to [d0d5ffdcd54c358756c6c2c161609252cbe47c63] # # patch "guitone/src/view/dialogs/AncestryGraph.cpp" # from [58a33faa80059e6d49bb56be9e95354f2d92ddcf] # to [a4970a0b4d5ea26caefd6043e32cdc8ad72f818c] # # patch "guitone/src/view/dialogs/AncestryGraph.h" # from [0c3eec8dc2abc89a2ee10f728d81448cc2bd5479] # to [89b850efca4e598ff588051fa42f7978d1ecdaac] # # patch "guitone/src/view/dialogs/ui_KeyManagment.h" # from [e82e9ba78fec73e56da2e9b08b2d64171849f85d] # to [6f4d50189c605c957aff73cc5da4c740f6b7fff4] # # patch "guitone/src/view/dialogs/ui_ancestry_graph.h" # from [70340c893ab4bfabf9dc46d42fcc0e6eb4ee2a66] # to [5afdf1780a162499183f114ae1511bc6678adfd4] # # patch "guitone/src/view/dialogs/ui_preferences.h" # from [7bf70ad1a88dcebe0fc90dc4eb0a309463676980] # to [f4126778baa21a54133d12046632498cc3477788] # # patch "guitone/src/view/dialogs/ui_switch_workspace.h" # from [9ea0d34e428e64e6f73521babeb3be52b12becd1] # to [0ec184d42a5f225416e92fba55a4ae8809e093dd] # ============================================================ --- guitone/guitone.pro 68b3ce576963c3d66b3e381071c0738815e280fc +++ guitone/guitone.pro e4ff029ae4f185ea4fd5fbbaea60c04c167c8d1b @@ -48,7 +48,12 @@ FORMS += res/dialogs/switch_workspace. res/dialogs/preferences.ui \ res/dialogs/ancestry_graph.ui \ res/dialogs/KeyManagment.ui -LIBS = -L../libs/qanava/build -lqanava_la -lqanava_can -lqanava_ui -lqanava_utl + +# -lstdc++: this is a workaround for a possible flaw in libqanava +# otherwise "undefined symbols: vtable for qan::la::Random" +# pops up during linkage +LIBS = -lstdc++ -L../libs/qanava/build -lqanava_la -lqanava_can -lqanava_ui -lqanava_utl + INCLUDEPATH = ../libs/qanava/src UI_DIR = src/view/dialogs OBJECTS_DIR = tmp @@ -59,6 +64,10 @@ PRECOMPILED_HEADER = src/stable.h RCC_DIR = tmp PRECOMPILED_HEADER = src/stable.h +macx | unix { + QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter +} + macx { # copy i18n resources into the final app bundle QMAKE_POST_LINK = cp -R res/osx/Resources bin/guitone.app/Contents ============================================================ --- guitone/res/dialogs/ancestry_graph.ui 8d9abf4e26fc78dfbca037ff9dbb1cea72959dfd +++ guitone/res/dialogs/ancestry_graph.ui 1c1020f5671406ddcf61222d24b7afd4a0a5d2b6 @@ -15,7 +15,7 @@ Ancestry Graph - + 9 @@ -31,6 +31,16 @@ 6 + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + Qt::Horizontal @@ -40,20 +50,10 @@ - - - - - - GraphItemView - QGraphicsView -
can/canGraphItemView.h
-
-
============================================================ --- guitone/src/model/Graph.cpp 9de07bc21167aa3019a82f5feca88cdb323e1104 +++ guitone/src/model/Graph.cpp 5ae5ab278033da19078df79636d5998341725edd @@ -20,20 +20,11 @@ #include "Graph.h" #include "../monotone/Monotone.h" -#include "la/laGraph.h" -using namespace qan; - Graph::Graph(QObject *parent) - : AutomateCommand(parent) -{ - graph = new la::Graph(); -} + : AutomateCommand(parent) {} -Graph::~Graph() -{ - if (graph) delete graph; -} +Graph::~Graph() {} bool Graph::readGraph() { @@ -62,11 +53,10 @@ void Graph::parseOutput(AutomateCommand QStringList revisionList = AutomateCommand::data.split("\n"); - QMap nodeMap; + QMap nodeMap; QMap parentMap; - la::Node *curNode, *parentNode; - la::Edge *edge; + qan::la::Node *curNode, *parentNode; // 1st pass: create node objects for every rev and add it to the graph for (int i=0, j=revisionList.size(); i 0); QString rev = revs.takeFirst(); - curNode = new la::Node(rev.toStdString(), la::Node::TYPE); - graph->insertNode(*curNode); + curNode = new qan::la::Node(rev.toStdString(), qan::la::Node::TYPE); + graph.insertNode(*curNode); // remember those for the 2nd pass nodeMap[rev] = curNode; @@ -97,13 +87,11 @@ void Graph::parseOutput(AutomateCommand { Q_ASSERT(nodeMap.contains(parents.at(x))); parentNode = nodeMap.value(parents.at(x)); - edge = new la::Edge(parentNode, curNode); - curNode->addInEdge(*edge); - parentNode->addOutEdge(*edge); + graph.createEdge(*parentNode, *curNode); } } - // reset the view + // reset any view(s) reset(); // restore the normal cursor ============================================================ --- guitone/src/model/Graph.h dfc025845ba3213b0eb7349adf08ab66157e044b +++ guitone/src/model/Graph.h 039b3072fea6b42191c0ecca526c5b7f5f2ddd24 @@ -22,13 +22,8 @@ #define SELECT_H #include "AutomateCommand.h" +#include "la/laGraph.h" -namespace qan { - namespace la { - class Graph; - } -} - class Graph : public AutomateCommand { Q_OBJECT @@ -44,6 +39,8 @@ public: inline QModelIndex parent(const QModelIndex&) const { return QModelIndex(); }; inline int rowCount(const QModelIndex&) const { return 0; }; inline int columnCount(const QModelIndex&) const { return 0; }; + + qan::la::Graph & getGraph() { return graph; } public slots: bool readGraph(); @@ -54,7 +51,7 @@ private: private: void parseOutput(AutomateCommand*); - qan::la::Graph *graph; + qan::la::Graph graph; }; #endif ============================================================ --- guitone/src/view/Guitone.cpp fa55a14466d1bcaacda65e58a5906435538020af +++ guitone/src/view/Guitone.cpp 428fb769b73daf3e313f1f616c06b17354f35faf @@ -29,6 +29,7 @@ #include "../view/AttributesView.h" #include "../view/dialogs/SwitchWorkspaceRevision.h" #include "../view/dialogs/Preferences.h" +#include "../view/dialogs/AncestryGraph.h" #include "../view/dialogs/KeyManagment.h" #include "../util/Settings.h" @@ -101,10 +102,16 @@ Guitone::Guitone() SLOT(openSwitchWorkspaceRevisionDialog()), Qt::CTRL + Qt::Key_R ); - - // Disabled until we see any functionality there... + + menu = menuBar()->addMenu(tr("&Database")); + menu->addAction( + tr("&Show ancestry graph"), + this, + SLOT(openAncestryGraphDialog()), + Qt::CTRL + Qt::Key_A + ); /* - menu = menuBar()->addMenu(tr("&Key Managment")); + // Disabled until we see any functionality there... menu->addAction( tr("&Key Managment"), this, @@ -375,6 +382,12 @@ void Guitone::openPreferencesDialog() dialog.exec(); } +void Guitone::openAncestryGraphDialog() +{ + AncestryGraph dialog(this); + dialog.exec(); +} + void Guitone::openKeyManagmentDialog() { KeyManagment dialog(this); ============================================================ --- guitone/src/view/Guitone.h e5db27aa3fa18109257cce092ff3f8b22c7e6ae1 +++ guitone/src/view/Guitone.h d0d5ffdcd54c358756c6c2c161609252cbe47c63 @@ -48,6 +48,7 @@ private slots: void showHideIgnoredFiles(); void openSwitchWorkspaceRevisionDialog(); void openPreferencesDialog(); + void openAncestryGraphDialog(); void openKeyManagmentDialog(); private: ============================================================ --- guitone/src/view/dialogs/AncestryGraph.cpp 58a33faa80059e6d49bb56be9e95354f2d92ddcf +++ guitone/src/view/dialogs/AncestryGraph.cpp a4970a0b4d5ea26caefd6043e32cdc8ad72f818c @@ -19,6 +19,7 @@ ***************************************************************************/ #include "AncestryGraph.h" +#include "../../model/Graph.h" #include "../../util/Settings.h" #include "../../monotone/Monotone.h" @@ -27,6 +28,27 @@ AncestryGraph::AncestryGraph(QWidget* pa { setupUi(this); + // some weird macros make demoting a QGraphView as GraphItemView + // impossible, so we use the "hack" of placing the actual view into + // a normal QFrame + QHBoxLayout *hbox = new QHBoxLayout(graphFrame); + hbox->setMargin(0); + hbox->setSpacing(2); + + // create the Graph object, read the graph and + // wrap the item model class around + Graph graph(this); + graph.readGraph(); + graphItemModel = new qan::can::GraphItemModel(graph.getGraph()); + + graphItemView = new qan::can::GraphItemView(graphFrame); + graphItemView->setModel(graphItemModel); + + qan::utl::ProgressVoid progress; + graphItemView->layoutGraph(progress); + + hbox->addWidget(graphItemView); + } AncestryGraph::~AncestryGraph() {} ============================================================ --- guitone/src/view/dialogs/AncestryGraph.h 0c3eec8dc2abc89a2ee10f728d81448cc2bd5479 +++ guitone/src/view/dialogs/AncestryGraph.h 89b850efca4e598ff588051fa42f7978d1ecdaac @@ -22,6 +22,8 @@ #define ANCESTRY_GRAPH_H #include "ui_ancestry_graph.h" +#include "can/canGraphItemView.h" +#include "can/canGraphItemModel.h" class AncestryGraph : public QDialog, private Ui::AncestryGraph { @@ -30,6 +32,10 @@ public: public: AncestryGraph(QWidget*); ~AncestryGraph(); + +private: + qan::can::GraphItemView *graphItemView; + qan::can::GraphItemModel *graphItemModel; }; #endif ============================================================ --- guitone/src/view/dialogs/ui_KeyManagment.h e82e9ba78fec73e56da2e9b08b2d64171849f85d +++ guitone/src/view/dialogs/ui_KeyManagment.h 6f4d50189c605c957aff73cc5da4c740f6b7fff4 @@ -1,3 +1,12 @@ +/******************************************************************************** +** Form generated from reading ui file 'KeyManagment.ui' +** +** Created: Wed Oct 11 01:00:11 2006 +** by: Qt User Interface Compiler version 4.2.0 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + #ifndef UI_KEYMANAGMENT_H #define UI_KEYMANAGMENT_H @@ -30,7 +39,6 @@ public: void setupUi(QDialog *KeyManagment) { KeyManagment->setObjectName(QString::fromUtf8("KeyManagment")); - KeyManagment->resize(QSize(587, 433).expandedTo(KeyManagment->minimumSizeHint())); gridLayout = new QGridLayout(KeyManagment); gridLayout->setSpacing(6); gridLayout->setMargin(9); @@ -82,7 +90,13 @@ public: gridLayout->addLayout(hboxLayout, 2, 0, 1, 1); + retranslateUi(KeyManagment); + + QSize size(587, 433); + size = size.expandedTo(KeyManagment->minimumSizeHint()); + KeyManagment->resize(size); + QObject::connect(okButton, SIGNAL(clicked()), KeyManagment, SLOT(accept())); QObject::connect(cancelButton, SIGNAL(clicked()), KeyManagment, SLOT(reject())); @@ -92,8 +106,8 @@ public: void retranslateUi(QDialog *KeyManagment) { KeyManagment->setWindowTitle(QApplication::translate("KeyManagment", "Key Managment", 0, QApplication::UnicodeUTF8)); - tableWidget->clear(); - tableWidget->setColumnCount(4); + if (tableWidget->columnCount() < 4) + tableWidget->setColumnCount(4); QTableWidgetItem *__colItem = new QTableWidgetItem(); __colItem->setText(QApplication::translate("KeyManagment", "Hash", 0, QApplication::UnicodeUTF8)); @@ -110,7 +124,6 @@ public: QTableWidgetItem *__colItem3 = new QTableWidgetItem(); __colItem3->setText(QApplication::translate("KeyManagment", "Priv Loc", 0, QApplication::UnicodeUTF8)); tableWidget->setHorizontalHeaderItem(3, __colItem3); - tableWidget->setRowCount(0); pushButtonGenerate->setText(QApplication::translate("KeyManagment", "Generate", 0, QApplication::UnicodeUTF8)); pushButtonRemove->setText(QApplication::translate("KeyManagment", "Remove", 0, QApplication::UnicodeUTF8)); okButton->setText(QApplication::translate("KeyManagment", "OK", 0, QApplication::UnicodeUTF8)); ============================================================ --- guitone/src/view/dialogs/ui_ancestry_graph.h 70340c893ab4bfabf9dc46d42fcc0e6eb4ee2a66 +++ guitone/src/view/dialogs/ui_ancestry_graph.h 5afdf1780a162499183f114ae1511bc6678adfd4 @@ -1,8 +1,8 @@ /******************************************************************************** ** Form generated from reading ui file 'ancestry_graph.ui' ** -** Created: Fri Oct 6 23:55:18 2006 -** by: Qt User Interface Compiler version 4.2.0-snapshot-20061003 +** Created: Wed Oct 11 01:00:11 2006 +** by: Qt User Interface Compiler version 4.2.0 ** ** WARNING! All changes made in this file will be lost when recompiling ui file! ********************************************************************************/ @@ -16,46 +16,47 @@ #include #include #include -#include +#include #include -#include "can/canGraphItemView.h" class Ui_AncestryGraph { public: - QHBoxLayout *hboxLayout; QVBoxLayout *vboxLayout; + QVBoxLayout *vboxLayout1; + QFrame *graphFrame; QDialogButtonBox *buttonBox; - GraphItemView *graphView; void setupUi(QDialog *AncestryGraph) { AncestryGraph->setObjectName(QString::fromUtf8("AncestryGraph")); AncestryGraph->setWindowModality(Qt::NonModal); - hboxLayout = new QHBoxLayout(AncestryGraph); - hboxLayout->setSpacing(6); - hboxLayout->setMargin(9); - hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); - vboxLayout = new QVBoxLayout(); + vboxLayout = new QVBoxLayout(AncestryGraph); vboxLayout->setSpacing(6); - vboxLayout->setMargin(0); + vboxLayout->setMargin(9); vboxLayout->setObjectName(QString::fromUtf8("vboxLayout")); + vboxLayout1 = new QVBoxLayout(); + vboxLayout1->setSpacing(6); + vboxLayout1->setMargin(0); + vboxLayout1->setObjectName(QString::fromUtf8("vboxLayout1")); + graphFrame = new QFrame(AncestryGraph); + graphFrame->setObjectName(QString::fromUtf8("graphFrame")); + graphFrame->setFrameShape(QFrame::StyledPanel); + graphFrame->setFrameShadow(QFrame::Sunken); + + vboxLayout1->addWidget(graphFrame); + buttonBox = new QDialogButtonBox(AncestryGraph); buttonBox->setObjectName(QString::fromUtf8("buttonBox")); buttonBox->setOrientation(Qt::Horizontal); buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok); - vboxLayout->addWidget(buttonBox); + vboxLayout1->addWidget(buttonBox); - graphView = new GraphItemView(AncestryGraph); - graphView->setObjectName(QString::fromUtf8("graphView")); - vboxLayout->addWidget(graphView); + vboxLayout->addLayout(vboxLayout1); - hboxLayout->addLayout(vboxLayout); - - retranslateUi(AncestryGraph); QSize size(550, 373); ============================================================ --- guitone/src/view/dialogs/ui_preferences.h 7bf70ad1a88dcebe0fc90dc4eb0a309463676980 +++ guitone/src/view/dialogs/ui_preferences.h f4126778baa21a54133d12046632498cc3477788 @@ -1,3 +1,12 @@ +/******************************************************************************** +** Form generated from reading ui file 'preferences.ui' +** +** Created: Wed Oct 11 01:00:11 2006 +** by: Qt User Interface Compiler version 4.2.0 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + #ifndef UI_PREFERENCES_H #define UI_PREFERENCES_H @@ -31,7 +40,6 @@ public: void setupUi(QDialog *PreferencesDialog) { PreferencesDialog->setObjectName(QString::fromUtf8("PreferencesDialog")); - PreferencesDialog->resize(QSize(404, 140).expandedTo(PreferencesDialog->minimumSizeHint())); QSizePolicy sizePolicy(static_cast(3), static_cast(0)); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); @@ -104,7 +112,13 @@ public: QWidget::setTabOrder(mtnExecutablePath, selectMtnExecutable); QWidget::setTabOrder(selectMtnExecutable, okButton); QWidget::setTabOrder(okButton, cancelButton); + retranslateUi(PreferencesDialog); + + QSize size(404, 140); + size = size.expandedTo(PreferencesDialog->minimumSizeHint()); + PreferencesDialog->resize(size); + QObject::connect(okButton, SIGNAL(clicked()), PreferencesDialog, SLOT(accept())); QObject::connect(cancelButton, SIGNAL(clicked()), PreferencesDialog, SLOT(reject())); ============================================================ --- guitone/src/view/dialogs/ui_switch_workspace.h 9ea0d34e428e64e6f73521babeb3be52b12becd1 +++ guitone/src/view/dialogs/ui_switch_workspace.h 0ec184d42a5f225416e92fba55a4ae8809e093dd @@ -1,3 +1,12 @@ +/******************************************************************************** +** Form generated from reading ui file 'switch_workspace.ui' +** +** Created: Wed Oct 11 01:00:11 2006 +** by: Qt User Interface Compiler version 4.2.0 +** +** WARNING! All changes made in this file will be lost when recompiling ui file! +********************************************************************************/ + #ifndef UI_SWITCH_WORKSPACE_H #define UI_SWITCH_WORKSPACE_H @@ -37,7 +46,6 @@ public: void setupUi(QDialog *SwitchWorkspaceRevision) { SwitchWorkspaceRevision->setObjectName(QString::fromUtf8("SwitchWorkspaceRevision")); - SwitchWorkspaceRevision->resize(QSize(622, 421).expandedTo(SwitchWorkspaceRevision->minimumSizeHint())); vboxLayout = new QVBoxLayout(SwitchWorkspaceRevision); vboxLayout->setSpacing(6); vboxLayout->setMargin(9); @@ -123,7 +131,13 @@ public: QWidget::setTabOrder(revisionList, certList); QWidget::setTabOrder(certList, okButton); QWidget::setTabOrder(okButton, cancelButton); + retranslateUi(SwitchWorkspaceRevision); + + QSize size(622, 421); + size = size.expandedTo(SwitchWorkspaceRevision->minimumSizeHint()); + SwitchWorkspaceRevision->resize(size); + QObject::connect(okButton, SIGNAL(clicked()), SwitchWorkspaceRevision, SLOT(accept())); QObject::connect(cancelButton, SIGNAL(clicked()), SwitchWorkspaceRevision, SLOT(reject()));