grandmas-svn-commit Mailing List for Grandma's SVN (Page 6)
Brought to you by:
matthiasmiller
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(7) |
Jun
|
Jul
(3) |
Aug
(15) |
Sep
(8) |
Oct
(36) |
Nov
(26) |
Dec
(51) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(18) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mat...@us...> - 2006-10-23 23:40:01
|
Revision: 42 http://svn.sourceforge.net/grandmas-svn/?rev=42&view=rev Author: matthiasmiller Date: 2006-10-23 16:39:57 -0700 (Mon, 23 Oct 2006) Log Message: ----------- remove destination file path for copies Modified Paths: -------------- trunk/include/svn/modification.h trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-10-13 16:40:55 UTC (rev 41) +++ trunk/include/svn/modification.h 2006-10-23 23:39:57 UTC (rev 42) @@ -64,10 +64,10 @@ QString getFilePath() const { return mFilePath; } Type getType() const { return mType; } - // Only use for move and copy mods - QString getDestFilePath() const + // Only use for move mods + QString getMoveDestFilePath() const { - Q_ASSERT(mType == Type_Move || mType == Type_Copy); + Q_ASSERT(mType == Type_Move); return mDestFilePath; } Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-10-13 16:40:55 UTC (rev 41) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-10-23 23:39:57 UTC (rev 42) @@ -124,8 +124,8 @@ } else if (isPathColumn(rcIndex.column())) { - if (mod.getType() == Modification::Type_Move || mod.getType() == Modification::Type_Copy) - return mod.getFilePath() + "\n" + mod.getDestFilePath(); + if (mod.getType() == Modification::Type_Move) + return mod.getFilePath() + "\n" + mod.getMoveDestFilePath(); else return mod.getFilePath(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-13 16:41:18
|
Revision: 41 http://svn.sourceforge.net/grandmas-svn/?rev=41&view=rev Author: matthiasmiller Date: 2006-10-13 09:40:55 -0700 (Fri, 13 Oct 2006) Log Message: ----------- -bracket allColumnsShowFocus setting to allow building with Qt 4.1 -rename "Type" column to "Status" Modified Paths: -------------- trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp trunk/src/dialogs/open.cpp trunk/ui/commit.ui trunk/ui/mainwindow.ui Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-10-06 23:27:23 UTC (rev 40) +++ trunk/src/dialogs/commit.cpp 2006-10-13 16:40:55 UTC (rev 41) @@ -32,6 +32,9 @@ mpUi = new Ui_CommitDialog(); mpUi->setupUi(this); +#if QT_VERSION >= 0x040200 + mpUi->changesTreeView->setAllColumnsShowFocus(true); +#endif mpModificationsModel = new ModificationsModel(); mpModificationsModel->setAllowSelections(true); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-06 23:27:23 UTC (rev 40) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-13 16:40:55 UTC (rev 41) @@ -37,6 +37,10 @@ mpUi = new Ui_MainWindow(); mpUi->setupUi(this); +#if QT_VERSION >= 0x040200 + mpUi->changesTreeView->setAllColumnsShowFocus(true); +#endif + connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); connect(mpUi->moveButton, SIGNAL(clicked()), this, SLOT(move())); @@ -105,4 +109,4 @@ mpModificationsModel->showModifications(summary.modifications()); else mpModificationsModel->showError(error); -} \ No newline at end of file +} Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 23:27:23 UTC (rev 40) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-10-13 16:40:55 UTC (rev 41) @@ -72,7 +72,7 @@ { // Top headings if (isTypeColumn(section)) - return tr("Type"); + return tr("Status"); else if (isPathColumn(section)) return tr("File"); else Modified: trunk/src/dialogs/open.cpp =================================================================== --- trunk/src/dialogs/open.cpp 2006-10-06 23:27:23 UTC (rev 40) +++ trunk/src/dialogs/open.cpp 2006-10-13 16:40:55 UTC (rev 41) @@ -60,8 +60,8 @@ void OpenDialog::openOther() { - QString other = QFileDialog::getExistingDirectory(this); - if (!other.isNull()) + QString other = QFileDialog::getExistingDirectory(this); + if (!other.isNull()) { // TODO: give an error if this is not a valid working copy QModelIndex index = mpPathsModel->addPath(other); Modified: trunk/ui/commit.ui =================================================================== --- trunk/ui/commit.ui 2006-10-06 23:27:23 UTC (rev 40) +++ trunk/ui/commit.ui 2006-10-13 16:40:55 UTC (rev 41) @@ -71,9 +71,6 @@ <property name="itemsExpandable" > <bool>false</bool> </property> - <property name="allColumnsShowFocus" > - <bool>true</bool> - </property> </widget> </item> <item> Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-10-06 23:27:23 UTC (rev 40) +++ trunk/ui/mainwindow.ui 2006-10-13 16:40:55 UTC (rev 41) @@ -162,9 +162,6 @@ <property name="itemsExpandable" > <bool>false</bool> </property> - <property name="allColumnsShowFocus" > - <bool>true</bool> - </property> </widget> </item> <item> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-06 23:27:30
|
Revision: 40 http://svn.sourceforge.net/grandmas-svn/?rev=40&view=rev Author: matthiasmiller Date: 2006-10-06 16:27:23 -0700 (Fri, 06 Oct 2006) Log Message: ----------- allow modifications to be checked/unchecked in commit dialog Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/include/svn/modification.h trunk/include/svn/revision.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/modificationsmodel.cpp trunk/src/svn/commit_summary.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-10-06 22:36:36 UTC (rev 39) +++ trunk/include/dialogs/modificationsmodel.h 2006-10-06 23:27:23 UTC (rev 40) @@ -36,6 +36,9 @@ virtual int rowCount(const QModelIndex& rcParent = QModelIndex()) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; virtual QVariant data(const QModelIndex& rcIndex, int role = Qt::DisplayRole) const; + + virtual bool setData(const QModelIndex& rcIndex, const QVariant& rcValue, int role); + virtual Qt::ItemFlags flags(const QModelIndex& rcIndex) const; void setAllowSelections(bool allowSelections); @@ -49,6 +52,6 @@ bool isPathColumn(int col) const; QString mError; - QList<Modification> mModifications; + QList<Modification> mAllModifications, mDeclinedModifications; bool mAllowSelections; }; Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-10-06 22:36:36 UTC (rev 39) +++ trunk/include/svn/modification.h 2006-10-06 23:27:23 UTC (rev 40) @@ -46,6 +46,21 @@ Type_Conflicting, }; + bool operator==(const Modification& rcOther) const + { + if (mType != rcOther.mType) return false; + if (mFilePath != rcOther.mFilePath) return false; + if (mDestFilePath != rcOther.mDestFilePath) return false; + if (mOldRevision != rcOther.mOldRevision) return false; + if (mNewRevision != rcOther.mNewRevision) return false; + + return true; + } + bool operator!=(const Modification& rcOther) const + { + return !(*this == rcOther); + } + QString getFilePath() const { return mFilePath; } Type getType() const { return mType; } @@ -62,8 +77,8 @@ Type mType; QString mFilePath; QString mDestFilePath; - Revision oldRevision; - Revision newRevision; + Revision mOldRevision; + Revision mNewRevision; }; #endif Modified: trunk/include/svn/revision.h =================================================================== --- trunk/include/svn/revision.h 2006-10-06 22:36:36 UTC (rev 39) +++ trunk/include/svn/revision.h 2006-10-06 23:27:23 UTC (rev 40) @@ -31,6 +31,20 @@ Revision(); ~Revision(); + bool operator==(const Revision& rcOther) const + { + if (mIsCommitted != rcOther.mIsCommitted) + return false; + if (mIsCommitted && mCommittedRevision != rcOther.mCommittedRevision) + return false; + + return true; + } + bool operator!=(const Revision& rcOther) const + { + return !(*this == rcOther); + } + void setUncommittedRevision(); void setCommittedRevision(int revision); Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-10-06 22:36:36 UTC (rev 39) +++ trunk/src/dialogs/commit.cpp 2006-10-06 23:27:23 UTC (rev 40) @@ -76,4 +76,5 @@ if (mpModificationsModel->hasCheckboxColumn()) mpUi->changesTreeView->resizeColumnToContents(mpModificationsModel->getCheckboxColumn()); -} \ No newline at end of file +} + Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 22:36:36 UTC (rev 39) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 23:27:23 UTC (rev 40) @@ -36,14 +36,14 @@ { GSVN_ASSERT(!error.isNull()); mError = error; - mModifications.clear(); + mAllModifications.clear(); emit layoutChanged(); } void ModificationsModel::showModifications(const QList<Modification>& rcModifications) { mError = QString(); - mModifications = rcModifications; + mAllModifications = rcModifications; emit layoutChanged(); } @@ -63,7 +63,7 @@ if (!mError.isEmpty()) return 1; - return mModifications.size(); + return mAllModifications.size(); } QVariant ModificationsModel::headerData(int section, Qt::Orientation orientation, int role) const @@ -84,18 +84,22 @@ QVariant ModificationsModel::data(const QModelIndex& rcIndex, int role) const { - if (role == Qt::DisplayRole) + if (!mError.isEmpty()) { - if (isErrorColumn(rcIndex.column())) + // show error? + if (role == Qt::DisplayRole && isErrorColumn(rcIndex.column())) return mError; - - if (!rcIndex.isValid()) - return QVariant(); - if (rcIndex.row() >= mModifications.size()) - return QVariant(); - - Modification mod = mModifications.at(rcIndex.row()); + return QVariant(); + } + + // require a valid modification + if (!rcIndex.isValid() || rcIndex.row() >= mAllModifications.size()) + return QVariant(); + + Modification mod = mAllModifications.at(rcIndex.row()); + if (role == Qt::DisplayRole) + { if (isCheckboxColumn(rcIndex.column())) { return QVariant(); @@ -131,7 +135,12 @@ else if (role == Qt::CheckStateRole) { if (isCheckboxColumn(rcIndex.column())) - return Qt::Checked; + { + if (mDeclinedModifications.contains(mod)) + return Qt::Unchecked; + else + return Qt::Checked; + } return QVariant(); } @@ -139,6 +148,43 @@ return QVariant(); } +bool ModificationsModel::setData(const QModelIndex& rcIndex, const QVariant& rcValue, int role) +{ + if (isCheckboxColumn(rcIndex.column()) && rcValue.canConvert(QVariant::Bool) && + rcIndex.isValid() && rcIndex.row() < mAllModifications.size()) + { + Modification mod = mAllModifications.at(rcIndex.row()); + if (rcValue.toBool()) + { + // remove from list of declined mods + mDeclinedModifications.removeAll(mod); + } + else + { + // add to the list of declined modifications + if (!mDeclinedModifications.contains(mod)) + mDeclinedModifications.push_back(mod); + } + + return true; + } + else + return QAbstractListModel::setData(rcIndex, rcValue, role); +} + +Qt::ItemFlags ModificationsModel::flags(const QModelIndex& rcIndex) const +{ + Qt::ItemFlags flags = QAbstractListModel::flags(rcIndex); + + if (isCheckboxColumn(rcIndex.column())) + { + // Enable checkboxes + if (rcIndex.isValid() && rcIndex.row() < mAllModifications.size()) + flags |= Qt::ItemIsUserCheckable; + } + return flags; +} + void ModificationsModel::setAllowSelections(bool allowSelections) { mAllowSelections = allowSelections; Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-10-06 22:36:36 UTC (rev 39) +++ trunk/src/svn/commit_summary.cpp 2006-10-06 23:27:23 UTC (rev 40) @@ -96,8 +96,8 @@ mod.mFilePath = path; - mod.newRevision.setCommittedRevision(revision); - mod.oldRevision.setCommittedRevision(revision-1); + mod.mNewRevision.setCommittedRevision(revision); + mod.mOldRevision.setCommittedRevision(revision-1); svn_log_changed_path_t *log_item = reinterpret_cast<svn_log_changed_path_t *>(val); switch (log_item->action) { @@ -133,11 +133,11 @@ CommitSummary* pThis = (CommitSummary*)baton; Modification mod; - mod.newRevision = pThis->mRevision; + mod.mNewRevision = pThis->mRevision; // Set old revision to base, if the file is already under version control if (status->entry) - mod.oldRevision.setCommittedRevision(status->entry->revision); + mod.mOldRevision.setCommittedRevision(status->entry->revision); switch (status->text_status) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-06 22:36:39
|
Revision: 39 http://svn.sourceforge.net/grandmas-svn/?rev=39&view=rev Author: matthiasmiller Date: 2006-10-06 15:36:36 -0700 (Fri, 06 Oct 2006) Log Message: ----------- show read-only checkboxes in commit dialog Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-10-06 19:20:47 UTC (rev 38) +++ trunk/include/dialogs/modificationsmodel.h 2006-10-06 22:36:36 UTC (rev 39) @@ -39,7 +39,16 @@ void setAllowSelections(bool allowSelections); + bool hasCheckboxColumn() const; + int getCheckboxColumn() const; + private: + bool isErrorColumn(int col) const; + bool isCheckboxColumn(int col) const; + bool isTypeColumn(int col) const; + bool isPathColumn(int col) const; + QString mError; QList<Modification> mModifications; + bool mAllowSelections; }; Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-10-06 19:20:47 UTC (rev 38) +++ trunk/src/dialogs/commit.cpp 2006-10-06 22:36:36 UTC (rev 39) @@ -34,6 +34,7 @@ mpUi->setupUi(this); mpModificationsModel = new ModificationsModel(); + mpModificationsModel->setAllowSelections(true); mpUi->changesTreeView->setModel(mpModificationsModel); reload(); @@ -71,5 +72,8 @@ if (summary.init(*mpContext, mPath, Revision(), error)) mpModificationsModel->showModifications(summary.modifications()); else - mpModificationsModel->showError(error); + mpModificationsModel->showError(error); + + if (mpModificationsModel->hasCheckboxColumn()) + mpUi->changesTreeView->resizeColumnToContents(mpModificationsModel->getCheckboxColumn()); } \ No newline at end of file Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 19:20:47 UTC (rev 38) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 22:36:36 UTC (rev 39) @@ -22,7 +22,9 @@ #include "svn/modification.h" #include "svn/revision.h" -ModificationsModel::ModificationsModel() +#include <QSize> + +ModificationsModel::ModificationsModel() : mAllowSelections(false) { } @@ -48,81 +50,133 @@ int ModificationsModel::columnCount(const QModelIndex &rcParent) const { Q_UNUSED(rcParent); - return mError.isEmpty() ? 2 : 1; + + if (!mError.isEmpty()) + return 1; + return mAllowSelections ? 3 : 2; } int ModificationsModel::rowCount(const QModelIndex& rcParent) const { Q_UNUSED(rcParent); - if (mError.isEmpty()) - return mModifications.size(); - else + if (!mError.isEmpty()) return 1; + + return mModifications.size(); } QVariant ModificationsModel::headerData(int section, Qt::Orientation orientation, int role) const { - Q_UNUSED(orientation); - - if (role != Qt::DisplayRole) - return QVariant(); - - if (!mError.isEmpty()) - return QVariant(); - - switch (section) + if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { - case 0: return tr("Type"); - case 1: return tr("File"); - default: - Q_ASSERT(false); + // Top headings + if (isTypeColumn(section)) + return tr("Type"); + else if (isPathColumn(section)) + return tr("File"); + else return QVariant(); } + else + return QVariant(); } QVariant ModificationsModel::data(const QModelIndex& rcIndex, int role) const { - if (!rcIndex.isValid()) - return QVariant(); - - if (role != Qt::DisplayRole) - return QVariant(); + if (role == Qt::DisplayRole) + { + if (isErrorColumn(rcIndex.column())) + return mError; - if (!mError.isEmpty()) - return mError; + if (!rcIndex.isValid()) + return QVariant(); + + if (rcIndex.row() >= mModifications.size()) + return QVariant(); + + Modification mod = mModifications.at(rcIndex.row()); + if (isCheckboxColumn(rcIndex.column())) + { + return QVariant(); + } + else if (isTypeColumn(rcIndex.column())) + { + switch (mod.getType()) + { + case Modification::Type_TextMod: return tr("Modified"); + case Modification::Type_Add: return tr("Added"); + case Modification::Type_Delete: return tr("Deleted"); + case Modification::Type_Move: return tr("Moved"); + case Modification::Type_PropMod: return tr("Property Modified"); + case Modification::Type_Copy: return tr("Copied"); + case Modification::Type_New: return tr("?"); + case Modification::Type_Missing: return tr("!"); + case Modification::Type_Conflicting: return tr("Conflicting"); + } - if (rcIndex.row() >= mModifications.size()) - return QVariant(); - - Modification mod = mModifications.at(rcIndex.row()); - switch (rcIndex.column()) - { - case 0: - switch (mod.getType()) + Q_ASSERT(false); + return QVariant(); + } + else if (isPathColumn(rcIndex.column())) { - case Modification::Type_TextMod: return tr("Modified"); - case Modification::Type_Add: return tr("Added"); - case Modification::Type_Delete: return tr("Deleted"); - case Modification::Type_Move: return tr("Moved"); - case Modification::Type_PropMod: return tr("Property Modified"); - case Modification::Type_Copy: return tr("Copied"); - case Modification::Type_New: return tr("?"); - case Modification::Type_Missing: return tr("!"); - case Modification::Type_Conflicting: return tr("Conflicting"); + if (mod.getType() == Modification::Type_Move || mod.getType() == Modification::Type_Copy) + return mod.getFilePath() + "\n" + mod.getDestFilePath(); + else + return mod.getFilePath(); } - - Q_ASSERT(false); - return QVariant(); - - case 1: - if (mod.getType() == Modification::Type_Move || mod.getType() == Modification::Type_Copy) - return mod.getFilePath() + "\n" + mod.getDestFilePath(); else - return mod.getFilePath(); + return QVariant(); + } + else if (role == Qt::CheckStateRole) + { + if (isCheckboxColumn(rcIndex.column())) + return Qt::Checked; - default: - Q_ASSERT(false); return QVariant(); } + else + return QVariant(); } + +void ModificationsModel::setAllowSelections(bool allowSelections) +{ + mAllowSelections = allowSelections; +} + +bool ModificationsModel::hasCheckboxColumn() const +{ + return mError.isEmpty() && mAllowSelections; +} + +int ModificationsModel::getCheckboxColumn() const +{ + GSVN_ASSERT(hasCheckboxColumn()); + return 0; +} + +bool ModificationsModel::isErrorColumn(int col) const +{ + if (mError.isEmpty()) + return false; + return col == 0; +} + +bool ModificationsModel::isCheckboxColumn(int col) const +{ + return hasCheckboxColumn() && getCheckboxColumn() == col; +} + +bool ModificationsModel::isTypeColumn(int col) const +{ + if (!mError.isEmpty()) + return false; + return col == (mAllowSelections ? 1 : 0); +} + +bool ModificationsModel::isPathColumn(int col) const +{ + if (!mError.isEmpty()) + return false; + return col == (mAllowSelections ? 2 : 1); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-06 19:20:50
|
Revision: 38 http://svn.sourceforge.net/grandmas-svn/?rev=38&view=rev Author: matthiasmiller Date: 2006-10-06 12:20:47 -0700 (Fri, 06 Oct 2006) Log Message: ----------- fix crash when closing MainWindow Modified Paths: -------------- trunk/src/dialogs/mainwindow.cpp Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-06 18:46:27 UTC (rev 37) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-06 19:20:47 UTC (rev 38) @@ -63,12 +63,12 @@ MainWindow::~MainWindow() { - delete mpUi; - mpUi = NULL; - mpUi->changesTreeView->setModel(NULL); delete mpModificationsModel; mpModificationsModel = NULL; + + delete mpUi; + mpUi = NULL; mpContext = NULL; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-06 18:46:33
|
Revision: 37 http://svn.sourceforge.net/grandmas-svn/?rev=37&view=rev Author: matthiasmiller Date: 2006-10-06 11:46:27 -0700 (Fri, 06 Oct 2006) Log Message: ----------- minor tweaks to svn tests Modified Paths: -------------- trunk/include/svn/commit_summary.h trunk/src/svn/commit_summary.cpp trunk/tests/svn_test.cpp trunk/tests/svn_test.h Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-10-06 17:50:54 UTC (rev 36) +++ trunk/include/svn/commit_summary.h 2006-10-06 18:46:27 UTC (rev 37) @@ -33,6 +33,7 @@ class CommitSummary { public: + // Must be passed a working copy path (TODO: support full repo path) bool init(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, QString& rError); // These functions should only be called for committed revisions Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-10-06 17:50:54 UTC (rev 36) +++ trunk/src/svn/commit_summary.cpp 2006-10-06 18:46:27 UTC (rev 37) @@ -37,8 +37,9 @@ if (!Operation::initAuthProviders(ctx, rContext, rError)) return false; - if (!Operation::getRelativeRepoUrl(rContext, fullRepoPath, ctx, mWcPath, rError)) - return false; + // TODO: This isn't working. Figure out why. + //if (!Operation::getRelativeRepoUrl(rContext, fullRepoPath, ctx, mWcPath, rError)) + // return false; svn_error_t* pError = NULL; if (revision.isCommittedRevision()) @@ -120,8 +121,6 @@ pThis->mModifications.append(mod); } - return NULL; - pThis->mAuthor = author; //pThis->mDate = date; pThis->mLogMessage = message; Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-10-06 17:50:54 UTC (rev 36) +++ trunk/tests/svn_test.cpp 2006-10-06 18:46:27 UTC (rev 37) @@ -247,9 +247,9 @@ rev.setCommittedRevision(1); CommitSummary summary; - QVERIFY(summary.init(*mpContext, getRepoPath(), rev, rError)); + QVERIFY(summary.init(*mpContext, getWcPath(), rev, rError)); - QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); + //QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); // TODO: set when committing //QCOMPARE(summary.getCommitDate(), bogus); // TODO: fill in QCOMPARE(summary.getCommitLogMessage(), QString("first commit")); } Modified: trunk/tests/svn_test.h =================================================================== --- trunk/tests/svn_test.h 2006-10-06 17:50:54 UTC (rev 36) +++ trunk/tests/svn_test.h 2006-10-06 18:46:27 UTC (rev 37) @@ -56,8 +56,8 @@ ~SvnTester(); private: - QString getRepoPath() { return QDir::convertSeparators(QDir::tempPath()+"/gsvn_repo"); } - QString getWcPath() { return QDir::convertSeparators(QDir::tempPath()+"/gsvn_wc"); } + QString getRepoPath() { return QDir::cleanPath(QDir::convertSeparators(QDir::tempPath()+"/gsvn_repo")); } + QString getWcPath() { return QDir::cleanPath(QDir::convertSeparators(QDir::tempPath()+"/gsvn_wc")); } bool commitChanges(QString commitMessage); bool addFile(QString relFilePath); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-06 17:50:59
|
Revision: 36 http://svn.sourceforge.net/grandmas-svn/?rev=36&view=rev Author: matthiasmiller Date: 2006-10-06 10:50:54 -0700 (Fri, 06 Oct 2006) Log Message: ----------- start showing modifications in MainWindow and CommitDialog Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/dialogs/commit.h trunk/include/dialogs/mainwindow.h trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp Removed Paths: ------------- trunk/src/svn/modification.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/grandmas_svn.pro 2006-10-06 17:50:54 UTC (rev 36) @@ -135,7 +135,6 @@ src/settings/userpaths.cpp \ src/svn/commit_summary.cpp \ src/svn/file_access.cpp \ - src/svn/modification.cpp \ src/svn/operation.cpp \ src/svn/operation_internal.cpp \ src/svn/revision.cpp \ Modified: trunk/include/dialogs/commit.h =================================================================== --- trunk/include/dialogs/commit.h 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/include/dialogs/commit.h 2006-10-06 17:50:54 UTC (rev 36) @@ -24,16 +24,27 @@ #include <QDialog> +class ModificationsModel; +class SvnOperationContext; class Ui_CommitDialog; class CommitDialog : public QDialog { public: - CommitDialog(QWidget* pParent); + CommitDialog(SvnOperationContext* pContext, QString path, QWidget* pParent); ~CommitDialog(); +protected: + virtual void changeEvent(QEvent* pEvent); + private: + void reload(); + Ui_CommitDialog* mpUi; + + SvnOperationContext* mpContext; + QString mPath; + ModificationsModel* mpModificationsModel; }; #endif Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/include/dialogs/mainwindow.h 2006-10-06 17:50:54 UTC (rev 36) @@ -44,6 +44,8 @@ void move(); private: + void reload(); + Ui_MainWindow* mpUi; SvnOperationContext* mpContext; QString mPath; Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/include/dialogs/modificationsmodel.h 2006-10-06 17:50:54 UTC (rev 36) @@ -29,8 +29,6 @@ ModificationsModel(); virtual ~ModificationsModel(); - void loadFromRevision(SvnOperationContext* pContext, QString path, Revision revision); - void showError(QString error); void showModifications(const QList<Modification>& rcModifications); Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/src/dialogs/commit.cpp 2006-10-06 17:50:54 UTC (rev 36) @@ -19,14 +19,25 @@ ***************************************************************************/ #include "dialogs/commit.h" +#include "dialogs/modificationsmodel.h" #include "dialogs/util.h" +#include "svn/commit_summary.h" +#include "svn/revision.h" #include "ui_commit.h" -CommitDialog::CommitDialog(QWidget* pParent) : QDialog(pParent) +CommitDialog::CommitDialog(SvnOperationContext* pContext, QString path, QWidget* pParent) : QDialog(pParent) { + mpContext = pContext; + mPath = path; + mpUi = new Ui_CommitDialog(); mpUi->setupUi(this); + mpModificationsModel = new ModificationsModel(); + mpUi->changesTreeView->setModel(mpModificationsModel); + + reload(); + #ifdef Q_WS_MAC exchangeWidgets(mpUi->hboxLayout, mpUi->okButton, mpUi->cancelButton); #endif @@ -34,6 +45,31 @@ CommitDialog::~CommitDialog() { + mpUi->changesTreeView->setModel(NULL); + delete mpModificationsModel; + mpModificationsModel = NULL; + delete mpUi; mpUi = NULL; } + +void CommitDialog::changeEvent(QEvent* pEvent) +{ + QDialog::changeEvent(pEvent); + + if (pEvent->type() == QEvent::ActivationChange && isActiveWindow()) + { + if (mpModificationsModel) + reload(); + } +} + +void CommitDialog::reload() +{ + CommitSummary summary; + QString error; + if (summary.init(*mpContext, mPath, Revision(), error)) + mpModificationsModel->showModifications(summary.modifications()); + else + mpModificationsModel->showError(error); +} \ No newline at end of file Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-06 17:50:54 UTC (rev 36) @@ -23,6 +23,7 @@ #include "dialogs/commit.h" #include "dialogs/modificationsmodel.h" #include "dialogs/move.h" +#include "svn/commit_summary.h" #include "svn/revision.h" #include "ui_mainwindow.h" @@ -34,15 +35,16 @@ mpContext = pContext; mPath = path; - mpModificationsModel = new ModificationsModel(); - mpModificationsModel->loadFromRevision(mpContext, mPath, mDisplayedRevision); - mpUi = new Ui_MainWindow(); mpUi->setupUi(this); connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); connect(mpUi->moveButton, SIGNAL(clicked()), this, SLOT(move())); + + mpModificationsModel = new ModificationsModel(); mpUi->changesTreeView->setModel(mpModificationsModel); + reload(); + const svn_version_t* pVersion = svn_client_version(); QString msg; @@ -79,13 +81,13 @@ { // Refresh the modifications if it doesn't require server access. if (mpModificationsModel && !mDisplayedRevision.isCommittedRevision()) - mpModificationsModel->loadFromRevision(mpContext, mPath, mDisplayedRevision); + reload(); } } void MainWindow::commit() { - CommitDialog dlg(this); + CommitDialog dlg(mpContext, mPath, this); dlg.exec(); } @@ -94,3 +96,13 @@ MoveDialog dlg(this); dlg.exec(); } + +void MainWindow::reload() +{ + CommitSummary summary; + QString error; + if (summary.init(*mpContext, mPath, mDisplayedRevision, error)) + mpModificationsModel->showModifications(summary.modifications()); + else + mpModificationsModel->showError(error); +} \ No newline at end of file Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 17:50:54 UTC (rev 36) @@ -30,16 +30,6 @@ { } -void ModificationsModel::loadFromRevision(SvnOperationContext* pContext, QString path, Revision revision) -{ -// Modifications mods; -// QString error; -// if (mods.init(*pContext, path, revision, error)) -// showModifications(mods.modifications()); -// else -// showError(error); -} - void ModificationsModel::showError(QString error) { GSVN_ASSERT(!error.isNull()); Deleted: trunk/src/svn/modification.cpp =================================================================== --- trunk/src/svn/modification.cpp 2006-10-06 14:53:39 UTC (rev 35) +++ trunk/src/svn/modification.cpp 2006-10-06 17:50:54 UTC (rev 36) @@ -1,19 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Matthias Miller * - * ad...@gr... * - * * - * 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. * - ***************************************************************************/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-10-06 14:54:09
|
Revision: 35 http://svn.sourceforge.net/grandmas-svn/?rev=35&view=rev Author: highjinx Date: 2006-10-06 07:53:39 -0700 (Fri, 06 Oct 2006) Log Message: ----------- Heavily rework svn wrapper code. Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/svn/commit_summary.h trunk/include/svn/file_access.h trunk/include/svn/modification.h trunk/src/dialogs/modificationsmodel.cpp trunk/src/svn/file_access.cpp trunk/src/svn/modification.cpp trunk/tests/svn_test.cpp trunk/tests/svn_test.h Added Paths: ----------- trunk/include/svn/operation.h trunk/include/svn/operation_internal.h trunk/src/svn/commit_summary.cpp trunk/src/svn/operation.cpp trunk/src/svn/operation_internal.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/grandmas_svn.pro 2006-10-06 14:53:39 UTC (rev 35) @@ -116,8 +116,11 @@ include/dialogs/open.h \ include/dialogs/util.h \ include/settings/userpaths.h \ + include/svn/commit_summary.h \ include/svn/file_access.h \ include/svn/modification.h \ + include/svn/operation.h \ + include/svn/operation_internal.h \ include/svn/revision.h \ include/svn/server_access.h \ src/grandmas_svn.h @@ -130,8 +133,11 @@ src/dialogs/move.cpp \ src/dialogs/open.cpp \ src/settings/userpaths.cpp \ + src/svn/commit_summary.cpp \ src/svn/file_access.cpp \ src/svn/modification.cpp \ + src/svn/operation.cpp \ + src/svn/operation_internal.cpp \ src/svn/revision.cpp \ src/svn/server_access.cpp \ src/dialogs/util.cpp \ Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/include/svn/commit_summary.h 2006-10-06 14:53:39 UTC (rev 35) @@ -18,19 +18,42 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include <svn/modification.h> #include <svn/revision.h> #include <svn/server_access.h> #include <Qt> #include <QList> +#include <QDateTime> +struct svn_error_t; +struct apr_hash_t; +struct svn_wc_status2_t; + class CommitSummary { public: - bool init(QString fullRepoPath, QString revision); + bool init(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, QString& rError); - bool getCommitAuthor(QString& rAuthor, QString& rError); - bool getCommitDate(QDateTime& rDate, QString& rError); - bool getCommitLogMessage(QString& rCommitLog, QString& rError); - bool getCommitModifications(QList<ModificationSummary>& rModifications, QString& rError); + // These functions should only be called for committed revisions + QString getCommitAuthor() const { return mAuthor; } + QDateTime getCommitDate() const { return mDate; } + QString getCommitLogMessage() const { return mLogMessage; } + + // This function may be called for working copy revision + const QList<Modification>& modifications() const { return mModifications; } + +protected: + QString mAuthor; + QDateTime mDate; + QString mLogMessage; + QList<Modification> mModifications; + Revision mRevision; + +private: + QString mWcPath; + +private: // Callbacks + static svn_error_t* logCallback(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, const char *author, const char *date, const char *message, apr_pool_t *pool); + static void statusCallback(void *baton, const char *path, svn_wc_status2_t *status); }; Modified: trunk/include/svn/file_access.h =================================================================== --- trunk/include/svn/file_access.h 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/include/svn/file_access.h 2006-10-06 14:53:39 UTC (rev 35) @@ -24,7 +24,7 @@ #include <QString> -class RepoFileAccess : public SvnOperation +class RepoFileAccess { public: static bool getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError); Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/include/svn/modification.h 2006-10-06 14:53:39 UTC (rev 35) @@ -21,15 +21,12 @@ #ifndef _MODIFICATION_H_ #define _MODIFICATION_H_ -#include "revision.h" +#include <svn/revision.h> -#include <QList> #include <QString> class SvnOperationContext; -struct svn_wc_status2_t; -struct svn_client_ctx_t; -struct svn_info_t; +class CommitSummary; class Modification { @@ -60,7 +57,7 @@ } private: - friend class Modifications; + friend class CommitSummary; Type mType; QString mFilePath; @@ -69,35 +66,4 @@ Revision newRevision; }; -class SvnOperation -{ -public: - static bool initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& rError); -}; - -class Modifications : public SvnOperation -{ -public: - // Public, interfaced functions - bool init(SvnOperationContext& rContext, QString path, Revision revision, QString& rError); - - const QList<Modification>& modifications() const; - -protected: - bool getRelativeRepoUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rError); - - QString mWcPath; - Revision mRevision; - SvnOperationContext* mpContext; - - QString mRelativeRepoUrl; - QList<Modification> mModifications; - -private: - // Callbacks - static void statusCallback(void *baton, const char *path, svn_wc_status2_t *status); - static svn_error_t* logCallback(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, const char *author, const char *date, const char *message, apr_pool_t *pool); - static svn_error_t* infoCallback(void *baton, const char *path, const svn_info_t *info, apr_pool_t *pool); -}; - #endif Added: trunk/include/svn/operation.h =================================================================== --- trunk/include/svn/operation.h (rev 0) +++ trunk/include/svn/operation.h 2006-10-06 14:53:39 UTC (rev 35) @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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. * + ***************************************************************************/ + +struct svn_client_ctx_t; +struct svn_error_t; +struct svn_info_t; +struct apr_pool_t; + +class SvnOperationContext; +class QString; + +namespace Operation +{ + bool initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& rError); + + bool getRelativeRepoUrl(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelPath, QString& rError); +}; Added: trunk/include/svn/operation_internal.h =================================================================== --- trunk/include/svn/operation_internal.h (rev 0) +++ trunk/include/svn/operation_internal.h 2006-10-06 14:53:39 UTC (rev 35) @@ -0,0 +1,40 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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 <QString> + +class SvnOperationContext; +struct svn_client_ctx_t; +struct svn_error_t; +struct svn_info_t; +struct apr_pool_t; + +class RelativeRepoRetriever +{ +public: + bool getRelativeRepoUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString fullRepoUrl, QString& rRelRepoUrl, QString& rError); + +protected: + static svn_error_t* infoCallback(void *baton, const char *path, const svn_info_t *info, apr_pool_t *pool); + +private: + QString mRelPath; +}; + Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-10-06 14:53:39 UTC (rev 35) @@ -32,12 +32,12 @@ void ModificationsModel::loadFromRevision(SvnOperationContext* pContext, QString path, Revision revision) { - Modifications mods; - QString error; - if (mods.init(*pContext, path, revision, error)) - showModifications(mods.modifications()); - else - showError(error); +// Modifications mods; +// QString error; +// if (mods.init(*pContext, path, revision, error)) +// showModifications(mods.modifications()); +// else +// showError(error); } void ModificationsModel::showError(QString error) Added: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp (rev 0) +++ trunk/src/svn/commit_summary.cpp 2006-10-06 14:53:39 UTC (rev 35) @@ -0,0 +1,191 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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 "svn/commit_summary.h" +#include "svn/operation.h" + +#include <svn_client.h> +#include <svn_path.h> + +bool CommitSummary::init(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, QString& rError) +{ + mModifications.clear(); + rError = ""; + mRevision = revision; + //mpContext = &rServer; + mWcPath = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); + + svn_client_ctx_t* ctx; + svn_client_create_context(&ctx, rContext.getAprPool()); + if (!Operation::initAuthProviders(ctx, rContext, rError)) + return false; + + if (!Operation::getRelativeRepoUrl(rContext, fullRepoPath, ctx, mWcPath, rError)) + return false; + + svn_error_t* pError = NULL; + if (revision.isCommittedRevision()) + { + svn_opt_revision_t startRev = revision.getSvnRevision(); + svn_opt_revision_t endRev = revision.getSvnRevision(); + apr_array_header_t *array = apr_array_make(rContext.getAprPool(), 1, sizeof(const char*)); + APR_ARRAY_PUSH(array, const char*) = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); + + pError = svn_client_log2(array, + &startRev, + &endRev, + 0/*limit*/, + true/*discover_changed_paths*/, + false/*strict_node_history*/, + logCallback, + this, + ctx, + rContext.getAprPool()); + } + else + { + svn_opt_revision_t svnRevision = revision.getSvnRevision(); + const char* canonPath = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); + pError = svn_client_status2(NULL, canonPath, &svnRevision, + statusCallback, + this, + true/*recurse*/, + false/*get_all*/, + false/*update*/, + false /*no_ignore*/, + true/*ignore_externals*/, + ctx/*svn_client_ctx_t*/, + rContext.getAprPool()); + } + if (pError) + { + rError = pError->message; + return false; + } + return true; +} + +svn_error_t* CommitSummary::logCallback(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, const char *author, const char *date, const char *message, apr_pool_t *pool) +{ + CommitSummary* pThis = (CommitSummary*)baton; + for (apr_hash_index_t* pKey = apr_hash_first(pool, changed_paths); pKey; pKey = apr_hash_next(pKey)) + { + char *path; + void *val; + apr_hash_this(pKey, (const void **)&path, NULL, &val); + + Modification mod; + mod.mFilePath = path; + + + mod.newRevision.setCommittedRevision(revision); + mod.oldRevision.setCommittedRevision(revision-1); + svn_log_changed_path_t *log_item = reinterpret_cast<svn_log_changed_path_t *>(val); + switch (log_item->action) + { + case 'A': + mod.mType = Modification::Type_Add; + break; + case 'D': + mod.mType = Modification::Type_Delete; + break; + case 'R': + // TODO: handle "replace" + mod.mType = Modification::Type_Add; + break; + case 'M': + mod.mType = Modification::Type_TextMod; + break; + default: + // TODO: return error + break; + } + pThis->mModifications.append(mod); + } + + return NULL; + + pThis->mAuthor = author; + //pThis->mDate = date; + pThis->mLogMessage = message; + + return NULL; +} + +void CommitSummary::statusCallback(void *baton, const char *path, svn_wc_status2_t *status) +{ + CommitSummary* pThis = (CommitSummary*)baton; + + Modification mod; + mod.newRevision = pThis->mRevision; + + // Set old revision to base, if the file is already under version control + if (status->entry) + mod.oldRevision.setCommittedRevision(status->entry->revision); + + switch (status->text_status) + { + // cases we care about + case svn_wc_status_unversioned: + mod.mType = Modification::Type_New; + break; + case svn_wc_status_added: + mod.mFilePath = path; + mod.mType = Modification::Type_Add; + break; + + case svn_wc_status_missing: + mod.mType = Modification::Type_Missing; + break; + + case svn_wc_status_deleted: + mod.mType = Modification::Type_Delete; + break; + + case svn_wc_status_modified: + mod.mType = Modification::Type_TextMod; + break; + + case svn_wc_status_conflicted: + mod.mType = Modification::Type_Conflicting; + break; + + // cases we can ignore + case svn_wc_status_ignored: + case svn_wc_status_obstructed: + case svn_wc_status_merged: + case svn_wc_status_normal: + case svn_wc_status_none: + return; + + // cases we need to learn how to handle + case svn_wc_status_replaced: + case svn_wc_status_incomplete: + case svn_wc_status_external: + assert(false); + break; + + } + mod.mFilePath = path; + if (mod.mFilePath.startsWith(pThis->mWcPath)) + mod.mFilePath.remove(0, pThis->mWcPath.length()); + + pThis->mModifications.append(mod); +} Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/src/svn/file_access.cpp 2006-10-06 14:53:39 UTC (rev 35) @@ -18,7 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <svn/file_access.h> +#include "svn/file_access.h" +#include "svn/operation.h" #include <svn_client.h> @@ -69,7 +70,7 @@ svn_client_ctx_t* pCtx = NULL; svn_client_create_context(&pCtx, rContext.getAprPool()); - if (!initAuthProviders(pCtx, rContext, rError)) + if (!Operation::initAuthProviders(pCtx, rContext, rError)) return false; svn_opt_revision_t svnRev = rev.getSvnRevision(); @@ -88,6 +89,6 @@ bool RepoFileAccess::getDiffFiles(SvnOperationContext& rContext, QString fullRepoPath, Revision leftRevision, Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError) { - return getFile(rContext, fullRepoPath, leftRevision, rLeftFilePath, rError) && !getFile(rContext, fullRepoPath, rightRevision, rRightFilePath, rError); + return getFile(rContext, fullRepoPath, leftRevision, rLeftFilePath, rError) && getFile(rContext, fullRepoPath, rightRevision, rRightFilePath, rError); } Modified: trunk/src/svn/modification.cpp =================================================================== --- trunk/src/svn/modification.cpp 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/src/svn/modification.cpp 2006-10-06 14:53:39 UTC (rev 35) @@ -17,252 +17,3 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ - -#include <svn/modification.h> -#include <svn/server_access.h> -#include "debug.h" - -#include <apr_pools.h> -#include <assert.h> -#include <iostream> -#include <svn_client.h> -#include <svn_path.h> -#include <svn_pools.h> - -using namespace std; - -svn_error_t* simpleAuthPrompt(svn_auth_cred_simple_t **cred, void *baton, const char */*realm*/, const char *username, svn_boolean_t /*_may_save*/, apr_pool_t *pool) -{ - QString promptUsername = username; - QString promptPassword; - SvnAuthentication* pAuth = ((SvnAuthentication*)baton); - if (!pAuth->getAuthentication(promptUsername)) - return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); - - svn_auth_cred_simple_t* lcred = (svn_auth_cred_simple_t*)apr_palloc(pool, sizeof (svn_auth_cred_simple_t)); - lcred->username = pAuth->getUsername(); - lcred->password = pAuth->getPassword(); - - // tell svn if the credentials need to be saved - lcred->may_save = true; - *cred = lcred; - - return SVN_NO_ERROR; - } - - -bool SvnOperation::initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& /*rError*/) -{ - apr_array_header_t *providers = apr_array_make(rContext.getAprPool(), 3, sizeof(svn_auth_provider_object_t *)); - - svn_auth_provider_object_t *provider; - - svn_client_get_simple_provider(&provider, rContext.getAprPool()); - APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; - - svn_client_get_username_provider(&provider, rContext.getAprPool()); - APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; - - svn_client_get_simple_prompt_provider(&provider, simpleAuthPrompt, rContext.getAuthenticationCallback(), 100000000, rContext.getAprPool()); - APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; - - // TODO: add ssl providers - - svn_auth_baton_t *authBaton; - svn_auth_open(&authBaton, providers, rContext.getAprPool()); - - context->auth_baton = authBaton; - return true; -} - -bool Modifications::init(SvnOperationContext& rServer, QString path, Revision revision, QString& rError) -{ - mModifications.clear(); - rError = ""; - mpContext = &rServer; - mWcPath = svn_path_canonicalize(path.toAscii(), rServer.getAprPool()); - - svn_client_ctx_t* ctx; - svn_client_create_context(&ctx, rServer.getAprPool()); - if (!initAuthProviders(ctx, rServer, rError)) - return false; - - if (!getRelativeRepoUrl(rServer, ctx, rError)) - return false; - - svn_error_t* pError = NULL; - if (revision.isCommittedRevision()) - { - svn_opt_revision_t startRev = revision.getSvnRevision(); - svn_opt_revision_t endRev = revision.getSvnRevision(); - apr_array_header_t *array = apr_array_make(rServer.getAprPool(), 1, sizeof(const char*)); - APR_ARRAY_PUSH(array, const char*) = svn_path_canonicalize(path.toAscii(), rServer.getAprPool()); - - pError = svn_client_log2(array, - &startRev, - &endRev, - 0/*limit*/, - true/*discover_changed_paths*/, - false/*strict_node_history*/, - logCallback, - this, - ctx, - rServer.getAprPool()); - } - else - { - svn_opt_revision_t svnRevision = revision.getSvnRevision(); - const char* canonPath = svn_path_canonicalize(path.toAscii(), rServer.getAprPool()); - pError = svn_client_status2(NULL, canonPath, &svnRevision, - statusCallback, - this, - true/*recurse*/, - false/*get_all*/, - false/*update*/, - false /*no_ignore*/, - true/*ignore_externals*/, - ctx/*svn_client_ctx_t*/, - rServer.getAprPool()); - } - if (pError) - { - rError = pError->message; - return false; - } - return true; -} - -const QList<Modification>& Modifications::modifications() const -{ - return mModifications; -} - -void Modifications::statusCallback(void *baton, const char *path, svn_wc_status2_t *status) -{ - Modifications* pThis = (Modifications*)baton; - - Modification mod; - mod.newRevision = pThis->mRevision; - - // Set old revision to base, if the file is already under version control - if (status->entry) - mod.oldRevision.setCommittedRevision(status->entry->revision); - - switch (status->text_status) - { - // cases we care about - case svn_wc_status_unversioned: - mod.mType = Modification::Type_New; - break; - case svn_wc_status_added: - mod.mFilePath = path; - mod.mType = Modification::Type_Add; - break; - - case svn_wc_status_missing: - mod.mType = Modification::Type_Missing; - break; - - case svn_wc_status_deleted: - mod.mType = Modification::Type_Delete; - break; - - case svn_wc_status_modified: - mod.mType = Modification::Type_TextMod; - break; - - case svn_wc_status_conflicted: - mod.mType = Modification::Type_Conflicting; - break; - - // cases we can ignore - case svn_wc_status_ignored: - case svn_wc_status_obstructed: - case svn_wc_status_merged: - case svn_wc_status_normal: - case svn_wc_status_none: - return; - - // cases we need to learn how to handle - case svn_wc_status_replaced: - case svn_wc_status_incomplete: - case svn_wc_status_external: - assert(false); - break; - - } - mod.mFilePath = path; - if (mod.mFilePath.startsWith(pThis->mWcPath)) - mod.mFilePath.remove(0, pThis->mWcPath.length()); - - pThis->mModifications.append(mod); -} - -svn_error_t* Modifications::logCallback(void *baton, apr_hash_t *changed_paths, svn_revnum_t revision, const char */*author*/, const char */*date*/, const char */*message*/, apr_pool_t *pool) -{ - Modifications* pThis = (Modifications*)baton; - for (apr_hash_index_t* pKey = apr_hash_first(pool, changed_paths); pKey; pKey = apr_hash_next(pKey)) - { - char *path; - void *val; - apr_hash_this(pKey, (const void **)&path, NULL, &val); - - Modification mod; - mod.mFilePath = path; - - - mod.newRevision.setCommittedRevision(revision); - mod.oldRevision.setCommittedRevision(revision-1); - svn_log_changed_path_t *log_item = reinterpret_cast<svn_log_changed_path_t *>(val); - switch (log_item->action) - { - case 'A': - mod.mType = Modification::Type_Add; - break; - case 'D': - mod.mType = Modification::Type_Delete; - break; - case 'R': - // TODO: handle "replace" - mod.mType = Modification::Type_Add; - break; - case 'M': - mod.mType = Modification::Type_TextMod; - break; - default: - // TODO: return error - break; - } - pThis->mModifications.append(mod); - } - - return NULL; -} - -svn_error_t* Modifications::infoCallback(void *baton, const char */*path*/, const svn_info_t *info, apr_pool_t */*pool*/) -{ - Modifications* pThis = (Modifications*)baton; - - QString sRootUrl = info->repos_root_URL; - QString sRepoUrl = info->URL; - - if (!sRepoUrl.startsWith(sRootUrl)) - return svn_error_create(SVN_ERR_INCOMPLETE_DATA, NULL, "Invalid repository information."); - - sRepoUrl.remove(0, sRootUrl.length()); - pThis->mRelativeRepoUrl = sRepoUrl; - return NULL; -} - -bool Modifications::getRelativeRepoUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rError) -{ - svn_error_t* pError = svn_client_info(mWcPath.toAscii(), NULL, NULL, infoCallback, this, false, ctx, rContext.getAprPool()); - if (pError) - { - rError = pError->message; - return false; - } - - return true; -} - Added: trunk/src/svn/operation.cpp =================================================================== --- trunk/src/svn/operation.cpp (rev 0) +++ trunk/src/svn/operation.cpp 2006-10-06 14:53:39 UTC (rev 35) @@ -0,0 +1,113 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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 "svn/operation.h" +#include "svn/server_access.h" + +#include <apr_pools.h> +#include <svn_client.h> + +#include <QString> + +svn_error_t* simpleAuthPrompt(svn_auth_cred_simple_t **cred, void *baton, const char */*realm*/, const char *username, svn_boolean_t /*_may_save*/, apr_pool_t *pool) +{ + QString promptUsername = username; + QString promptPassword; + SvnAuthentication* pAuth = ((SvnAuthentication*)baton); + if (!pAuth->getAuthentication(promptUsername)) + return svn_error_create(SVN_ERR_CANCELLED, NULL, ""); + + svn_auth_cred_simple_t* lcred = (svn_auth_cred_simple_t*)apr_palloc(pool, sizeof (svn_auth_cred_simple_t)); + lcred->username = pAuth->getUsername(); + lcred->password = pAuth->getPassword(); + + // tell svn if the credentials need to be saved + lcred->may_save = true; + *cred = lcred; + + return SVN_NO_ERROR; + } + + +bool Operation::initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& /*rError*/) +{ + apr_array_header_t *providers = apr_array_make(rContext.getAprPool(), 3, sizeof(svn_auth_provider_object_t *)); + + svn_auth_provider_object_t *provider; + + svn_client_get_simple_provider(&provider, rContext.getAprPool()); + APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; + + svn_client_get_username_provider(&provider, rContext.getAprPool()); + APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; + + svn_client_get_simple_prompt_provider(&provider, simpleAuthPrompt, rContext.getAuthenticationCallback(), 100000000, rContext.getAprPool()); + APR_ARRAY_PUSH(providers,svn_auth_provider_object_t*) = provider; + + // TODO: add ssl providers + + svn_auth_baton_t *authBaton; + svn_auth_open(&authBaton, providers, rContext.getAprPool()); + + context->auth_baton = authBaton; + return true; +} + +class SvnInfo +{ +public: + bool getRelativeRepoUrl(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelPath, QString& rError) + { + svn_error_t* pError = svn_client_info(fullRepoPath.toAscii(), NULL, NULL, infoCallback, this, false, ctx, rContext.getAprPool()); + if (pError) + { + rError = pError->message; + return false; + } + rRelPath = mRelativeRepoUrl; + return true; + } + +protected: + static svn_error_t* infoCallback(void *baton, const char */*path*/, const svn_info_t *info, apr_pool_t */*pool*/) + { + SvnInfo* pThis = (SvnInfo*)baton; + + QString sRootUrl = info->repos_root_URL; + QString sRepoUrl = info->URL; + + if (!sRepoUrl.startsWith(sRootUrl)) + return svn_error_create(SVN_ERR_INCOMPLETE_DATA, NULL, "Invalid repository information."); + + sRepoUrl.remove(0, sRootUrl.length()); + pThis->mRelativeRepoUrl = sRepoUrl; + return NULL; + } + + QString mRelativeRepoUrl; +}; + + +bool Operation::getRelativeRepoUrl(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelPath, QString& rError) +{ + SvnInfo info; + return info.getRelativeRepoUrl(rContext, fullRepoPath, ctx, rRelPath, rError); +} + Added: trunk/src/svn/operation_internal.cpp =================================================================== --- trunk/src/svn/operation_internal.cpp (rev 0) +++ trunk/src/svn/operation_internal.cpp 2006-10-06 14:53:39 UTC (rev 35) @@ -0,0 +1,21 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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 <svn/operation_internal.h> Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/tests/svn_test.cpp 2006-10-06 14:53:39 UTC (rev 35) @@ -20,7 +20,10 @@ #include "svn_test.h" +#include <svn/commit_summary.h> #include <svn/file_access.h> +#include <svn/modification.h> +#include "svn/operation.h" #include <svn_client.h> #include <svn_repos.h> @@ -38,7 +41,7 @@ svn_client_create_context(&mpCtx, mpContext->getAprPool()); QString rIgnoredError; - Q_ASSERT(initAuthProviders(mpCtx, *mpContext, rIgnoredError)); + Q_ASSERT(Operation::initAuthProviders(mpCtx, *mpContext, rIgnoredError)); mpCtx->log_msg_func = logMsgCallback; mpCtx->log_msg_baton = this; @@ -164,7 +167,7 @@ QVERIFY(touchFile("/first.txt", "This is the first file")); QVERIFY(addFile("/first.txt")); - QVERIFY(commitChanges("First commit")); + QVERIFY(commitChanges("first commit")); QVERIFY(touchFile("/second.txt", "This is the second file")); QVERIFY(addFile("/second.txt")); @@ -190,23 +193,20 @@ void SvnTester::testModifications() { - Modifications modifications; + CommitSummary summary; QString rError; Revision rev; rev.setCommittedRevision(1); - QVERIFY(modifications.init(*mpContext, getWcPath(), rev, rError)); + QVERIFY(summary.init(*mpContext, getWcPath(), rev, rError)); - QList<Modification> mods; - mods = modifications.modifications(); + const QList<Modification>& mods = summary.modifications(); QCOMPARE(mods.size(), 1); QCOMPARE(mods[0].getFilePath(), QString("/first.txt")); QCOMPARE(mods[0].getType(), Modification::Type_Add); rev.setUncommittedRevision(); - QVERIFY(modifications.init(*mpContext, getWcPath(), rev, rError)); - - mods = modifications.modifications(); + QVERIFY(summary.init(*mpContext, getWcPath(), rev, rError)); QCOMPARE(mods.size(), 1); QCOMPARE(mods[0].getFilePath(), QString("/second.txt")); @@ -217,16 +217,40 @@ { QString rError; QString filePath; - Revision rev; - rev.setCommittedRevision(1); - QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), rev, filePath, rError)); + Revision oldRev; + oldRev.setCommittedRevision(1); + QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), oldRev, filePath, rError)); QCOMPARE(getFileContents(filePath), QString("This is the first file")); + QVERIFY(filePath != getWcPath()+"/first.txt"); // We should not overwrite the WC copy! - rev.setUncommittedRevision(); - QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/second.txt"), rev, filePath, rError)); + Revision newRev; + newRev.setUncommittedRevision(); + QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/second.txt"), newRev, filePath, rError)); + + QCOMPARE(filePath, getWcPath()+"/second.txt"); // We should return the WC file path directly if working on uncommitted revisions QCOMPARE(getFileContents(filePath), QString("This is the second file")); + + + QVERIFY(touchFile("/first.txt", "This is the first file, now modified")); + + QString oldFilePath, newFilePath; + QVERIFY(RepoFileAccess::getDiffFiles(*mpContext, getWcPath()+"/first.txt", oldRev, newRev, oldFilePath, newFilePath, rError)); + QCOMPARE(getFileContents(oldFilePath), QString("This is the first file")); + QCOMPARE(getFileContents(newFilePath), QString("This is the first file, now modified")); } + + +void SvnTester::testCommitSummary() +{ + QString rError; + Revision rev; + rev.setCommittedRevision(1); + + CommitSummary summary; + QVERIFY(summary.init(*mpContext, getRepoPath(), rev, rError)); + + QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); + //QCOMPARE(summary.getCommitDate(), bogus); // TODO: fill in + QCOMPARE(summary.getCommitLogMessage(), QString("first commit")); +} - - - Modified: trunk/tests/svn_test.h =================================================================== --- trunk/tests/svn_test.h 2006-10-06 05:51:36 UTC (rev 34) +++ trunk/tests/svn_test.h 2006-10-06 14:53:39 UTC (rev 35) @@ -47,7 +47,7 @@ virtual bool getAuthentication(QString& /*rUsername*/, QString& /*rPassword*/) { return false; } }; -class SvnTester : public QObject, public SvnOperation +class SvnTester : public QObject { Q_OBJECT @@ -75,6 +75,8 @@ void testRepoFileAccess(); + void testCommitSummary(); + private: // Callbacks static svn_error_t* logMsgCallback(const char **log_msg, const char **tmp_file, apr_array_header_t *commit_items, void *baton, apr_pool_t *pool); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-06 05:51:42
|
Revision: 34 http://svn.sourceforge.net/grandmas-svn/?rev=34&view=rev Author: matthiasmiller Date: 2006-10-05 22:51:36 -0700 (Thu, 05 Oct 2006) Log Message: ----------- QTreeView tweaks for better appearance in Windows Modified Paths: -------------- trunk/ui/commit.ui trunk/ui/mainwindow.ui Modified: trunk/ui/commit.ui =================================================================== --- trunk/ui/commit.ui 2006-09-29 14:50:38 UTC (rev 33) +++ trunk/ui/commit.ui 2006-10-06 05:51:36 UTC (rev 34) @@ -1,7 +1,4 @@ <ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> <class>CommitDialog</class> <widget class="QDialog" name="CommitDialog" > <property name="geometry" > @@ -67,7 +64,17 @@ </widget> </item> <item> - <widget class="QTableView" name="changesTableView" /> + <widget class="QTreeView" name="changesTreeView" > + <property name="indentation" > + <number>0</number> + </property> + <property name="itemsExpandable" > + <bool>false</bool> + </property> + <property name="allColumnsShowFocus" > + <bool>true</bool> + </property> + </widget> </item> <item> <layout class="QHBoxLayout" > @@ -115,10 +122,9 @@ </item> </layout> </widget> - <pixmapfunction></pixmapfunction> <tabstops> <tabstop>logTextEdit</tabstop> - <tabstop>changesTableView</tabstop> + <tabstop>changesTreeView</tabstop> <tabstop>okButton</tabstop> <tabstop>cancelButton</tabstop> </tabstops> Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-09-29 14:50:38 UTC (rev 33) +++ trunk/ui/mainwindow.ui 2006-10-06 05:51:36 UTC (rev 34) @@ -1,7 +1,4 @@ <ui version="4.0" > - <author></author> - <comment></comment> - <exportmacro></exportmacro> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow" > <property name="geometry" > @@ -158,7 +155,17 @@ <number>6</number> </property> <item> - <widget class="QTreeView" name="changesTreeView" /> + <widget class="QTreeView" name="changesTreeView" > + <property name="indentation" > + <number>0</number> + </property> + <property name="itemsExpandable" > + <bool>false</bool> + </property> + <property name="allColumnsShowFocus" > + <bool>true</bool> + </property> + </widget> </item> <item> <layout class="QVBoxLayout" > @@ -301,7 +308,6 @@ </property> </action> </widget> - <pixmapfunction></pixmapfunction> <tabstops> <tabstop>logEdit</tabstop> <tabstop>changesTreeView</tabstop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-29 14:50:41
|
Revision: 33 http://svn.sourceforge.net/grandmas-svn/?rev=33&view=rev Author: matthiasmiller Date: 2006-09-29 07:50:38 -0700 (Fri, 29 Sep 2006) Log Message: ----------- UI tweaks: * interface option to update working copy on commit * remove empty menu bar from main window Modified Paths: -------------- trunk/ui/commit.ui trunk/ui/mainwindow.ui Modified: trunk/ui/commit.ui =================================================================== --- trunk/ui/commit.ui 2006-09-28 23:15:27 UTC (rev 32) +++ trunk/ui/commit.ui 2006-09-29 14:50:38 UTC (rev 33) @@ -78,6 +78,13 @@ <number>6</number> </property> <item> + <widget class="QCheckBox" name="updateCheckBox" > + <property name="text" > + <string>&Also update this working copy.</string> + </property> + </widget> + </item> + <item> <spacer> <property name="orientation" > <enum>Qt::Horizontal</enum> Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-09-28 23:15:27 UTC (rev 32) +++ trunk/ui/mainwindow.ui 2006-09-29 14:50:38 UTC (rev 33) @@ -294,16 +294,6 @@ </item> </layout> </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>639</width> - <height>22</height> - </rect> - </property> - </widget> <widget class="QStatusBar" name="statusbar" /> <action name="action_Close" > <property name="text" > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-28 23:15:29
|
Revision: 32 http://svn.sourceforge.net/grandmas-svn/?rev=32&view=rev Author: matthiasmiller Date: 2006-09-28 16:15:27 -0700 (Thu, 28 Sep 2006) Log Message: ----------- fix broken build in tests Modified Paths: -------------- trunk/tests/svn_test.cpp Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-09-28 03:34:38 UTC (rev 31) +++ trunk/tests/svn_test.cpp 2006-09-28 23:15:27 UTC (rev 32) @@ -197,7 +197,7 @@ QVERIFY(modifications.init(*mpContext, getWcPath(), rev, rError)); QList<Modification> mods; - modifications.getModifications(mods); + mods = modifications.modifications(); QCOMPARE(mods.size(), 1); QCOMPARE(mods[0].getFilePath(), QString("/first.txt")); @@ -206,7 +206,7 @@ rev.setUncommittedRevision(); QVERIFY(modifications.init(*mpContext, getWcPath(), rev, rError)); - modifications.getModifications(mods); + mods = modifications.modifications(); QCOMPARE(mods.size(), 1); QCOMPARE(mods[0].getFilePath(), QString("/second.txt")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-28 03:34:45
|
Revision: 31 http://svn.sourceforge.net/grandmas-svn/?rev=31&view=rev Author: matthiasmiller Date: 2006-09-27 20:34:38 -0700 (Wed, 27 Sep 2006) Log Message: ----------- ModificationsModel: remove obsolete member variables Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-09-28 03:26:28 UTC (rev 30) +++ trunk/include/dialogs/modificationsmodel.h 2006-09-28 03:34:38 UTC (rev 31) @@ -42,9 +42,6 @@ void setAllowSelections(bool allowSelections); private: - SvnOperationContext* mpContext; - QString mPath; - QString mError; QList<Modification> mModifications; }; Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-09-28 03:26:28 UTC (rev 30) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-09-28 03:34:38 UTC (rev 31) @@ -34,7 +34,7 @@ { Modifications mods; QString error; - if (mods.init(*mpContext, mPath, revision, error)) + if (mods.init(*pContext, path, revision, error)) showModifications(mods.modifications()); else showError(error); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-28 03:26:32
|
Revision: 30 http://svn.sourceforge.net/grandmas-svn/?rev=30&view=rev Author: matthiasmiller Date: 2006-09-27 20:26:28 -0700 (Wed, 27 Sep 2006) Log Message: ----------- fix build Modified Paths: -------------- trunk/src/dialogs/mainwindow.cpp Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-09-28 02:04:44 UTC (rev 29) +++ trunk/src/dialogs/mainwindow.cpp 2006-09-28 03:26:28 UTC (rev 30) @@ -85,7 +85,7 @@ void MainWindow::commit() { - CommitDialog dlg(mpContext, mPath, this); + CommitDialog dlg(this); dlg.exec(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-28 02:04:59
|
Revision: 29 http://svn.sourceforge.net/grandmas-svn/?rev=29&view=rev Author: matthiasmiller Date: 2006-09-27 19:04:44 -0700 (Wed, 27 Sep 2006) Log Message: ----------- refactor ModificationsModel for commit dialog Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/include/dialogs/modificationsmodel.h trunk/include/svn/modification.h trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp trunk/src/svn/modification.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-09-22 05:09:01 UTC (rev 28) +++ trunk/include/dialogs/mainwindow.h 2006-09-28 02:04:44 UTC (rev 29) @@ -45,6 +45,8 @@ private: Ui_MainWindow* mpUi; + SvnOperationContext* mpContext; + QString mPath; ModificationsModel* mpModificationsModel; Revision mDisplayedRevision; }; Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-09-22 05:09:01 UTC (rev 28) +++ trunk/include/dialogs/modificationsmodel.h 2006-09-28 02:04:44 UTC (rev 29) @@ -26,16 +26,21 @@ class ModificationsModel : public QAbstractListModel { public: - ModificationsModel(SvnOperationContext* pContext, QString path); + ModificationsModel(); virtual ~ModificationsModel(); - void loadRevision(Revision revision); + void loadFromRevision(SvnOperationContext* pContext, QString path, Revision revision); + void showError(QString error); + void showModifications(const QList<Modification>& rcModifications); + virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; virtual int rowCount(const QModelIndex& rcParent = QModelIndex()) const; virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; virtual QVariant data(const QModelIndex& rcIndex, int role = Qt::DisplayRole) const; + void setAllowSelections(bool allowSelections); + private: SvnOperationContext* mpContext; QString mPath; Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-09-22 05:09:01 UTC (rev 28) +++ trunk/include/svn/modification.h 2006-09-28 02:04:44 UTC (rev 29) @@ -81,7 +81,7 @@ // Public, interfaced functions bool init(SvnOperationContext& rContext, QString path, Revision revision, QString& rError); - void getModifications(QList<Modification>& rModifications); + const QList<Modification>& modifications() const; protected: bool getRelativeRepoUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rError); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-09-22 05:09:01 UTC (rev 28) +++ trunk/src/dialogs/mainwindow.cpp 2006-09-28 02:04:44 UTC (rev 29) @@ -31,9 +31,12 @@ MainWindow::MainWindow(SvnOperationContext* pContext, QString path) : mpModificationsModel(NULL) { - mpModificationsModel = new ModificationsModel(pContext, path); - mpModificationsModel->loadRevision(mDisplayedRevision); + mpContext = pContext; + mPath = path; + mpModificationsModel = new ModificationsModel(); + mpModificationsModel->loadFromRevision(mpContext, mPath, mDisplayedRevision); + mpUi = new Ui_MainWindow(); mpUi->setupUi(this); connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); @@ -64,6 +67,8 @@ mpUi->changesTreeView->setModel(NULL); delete mpModificationsModel; mpModificationsModel = NULL; + + mpContext = NULL; } void MainWindow::changeEvent(QEvent* pEvent) @@ -74,13 +79,13 @@ { // Refresh the modifications if it doesn't require server access. if (mpModificationsModel && !mDisplayedRevision.isCommittedRevision()) - mpModificationsModel->loadRevision(mDisplayedRevision); + mpModificationsModel->loadFromRevision(mpContext, mPath, mDisplayedRevision); } } void MainWindow::commit() { - CommitDialog dlg(this); + CommitDialog dlg(mpContext, mPath, this); dlg.exec(); } Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-09-22 05:09:01 UTC (rev 28) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-09-28 02:04:44 UTC (rev 29) @@ -18,29 +18,43 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "dialogs/modificationsmodel.h" +#include "debug.h" #include "svn/modification.h" +#include "svn/revision.h" -ModificationsModel::ModificationsModel(SvnOperationContext* pContext, QString path) +ModificationsModel::ModificationsModel() { - mpContext = pContext; - mPath = path; } ModificationsModel::~ModificationsModel() { } -void ModificationsModel::loadRevision(Revision revision) +void ModificationsModel::loadFromRevision(SvnOperationContext* pContext, QString path, Revision revision) { - mError = QString(); + Modifications mods; + QString error; + if (mods.init(*mpContext, mPath, revision, error)) + showModifications(mods.modifications()); + else + showError(error); +} - Modifications mods; - if (mods.init(*mpContext, mPath, revision, mError)) - mods.getModifications(mModifications); - +void ModificationsModel::showError(QString error) +{ + GSVN_ASSERT(!error.isNull()); + mError = error; + mModifications.clear(); emit layoutChanged(); } +void ModificationsModel::showModifications(const QList<Modification>& rcModifications) +{ + mError = QString(); + mModifications = rcModifications; + emit layoutChanged(); +} + int ModificationsModel::columnCount(const QModelIndex &rcParent) const { Q_UNUSED(rcParent); Modified: trunk/src/svn/modification.cpp =================================================================== --- trunk/src/svn/modification.cpp 2006-09-22 05:09:01 UTC (rev 28) +++ trunk/src/svn/modification.cpp 2006-09-28 02:04:44 UTC (rev 29) @@ -132,9 +132,9 @@ return true; } -void Modifications::getModifications(QList<Modification>& rModifications) +const QList<Modification>& Modifications::modifications() const { - rModifications = mModifications; + return mModifications; } void Modifications::statusCallback(void *baton, const char *path, svn_wc_status2_t *status) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-22 05:09:06
|
Revision: 28 http://svn.sourceforge.net/grandmas-svn/?rev=28&view=rev Author: matthiasmiller Date: 2006-09-21 22:09:01 -0700 (Thu, 21 Sep 2006) Log Message: ----------- change build script to use MinGW libraries Modified Paths: -------------- trunk/grandmas_svn.pro Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-09-22 02:04:21 UTC (rev 27) +++ trunk/grandmas_svn.pro 2006-09-22 05:09:01 UTC (rev 28) @@ -51,77 +51,35 @@ LIBS += -lsvn_client-1 -lsvn_subr-1 } -win32 { - !exists($(SVN_DEV_DIR)) { +win32 { + !exists($(SVN_DEV_DIR)) { error("SVN_DEV_DIR must point to the Subversion development folder."); } - SVN_INCLUDE_DIR = $$(SVN_DEV_DIR)\include - SVN_LIB_DIR = $$(SVN_DEV_DIR)\lib - INCLUDEPATH += $${SVN_INCLUDE_DIR} - INCLUDEPATH += $${SVN_INCLUDE_DIR}\apr - INCLUDEPATH += $${SVN_INCLUDE_DIR}\apr-util - INCLUDEPATH += $${SVN_INCLUDE_DIR}\apr-iconv - - LIBS += $${SVN_LIB_DIR}\libsvn_client-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_delta-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_diff-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_fs-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_fs_base-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_fs_fs-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_ra-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_ra_dav-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_ra_local-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_ra_svn-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_repos-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_subr-1.lib - LIBS += $${SVN_LIB_DIR}\libsvn_wc-1.lib - - APR_LIBS = apr:libapr apr-iconv:libapriconv #aprutil:apr-util aprutil:xml - for(APR_LIB, APR_LIBS) { - APR_LIB_DIR = $$APR_LIB - APR_LIB_DIR ~= s/:.*$//g - APR_LIB_DIR = $${SVN_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_DIR} - - APR_LIB_NAME = $$APR_LIB - APR_LIB_NAME ~= s/^[^:]*://g - - !exists($${APR_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_NAME}.a) { - APR_DEF_MSVC = $${APR_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_NAME}.def - - # Get the library def file - !system(cd /D $$APR_LIB_DIR && reimp -d $${APR_LIB_NAME}.lib) { - error(Could not generate definition for $${APR_LIB_NAME}. Please make sure the reimp tool is installed.) - } - - # Retranslate the definition for MinGW - APR_DEF_MINGW = $${APR_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_NAME}-MinGW.def - - !system(copy $${APR_DEF_MSVC} $${APR_DEF_MINGW} > nul) { - error(Could not copy $${APR_LIB_NAME} library definition file.) - } - !system( \ - @FOR /F "tokens=*" %a in ($${APR_DEF_MSVC}) DO @( \ #for each line... - @FOR /F "tokens=1,* delims=_" %b IN ("%a") DO @( \ - @IF "%a"=="_%b_%c" @( \ #contains stdcall prefix (underscore)? - @FOR /F "tokens=1,* delims=@" %d IN ("%c") DO @( \ - @IF "%c"=="%d@%e" @( \ #contains ordinal? - @echo %b_%d = _%b_%d@%e >> $${APR_DEF_MINGW} \ #output: function = _function@ordinal - ) \ - ) \ - ) \ - ) \ - ) \ - ):error(Could not translate $${APR_LIB_NAME} library definition file) - - # Create MinGW library files - !system(cd /D $$APR_LIB_DIR && dlltool -d $${APR_LIB_NAME}-MinGW.def -l $${APR_LIB_NAME}.a) { - error(Could not generate MinGW library file for $${APR_LIB_NAME}) - } - } - - LIBS += -L$${APR_LIB_DIR} -l$${APR_LIB_NAME} - } + INCLUDEPATH += $(SVN_DEV_DIR)\include + INCLUDEPATH += $(SVN_DEV_DIR)\include\subversion-1 + LIBS += -L$(SVN_DEV_DIR)\lib + LIBS += \ + -lsvn_client-1 \ + -lsvn_ra-1 \ + -lsvn_ra_dav-1 \ + -lsvn_ra_local-1 \ + -lsvn_ra_svn-1 \ + -lsvn_fs-1 \ + -lsvn_fs_fs-1 \ + -lsvn_repos-1 \ + -lsvn_delta-1 \ + -lsvn_wc-1 \ + -lsvn_subr-1 \ + -lsvn_diff-1 \ + -lneon \ + -laprutil \ + -lapr \ + -lws2_32 \ + -lexpat \ + -lssl \ + -lcrypto \ + -lrpcrt4 } TARGET = bin/grandmas-svn This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-22 02:04:25
|
Revision: 27 http://svn.sourceforge.net/grandmas-svn/?rev=27&view=rev Author: matthiasmiller Date: 2006-09-21 19:04:21 -0700 (Thu, 21 Sep 2006) Log Message: ----------- helper script for creating MinGW build environment for building Subversion libraries Added Paths: ----------- trunk/mingw-install.sh Added: trunk/mingw-install.sh =================================================================== --- trunk/mingw-install.sh (rev 0) +++ trunk/mingw-install.sh 2006-09-22 02:04:21 UTC (rev 27) @@ -0,0 +1,80 @@ +#!/bin/sh + +# This script is used to create a MinGW build environment for the Subversion libraries. + +DOWNLOAD_DIR="/tmp/svn-mingw-installer" + +SF_MIRROR='internap' +SF_MIRROR='superb-east' +SF_MIRROR='kent' + +MINGW_PACKAGES=' + gcc-core-3.4.5-20060117-1.tar.gz + gcc-g++-3.4.5-20060117-1.tar.gz + w32api-3.7.tar.gz + mingw-runtime-3.9.tar.gz + binutils-2.16.91-20060119-1.tar.gz + ' + +MSYS_PACKAGES=' + msys-autoconf-2.59.tar.bz2 + msys-automake-1.8.2.tar.bz2 + msys-libtool-1.5.tar.bz2 + ' + +if test "no$WGET" = "no"; then + echo "Please set the WGET environment variable." + echo "For example:" + echo " WGET=wget.exe sh mingw-install.sh" + exit 1 +fi +if ! [ -d $DOWNLOAD_DIR ] && ! mkdir $DOWNLOAD_DIR; then + echo "The download directory could not be created: $DOWNLOAD_DIR"; + exit 1 +fi + +# DOWNLOAD MINGW +# +for PACKAGE in $MINGW_PACKAGES $MSYS_PACKAGES; do + URL=http://$SF_MIRROR.dl.sourceforge.net/sourceforge/mingw/$PACKAGE + if ! $WGET --continue --output-document=$DOWNLOAD_DIR/$PACKAGE $URL; then + echo "Could not download $PACKAGE" + exit 1 + fi +done +echo "All files successfully downloaded." + + +# INSTALL MINGW +# +extract_package() { + PACKAGE=$1 + TARGET_DIR=$2 + + echo "Extracting $PACKAGE into $TARGET_DIR" + if (echo $PACKAGE | grep '.tar.gz') > /dev/null; then + TAR_FLAG="z" + elif (echo $PACKAGE | grep '.tar.bz2') > /dev/null; then + TAR_FLAG="j" + else + echo "Unrecognized file type: $PACKAGE" + exit 1 + fi + + if ! tar -${TAR_FLAG}xf $DOWNLOAD_DIR/$PACKAGE -C$TARGET_DIR; then + echo "Could not extract $PACKAGE" + exit 1 + fi +} + +for PACKAGE in $MSYS_PACKAGES; +do + extract_package $PACKAGE / +done + +for PACKAGE in $MINGW_PACKAGES +do + extract_package $PACKAGE /mingw/ +done + +echo "All files successfully installed." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-09-01 03:20:22
|
Revision: 26 http://svn.sourceforge.net/grandmas-svn/?rev=26&view=rev Author: matthiasmiller Date: 2006-08-31 20:20:18 -0700 (Thu, 31 Aug 2006) Log Message: ----------- don't show the open dialog when running unit tests Modified Paths: -------------- trunk/src/grandmas_svn.cpp trunk/src/grandmas_svn.h trunk/src/main.cpp Modified: trunk/src/grandmas_svn.cpp =================================================================== --- trunk/src/grandmas_svn.cpp 2006-08-28 22:55:50 UTC (rev 25) +++ trunk/src/grandmas_svn.cpp 2006-09-01 03:20:18 UTC (rev 26) @@ -37,9 +37,6 @@ #else connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit())); #endif - - // Show OpenDialog on startup - open(); } GrandmasSVNApp::~GrandmasSVNApp() @@ -60,7 +57,7 @@ mpAppMenu = new QMenuBar(); QMenu* pFile = mpAppMenu->addMenu(tr("&File")); - QAction* pOpen = pFile->addAction(tr("&Open"), this, SLOT(open())); + QAction* pOpen = pFile->addAction(tr("&Open"), this, SLOT(openWorkingCopy())); pOpen->setShortcut(tr("Ctrl+O")); } @@ -69,7 +66,7 @@ return new QSettings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName()); } -void GrandmasSVNApp::open() +void GrandmasSVNApp::openWorkingCopy() { if (mpOpenDlg) { Modified: trunk/src/grandmas_svn.h =================================================================== --- trunk/src/grandmas_svn.h 2006-08-28 22:55:50 UTC (rev 25) +++ trunk/src/grandmas_svn.h 2006-09-01 03:20:18 UTC (rev 26) @@ -37,12 +37,14 @@ GrandmasSVNApp(int& argc, char** argv, SvnOperationContext* pContext); ~GrandmasSVNApp(); +public slots: + void openWorkingCopy(); + private: void initMac(); static QSettings* createSettings(); private slots: - void open(); void open_done(int result); void openPath(QString path); Modified: trunk/src/main.cpp =================================================================== --- trunk/src/main.cpp 2006-08-28 22:55:50 UTC (rev 25) +++ trunk/src/main.cpp 2006-09-01 03:20:18 UTC (rev 26) @@ -116,5 +116,6 @@ return runTests(); #endif + app.openWorkingCopy(); return app.exec(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-08-28 22:55:59
|
Revision: 25 Author: highjinx Date: 2006-08-28 15:55:50 -0700 (Mon, 28 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=25&view=rev Log Message: ----------- Including file_access.cpp Added Paths: ----------- trunk/src/svn/file_access.cpp Added: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp (rev 0) +++ trunk/src/svn/file_access.cpp 2006-08-28 22:55:50 UTC (rev 25) @@ -0,0 +1,93 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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 <svn/file_access.h> + +#include <svn_client.h> + +#include <QDir> + +#include <iostream> + +bool getRandomFilePath(QString dirPath, QString filePrefix, QString fileExtension, QString& rFilePath) +{ + QString randString; + while (true) + { + if (!QFile::exists(dirPath+filePrefix+randString+"."+fileExtension)) + { + rFilePath = dirPath+filePrefix+randString+"."+fileExtension; + return true; + } + randString.setNum(rand() % 10000); + } + + return false; +} + +bool RepoFileAccess::getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError) +{ + if (!rev.isCommittedRevision()) + { + rCreatedFilePath = fullRepoPath; + return true; + } + // create a new file and suppose we only want + // this users to be able to read and write the file + apr_file_t* pAprFile = NULL; + if (!getRandomFilePath(QDir::tempPath(), "bogus", "cpp", rCreatedFilePath) || + apr_file_open(&pAprFile, rCreatedFilePath.toAscii(), APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BINARY, APR_OS_DEFAULT, rContext.getAprPool())) + { + rError = "Unable to create temporary file."; + return false; + } + + // now create a stream and let svn_client_cat write to the stream + svn_stream_t* pStream = svn_stream_from_aprfile(pAprFile, rContext.getAprPool()); + if (!pStream) + { + rError = "Unable to load temporary file."; + return false; + } + + svn_client_ctx_t* pCtx = NULL; + svn_client_create_context(&pCtx, rContext.getAprPool()); + if (!initAuthProviders(pCtx, rContext, rError)) + return false; + + svn_opt_revision_t svnRev = rev.getSvnRevision(); + svn_error_t* pError = svn_client_cat(pStream, fullRepoPath.toAscii(), &svnRev, pCtx, rContext.getAprPool()); + if (pError) + { + rError = pError->message; + return false; + } + + svn_stream_close(pStream); + apr_file_close(pAprFile); + + return true; +} + +bool RepoFileAccess::getDiffFiles(SvnOperationContext& rContext, QString fullRepoPath, Revision leftRevision, Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError) +{ + return getFile(rContext, fullRepoPath, leftRevision, rLeftFilePath, rError) && !getFile(rContext, fullRepoPath, rightRevision, rRightFilePath, rError); +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-08-25 21:23:03
|
Revision: 24 Author: matthiasmiller Date: 2006-08-25 14:22:59 -0700 (Fri, 25 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=24&view=rev Log Message: ----------- auto-open "other" working copies Modified Paths: -------------- trunk/src/dialogs/open.cpp Modified: trunk/src/dialogs/open.cpp =================================================================== --- trunk/src/dialogs/open.cpp 2006-08-25 21:18:25 UTC (rev 23) +++ trunk/src/dialogs/open.cpp 2006-08-25 21:22:59 UTC (rev 24) @@ -67,5 +67,6 @@ QModelIndex index = mpPathsModel->addPath(other); mpUi->workingCopyListView->setCurrentIndex(index); mpUi->workingCopyListView->setFocus(); + accept(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-08-25 21:18:33
|
Revision: 23 Author: matthiasmiller Date: 2006-08-25 14:18:25 -0700 (Fri, 25 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=23&view=rev Log Message: ----------- update list of modifications when the window receives focus Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-08-17 16:16:12 UTC (rev 22) +++ trunk/include/dialogs/mainwindow.h 2006-08-25 21:18:25 UTC (rev 23) @@ -22,6 +22,7 @@ #define DIALOGS_MAINWINDOW_H #include <QMainWindow> +#include "svn/revision.h" class ModificationsModel; class SvnOperationContext; @@ -35,6 +36,9 @@ MainWindow(SvnOperationContext* pContext, QString path); ~MainWindow(); +protected: + virtual void changeEvent(QEvent* pEvent); + private slots: void commit(); void move(); @@ -42,6 +46,7 @@ private: Ui_MainWindow* mpUi; ModificationsModel* mpModificationsModel; + Revision mDisplayedRevision; }; #endif Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-08-17 16:16:12 UTC (rev 22) +++ trunk/include/dialogs/modificationsmodel.h 2006-08-25 21:18:25 UTC (rev 23) @@ -29,7 +29,7 @@ ModificationsModel(SvnOperationContext* pContext, QString path); virtual ~ModificationsModel(); - void setRevision(Revision revision); + void loadRevision(Revision revision); virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; virtual int rowCount(const QModelIndex& rcParent = QModelIndex()) const; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-08-17 16:16:12 UTC (rev 22) +++ trunk/src/dialogs/mainwindow.cpp 2006-08-25 21:18:25 UTC (rev 23) @@ -29,10 +29,10 @@ #include <svn_client.h> -MainWindow::MainWindow(SvnOperationContext* pContext, QString path) +MainWindow::MainWindow(SvnOperationContext* pContext, QString path) : mpModificationsModel(NULL) { mpModificationsModel = new ModificationsModel(pContext, path); - mpModificationsModel->setRevision(Revision()); + mpModificationsModel->loadRevision(mDisplayedRevision); mpUi = new Ui_MainWindow(); mpUi->setupUi(this); @@ -61,10 +61,23 @@ delete mpUi; mpUi = NULL; + mpUi->changesTreeView->setModel(NULL); delete mpModificationsModel; mpModificationsModel = NULL; } +void MainWindow::changeEvent(QEvent* pEvent) +{ + QMainWindow::changeEvent(pEvent); + + if (pEvent->type() == QEvent::ActivationChange && isActiveWindow()) + { + // Refresh the modifications if it doesn't require server access. + if (mpModificationsModel && !mDisplayedRevision.isCommittedRevision()) + mpModificationsModel->loadRevision(mDisplayedRevision); + } +} + void MainWindow::commit() { CommitDialog dlg(this); Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-08-17 16:16:12 UTC (rev 22) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-08-25 21:18:25 UTC (rev 23) @@ -30,7 +30,7 @@ { } -void ModificationsModel::setRevision(Revision revision) +void ModificationsModel::loadRevision(Revision revision) { mError = QString(); @@ -107,12 +107,18 @@ case Modification::Type_Missing: return tr("!"); case Modification::Type_Conflicting: return tr("Conflicting"); } - break; + + Q_ASSERT(false); + return QVariant(); - case 1: - if (mod.getType() == Modification::Type_Move || mod.getType() == Modification::Type_Copy) - return mod.getFilePath() + "\n" + mod.getDestFilePath(); - else - return mod.getFilePath(); + case 1: + if (mod.getType() == Modification::Type_Move || mod.getType() == Modification::Type_Copy) + return mod.getFilePath() + "\n" + mod.getDestFilePath(); + else + return mod.getFilePath(); + + default: + Q_ASSERT(false); + return QVariant(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-08-17 16:16:29
|
Revision: 22 Author: matthiasmiller Date: 2006-08-17 09:16:12 -0700 (Thu, 17 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=22&view=rev Log Message: ----------- small steps toward the windows build Modified Paths: -------------- trunk/grandmas_svn.pro Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-08-17 02:03:39 UTC (rev 21) +++ trunk/grandmas_svn.pro 2006-08-17 16:16:12 UTC (rev 22) @@ -51,8 +51,8 @@ LIBS += -lsvn_client-1 -lsvn_subr-1 } -win32 { - !exists($(SVN_DEV_DIR)) { +win32 { + !exists($(SVN_DEV_DIR)) { error("SVN_DEV_DIR must point to the Subversion development folder."); } SVN_INCLUDE_DIR = $$(SVN_DEV_DIR)\include @@ -64,22 +64,38 @@ INCLUDEPATH += $${SVN_INCLUDE_DIR}\apr-iconv LIBS += $${SVN_LIB_DIR}\libsvn_client-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_delta-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_diff-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_fs-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_fs_base-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_fs_fs-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_ra-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_ra_dav-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_ra_local-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_ra_svn-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_repos-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_subr-1.lib + LIBS += $${SVN_LIB_DIR}\libsvn_wc-1.lib - APR_LIBS = apr #apr-iconv apr-util + APR_LIBS = apr:libapr apr-iconv:libapriconv #aprutil:apr-util aprutil:xml for(APR_LIB, APR_LIBS) { - APR_LIB_DIR = $${SVN_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB} + APR_LIB_DIR = $$APR_LIB + APR_LIB_DIR ~= s/:.*$//g + APR_LIB_DIR = $${SVN_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_DIR} + APR_LIB_NAME = $$APR_LIB - APR_LIB_NAME ~= s/-//g + APR_LIB_NAME ~= s/^[^:]*://g - !exists($${APR_LIB_DIR}$${DIR_SEPARATOR}lib$${APR_LIB_NAME}.a) { + !exists($${APR_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_NAME}.a) { + APR_DEF_MSVC = $${APR_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_NAME}.def + # Get the library def file - !system(cd /D $$APR_LIB_DIR && reimp -d lib$${APR_LIB_NAME}.lib) { + !system(cd /D $$APR_LIB_DIR && reimp -d $${APR_LIB_NAME}.lib) { error(Could not generate definition for $${APR_LIB_NAME}. Please make sure the reimp tool is installed.) } # Retranslate the definition for MinGW - APR_DEF_MSVC = $${APR_LIB_DIR}$${DIR_SEPARATOR}lib$${APR_LIB_NAME}.def - APR_DEF_MINGW = $${APR_LIB_DIR}$${DIR_SEPARATOR}lib$${APR_LIB_NAME}-MinGW.def + APR_DEF_MINGW = $${APR_LIB_DIR}$${DIR_SEPARATOR}$${APR_LIB_NAME}-MinGW.def !system(copy $${APR_DEF_MSVC} $${APR_DEF_MINGW} > nul) { error(Could not copy $${APR_LIB_NAME} library definition file.) @@ -99,7 +115,7 @@ ):error(Could not translate $${APR_LIB_NAME} library definition file) # Create MinGW library files - !system(cd /D $$APR_LIB_DIR && dlltool -d lib$${APR_LIB_NAME}-MinGW.def -l lib$${APR_LIB_NAME}.a) { + !system(cd /D $$APR_LIB_DIR && dlltool -d $${APR_LIB_NAME}-MinGW.def -l $${APR_LIB_NAME}.a) { error(Could not generate MinGW library file for $${APR_LIB_NAME}) } } @@ -167,17 +183,18 @@ # UNIT TESTS -debug { - DEFINES += GSVN_TESTS +!win32 { + debug { + DEFINES += GSVN_TESTS + } + contains(DEFINES, GSVN_TESTS) { + CONFIG += qtestlib + HEADERS += tests/commandlinetest.h \ + tests/svn_test.h \ + tests/tests.h + SOURCES += tests/commandlinetest.cpp \ + tests/svn_test.cpp \ + tests/tests.cpp + LIBS += -lsvn_repos-1 + } } -contains(DEFINES, GSVN_TESTS) { - CONFIG += qtestlib - HEADERS += tests/commandlinetest.h \ - tests/svn_test.h \ - tests/tests.h - SOURCES += tests/commandlinetest.cpp \ - tests/svn_test.cpp \ - tests/tests.cpp - LIBS += -lsvn_repos-1 -} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-08-17 02:03:47
|
Revision: 21 Author: matthiasmiller Date: 2006-08-16 19:03:39 -0700 (Wed, 16 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=21&view=rev Log Message: ----------- bracket QtTest code Modified Paths: -------------- trunk/src/debug.cpp Modified: trunk/src/debug.cpp =================================================================== --- trunk/src/debug.cpp 2006-08-11 01:04:46 UTC (rev 20) +++ trunk/src/debug.cpp 2006-08-17 02:03:39 UTC (rev 21) @@ -19,9 +19,17 @@ ***************************************************************************/ #include "debug.h" + +#ifdef GSVN_TESTS #include <QtTest/QtTest> +#endif bool gsvn_allowAssert() { - return (QTest::currentTestFunction() == NULL); +#ifdef GSVN_TESTS + if (QTest::currentTestFunction() != NULL) + return false; +#endif + + return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-08-11 01:04:54
|
Revision: 20 Author: highjinx Date: 2006-08-10 18:04:46 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=20&view=rev Log Message: ----------- Implementing functionality to retrieve historical files (to be used for diffing) Modified Paths: -------------- trunk/grandmas_svn.kdevelop trunk/grandmas_svn.pro trunk/include/svn/file_access.h trunk/include/svn/modification.h trunk/tests/svn_test.cpp trunk/tests/svn_test.h Modified: trunk/grandmas_svn.kdevelop =================================================================== --- trunk/grandmas_svn.kdevelop 2006-08-10 13:27:59 UTC (rev 19) +++ trunk/grandmas_svn.kdevelop 2006-08-11 01:04:46 UTC (rev 20) @@ -12,7 +12,7 @@ <ignoreparts/> <projectdirectory>.</projectdirectory> <absoluteprojectpath>false</absoluteprojectpath> - <description></description> + <description/> <versioncontrol/> </general> <kdevfileview> @@ -69,16 +69,16 @@ </kdevdoctreeview> <kdevdebugger> <general> - <dbgshell></dbgshell> + <dbgshell/> <breakpoints/> <programargs>-t</programargs> <gdbpath>/usr/bin/</gdbpath> <breakonloadinglibs>true</breakonloadinglibs> <separatetty>false</separatetty> <floatingtoolbar>false</floatingtoolbar> - <configGdbScript></configGdbScript> - <runShellScript></runShellScript> - <runGdbScript></runGdbScript> + <configGdbScript/> + <runShellScript/> + <runGdbScript/> </general> <display> <staticmembers>false</staticmembers> @@ -105,7 +105,7 @@ <runmultiplejobs>false</runmultiplejobs> <numberofjobs>1</numberofjobs> <dontact>false</dontact> - <makebin></makebin> + <makebin/> <prio>0</prio> <envvars/> </make> @@ -159,10 +159,10 @@ <qt> <used>true</used> <version>4</version> - <root></root> + <root/> </qt> <creategettersetter> - <prefixGet></prefixGet> + <prefixGet/> <prefixSet>set</prefixSet> <prefixVariable>m_,_</prefixVariable> <parameterName>theValue</parameterName> Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-08-10 13:27:59 UTC (rev 19) +++ trunk/grandmas_svn.pro 2006-08-11 01:04:46 UTC (rev 20) @@ -142,6 +142,7 @@ include/dialogs/open.h \ include/dialogs/util.h \ include/settings/userpaths.h \ + include/svn/file_access.h \ include/svn/modification.h \ include/svn/revision.h \ include/svn/server_access.h \ @@ -155,6 +156,7 @@ src/dialogs/move.cpp \ src/dialogs/open.cpp \ src/settings/userpaths.cpp \ + src/svn/file_access.cpp \ src/svn/modification.cpp \ src/svn/revision.cpp \ src/svn/server_access.cpp \ Modified: trunk/include/svn/file_access.h =================================================================== --- trunk/include/svn/file_access.h 2006-08-10 13:27:59 UTC (rev 19) +++ trunk/include/svn/file_access.h 2006-08-11 01:04:46 UTC (rev 20) @@ -18,16 +18,16 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#include <svn/modification.h> #include <svn/revision.h> #include <svn/server_access.h> -#include <Qt> +#include <QString> -class RepoFileAccess +class RepoFileAccess : public SvnOperation { public: - bool init(QString fullRepoPath, Revision oldRevision, Revision newRevision, QString& rError); - bool getOldFile(ServerAccess& rAccess, QString relFilePath, QString& rCreatedFilePath, QString& rError); - bool getNewFile(ServerAccess& rAccess, QString relFilePath, QString& rCreatedFilePath, QString& rError); - bool getDiff(ServerAccess& rAccess, QString relLeftFilePath, QString relRightFilePath, QString& rDiff, QString& rError); + static bool getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError); + static bool getDiffFiles(SvnOperationContext& rContext, QString fullRepoPath, Revision leftRevision, Revision rightRevision, QString& rLeftFilePath, QString& rRightFilePath, QString& rError); }; + Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-08-10 13:27:59 UTC (rev 19) +++ trunk/include/svn/modification.h 2006-08-11 01:04:46 UTC (rev 20) @@ -72,7 +72,7 @@ class SvnOperation { public: - bool initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& rError); + static bool initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& rError); }; class Modifications : public SvnOperation Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-08-10 13:27:59 UTC (rev 19) +++ trunk/tests/svn_test.cpp 2006-08-11 01:04:46 UTC (rev 20) @@ -20,6 +20,8 @@ #include "svn_test.h" +#include <svn/file_access.h> + #include <svn_client.h> #include <svn_repos.h> #include <svn_path.h> @@ -90,7 +92,7 @@ { QDir dir(filePath); QFileInfoList entries = dir.entryInfoList(QDir::NoDotAndDotDot|QDir::Hidden|QDir::System|QDir::AllDirs|QDir::Files); - Q_FOREACH(QFileInfo entry, entries) + foreach(QFileInfo entry, entries) { if (entry.isDir()) { @@ -108,7 +110,21 @@ return true; } + +QString SvnTester::getFileContents(QString filePath) +{ + QFile file(filePath); + Q_ASSERT(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QTextStream in(&file); + QString fileText; + while (!in.atEnd()) + { + fileText += in.readLine(); + } + return fileText; +} + bool SvnTester::updateWc() { apr_array_header_t *array = apr_array_make(mpContext->getAprPool(), 1, sizeof(const char*)); @@ -197,3 +213,20 @@ QCOMPARE(mods[0].getType(), Modification::Type_Add); } +void SvnTester::testRepoFileAccess() +{ + QString rError; + QString filePath; + Revision rev; + rev.setCommittedRevision(1); + QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), rev, filePath, rError)); + QCOMPARE(getFileContents(filePath), QString("This is the first file")); + + rev.setUncommittedRevision(); + QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/second.txt"), rev, filePath, rError)); + QCOMPARE(getFileContents(filePath), QString("This is the second file")); +} + + + + Modified: trunk/tests/svn_test.h =================================================================== --- trunk/tests/svn_test.h 2006-08-10 13:27:59 UTC (rev 19) +++ trunk/tests/svn_test.h 2006-08-11 01:04:46 UTC (rev 20) @@ -59,19 +59,21 @@ QString getRepoPath() { return QDir::convertSeparators(QDir::tempPath()+"/gsvn_repo"); } QString getWcPath() { return QDir::convertSeparators(QDir::tempPath()+"/gsvn_wc"); } - bool createRepos(); bool commitChanges(QString commitMessage); bool addFile(QString relFilePath); bool touchFile(QString relFilePath, QString fileText); // fails if the file exists bool updateWc(); bool removeDirectory(QString filePath); + QString getFileContents(QString filePath); private slots: void init(); void cleanup(); void testModifications(); + + void testRepoFileAccess(); private: // Callbacks This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-08-10 13:28:06
|
Revision: 19 Author: matthiasmiller Date: 2006-08-10 06:27:59 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=19&view=rev Log Message: ----------- initial implementation of ModificationsModel Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/dialogs/mainwindow.h trunk/src/dialogs/mainwindow.cpp trunk/src/grandmas_svn.cpp trunk/src/grandmas_svn.h trunk/src/main.cpp trunk/ui/mainwindow.ui Added Paths: ----------- trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-08-10 13:26:31 UTC (rev 18) +++ trunk/grandmas_svn.pro 2006-08-10 13:27:59 UTC (rev 19) @@ -137,6 +137,7 @@ include/debug.h \ include/dialogs/commit.h \ include/dialogs/mainwindow.h \ + include/dialogs/modificationsmodel.h \ include/dialogs/move.h \ include/dialogs/open.h \ include/dialogs/util.h \ @@ -150,6 +151,7 @@ src/debug.cpp \ src/dialogs/commit.cpp \ src/dialogs/mainwindow.cpp \ + src/dialogs/modificationsmodel.cpp \ src/dialogs/move.cpp \ src/dialogs/open.cpp \ src/settings/userpaths.cpp \ Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-08-10 13:26:31 UTC (rev 18) +++ trunk/include/dialogs/mainwindow.h 2006-08-10 13:27:59 UTC (rev 19) @@ -23,6 +23,8 @@ #include <QMainWindow> +class ModificationsModel; +class SvnOperationContext; class Ui_MainWindow; class MainWindow: public QMainWindow @@ -30,7 +32,7 @@ Q_OBJECT public: - MainWindow(); + MainWindow(SvnOperationContext* pContext, QString path); ~MainWindow(); private slots: @@ -39,6 +41,7 @@ private: Ui_MainWindow* mpUi; + ModificationsModel* mpModificationsModel; }; #endif Copied: trunk/include/dialogs/modificationsmodel.h (from rev 16, trunk/templates/h) =================================================================== --- trunk/include/dialogs/modificationsmodel.h (rev 0) +++ trunk/include/dialogs/modificationsmodel.h 2006-08-10 13:27:59 UTC (rev 19) @@ -0,0 +1,45 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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 <QAbstractListModel> + +class Modification; +class Revision; +class SvnOperationContext; + +class ModificationsModel : public QAbstractListModel +{ +public: + ModificationsModel(SvnOperationContext* pContext, QString path); + virtual ~ModificationsModel(); + + void setRevision(Revision revision); + + virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; + virtual int rowCount(const QModelIndex& rcParent = QModelIndex()) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual QVariant data(const QModelIndex& rcIndex, int role = Qt::DisplayRole) const; + +private: + SvnOperationContext* mpContext; + QString mPath; + + QString mError; + QList<Modification> mModifications; +}; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-08-10 13:26:31 UTC (rev 18) +++ trunk/src/dialogs/mainwindow.cpp 2006-08-10 13:27:59 UTC (rev 19) @@ -21,19 +21,25 @@ #include "dialogs/mainwindow.h" #include "dialogs/commit.h" +#include "dialogs/modificationsmodel.h" #include "dialogs/move.h" +#include "svn/revision.h" #include "ui_mainwindow.h" #include <svn_client.h> -MainWindow::MainWindow() +MainWindow::MainWindow(SvnOperationContext* pContext, QString path) { + mpModificationsModel = new ModificationsModel(pContext, path); + mpModificationsModel->setRevision(Revision()); + mpUi = new Ui_MainWindow(); mpUi->setupUi(this); connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); connect(mpUi->moveButton, SIGNAL(clicked()), this, SLOT(move())); - + mpUi->changesTreeView->setModel(mpModificationsModel); + const svn_version_t* pVersion = svn_client_version(); QString msg; @@ -54,6 +60,9 @@ { delete mpUi; mpUi = NULL; + + delete mpModificationsModel; + mpModificationsModel = NULL; } void MainWindow::commit() Copied: trunk/src/dialogs/modificationsmodel.cpp (from rev 16, trunk/templates/cpp) =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp (rev 0) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-08-10 13:27:59 UTC (rev 19) @@ -0,0 +1,118 @@ +/*************************************************************************** + * Copyright (C) 2006 by Matthias Miller * + * ad...@gr... * + * * + * 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 "dialogs/modificationsmodel.h" +#include "svn/modification.h" + +ModificationsModel::ModificationsModel(SvnOperationContext* pContext, QString path) +{ + mpContext = pContext; + mPath = path; +} + +ModificationsModel::~ModificationsModel() +{ +} + +void ModificationsModel::setRevision(Revision revision) +{ + mError = QString(); + + Modifications mods; + if (mods.init(*mpContext, mPath, revision, mError)) + mods.getModifications(mModifications); + + emit layoutChanged(); +} + +int ModificationsModel::columnCount(const QModelIndex &rcParent) const +{ + Q_UNUSED(rcParent); + return mError.isEmpty() ? 2 : 1; +} + +int ModificationsModel::rowCount(const QModelIndex& rcParent) const +{ + Q_UNUSED(rcParent); + + if (mError.isEmpty()) + return mModifications.size(); + else + return 1; +} + +QVariant ModificationsModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + Q_UNUSED(orientation); + + if (role != Qt::DisplayRole) + return QVariant(); + + if (!mError.isEmpty()) + return QVariant(); + + switch (section) + { + case 0: return tr("Type"); + case 1: return tr("File"); + default: + Q_ASSERT(false); + return QVariant(); + } +} + +QVariant ModificationsModel::data(const QModelIndex& rcIndex, int role) const +{ + if (!rcIndex.isValid()) + return QVariant(); + + if (role != Qt::DisplayRole) + return QVariant(); + + if (!mError.isEmpty()) + return mError; + + if (rcIndex.row() >= mModifications.size()) + return QVariant(); + + Modification mod = mModifications.at(rcIndex.row()); + switch (rcIndex.column()) + { + case 0: + switch (mod.getType()) + { + case Modification::Type_TextMod: return tr("Modified"); + case Modification::Type_Add: return tr("Added"); + case Modification::Type_Delete: return tr("Deleted"); + case Modification::Type_Move: return tr("Moved"); + case Modification::Type_PropMod: return tr("Property Modified"); + case Modification::Type_Copy: return tr("Copied"); + case Modification::Type_New: return tr("?"); + case Modification::Type_Missing: return tr("!"); + case Modification::Type_Conflicting: return tr("Conflicting"); + } + break; + + case 1: + if (mod.getType() == Modification::Type_Move || mod.getType() == Modification::Type_Copy) + return mod.getFilePath() + "\n" + mod.getDestFilePath(); + else + return mod.getFilePath(); + } +} Modified: trunk/src/grandmas_svn.cpp =================================================================== --- trunk/src/grandmas_svn.cpp 2006-08-10 13:26:31 UTC (rev 18) +++ trunk/src/grandmas_svn.cpp 2006-08-10 13:27:59 UTC (rev 19) @@ -25,8 +25,10 @@ #include <QMenuBar> #include <QSettings> -GrandmasSVNApp::GrandmasSVNApp(int& argc, char** argv) : QApplication(argc, argv) +GrandmasSVNApp::GrandmasSVNApp(int& argc, char** argv, SvnOperationContext* pContext) : QApplication(argc, argv) { + mpContext = pContext; + mpOpenDlg = NULL; mpAppMenu = NULL; @@ -86,9 +88,9 @@ } } -void GrandmasSVNApp::openPath(QString /*path*/) +void GrandmasSVNApp::openPath(QString path) { - MainWindow* pMainWnd = new MainWindow(); + MainWindow* pMainWnd = new MainWindow(mpContext, path); pMainWnd->show(); } Modified: trunk/src/grandmas_svn.h =================================================================== --- trunk/src/grandmas_svn.h 2006-08-10 13:26:31 UTC (rev 18) +++ trunk/src/grandmas_svn.h 2006-08-10 13:27:59 UTC (rev 19) @@ -27,13 +27,14 @@ class OpenDialog; class QMenuBar; class QSettings; +class SvnOperationContext; class GrandmasSVNApp : public QApplication { Q_OBJECT public: - GrandmasSVNApp(int& argc, char** argv); + GrandmasSVNApp(int& argc, char** argv, SvnOperationContext* pContext); ~GrandmasSVNApp(); private: @@ -50,6 +51,8 @@ QMenuBar* mpAppMenu; OpenDialog* mpOpenDlg; QSettings* mpSettings; + + SvnOperationContext* mpContext; }; #endif Modified: trunk/src/main.cpp =================================================================== --- trunk/src/main.cpp 2006-08-10 13:26:31 UTC (rev 18) +++ trunk/src/main.cpp 2006-08-10 13:27:59 UTC (rev 19) @@ -55,53 +55,53 @@ return false; } }; -using namespace std; +class AprPoolWrapper +{ +public: + AprPoolWrapper() + { + apr_pool_create(&mPool, NULL); + } + ~AprPoolWrapper() + { + apr_pool_destroy(mPool); + mPool = NULL; + } + + apr_pool_t* getPool() + { + return mPool; + } + +private: + apr_pool_t* mPool; +}; + int main(int argc, char** argv) { - GrandmasSVNApp app(argc, argv); - - // This information is used for the QSettings object. - QCoreApplication::setOrganizationName("grandmas-svn.org"); - QCoreApplication::setOrganizationDomain("grandmas-svn.org"); - QCoreApplication::setApplicationName("Grandma's SVN"); - - apr_status_t rv = apr_initialize(); - if (rv != APR_SUCCESS) + if (apr_initialize() != APR_SUCCESS) return 1; - // BEGIN TEST CODE - if (false) - { - apr_pool_t* pool; - apr_pool_create(&pool, NULL); + AprPoolWrapper poolWrapper; - QSvnOperationStatus status; - QSvnAuthentication auth; - SvnOperationContext context(pool, status, auth);; + QSvnOperationStatus status; + QSvnAuthentication auth; + SvnOperationContext context(poolWrapper.getPool(), status, auth); - QString error; - Revision revision; - //revision.setUncommittedRevision(); - revision.setCommittedRevision(5); + GrandmasSVNApp app(argc, argv, &context); - Modifications mods; - if (!mods.init(context, "/home/joshn/projects/gsvn", revision, error)) - { - cout << "Error!: " << (const char*)error.toAscii() << "\n"; - } + // This information is used for the QSettings object. + QCoreApplication::setOrganizationName("grandmas-svn.org"); + QCoreApplication::setOrganizationDomain("grandmas-svn.org"); + QCoreApplication::setApplicationName("Grandma's SVN"); - apr_pool_destroy(pool); - } - // END TEST CODE - CommandLine cmd; #ifdef GSVN_TESTS cmd.addAvailableOption('t', "tests", "run unit tests", false); #endif QString error; - if (!cmd.parse(argc, argv, error)) { fputs(error.toAscii(), stderr); Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-08-10 13:26:31 UTC (rev 18) +++ trunk/ui/mainwindow.ui 2006-08-10 13:27:59 UTC (rev 19) @@ -145,7 +145,7 @@ <string>Changes:</string> </property> <property name="buddy" > - <cstring>changesTableView</cstring> + <cstring>changesTreeView</cstring> </property> </widget> </item> @@ -158,11 +158,7 @@ <number>6</number> </property> <item> - <widget class="QTableView" name="changesTableView" > - <property name="tabKeyNavigation" > - <bool>false</bool> - </property> - </widget> + <widget class="QTreeView" name="changesTreeView" /> </item> <item> <layout class="QVBoxLayout" > @@ -304,20 +300,11 @@ <x>0</x> <y>0</y> <width>639</width> - <height>21</height> + <height>22</height> </rect> </property> </widget> - <widget class="QStatusBar" name="statusbar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>433</y> - <width>639</width> - <height>19</height> - </rect> - </property> - </widget> + <widget class="QStatusBar" name="statusbar" /> <action name="action_Close" > <property name="text" > <string>&Close</string> @@ -327,7 +314,7 @@ <pixmapfunction></pixmapfunction> <tabstops> <tabstop>logEdit</tabstop> - <tabstop>changesTableView</tabstop> + <tabstop>changesTreeView</tabstop> <tabstop>diffButton</tabstop> <tabstop>revertButton</tabstop> <tabstop>addButton</tabstop> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-08-10 13:26:33
|
Revision: 18 Author: matthiasmiller Date: 2006-08-10 06:26:31 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/grandmas-svn/?rev=18&view=rev Log Message: ----------- implementing Modification::getDestFilePath and constifying Modified Paths: -------------- trunk/include/svn/modification.h Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-08-10 04:20:34 UTC (rev 17) +++ trunk/include/svn/modification.h 2006-08-10 13:26:31 UTC (rev 18) @@ -49,11 +49,15 @@ Type_Conflicting, }; - QString getFilePath() { return mFilePath; } - Type getType() { return mType; } + QString getFilePath() const { return mFilePath; } + Type getType() const { return mType; } // Only use for move and copy mods - QString getDestFilePath(); + QString getDestFilePath() const + { + Q_ASSERT(mType == Type_Move || mType == Type_Copy); + return mDestFilePath; + } private: friend class Modifications; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |