# # # add_file "guitone/src/model/GetBranchLog.cpp" # content [163320c1ccf32c2fb964bb49ff5d93bfc1ab78b5] # # add_file "guitone/src/model/GetBranchLog.h" # content [9246d87a81b2746aa9e5b8bc87a2f1b0e4037499] # # patch "guitone/guitone.pro" # from [4d7b37fc37972ff6e8e387cd9d96685b3f5f5793] # to [c39e690b16c4e69b49fb537596e6f414eb9e4cf2] # # patch "guitone/res/i18n/guitone_de.ts" # from [db1af251ea647d64599652b8107a5bf63e5e7f10] # to [6a9a72e618efd019a7f5ffbe58ca4e669c5c6ec4] # # patch "guitone/src/model/ChangesetModel.cpp" # from [da747f356974cb854d4df1cf3b049ebc886150c9] # to [f66f6d69e00e8e0a8abee189696fe1dde3ef0c8b] # # patch "guitone/src/model/ChangesetModel.h" # from [de65803c9618125cd0f9983a3bf1af3b36bb9499] # to [a3d409b3a0c98567d4df0df21acfff1e55913223] # ============================================================ --- guitone/src/model/GetBranchLog.cpp 163320c1ccf32c2fb964bb49ff5d93bfc1ab78b5 +++ guitone/src/model/GetBranchLog.cpp 163320c1ccf32c2fb964bb49ff5d93bfc1ab78b5 @@ -0,0 +1,77 @@ +/*************************************************************************** + * 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 "GetBranchLog.h" + +GetBranchLog::GetBranchLog(QString branch, QObject *parent) : QObject(parent) +{ + this->branch = branch; + selectModel = new Select(this); + revSortModel = new Toposort(this); + ancestorModel = new Ancestors(this); + revSortModel->setSourceModel(ancestorModel); + connect(selectModel, SIGNAL(selectionRead()), + this, SLOT(selectionReady())); + connect(revSortModel, SIGNAL(sortingFinished()), + this, SLOT(revisionsReady())); + connect(this, SIGNAL(commandDone(GetBranchLog *)), + parent, SLOT(branchLogRead(GetBranchLog *))); + selectModel->readSelection("h:" + branch); +} + +GetBranchLog::~GetBranchLog() +{ + delete selectModel; + delete revSortModel; + delete ancestorModel; +} + +QString GetBranchLog::getBranch() +{ + return branch; +} + +QStringList GetBranchLog::getRevisions() +{ + return revisions; +} + +void GetBranchLog::selectionReady() +{ + QStringList heads; + int count = selectModel->rowCount(QModelIndex()); + for(int i = 0; i < count; i++) + { + heads << selectModel->data(selectModel->index(i, 0, QModelIndex()), Qt::DisplayRole).toString(); + } + + ancestorModel->readAncestors(heads); +} + +void GetBranchLog::revisionsReady() +{ + int count = revSortModel->rowCount(QModelIndex()); + for(int i = 0; i < count; i++) + { + revSortModel->sort(0, Qt::AscendingOrder); + revisions << revSortModel->QSortFilterProxyModel::data(revSortModel->index(i, 0, QModelIndex()), Qt::DisplayRole).toString(); + } + emit commandDone(this); +} ============================================================ --- guitone/src/model/GetBranchLog.h 9246d87a81b2746aa9e5b8bc87a2f1b0e4037499 +++ guitone/src/model/GetBranchLog.h 9246d87a81b2746aa9e5b8bc87a2f1b0e4037499 @@ -0,0 +1,56 @@ +/*************************************************************************** + * 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 GETBRANCHLOG_H +#define GETBRANCHLOG_H + +#include "Ancestors.h" +#include "Select.h" +#include "Toposort.h" + +#include + + +class GetBranchLog : public QObject +{ + Q_OBJECT +public: + GetBranchLog(QString branch, QObject *parent); + ~GetBranchLog(); + + QStringList getRevisions(); + QString getBranch(); + +signals: + void commandDone(GetBranchLog *); + +private: + QString branch; + QStringList revisions; + Select * selectModel; + Toposort * revSortModel; + Ancestors * ancestorModel; + +private slots: + void selectionReady(); + void revisionsReady(); +}; + +#endif //GETBRANCHLOG_H ============================================================ --- guitone/guitone.pro 4d7b37fc37972ff6e8e387cd9d96685b3f5f5793 +++ guitone/guitone.pro c39e690b16c4e69b49fb537596e6f414eb9e4cf2 @@ -48,6 +48,7 @@ HEADERS += src/view/MainWindow.h \ src/model/Toposort.h \ src/model/Manifest.h \ src/model/Ancestors.h \ + src/model/GetBranchLog.h \ src/util/IconProvider.h \ src/util/StanzaParser.h \ src/util/Settings.h \ @@ -93,6 +94,7 @@ SOURCES += src/view/MainWindow.cpp \ src/model/Toposort.cpp \ src/model/Manifest.cpp \ src/model/Ancestors.cpp \ + src/model/GetBranchLog.cpp \ src/util/IconProvider.cpp \ src/util/StanzaParser.cpp \ src/util/Settings.cpp \ ============================================================ --- guitone/res/i18n/guitone_de.ts db1af251ea647d64599652b8107a5bf63e5e7f10 +++ guitone/res/i18n/guitone_de.ts 6a9a72e618efd019a7f5ffbe58ca4e669c5c6ec4 @@ -136,10 +136,25 @@ ChangesetModel - + Revision ID Revisions-ID + + + Date + Datum + + + + Author + Autor + + + + Changelog + + ContentDiff ============================================================ --- guitone/src/model/ChangesetModel.cpp da747f356974cb854d4df1cf3b049ebc886150c9 +++ guitone/src/model/ChangesetModel.cpp f66f6d69e00e8e0a8abee189696fe1dde3ef0c8b @@ -23,26 +23,13 @@ ChangesetModel::ChangesetModel(QObject * ChangesetModel::ChangesetModel(QObject *parent) : QAbstractItemModel(parent) { currentBranch = ""; - selectModel = new Select(this); - revSortModel = new Toposort(this); - ancestorModel = new Ancestors(this); - revSortModel->setSourceModel(ancestorModel); - connect(selectModel, SIGNAL(selectionRead()), - this, SLOT(selectionReady())); - connect(revSortModel, SIGNAL(sortingFinished()), - this, SLOT(revisionsReady())); } -ChangesetModel::~ChangesetModel() -{ - delete selectModel; - delete revSortModel; - delete ancestorModel; -} +ChangesetModel::~ChangesetModel() {} void ChangesetModel::receiveRevisions() { - + } void ChangesetModel::setBranch(QString branch) @@ -50,37 +37,21 @@ void ChangesetModel::setBranch(QString b currentBranch = branch; if(branchMap[currentBranch].count() == 0) { - selectModel->readSelection("h:" + currentBranch); + GetBranchLog *glog = new GetBranchLog(branch, this); + } else reset(); } -void ChangesetModel::selectionReady() +void ChangesetModel::branchLogRead(GetBranchLog *glog) { - QStringList heads; - int count = selectModel->rowCount(QModelIndex()); - for(int i = 0; i < count; i++) - { - heads << selectModel->data(selectModel->index(i, 0, QModelIndex()), Qt::DisplayRole).toString(); - } - - ancestorModel->readAncestors(heads); + QString branch = glog->getBranch(); + branchMap[branch] << glog->getRevisions(); + if(branch == currentBranch) reset(); + delete glog; } -void ChangesetModel::revisionsReady() -{ - QStringList *list = &branchMap[currentBranch]; - int count = revSortModel->rowCount(QModelIndex()); - for(int i = 0; i < count; i++) - { - revSortModel->sort(0, Qt::AscendingOrder); - (*list) << revSortModel->QSortFilterProxyModel::data(revSortModel->index(i, 0, QModelIndex()), Qt::DisplayRole).toString(); - } - reset(); - receiveRevisions(); -} - int ChangesetModel::columnCount(const QModelIndex &parent) const { return 4; ============================================================ --- guitone/src/model/ChangesetModel.h de65803c9618125cd0f9983a3bf1af3b36bb9499 +++ guitone/src/model/ChangesetModel.h a3d409b3a0c98567d4df0df21acfff1e55913223 @@ -22,9 +22,7 @@ #define CHANGESETMODE_H #include "Changeset.h" -#include "Ancestors.h" -#include "Select.h" -#include "Toposort.h" +#include "GetBranchLog.h" #include @@ -52,18 +50,14 @@ public: int rowCount(const QModelIndex&) const; int columnCount(const QModelIndex&) const; -private slots: - void selectionReady(); - void revisionsReady(); - private: QString currentBranch; static const int revPerReceive = 50; - Select * selectModel; - Toposort * revSortModel; - Ancestors * ancestorModel; BranchMap branchMap; ChangesetMap changesetMap; + +private slots: + void branchLogRead(GetBranchLog *); }; #endif //CHANGESETMODE_H