Thread: [Grandmas-svn-commit] SF.net SVN: grandmas-svn: [51] trunk (Page 3)
Brought to you by:
matthiasmiller
From: <mat...@us...> - 2006-10-25 18:59:14
|
Revision: 51 http://svn.sourceforge.net/grandmas-svn/?rev=51&view=rev Author: matthiasmiller Date: 2006-10-25 11:59:09 -0700 (Wed, 25 Oct 2006) Log Message: ----------- Several UI tweaks: * fix title on main window * add settings button to main window * allow enter key to open diffs Modified Paths: -------------- trunk/src/dialogs/mainwindow.cpp trunk/ui/mainwindow.ui Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-25 15:20:18 UTC (rev 50) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-25 18:59:09 UTC (rev 51) @@ -96,29 +96,14 @@ #endif connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); - connect(mpUi->changesTreeView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(diff(const QModelIndex&))); + connect(mpUi->changesTreeView, SIGNAL(activated(const QModelIndex&)), this, SLOT(diff(const QModelIndex&))); connect(mpUi->diffButton, SIGNAL(clicked()), this, SLOT(diff())); 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; - msg += QString::number(pVersion->major); - msg += "."; - msg += QString::number(pVersion->minor); - msg += "."; - msg += QString::number(pVersion->patch); - if (pVersion->tag) - { - msg += "-"; - msg += pVersion->tag; - } - setWindowTitle(tr("Grandma's SVN - ") + msg); + reload(); } MainWindow::~MainWindow() Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-10-25 15:20:18 UTC (rev 50) +++ trunk/ui/mainwindow.ui 2006-10-25 18:59:09 UTC (rev 51) @@ -104,10 +104,51 @@ </font> </property> <property name="text" > - <string>grandmas-svn</string> + <string>Grandma's SVN</string> </property> </widget> </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="settingsButton" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>&Settings</string> + </property> + </widget> + </item> </layout> </item> <item> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-10-25 23:47:42
|
Revision: 52 http://svn.sourceforge.net/grandmas-svn/?rev=52&view=rev Author: highjinx Date: 2006-10-25 16:47:09 -0700 (Wed, 25 Oct 2006) Log Message: ----------- * Fixed file status on working revisions * Changed the Revision object to know about "base" revisions, to speed diffing Modified Paths: -------------- trunk/include/svn/operation.h trunk/include/svn/revision.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/commit_summary.cpp trunk/src/svn/file_access.cpp trunk/src/svn/operation.cpp trunk/src/svn/revision.cpp trunk/tests/svn_test.cpp Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist + *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist tags Modified: trunk/include/svn/operation.h =================================================================== --- trunk/include/svn/operation.h 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/include/svn/operation.h 2006-10-25 23:47:09 UTC (rev 52) @@ -28,7 +28,7 @@ namespace Operation { - bool initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& rError); + bool initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& rError); - bool getRelativeRepoUrl(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelPath, QString& rError); + bool getRepoCheckoutUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError); }; Modified: trunk/include/svn/revision.h =================================================================== --- trunk/include/svn/revision.h 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/include/svn/revision.h 2006-10-25 23:47:09 UTC (rev 52) @@ -30,12 +30,25 @@ public: Revision(); ~Revision(); + + static Revision uncommitted() { Revision rev; rev.mType = Uncommitted; rev.mCommittedRevision = 0; return rev; } + static Revision committed(int revision) { Revision rev; rev.mType = Committed; rev.mCommittedRevision = revision; return rev; } + static Revision base() { Revision rev; rev.mType = Base; rev.mCommittedRevision = 0; return rev; } + static Revision head() { Revision rev; rev.mType = Head; rev.mCommittedRevision = 0; return rev; } + + enum Type + { + Uncommitted, + Committed, + Base, + Head, // Unimplemented + }; bool operator==(const Revision& rcOther) const { - if (mIsCommitted != rcOther.mIsCommitted) + if (mType != rcOther.mType) return false; - if (mIsCommitted && mCommittedRevision != rcOther.mCommittedRevision) + if (mType == Committed && mCommittedRevision != rcOther.mCommittedRevision) return false; return true; @@ -44,11 +57,8 @@ { return !(*this == rcOther); } - - void setUncommittedRevision(); - void setCommittedRevision(int revision); - bool isCommittedRevision(); + Type getType(); int getCommittedRevision(); // svn wrapper functions @@ -56,7 +66,7 @@ svn_opt_revision_t getSvnRevision(); private: - bool mIsCommitted; + Type mType; int mCommittedRevision; }; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-25 23:47:09 UTC (rev 52) @@ -125,7 +125,7 @@ if (pEvent->type() == QEvent::ActivationChange && isActiveWindow()) { // Refresh the modifications if it doesn't require server access. - if (mpModificationsModel && !mDisplayedRevision.isCommittedRevision()) + if (mpModificationsModel && mDisplayedRevision.getType() == Revision::Uncommitted) reload(); } } @@ -190,7 +190,7 @@ #elif defined(Q_WS_MAC) app = "opendiff"; #else - return false; + app = "meld"; #endif QStringList args; Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/src/svn/commit_summary.cpp 2006-10-25 23:47:09 UTC (rev 52) @@ -29,25 +29,23 @@ mModifications.clear(); rError = ""; mRevision = revision; - //mpContext = &rServer; - mWcPath = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); + const char* fullCanonPath = 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)) + if (!Operation::initAuthProviders(rContext, ctx, 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()) + if (revision.getType() != Revision::Uncommitted) { + if (!Operation::getRepoCheckoutUrl(rContext, ctx, fullRepoPath, mWcPath, rError)) + return false; + 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()); + APR_ARRAY_PUSH(array, const char*) = fullCanonPath; pError = svn_client_log2(array, &startRev, @@ -62,9 +60,10 @@ } else { + mWcPath = fullRepoPath; + svn_opt_revision_t svnRevision = revision.getSvnRevision(); - const char* canonPath = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); - pError = svn_client_status2(NULL, canonPath, &svnRevision, + pError = svn_client_status2(NULL, fullCanonPath, &svnRevision, statusCallback, this, true/*recurse*/, @@ -96,8 +95,8 @@ mod.mFilePath = path; - mod.mNewRevision.setCommittedRevision(revision); - mod.mOldRevision.setCommittedRevision(revision-1); + mod.mNewRevision = Revision::committed(revision); + mod.mOldRevision = Revision::committed(revision-1); svn_log_changed_path_t *log_item = reinterpret_cast<svn_log_changed_path_t *>(val); switch (log_item->action) { @@ -122,7 +121,7 @@ } pThis->mAuthor = author; - //pThis->mDate = date; + pThis->mDate = QDateTime::fromString(date, Qt::ISODate); pThis->mLogMessage = message; return NULL; @@ -137,7 +136,9 @@ // Set old revision to base, if the file is already under version control if (status->entry) - mod.mOldRevision.setCommittedRevision(status->entry->revision); + mod.mOldRevision = Revision::base(); +// else +// mod.mOldRevision = Revision::unknown(); switch (status->text_status) { Modified: trunk/src/svn/file_access.cpp =================================================================== --- trunk/src/svn/file_access.cpp 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/src/svn/file_access.cpp 2006-10-25 23:47:09 UTC (rev 52) @@ -30,14 +30,16 @@ namespace { - bool getRandomFilePath(QString dirPath, QString filePrefix, QString fileExtension, QString& rFilePath) + bool getRandomFilePath(QString dirPath, QString filePrefix, QString fileExtension, QString& rFilePath, SvnOperationContext& rContext) { QString randString; while (true) { - if (!QFile::exists(dirPath+filePrefix+randString+"."+fileExtension)) + QString testPath = dirPath + QDir::separator() + filePrefix+randString+"."+fileExtension; + testPath = svn_path_canonicalize(testPath.toAscii(), rContext.getAprPool()); + if (!QFile::exists(testPath)) { - rFilePath = dirPath+filePrefix+randString+"."+fileExtension; + rFilePath = testPath; return true; } randString.setNum(rand() % 10000); @@ -55,7 +57,7 @@ bool RepoFileAccess::getFile(SvnOperationContext& rContext, QString fullRepoPath, Revision rev, QString& rCreatedFilePath, QString& rError) { - if (!rev.isCommittedRevision()) + if (rev.getType() == Revision::Uncommitted) { rCreatedFilePath = fullRepoPath; return true; @@ -63,7 +65,7 @@ // 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) || + if (!getRandomFilePath(QDir::tempPath(), "bogus", "cpp", rCreatedFilePath, rContext) || 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."; @@ -80,7 +82,7 @@ svn_client_ctx_t* pCtx = NULL; svn_client_create_context(&pCtx, rContext.getAprPool()); - if (!Operation::initAuthProviders(pCtx, rContext, rError)) + if (!Operation::initAuthProviders(rContext, pCtx, rError)) return false; svn_opt_revision_t svnRev = rev.getSvnRevision(); Modified: trunk/src/svn/operation.cpp =================================================================== --- trunk/src/svn/operation.cpp 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/src/svn/operation.cpp 2006-10-25 23:47:09 UTC (rev 52) @@ -46,7 +46,7 @@ } -bool Operation::initAuthProviders(svn_client_ctx_t* context, SvnOperationContext& rContext, QString& /*rError*/) +bool Operation::initAuthProviders(SvnOperationContext& rContext, svn_client_ctx_t* context, QString& /*rError*/) { apr_array_header_t *providers = apr_array_make(rContext.getAprPool(), 7, sizeof(svn_auth_provider_object_t *)); @@ -83,7 +83,7 @@ class SvnInfo { public: - bool getRelativeRepoUrl(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelPath, QString& rError) + bool getRepoCheckoutUrl(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) @@ -91,6 +91,7 @@ rError = pError->message; return false; } + Q_ASSERT(mRelativeRepoUrl != ""); rRelPath = mRelativeRepoUrl; return true; } @@ -115,9 +116,9 @@ }; -bool Operation::getRelativeRepoUrl(SvnOperationContext& rContext, QString fullRepoPath, svn_client_ctx_t* ctx, QString& rRelPath, QString& rError) +bool Operation::getRepoCheckoutUrl(SvnOperationContext& rContext, svn_client_ctx_t* ctx, QString& rRelPath, QString fullRepoPath, QString& rError) { SvnInfo info; - return info.getRelativeRepoUrl(rContext, fullRepoPath, ctx, rRelPath, rError); + return info.getRepoCheckoutUrl(rContext, fullRepoPath, ctx, rRelPath, rError); } Modified: trunk/src/svn/revision.cpp =================================================================== --- trunk/src/svn/revision.cpp 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/src/svn/revision.cpp 2006-10-25 23:47:09 UTC (rev 52) @@ -24,48 +24,42 @@ Revision::Revision() { - mIsCommitted = false; - mCommittedRevision = -1; + mType = Uncommitted; } Revision::~Revision() { } -void Revision::setUncommittedRevision() +Revision::Type Revision::getType() { - mIsCommitted = false; + return mType; } -void Revision::setCommittedRevision(int revision) -{ - mIsCommitted = true; - mCommittedRevision = revision; -} - -bool Revision::isCommittedRevision() -{ - return mIsCommitted; -} - int Revision::getCommittedRevision() { - GSVN_ASSERT(mIsCommitted); + GSVN_ASSERT(mType == Committed); return mCommittedRevision; } svn_opt_revision_t Revision::getSvnRevision() { svn_opt_revision_t svnRev; - if (!isCommittedRevision()) + svnRev.value.number = mCommittedRevision; + switch (mType) { + case Uncommitted: svnRev.kind = svn_opt_revision_working; - svnRev.value.number = 0; - } - else - { + break; + case Committed: svnRev.kind = svn_opt_revision_number; - svnRev.value.number = getCommittedRevision(); + break; + case Base: + svnRev.kind = svn_opt_revision_base; + break; + case Head: + svnRev.kind = svn_opt_revision_head; + break; } return svnRev; } Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-10-25 18:59:09 UTC (rev 51) +++ trunk/tests/svn_test.cpp 2006-10-25 23:47:09 UTC (rev 52) @@ -41,7 +41,7 @@ svn_client_create_context(&mpCtx, mpContext->getAprPool()); QString rIgnoredError; - Q_ASSERT(Operation::initAuthProviders(mpCtx, *mpContext, rIgnoredError)); + Q_ASSERT(Operation::initAuthProviders(*mpContext, mpCtx, rIgnoredError)); mpCtx->log_msg_func = logMsgCallback; mpCtx->log_msg_baton = this; @@ -58,7 +58,7 @@ { mCurrentCommitMsg = commitMessage; - svn_client_commit_info_t* pCommitInfo; + svn_client_commit_info_t* pCommitInfo; apr_array_header_t *array = apr_array_make(mpContext->getAprPool(), 1, sizeof(const char*)); APR_ARRAY_PUSH(array, const char*) = svn_path_canonicalize(getWcPath().toAscii(), mpContext->getAprPool()); @@ -196,7 +196,7 @@ CommitSummary summary; QString rError; Revision rev; - rev.setCommittedRevision(1); + rev = Revision::committed(1); QVERIFY(summary.init(*mpContext, getWcPath(), rev, rError)); const QList<Modification>& mods = summary.modifications(); @@ -205,7 +205,7 @@ QCOMPARE(mods[0].getFilePath(), QString("/first.txt")); QCOMPARE(mods[0].getType(), Modification::Type_Add); - rev.setUncommittedRevision(); + rev = Revision::uncommitted(); QVERIFY(summary.init(*mpContext, getWcPath(), rev, rError)); QCOMPARE(mods.size(), 1); @@ -218,13 +218,13 @@ QString rError; QString filePath; Revision oldRev; - oldRev.setCommittedRevision(1); + oldRev = Revision::committed(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! Revision newRev; - newRev.setUncommittedRevision(); + newRev = Revision::uncommitted(); 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 @@ -244,13 +244,13 @@ { QString rError; Revision rev; - rev.setCommittedRevision(1); + rev = Revision::committed(1); CommitSummary summary; QVERIFY(summary.init(*mpContext, getWcPath(), rev, rError)); - //QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); // TODO: set when committing - //QCOMPARE(summary.getCommitDate(), bogus); // TODO: fill in + //QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); + //QCOMPARE(summary.getCommitDate(), bogus); QCOMPARE(summary.getCommitLogMessage(), QString("first commit")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-27 04:30:39
|
Revision: 61 http://svn.sourceforge.net/grandmas-svn/?rev=61&view=rev Author: matthiasmiller Date: 2006-10-26 21:30:33 -0700 (Thu, 26 Oct 2006) Log Message: ----------- change revisions view from a QTableView to a QTreeView Modified Paths: -------------- trunk/src/dialogs/mainwindow.cpp trunk/ui/mainwindow.ui Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-26 14:45:13 UTC (rev 60) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-27 04:30:33 UTC (rev 61) @@ -94,6 +94,7 @@ mpUi->setupUi(this); #if QT_VERSION >= 0x040200 mpUi->changesTreeView->setAllColumnsShowFocus(true); + mpUi->revisionsTreeView->setAllColumnsShowFocus(true); #endif connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-10-26 14:45:13 UTC (rev 60) +++ trunk/ui/mainwindow.ui 2006-10-27 04:30:33 UTC (rev 61) @@ -1,4 +1,7 @@ <ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow" > <property name="geometry" > @@ -289,27 +292,27 @@ <string>Recent Activity:</string> </property> <property name="buddy" > - <cstring>revisionsTableView</cstring> + <cstring>revisionsTreeView</cstring> </property> </widget> </item> <item> - <widget class="QTableView" name="revisionsTableView" > + <widget class="QTreeView" name="revisionsTreeView" > <property name="minimumSize" > <size> <width>0</width> <height>100</height> </size> </property> - <property name="sizeIncrement" > - <size> - <width>0</width> - <height>0</height> - </size> + <property name="selectionMode" > + <enum>QAbstractItemView::ExtendedSelection</enum> </property> - <property name="tabKeyNavigation" > - <bool>false</bool> + <property name="indentation" > + <number>0</number> </property> + <property name="rootIsDecorated" > + <bool>true</bool> + </property> </widget> </item> </layout> @@ -321,6 +324,7 @@ </property> </action> </widget> + <pixmapfunction></pixmapfunction> <tabstops> <tabstop>logEdit</tabstop> <tabstop>changesTreeView</tabstop> @@ -329,7 +333,6 @@ <tabstop>addButton</tabstop> <tabstop>deleteButton</tabstop> <tabstop>moveButton</tabstop> - <tabstop>revisionsTableView</tabstop> <tabstop>updateButton</tabstop> <tabstop>commitButton</tabstop> </tabstops> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-10-27 15:09:55
|
Revision: 66 http://svn.sourceforge.net/grandmas-svn/?rev=66&view=rev Author: highjinx Date: 2006-10-27 08:09:48 -0700 (Fri, 27 Oct 2006) Log Message: ----------- Enable callers to chose whether to fetch modifications in CommitSummaryFetcher Modified Paths: -------------- trunk/include/svn/commit_summary.h trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/svn/commit_summary.cpp trunk/tests/svn_test.cpp Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-10-27 15:01:19 UTC (rev 65) +++ trunk/include/svn/commit_summary.h 2006-10-27 15:09:48 UTC (rev 66) @@ -59,10 +59,10 @@ public: // Must be passed a working copy path (TODO: support full repo path) bool fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, - Revision startRevision, Revision endRevision, + Revision startRevision, Revision endRevision, bool fetchModifications, QList<CommitSummary>& rSummaries, QString& rError); - bool fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, - Revision revision, CommitSummary& rSummary, QString& rError); + bool fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, + bool fetchModifications, CommitSummary& rSummary, QString& rError); protected: QString mWcPath; Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-10-27 15:01:19 UTC (rev 65) +++ trunk/src/dialogs/commit.cpp 2006-10-27 15:09:48 UTC (rev 66) @@ -76,7 +76,7 @@ CommitSummary summary; CommitSummaryFetcher fetcher; QString error; - if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), summary, error)) + if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), true, summary, error)) mpModificationsModel->showModifications(summary.modifications(), false); else mpModificationsModel->showError(error); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-27 15:01:19 UTC (rev 65) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-27 15:09:48 UTC (rev 66) @@ -202,7 +202,7 @@ CommitSummary summary; CommitSummaryFetcher fetcher; QString error; - if (fetcher.fetchSummary(*mpContext, mPath, mDisplayedRevision, summary, error)) + if (fetcher.fetchSummary(*mpContext, mPath, mDisplayedRevision, true, summary, error)) mpModificationsModel->showModifications(summary.modifications(), false); else mpModificationsModel->showError(error); Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-10-27 15:01:19 UTC (rev 65) +++ trunk/src/svn/commit_summary.cpp 2006-10-27 15:09:48 UTC (rev 66) @@ -25,7 +25,7 @@ #include <svn_path.h> bool CommitSummaryFetcher::fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, - Revision startRevision, Revision endRevision, + Revision startRevision, Revision endRevision, bool fetchModifications, QList<CommitSummary>& rSummaries, QString& rError) { mSummaries.clear(); @@ -52,7 +52,7 @@ &startRev, &endRev, 0/*limit*/, - true/*discover_changed_paths*/, + fetchModifications/*discover_changed_paths*/, false/*strict_node_history*/, logCallback, this, @@ -88,10 +88,10 @@ } bool CommitSummaryFetcher::fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, - Revision revision, CommitSummary& rSummary, QString& rError) + Revision revision, bool fetchModifications, CommitSummary& rSummary, QString& rError) { QList<CommitSummary> summaries; - if (!fetchSummaries(rContext, fullRepoPath, revision, revision, summaries, rError)) + if (!fetchSummaries(rContext, fullRepoPath, revision, revision, fetchModifications, summaries, rError)) return false; GSVN_ASSERT(summaries.size() == 1); @@ -103,38 +103,41 @@ { CommitSummary summary; - for (apr_hash_index_t* pKey = apr_hash_first(pool, changed_paths); pKey; pKey = apr_hash_next(pKey)) + if (changed_paths) { - char *path; - void *val; - apr_hash_this(pKey, (const void **)&path, NULL, &val); - - Modification mod; - mod.mFilePath = path; - - mod.mNewRevision = Revision::committed(revision); - mod.mOldRevision = Revision::committed(revision-1); - svn_log_changed_path_t *log_item = reinterpret_cast<svn_log_changed_path_t *>(val); - switch (log_item->action) + for (apr_hash_index_t* pKey = apr_hash_first(pool, changed_paths); pKey; pKey = apr_hash_next(pKey)) { - 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; + char *path; + void *val; + apr_hash_this(pKey, (const void **)&path, NULL, &val); + + Modification mod; + mod.mFilePath = path; + + mod.mNewRevision = Revision::committed(revision); + mod.mOldRevision = Revision::committed(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; + } + summary.mModifications.append(mod); } - summary.mModifications.append(mod); } summary.mRevision = Revision::committed(revision); Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-10-27 15:01:19 UTC (rev 65) +++ trunk/tests/svn_test.cpp 2006-10-27 15:09:48 UTC (rev 66) @@ -198,7 +198,7 @@ QString rError; Revision rev; rev = Revision::committed(1); - QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, summary, rError)); + QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, true, summary, rError)); const QList<Modification>& mods = summary.modifications(); @@ -208,7 +208,7 @@ QCOMPARE(summary.getRevision(), Revision::committed(1)); rev = Revision::uncommitted(); - QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, summary, rError)); + QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, true, summary, rError)); QCOMPARE(mods.size(), 1); QCOMPARE(mods[0].getFilePath(), QString("/second.txt")); @@ -251,7 +251,7 @@ CommitSummary summary; CommitSummaryFetcher fetcher; - QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, summary, rError)); + QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, false, summary, rError)); //QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); //QCOMPARE(summary.getCommitDate(), bogus); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-27 15:35:39
|
Revision: 67 http://svn.sourceforge.net/grandmas-svn/?rev=67&view=rev Author: matthiasmiller Date: 2006-10-27 08:35:28 -0700 (Fri, 27 Oct 2006) Log Message: ----------- * start showing revisions in main window * fix bug in CommitSummary::fetchSummaries that sometimes prevented committed summaries from being loaded Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/include/dialogs/revisionsmodel.h trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp trunk/src/dialogs/revisionsmodel.cpp trunk/src/svn/commit_summary.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-10-27 15:09:48 UTC (rev 66) +++ trunk/include/dialogs/mainwindow.h 2006-10-27 15:35:28 UTC (rev 67) @@ -48,7 +48,8 @@ void move(); private: - void reload(); + void reloadCommitSummaries(); + void reloadModifications(); bool diffFiles(QString left, QString right); Ui_MainWindow* mpUi; Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2006-10-27 15:09:48 UTC (rev 66) +++ trunk/include/dialogs/revisionsmodel.h 2006-10-27 15:35:28 UTC (rev 67) @@ -19,17 +19,24 @@ ***************************************************************************/ #include <QAbstractListModel> +class CommitSummary; + class RevisionsModel : public QAbstractListModel { public: RevisionsModel(); virtual ~RevisionsModel(); - + + void showError(QString error); + void showCommitSummaries(QList<CommitSummary> summaries); + 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: + QString mError; + QList<CommitSummary> mCommitSummaries; }; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-27 15:09:48 UTC (rev 66) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-27 15:35:28 UTC (rev 67) @@ -114,7 +114,8 @@ setWindowTitle(tr("%1 - %2").arg(QDir::convertSeparators(path)).arg(windowTitle())); - reload(); + reloadCommitSummaries(); + reloadModifications(); } MainWindow::~MainWindow() @@ -143,7 +144,7 @@ { // Refresh the modifications if it doesn't require server access. if (mpModificationsModel && mDisplayedRevision.getType() == Revision::Uncommitted) - reload(); + reloadModifications(); } } @@ -197,13 +198,30 @@ dlg.exec(); } -void MainWindow::reload() +void MainWindow::reloadCommitSummaries() { + CommitSummaryFetcher fetcher; + QList<CommitSummary> summaries; + CommitSummary uncommittedSummary; + QString error; + if (!fetcher.fetchSummaries(*mpContext, mPath, Revision::base(), Revision::committed(0), false, summaries, error) || + !fetcher.fetchSummary(*mpContext, mPath, mDisplayedRevision, false, uncommittedSummary, error)) + { + mpRevisionsModel->showError(error); + return; + } + + summaries.push_front(uncommittedSummary); + mpRevisionsModel->showCommitSummaries(summaries); +} + +void MainWindow::reloadModifications() +{ CommitSummary summary; CommitSummaryFetcher fetcher; QString error; if (fetcher.fetchSummary(*mpContext, mPath, mDisplayedRevision, true, summary, error)) - mpModificationsModel->showModifications(summary.modifications(), false); + mpModificationsModel->showModifications(summary.modifications(), true); else mpModificationsModel->showError(error); } Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-10-27 15:09:48 UTC (rev 66) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-10-27 15:35:28 UTC (rev 67) @@ -83,7 +83,7 @@ Modification ModificationsModel::getModificationFromIndex(int row) const { - if (row < 0 || row >= mAllModifications.count()) + if (row < 0 || row >= mAllModifications.size()) { GSVN_ASSERT(false); return Modification(); Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2006-10-27 15:09:48 UTC (rev 66) +++ trunk/src/dialogs/revisionsmodel.cpp 2006-10-27 15:35:28 UTC (rev 67) @@ -19,6 +19,9 @@ ***************************************************************************/ #include "dialogs/revisionsmodel.h" +#include "debug.h" +#include "svn/commit_summary.h" + RevisionsModel::RevisionsModel() { } @@ -27,26 +30,54 @@ { } +void RevisionsModel::showError(QString error) +{ + GSVN_ASSERT(!error.isNull()); + mError = error; + mCommitSummaries.clear(); +} + +void RevisionsModel::showCommitSummaries(QList<CommitSummary> summaries) +{ + mError = QString(); + mCommitSummaries = summaries; +} + int RevisionsModel::columnCount(const QModelIndex &rcParent) const { + Q_UNUSED(rcParent); + + if (!mError.isNull()) + return 1; + return 4; } int RevisionsModel::rowCount(const QModelIndex& rcParent) const { - return 0; + Q_UNUSED(rcParent); + + if (!mError.isNull()) + return 1; + + return mCommitSummaries.count(); } QVariant RevisionsModel::headerData(int section, Qt::Orientation orientation, int role) const { + Q_UNUSED(orientation); + if (role == Qt::DisplayRole) { + if (!mError.isNull()) + return QVariant(); + switch (section) { case 0: return tr("Revision"); case 1: return tr("Author"); case 2: return tr("Date"); - case 3: return tr("Message"); + case 3: return tr("Log Message"); default: return QVariant(); } } @@ -56,6 +87,44 @@ QVariant RevisionsModel::data(const QModelIndex& rcIndex, int role) const { - return QVariant(); + if (role == Qt::DisplayRole) + { + // display the error + if (!mError.isNull()) + return mError; + + if (!rcIndex.isValid() || rcIndex.row() >= mCommitSummaries.size()) + return QVariant(); + + CommitSummary summary = mCommitSummaries.at(rcIndex.row()); + switch (rcIndex.column()) + { + case 0: + { + Revision rev = summary.getRevision(); + switch (rev.getType()) + { + case Revision::Uncommitted: return tr("(uncommitted)"); + case Revision::Committed: return tr("r%1").arg(QString::number(rev.getCommittedRevision())) ; + case Revision::Base: return tr("(base)"); + case Revision::Head: return tr("(head)"); + default: + return QVariant(); + } + } + case 1: return summary.getCommitAuthor(); + case 2: return summary.getCommitDate(); + case 3: + { + QString logMessage = summary.getCommitLogMessage(); + logMessage = logMessage.replace('\r', ' '); + logMessage = logMessage.replace('\n', ' '); + return logMessage; + } + default: return QVariant(); + } + } + else + return QVariant(); } Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-10-27 15:09:48 UTC (rev 66) +++ trunk/src/svn/commit_summary.cpp 2006-10-27 15:35:28 UTC (rev 67) @@ -40,7 +40,7 @@ svn_error_t* pError = NULL; if (startRevision.getType() != Revision::Uncommitted) { - if (!Operation::getRepoCheckoutUrl(rContext, ctx, fullRepoPath, mWcPath, rError)) + if (!Operation::getRepoCheckoutUrl(rContext, ctx, mWcPath, fullRepoPath, rError)) return false; svn_opt_revision_t startRev = startRevision.getSvnRevision(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-10-28 15:24:16
|
Revision: 68 http://svn.sourceforge.net/grandmas-svn/?rev=68&view=rev Author: matthiasmiller Date: 2006-10-28 08:24:10 -0700 (Sat, 28 Oct 2006) Log Message: ----------- allow merging of diffs on Mac Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/src/dialogs/mainwindow.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-10-27 15:35:28 UTC (rev 67) +++ trunk/include/dialogs/mainwindow.h 2006-10-28 15:24:10 UTC (rev 68) @@ -50,7 +50,7 @@ private: void reloadCommitSummaries(); void reloadModifications(); - bool diffFiles(QString left, QString right); + bool diffFiles(QString left, QString right, bool allowMerge); Ui_MainWindow* mpUi; SvnOperationContext* mpContext; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-10-27 15:35:28 UTC (rev 67) +++ trunk/src/dialogs/mainwindow.cpp 2006-10-28 15:24:10 UTC (rev 68) @@ -178,7 +178,8 @@ } // Launch the diff - if (!diffFiles(leftPath, rightPath)) + bool allowMerge = mod.getNewRevision().getType() == Revision::Uncommitted; + if (!diffFiles(leftPath, rightPath, allowMerge)) { QMessageBox::critical(this, tr("The differences could not be displayed."), tr("The comparison program could not be opened.")); return; @@ -226,23 +227,31 @@ mpModificationsModel->showError(error); } -bool MainWindow::diffFiles(QString left, QString right) +bool MainWindow::diffFiles(QString left, QString right, bool allowMerge) { // TODO: This should be configurable. QString app; + + QStringList args; + args.push_back(left); + args.push_back(right); + #if defined(Q_WS_WIN) if (!getWinAppForExtension("WinMerge", app)) return false; + Q_UNUSED(allowMerge); #elif defined(Q_WS_MAC) app = "opendiff"; + if (allowMerge) + { + args.push_back(tr("-merge")); + args.push_back(right); + } #else app = "meld"; + Q_UNUSED(allowMerge); #endif - QStringList args; - args.push_back(left); - args.push_back(right); - QProcess* pProcess = new QProcess(this); pProcess->start(app, args); return pProcess->waitForStarted(-1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-03 18:11:00
|
Revision: 72 http://svn.sourceforge.net/grandmas-svn/?rev=72&view=rev Author: matthiasmiller Date: 2006-11-03 10:10:54 -0800 (Fri, 03 Nov 2006) Log Message: ----------- show modifications for committed revisions Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/include/dialogs/modificationsmodel.h trunk/include/dialogs/revisionsmodel.h trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/modificationsmodel.cpp trunk/src/dialogs/revisionsmodel.cpp trunk/ui/mainwindow.ui Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-11-03 02:47:17 UTC (rev 71) +++ trunk/include/dialogs/mainwindow.h 2006-11-03 18:10:54 UTC (rev 72) @@ -28,6 +28,8 @@ class RevisionsModel; class SvnOperationContext; class Ui_MainWindow; +class QAbstractItemView; +class QItemSelection; class QModelIndex; class MainWindow: public QMainWindow @@ -46,11 +48,13 @@ void diff(); void diff(const QModelIndex& rcIndex); void move(); + void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); private: void reloadCommitSummaries(); void reloadModifications(); bool diffFiles(QString left, QString right, bool allowMerge); + QList<int> getSelectedRows(QAbstractItemView* pView); Ui_MainWindow* mpUi; SvnOperationContext* mpContext; Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-11-03 02:47:17 UTC (rev 71) +++ trunk/include/dialogs/modificationsmodel.h 2006-11-03 18:10:54 UTC (rev 72) @@ -32,7 +32,7 @@ void showError(QString error); void showModifications(const QList<Modification>& rcModifications, bool includeUnversionedMods); - Modification getModificationFromIndex(int row) const; + bool getModificationForRow(int row, Modification& rModification) const; virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; virtual int rowCount(const QModelIndex& rcParent = QModelIndex()) const; Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2006-11-03 02:47:17 UTC (rev 71) +++ trunk/include/dialogs/revisionsmodel.h 2006-11-03 18:10:54 UTC (rev 72) @@ -20,6 +20,7 @@ #include <QAbstractListModel> class CommitSummary; +class Revision; class RevisionsModel : public QAbstractListModel { @@ -28,14 +29,19 @@ virtual ~RevisionsModel(); void showError(QString error); - void showCommitSummaries(QList<CommitSummary> summaries); - + void showCommitSummaries(CommitSummary uncommittedRevision, QList<CommitSummary> committedRevisions); + + bool getRevisionForRow(int row, Revision& rRevision); + QModelIndex getUncommittedRevision(); + 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: + static QString getRevisionAsString(Revision rev); + QString mError; QList<CommitSummary> mCommitSummaries; }; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-03 02:47:17 UTC (rev 71) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-03 18:10:54 UTC (rev 72) @@ -112,10 +112,13 @@ mpUi->revisionsTreeView->setModel(mpRevisionsModel); mpUi->revisionsTreeView->header()->setMovable(false); + connect(mpUi->revisionsTreeView->selectionModel(), + SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), + this, SLOT(revisionSelectionChanged(const QItemSelection&, const QItemSelection&))); + setWindowTitle(tr("%1 - %2").arg(QDir::convertSeparators(path)).arg(windowTitle())); reloadCommitSummaries(); - reloadModifications(); } MainWindow::~MainWindow() @@ -156,20 +159,15 @@ void MainWindow::diff() { - // determine which rows are selected (remove duplicate rows, since an index is returned for each column) - QModelIndexList selection = mpUi->changesTreeView->selectionModel()->selectedIndexes(); - QSet<int> rows; - Q_FOREACH(QModelIndex index, selection) - { - if (index.isValid()) - rows.insert(index.row()); - } - + QList<int> rows = getSelectedRows(mpUi->changesTreeView); Q_FOREACH(int row, rows) { // Generate each side of the diff QString error, leftPath, rightPath; - Modification mod = mpModificationsModel->getModificationFromIndex(row); + Modification mod; + if (!mpModificationsModel->getModificationForRow(row, mod)) + continue; + QString fullFilePath = RepoFileAccess::getCanonicalPath(*mpContext, mPath, mod.getFilePath()); if (!RepoFileAccess::getDiffFiles(*mpContext, fullFilePath, mod.getOldRevision(), mod.getNewRevision(), leftPath, rightPath, error)) { @@ -202,18 +200,34 @@ void MainWindow::reloadCommitSummaries() { CommitSummaryFetcher fetcher; + + // load committed revisions QList<CommitSummary> summaries; - CommitSummary uncommittedSummary; QString error; - if (!fetcher.fetchSummaries(*mpContext, mPath, Revision::base(), Revision::committed(0), false, summaries, error) || - !fetcher.fetchSummary(*mpContext, mPath, mDisplayedRevision, false, uncommittedSummary, error)) + if (!fetcher.fetchSummaries(*mpContext, mPath, Revision::base(), Revision::committed(0), false, summaries, error)) { + qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); + summaries.empty(); + error = QString(); + } + + // load uncommitted revisions + CommitSummary uncommittedSummary; + if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), false, uncommittedSummary, error)) + { + mpRevisionsModel->showCommitSummaries(uncommittedSummary, summaries); + + QItemSelectionModel* pSelection = mpUi->revisionsTreeView->selectionModel(); + if (pSelection->selectedIndexes().count() == 0) + { + QModelIndex index = mpRevisionsModel->getUncommittedRevision(); + pSelection->select(index, QItemSelectionModel::Clear | QItemSelectionModel::Select | QItemSelectionModel::Current | QItemSelectionModel::Rows); + } + } + else + { mpRevisionsModel->showError(error); - return; } - - summaries.push_front(uncommittedSummary); - mpRevisionsModel->showCommitSummaries(summaries); } void MainWindow::reloadModifications() @@ -256,3 +270,35 @@ pProcess->start(app, args); return pProcess->waitForStarted(1000); } + +void MainWindow::revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected) +{ + Q_UNUSED(rcSelected); + Q_UNUSED(rcDeselected); + + QList<int> rows = getSelectedRows(mpUi->revisionsTreeView); + if (rows.count() == 0) + return; + GSVN_ASSERT(rows.count() == 1); + + Revision revision; + if (mpRevisionsModel->getRevisionForRow(rows.at(0), revision)) + { + mDisplayedRevision = revision; + reloadModifications(); + } +} + +QList<int> MainWindow::getSelectedRows(QAbstractItemView* pView) +{ + // determine which rows are selected (remove duplicate rows, since an index is returned for each column) + QModelIndexList selection = pView->selectionModel()->selectedIndexes(); + QSet<int> rows; + Q_FOREACH(QModelIndex index, selection) + { + if (index.isValid()) + rows.insert(index.row()); + } + + return QList<int>::fromSet(rows); +} Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-11-03 02:47:17 UTC (rev 71) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-11-03 18:10:54 UTC (rev 72) @@ -81,15 +81,16 @@ emit layoutChanged(); } -Modification ModificationsModel::getModificationFromIndex(int row) const +bool ModificationsModel::getModificationForRow(int row, Modification& rModification) const { + if (!mError.isEmpty()) + return false; + if (row < 0 || row >= mAllModifications.size()) - { - GSVN_ASSERT(false); - return Modification(); - } + return false; - return mAllModifications.at(row); + rModification = mAllModifications.at(row); + return true; } int ModificationsModel::columnCount(const QModelIndex &rcParent) const Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2006-11-03 02:47:17 UTC (rev 71) +++ trunk/src/dialogs/revisionsmodel.cpp 2006-11-03 18:10:54 UTC (rev 72) @@ -37,12 +37,47 @@ mCommitSummaries.clear(); } -void RevisionsModel::showCommitSummaries(QList<CommitSummary> summaries) +void RevisionsModel::showCommitSummaries(CommitSummary uncommittedRevision, QList<CommitSummary> committedRevisions) { mError = QString(); - mCommitSummaries = summaries; + mCommitSummaries = committedRevisions; + mCommitSummaries.push_front(uncommittedRevision); } +bool RevisionsModel::getRevisionForRow(int row, Revision& rRevision) +{ + if (!mError.isNull()) + return false; + + if (row < 0 || row >= mCommitSummaries.count()) + return false; + + rRevision = mCommitSummaries.at(row).getRevision(); + return true; +} + +QModelIndex RevisionsModel::getUncommittedRevision() +{ + if (!mError.isNull()) + return QModelIndex(); + + return index(0, 0); +} + +QString RevisionsModel::getRevisionAsString(Revision rev) +{ + switch (rev.getType()) + { + case Revision::Uncommitted: return tr("(uncommitted)"); + case Revision::Committed: return tr("r%1").arg(QString::number(rev.getCommittedRevision())) ; + case Revision::Base: return tr("(base)"); + case Revision::Head: return tr("(head)"); + default: + GSVN_ASSERT(false); + return QString(); + } +} + int RevisionsModel::columnCount(const QModelIndex &rcParent) const { Q_UNUSED(rcParent); @@ -99,19 +134,7 @@ CommitSummary summary = mCommitSummaries.at(rcIndex.row()); switch (rcIndex.column()) { - case 0: - { - Revision rev = summary.getRevision(); - switch (rev.getType()) - { - case Revision::Uncommitted: return tr("(uncommitted)"); - case Revision::Committed: return tr("r%1").arg(QString::number(rev.getCommittedRevision())) ; - case Revision::Base: return tr("(base)"); - case Revision::Head: return tr("(head)"); - default: - return QVariant(); - } - } + case 0: return getRevisionAsString(summary.getRevision()); case 1: return summary.getCommitAuthor(); case 2: return summary.getCommitDate(); case 3: Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-11-03 02:47:17 UTC (rev 71) +++ trunk/ui/mainwindow.ui 2006-11-03 18:10:54 UTC (rev 72) @@ -305,7 +305,7 @@ </size> </property> <property name="selectionMode" > - <enum>QAbstractItemView::ExtendedSelection</enum> + <enum>QAbstractItemView::SingleSelection</enum> </property> <property name="indentation" > <number>0</number> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-03 18:54:55
|
Revision: 74 http://svn.sourceforge.net/grandmas-svn/?rev=74&view=rev Author: matthiasmiller Date: 2006-11-03 10:54:52 -0800 (Fri, 03 Nov 2006) Log Message: ----------- improve date format for committed revisions Modified Paths: -------------- trunk/include/dialogs/revisionsmodel.h trunk/src/dialogs/revisionsmodel.cpp Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2006-11-03 18:28:03 UTC (rev 73) +++ trunk/include/dialogs/revisionsmodel.h 2006-11-03 18:54:52 UTC (rev 74) @@ -41,6 +41,7 @@ private: static QString getRevisionAsString(Revision rev); + static QString getDateTimeAsString(QDateTime dateTime); QString mError; QList<CommitSummary> mCommitSummaries; Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2006-11-03 18:28:03 UTC (rev 73) +++ trunk/src/dialogs/revisionsmodel.cpp 2006-11-03 18:54:52 UTC (rev 74) @@ -78,6 +78,20 @@ } } +QString RevisionsModel::getDateTimeAsString(QDateTime dateTime) +{ + // The time must be compared/displayed in local time. + dateTime = dateTime.toTimeSpec(Qt::LocalTime); + QDateTime now = QDateTime::currentDateTime().toTimeSpec(Qt::LocalTime); + + // hide date for today + QString format; + if (dateTime.date() == now.date()) + return dateTime.toString(tr("h:mm:ss")); + + return dateTime.toString(tr("M/d/yy h:mm:ss")); +} + int RevisionsModel::columnCount(const QModelIndex &rcParent) const { Q_UNUSED(rcParent); @@ -136,7 +150,7 @@ { case 0: return getRevisionAsString(summary.getRevision()); case 1: return summary.getCommitAuthor(); - case 2: return summary.getCommitDate(); + case 2: return getDateTimeAsString(summary.getCommitDate()); case 3: { QString logMessage = summary.getCommitLogMessage(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-03 22:28:59
|
Revision: 75 http://svn.sourceforge.net/grandmas-svn/?rev=75&view=rev Author: matthiasmiller Date: 2006-11-03 14:28:51 -0800 (Fri, 03 Nov 2006) Log Message: ----------- -move diff-launching to a separate module -run processes in a background thread to prevent lockups on Unix Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/dialogs/mainwindow.h trunk/src/dialogs/mainwindow.cpp Added Paths: ----------- trunk/include/diff.h trunk/src/diff.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-11-03 18:54:52 UTC (rev 74) +++ trunk/grandmas_svn.pro 2006-11-03 22:28:51 UTC (rev 75) @@ -118,6 +118,7 @@ include/dialogs/open.h \ include/dialogs/revisionsmodel.h \ include/dialogs/util.h \ + include/diff.h \ include/settings/userpaths.h \ include/svn/commit_summary.h \ include/svn/file_access.h \ @@ -137,6 +138,7 @@ src/dialogs/open.cpp \ src/dialogs/revisionsmodel.cpp \ src/dialogs/util.cpp \ + src/diff.cpp \ src/settings/userpaths.cpp \ src/svn/commit_summary.cpp \ src/svn/file_access.cpp \ Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-11-03 18:54:52 UTC (rev 74) +++ trunk/include/dialogs/mainwindow.h 2006-11-03 22:28:51 UTC (rev 75) @@ -53,7 +53,6 @@ private: void reloadCommitSummaries(); void reloadModifications(); - bool diffFiles(QString left, QString right, bool allowMerge); QList<int> getSelectedRows(QAbstractItemView* pView); Ui_MainWindow* mpUi; Copied: trunk/include/diff.h (from rev 74, trunk/templates/h) =================================================================== --- trunk/include/diff.h (rev 0) +++ trunk/include/diff.h 2006-11-03 22:28:51 UTC (rev 75) @@ -0,0 +1,28 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + +#ifndef DIFF_H +#define DIFF_H + +class QString; + +bool diffFiles(QString left, QString right, bool allowMerge); + +#endif Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-03 18:54:52 UTC (rev 74) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-03 22:28:51 UTC (rev 75) @@ -24,6 +24,7 @@ #include "dialogs/modificationsmodel.h" #include "dialogs/move.h" #include "dialogs/revisionsmodel.h" +#include "diff.h" #include "svn/commit_summary.h" #include "svn/file_access.h" #include "svn/revision.h" @@ -35,58 +36,6 @@ #include <QProcess> #include <svn_client.h> -#ifdef Q_WS_WIN -#include <shlwapi.h> - -namespace -{ - bool assocQueryString(ASSOCF flags, ASSOCSTR str, QString assoc, QString extra, QString& rOut) - { - // wchar_t must be the same size as QChar - enum { assert_at_compile = 1 / (sizeof(wchar_t) == sizeof(QChar) ? 1 : 0) }; - - wchar_t szOut[MAX_PATH]; - DWORD length = sizeof(szOut); - if (FAILED(AssocQueryString(flags, str, (const wchar_t*)assoc.utf16(), - (const wchar_t*)extra.utf16(), szOut, &length))) - { - return false; - } - - rOut = QString::fromUtf16((ushort *)szOut, -1); - return true; - } - - bool getWinAppForExtension(QString ext, QString& rPath) - { - QString path; - if (!assocQueryString(0, ASSOCSTR_EXECUTABLE, "." + ext, "open", path)) - return false; - - if (path.startsWith("\"")) - { - // extract text between quotes - path.remove(0,1); - - int offset = path.indexOf('"', 1); - if (offset == -1) - return false; - path = path.left(offset); - } - else - { - // extract first word - int offset = path.indexOf(' '); - if (offset != -1) - path = path.left(offset); - } - - rPath = path; - return true; - } -} -#endif - MainWindow::MainWindow(SvnOperationContext* pContext, QString path) : mpModificationsModel(NULL) { mpContext = pContext; @@ -241,36 +190,6 @@ mpModificationsModel->showError(error); } -bool MainWindow::diffFiles(QString left, QString right, bool allowMerge) -{ - // TODO: This should be configurable. - QString app; - - QStringList args; - args.push_back(left); - args.push_back(right); - -#if defined(Q_WS_WIN) - if (!getWinAppForExtension("WinMerge", app)) - return false; - Q_UNUSED(allowMerge); -#elif defined(Q_WS_MAC) - app = "opendiff"; - if (allowMerge) - { - args.push_back(tr("-merge")); - args.push_back(right); - } -#else - app = "meld"; - Q_UNUSED(allowMerge); -#endif - - QProcess* pProcess = new QProcess(this); - pProcess->start(app, args); - return pProcess->waitForStarted(1000); -} - void MainWindow::revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected) { Q_UNUSED(rcSelected); Copied: trunk/src/diff.cpp (from rev 74, trunk/templates/cpp) =================================================================== --- trunk/src/diff.cpp (rev 0) +++ trunk/src/diff.cpp 2006-11-03 22:28:51 UTC (rev 75) @@ -0,0 +1,136 @@ +/*************************************************************************** + * 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 "diff.h" + +#include <QProcess> +#include <QString> +#include <QStringList> +#include <QThread> + +#ifdef Q_WS_WIN +#include <shlwapi.h> + +namespace +{ + bool assocQueryString(ASSOCF flags, ASSOCSTR str, QString assoc, QString extra, QString& rOut) + { + // wchar_t must be the same size as QChar + enum { assert_at_compile = 1 / (sizeof(wchar_t) == sizeof(QChar) ? 1 : 0) }; + + wchar_t szOut[MAX_PATH]; + DWORD length = sizeof(szOut); + if (FAILED(AssocQueryString(flags, str, (const wchar_t*)assoc.utf16(), + (const wchar_t*)extra.utf16(), szOut, &length))) + { + return false; + } + + rOut = QString::fromUtf16((ushort *)szOut, -1); + return true; + } + + bool getWinAppForExtension(QString ext, QString& rPath) + { + QString path; + if (!assocQueryString(0, ASSOCSTR_EXECUTABLE, "." + ext, "open", path)) + return false; + + if (path.startsWith("\"")) + { + // extract text between quotes + path.remove(0,1); + + int offset = path.indexOf('"', 1); + if (offset == -1) + return false; + path = path.left(offset); + } + else + { + // extract first word + int offset = path.indexOf(' '); + if (offset != -1) + path = path.left(offset); + } + + rPath = path; + return true; + } +} +#endif + +namespace +{ + class AppLauncher : private QThread + { + public: + static bool launch(QString app, QStringList args); + + private: + virtual void run(); + + QProcess mProcess; + }; +} + +bool AppLauncher::launch(QString app, QStringList args) +{ + AppLauncher launcher; + launcher.mProcess.start(app, args); + if (!launcher.mProcess.waitForStarted()) + return false; + + launcher.mProcess.moveToThread(&launcher); + launcher.run(); + return true; +} + +void AppLauncher::run() +{ + mProcess.waitForFinished(); +} + +bool diffFiles(QString left, QString right, bool allowMerge) +{ + // TODO: This should be configurable. + QString app; + + QStringList args; + args.push_back(left); + args.push_back(right); + +#if defined(Q_WS_WIN) + if (!getWinAppForExtension("WinMerge", app)) + return false; + Q_UNUSED(allowMerge); +#elif defined(Q_WS_MAC) + app = "opendiff"; + if (allowMerge) + { + args.push_back("-merge"); + args.push_back(right); + } +#else + app = "meld"; + Q_UNUSED(allowMerge); +#endif + + return AppLauncher::launch(app, args); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-04 11:28:03
|
Revision: 77 http://svn.sourceforge.net/grandmas-svn/?rev=77&view=rev Author: matthiasmiller Date: 2006-11-04 03:27:56 -0800 (Sat, 04 Nov 2006) Log Message: ----------- move APR and SVN stub classes to the svn directory Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/svn/server_access.h trunk/src/main.cpp Added Paths: ----------- trunk/include/svn/pool.h trunk/src/svn/pool.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-11-03 22:40:28 UTC (rev 76) +++ trunk/grandmas_svn.pro 2006-11-04 11:27:56 UTC (rev 77) @@ -125,6 +125,7 @@ include/svn/modification.h \ include/svn/operation.h \ include/svn/operation_internal.h \ + include/svn/pool.h \ include/svn/revision.h \ include/svn/server_access.h \ src/grandmas_svn.h @@ -144,6 +145,7 @@ src/svn/file_access.cpp \ src/svn/operation.cpp \ src/svn/operation_internal.cpp \ + src/svn/pool.cpp \ src/svn/revision.cpp \ src/svn/server_access.cpp \ src/grandmas_svn.cpp \ Copied: trunk/include/svn/pool.h (from rev 74, trunk/templates/h) =================================================================== --- trunk/include/svn/pool.h (rev 0) +++ trunk/include/svn/pool.h 2006-11-04 11:27:56 UTC (rev 77) @@ -0,0 +1,41 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + +#ifndef SVN_POOL_H +#define SVN_POOL_H + +#include <QtGlobal> + +struct apr_pool_t; + +class AprPoolWrapper +{ +public: + AprPoolWrapper(); + ~AprPoolWrapper(); + apr_pool_t* getPool(); + +private: + Q_DISABLE_COPY(AprPoolWrapper); + + apr_pool_t* mPool; +}; + +#endif \ No newline at end of file Modified: trunk/include/svn/server_access.h =================================================================== --- trunk/include/svn/server_access.h 2006-11-03 22:40:28 UTC (rev 76) +++ trunk/include/svn/server_access.h 2006-11-04 11:27:56 UTC (rev 77) @@ -35,6 +35,20 @@ virtual bool shouldCancel()=0; }; +class SvnOperationStatusUnimpl : public SvnOperationStatus +{ +public: + virtual ~SvnOperationStatusUnimpl() {} + virtual void update(QString textToAdd) + { + Q_UNUSED(textToAdd); + } + virtual bool shouldCancel() + { + return false; + } +}; + class SvnAuthentication { public: @@ -56,6 +70,18 @@ QString mPassword; }; +class SvnAuthenticationUnimpl : public SvnAuthentication +{ +public: + virtual ~SvnAuthenticationUnimpl() {} + virtual bool getAuthentication(QString& rUserName, QString& rPassword) + { + Q_UNUSED(rUserName); + Q_UNUSED(rPassword); + return false; + } +}; + class SvnOperationContext { public: Modified: trunk/src/main.cpp =================================================================== --- trunk/src/main.cpp 2006-11-03 22:40:28 UTC (rev 76) +++ trunk/src/main.cpp 2006-11-04 11:27:56 UTC (rev 77) @@ -25,62 +25,12 @@ #include "../tests/tests.h" #endif -#include <apr_general.h> -#include <svn/modification.h> -#include <svn/server_access.h> +#include "svn/modification.h" +#include "svn/server_access.h" +#include "svn/pool.h" #include <iostream> -namespace -{ - class QSvnOperationStatus : public SvnOperationStatus - { - public: - virtual void update(QString textToAdd) - { - textToAdd = textToAdd; - } - - virtual bool shouldCancel() - { - return false; - } - }; - - class QSvnAuthentication : public SvnAuthentication - { - public: - virtual bool getAuthentication(QString& rUsername, QString& rPassword) - { - rUsername = ""; - rPassword = ""; - return false; - } - }; - - 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) { if (apr_initialize() != APR_SUCCESS) @@ -88,8 +38,8 @@ AprPoolWrapper poolWrapper; - QSvnOperationStatus status; - QSvnAuthentication auth; + SvnOperationStatusUnimpl status; + SvnAuthenticationUnimpl auth; SvnOperationContext context(poolWrapper.getPool(), status, auth); GrandmasSVNApp app(argc, argv, &context); Copied: trunk/src/svn/pool.cpp (from rev 74, trunk/templates/cpp) =================================================================== --- trunk/src/svn/pool.cpp (rev 0) +++ trunk/src/svn/pool.cpp 2006-11-04 11:27:56 UTC (rev 77) @@ -0,0 +1,39 @@ +/*************************************************************************** + * 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/pool.h" + +#include <apr_general.h> + +AprPoolWrapper::AprPoolWrapper() +{ + apr_pool_create(&mPool, NULL); +} + +AprPoolWrapper::~AprPoolWrapper() +{ + apr_pool_destroy(mPool); + mPool = NULL; +} + +apr_pool_t* AprPoolWrapper::getPool() +{ + return mPool; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-04 18:32:07
|
Revision: 78 http://svn.sourceforge.net/grandmas-svn/?rev=78&view=rev Author: matthiasmiller Date: 2006-11-04 10:32:03 -0800 (Sat, 04 Nov 2006) Log Message: ----------- allow the revisions model to load committed and uncommitted revisions separately Modified Paths: -------------- trunk/include/dialogs/revisionsmodel.h trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/revisionsmodel.cpp Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2006-11-04 11:27:56 UTC (rev 77) +++ trunk/include/dialogs/revisionsmodel.h 2006-11-04 18:32:03 UTC (rev 78) @@ -27,12 +27,13 @@ public: RevisionsModel(); virtual ~RevisionsModel(); - + void showError(QString error); - void showCommitSummaries(CommitSummary uncommittedRevision, QList<CommitSummary> committedRevisions); + void showUncommittedRevision(CommitSummary uncommittedRevision); + void showCommittedRevisions(QList<CommitSummary> committedRevisions); - bool getRevisionForRow(int row, Revision& rRevision); - QModelIndex getUncommittedRevision(); + bool getRevisionForRow(int row, Revision& rRevision) const; + QModelIndex getUncommittedRevision() const; virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; virtual int rowCount(const QModelIndex& rcParent = QModelIndex()) const; @@ -42,8 +43,9 @@ private: static QString getRevisionAsString(Revision rev); static QString getDateTimeAsString(QDateTime dateTime); + bool getCommitSummaryForRow(int row, CommitSummary& rSummary) const; QString mError; - QList<CommitSummary> mCommitSummaries; + QList<CommitSummary> mUncommittedSummaries, mCommittedSummaries; }; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-04 11:27:56 UTC (rev 77) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-04 18:32:03 UTC (rev 78) @@ -153,8 +153,12 @@ // load committed revisions QList<CommitSummary> summaries; QString error; - if (!fetcher.fetchSummaries(*mpContext, mPath, Revision::base(), Revision::committed(0), false, summaries, error)) + if (fetcher.fetchSummaries(*mpContext, mPath, Revision::base(), Revision::committed(0), false, summaries, error)) { + mpRevisionsModel->showCommittedRevisions(summaries); + } + else + { qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); summaries.empty(); error = QString(); @@ -164,7 +168,7 @@ CommitSummary uncommittedSummary; if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), false, uncommittedSummary, error)) { - mpRevisionsModel->showCommitSummaries(uncommittedSummary, summaries); + mpRevisionsModel->showUncommittedRevision(uncommittedSummary); QItemSelectionModel* pSelection = mpUi->revisionsTreeView->selectionModel(); if (pSelection->selectedIndexes().count() == 0) Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2006-11-04 11:27:56 UTC (rev 77) +++ trunk/src/dialogs/revisionsmodel.cpp 2006-11-04 18:32:03 UTC (rev 78) @@ -34,31 +34,37 @@ { GSVN_ASSERT(!error.isNull()); mError = error; - mCommitSummaries.clear(); + mUncommittedSummaries.clear(); + mCommittedSummaries.clear(); } -void RevisionsModel::showCommitSummaries(CommitSummary uncommittedRevision, QList<CommitSummary> committedRevisions) +void RevisionsModel::showUncommittedRevision(CommitSummary uncommittedRevision) { mError = QString(); - mCommitSummaries = committedRevisions; - mCommitSummaries.push_front(uncommittedRevision); + mUncommittedSummaries.clear(); + mUncommittedSummaries.push_back(uncommittedRevision); } -bool RevisionsModel::getRevisionForRow(int row, Revision& rRevision) +void RevisionsModel::showCommittedRevisions(QList<CommitSummary> committedRevisions) { - if (!mError.isNull()) - return false; + mError = QString(); + mCommittedSummaries = committedRevisions; +} - if (row < 0 || row >= mCommitSummaries.count()) +bool RevisionsModel::getRevisionForRow(int row, Revision& rRevision) const +{ + CommitSummary summary; + if (!getCommitSummaryForRow(row, summary)) return false; - rRevision = mCommitSummaries.at(row).getRevision(); + rRevision = summary.getRevision(); return true; } -QModelIndex RevisionsModel::getUncommittedRevision() +QModelIndex RevisionsModel::getUncommittedRevision() const { - if (!mError.isNull()) + Revision rev; + if (!getRevisionForRow(0, rev) || rev.getType() != Revision::Uncommitted) return QModelIndex(); return index(0, 0); @@ -109,7 +115,7 @@ if (!mError.isNull()) return 1; - return mCommitSummaries.count(); + return mUncommittedSummaries.count() + mCommittedSummaries.count(); } QVariant RevisionsModel::headerData(int section, Qt::Orientation orientation, int role) const @@ -142,10 +148,10 @@ if (!mError.isNull()) return mError; - if (!rcIndex.isValid() || rcIndex.row() >= mCommitSummaries.size()) + CommitSummary summary; + if (!rcIndex.isValid() || !getCommitSummaryForRow(rcIndex.row(), summary)) return QVariant(); - CommitSummary summary = mCommitSummaries.at(rcIndex.row()); switch (rcIndex.column()) { case 0: return getRevisionAsString(summary.getRevision()); @@ -165,3 +171,30 @@ return QVariant(); } +bool RevisionsModel::getCommitSummaryForRow(int row, CommitSummary& rSummary) const +{ + // showing error? + if (!mError.isNull()) + return false; + + if (row < 0) + return false; + + // uncommitted revision? + if (row < mUncommittedSummaries.count()) + { + rSummary = mUncommittedSummaries.at(row); + return true; + } + + // committed revision? + row -= mUncommittedSummaries.count(); + GSVN_ASSERT(row >= 0); + if (row < mCommittedSummaries.count()) + { + rSummary = mCommittedSummaries.at(row); + return true; + } + + return false; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-04 18:41:48
|
Revision: 80 http://svn.sourceforge.net/grandmas-svn/?rev=80&view=rev Author: matthiasmiller Date: 2006-11-04 10:41:41 -0800 (Sat, 04 Nov 2006) Log Message: ----------- load revisions view in a background thread Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/dialogs/mainwindow.h trunk/include/svn/server_access.h trunk/src/dialogs/mainwindow.cpp Added Paths: ----------- trunk/include/svn/commit_summary_thread.h trunk/src/svn/commit_summary_thread.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-11-04 18:40:29 UTC (rev 79) +++ trunk/grandmas_svn.pro 2006-11-04 18:41:41 UTC (rev 80) @@ -121,6 +121,7 @@ include/diff.h \ include/settings/userpaths.h \ include/svn/commit_summary.h \ + include/svn/commit_summary_thread.h \ include/svn/file_access.h \ include/svn/modification.h \ include/svn/operation.h \ @@ -142,6 +143,7 @@ src/diff.cpp \ src/settings/userpaths.cpp \ src/svn/commit_summary.cpp \ + src/svn/commit_summary_thread.cpp \ src/svn/file_access.cpp \ src/svn/operation.cpp \ src/svn/operation_internal.cpp \ Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-11-04 18:40:29 UTC (rev 79) +++ trunk/include/dialogs/mainwindow.h 2006-11-04 18:41:41 UTC (rev 80) @@ -24,6 +24,7 @@ #include <QMainWindow> #include "svn/revision.h" +class CommitSummaryFetcherThread; class ModificationsModel; class RevisionsModel; class SvnOperationContext; @@ -49,6 +50,8 @@ void diff(const QModelIndex& rcIndex); void move(); void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); + void fetchedCommittedRevisions(); + void fetchCommittedRevisionsFailed(QString error); private: void reloadCommitSummaries(); @@ -61,6 +64,7 @@ ModificationsModel* mpModificationsModel; Revision mDisplayedRevision; RevisionsModel* mpRevisionsModel; + CommitSummaryFetcherThread* mpCommitSummaryThread; }; #endif Copied: trunk/include/svn/commit_summary_thread.h (from rev 74, trunk/templates/h) =================================================================== --- trunk/include/svn/commit_summary_thread.h (rev 0) +++ trunk/include/svn/commit_summary_thread.h 2006-11-04 18:41:41 UTC (rev 80) @@ -0,0 +1,55 @@ +/*************************************************************************** + * 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 <QMutex> +#include <QThread> + +class CommitSummary; +class Revision; +class SvnOperationStatusUnimpl; + +class CommitSummaryFetcherThread : public QThread +{ + Q_OBJECT + +public: + CommitSummaryFetcherThread(); + virtual ~CommitSummaryFetcherThread(); + + // The caller should connect to the fetchedSummaries signal to receive the results. Any pending requests will be cancelled. + void fetchSummaries(QString fullRepoPath, Revision startRevision, Revision endRevision, bool fetchModifications); + void getSummaries(QList<CommitSummary>& rSummaries); + + void cancel(); + +signals: + void fetchedSummaries(); + void failed(QString error); + +private: + virtual void run(); + + struct Parms; + + SvnOperationStatusUnimpl* mpStatus; + QMutex mMutex; + Parms* mpParms; + QList<CommitSummary> mSummaries; +}; Modified: trunk/include/svn/server_access.h =================================================================== --- trunk/include/svn/server_access.h 2006-11-04 18:40:29 UTC (rev 79) +++ trunk/include/svn/server_access.h 2006-11-04 18:41:41 UTC (rev 80) @@ -35,9 +35,11 @@ virtual bool shouldCancel()=0; }; +// This class is thread-safe. class SvnOperationStatusUnimpl : public SvnOperationStatus { public: + SvnOperationStatusUnimpl() { mCancel = false; } virtual ~SvnOperationStatusUnimpl() {} virtual void update(QString textToAdd) { @@ -45,8 +47,19 @@ } virtual bool shouldCancel() { - return false; + return mCancel; } + void cancel() + { + mCancel = true; + } + void clear() + { + mCancel = false; + } + +private: + volatile bool mCancel; }; class SvnAuthentication Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-04 18:40:29 UTC (rev 79) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-04 18:41:41 UTC (rev 80) @@ -26,6 +26,7 @@ #include "dialogs/revisionsmodel.h" #include "diff.h" #include "svn/commit_summary.h" +#include "svn/commit_summary_thread.h" #include "svn/file_access.h" #include "svn/revision.h" #include "ui_mainwindow.h" @@ -41,6 +42,10 @@ mpContext = pContext; mPath = path; + mpCommitSummaryThread = new CommitSummaryFetcherThread; + connect(mpCommitSummaryThread, SIGNAL(fetchedSummaries()), this, SLOT(fetchedCommittedRevisions())); + connect(mpCommitSummaryThread, SIGNAL(failed(QString)), this, SLOT(fetchCommittedRevisionsFailed(QString))); + mpUi = new Ui_MainWindow(); mpUi->setupUi(this); #if QT_VERSION >= 0x040200 @@ -85,6 +90,10 @@ delete mpUi; mpUi = NULL; + mpCommitSummaryThread->cancel(); + delete mpCommitSummaryThread; + mpCommitSummaryThread = NULL; + mpContext = NULL; } @@ -148,24 +157,10 @@ void MainWindow::reloadCommitSummaries() { + // load uncommitted revisions CommitSummaryFetcher fetcher; - - // load committed revisions - QList<CommitSummary> summaries; + CommitSummary uncommittedSummary; QString error; - if (fetcher.fetchSummaries(*mpContext, mPath, Revision::base(), Revision::committed(0), false, summaries, error)) - { - mpRevisionsModel->showCommittedRevisions(summaries); - } - else - { - qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); - summaries.empty(); - error = QString(); - } - - // load uncommitted revisions - CommitSummary uncommittedSummary; if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), false, uncommittedSummary, error)) { mpRevisionsModel->showUncommittedRevision(uncommittedSummary); @@ -181,6 +176,9 @@ { mpRevisionsModel->showError(error); } + + // load committed revisions + mpCommitSummaryThread->fetchSummaries(mPath, Revision::base(), Revision::committed(0), false); } void MainWindow::reloadModifications() @@ -212,6 +210,18 @@ } } +void MainWindow::fetchedCommittedRevisions() +{ + QList<CommitSummary> summaries; + mpCommitSummaryThread->getSummaries(summaries); + mpRevisionsModel->showCommittedRevisions(summaries); +} + +void MainWindow::fetchCommittedRevisionsFailed(QString error) +{ + qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); +} + QList<int> MainWindow::getSelectedRows(QAbstractItemView* pView) { // determine which rows are selected (remove duplicate rows, since an index is returned for each column) Copied: trunk/src/svn/commit_summary_thread.cpp (from rev 74, trunk/templates/cpp) =================================================================== --- trunk/src/svn/commit_summary_thread.cpp (rev 0) +++ trunk/src/svn/commit_summary_thread.cpp 2006-11-04 18:41:41 UTC (rev 80) @@ -0,0 +1,107 @@ +/*************************************************************************** + * 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_thread.h" +#include "svn/pool.h" +#include "svn/commit_summary.h" +#include "svn/revision.h" + +struct CommitSummaryFetcherThread::Parms +{ + QString mFullRepoPath; + Revision mStartRevision, mEndRevision; + bool mFetchModifications; +}; + + +CommitSummaryFetcherThread::CommitSummaryFetcherThread() +{ + mpStatus = new SvnOperationStatusUnimpl; + mpParms = new Parms(); +} + +CommitSummaryFetcherThread::~CommitSummaryFetcherThread() +{ + delete mpParms; + mpParms = NULL; + + delete mpStatus; + mpStatus = NULL; +} + +void CommitSummaryFetcherThread::fetchSummaries(QString fullRepoPath, Revision startRevision, Revision endRevision, bool fetchModifications) +{ + // cancel any outstanding requests + cancel(); + + mMutex.lock(); + mpParms->mFullRepoPath = fullRepoPath; + mpParms->mStartRevision = startRevision; + mpParms->mEndRevision = endRevision; + mpParms->mFetchModifications = fetchModifications; + mMutex.unlock(); + + start(); +} + +void CommitSummaryFetcherThread::getSummaries(QList<CommitSummary>& rSummaries) +{ + mMutex.lock(); + rSummaries = mSummaries; + mMutex.unlock(); +} + +void CommitSummaryFetcherThread::cancel() +{ + if (isRunning()) + { + mpStatus->cancel(); + wait(); + } + mpStatus->clear(); +} + +void CommitSummaryFetcherThread::run() +{ + mMutex.lock(); + Parms parms = *mpParms; + mMutex.unlock(); + + // set up SVN context + AprPoolWrapper pool; + SvnAuthenticationUnimpl auth; + SvnOperationContext context(pool.getPool(), *mpStatus, auth); + + // fetch revisions + CommitSummaryFetcher fetcher; + QList<CommitSummary> summaries; + QString error; + if (fetcher.fetchSummaries(context, parms.mFullRepoPath, parms.mStartRevision, parms.mEndRevision, parms.mFetchModifications, summaries, error)) + { + mMutex.lock(); + mSummaries = summaries; + mMutex.unlock(); + + emit fetchedSummaries(); + } + else + { + emit failed(error); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-04 18:49:25
|
Revision: 81 http://svn.sourceforge.net/grandmas-svn/?rev=81&view=rev Author: matthiasmiller Date: 2006-11-04 10:49:22 -0800 (Sat, 04 Nov 2006) Log Message: ----------- load modifications in a background thread Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/src/dialogs/mainwindow.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-11-04 18:41:41 UTC (rev 80) +++ trunk/include/dialogs/mainwindow.h 2006-11-04 18:49:22 UTC (rev 81) @@ -52,6 +52,8 @@ void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); void fetchedCommittedRevisions(); void fetchCommittedRevisionsFailed(QString error); + void fetchedModifications(); + void fetchModificationsFailed(QString error); private: void reloadCommitSummaries(); @@ -65,6 +67,7 @@ Revision mDisplayedRevision; RevisionsModel* mpRevisionsModel; CommitSummaryFetcherThread* mpCommitSummaryThread; + CommitSummaryFetcherThread* mpModificationsThread; }; #endif Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-04 18:41:41 UTC (rev 80) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-04 18:49:22 UTC (rev 81) @@ -46,6 +46,10 @@ connect(mpCommitSummaryThread, SIGNAL(fetchedSummaries()), this, SLOT(fetchedCommittedRevisions())); connect(mpCommitSummaryThread, SIGNAL(failed(QString)), this, SLOT(fetchCommittedRevisionsFailed(QString))); + mpModificationsThread = new CommitSummaryFetcherThread; + connect(mpModificationsThread, SIGNAL(fetchedSummaries()), this, SLOT(fetchedModifications())); + connect(mpModificationsThread, SIGNAL(failed(QString)), this, SLOT(fetchModificationsFailed(QString))); + mpUi = new Ui_MainWindow(); mpUi->setupUi(this); #if QT_VERSION >= 0x040200 @@ -90,6 +94,10 @@ delete mpUi; mpUi = NULL; + mpModificationsThread->cancel(); + delete mpModificationsThread; + mpModificationsThread = NULL; + mpCommitSummaryThread->cancel(); delete mpCommitSummaryThread; mpCommitSummaryThread = NULL; @@ -183,13 +191,11 @@ void MainWindow::reloadModifications() { - CommitSummary summary; - CommitSummaryFetcher fetcher; - QString error; - if (fetcher.fetchSummary(*mpContext, mPath, mDisplayedRevision, true, summary, error)) - mpModificationsModel->showModifications(summary.modifications(), true); - else - mpModificationsModel->showError(error); + // clear the displayed mods + QList<Modification> mods; + mpModificationsModel->showModifications(mods, true); + + mpModificationsThread->fetchSummaries(mPath, mDisplayedRevision, mDisplayedRevision, true); } void MainWindow::revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected) @@ -222,6 +228,19 @@ qDebug(tr("Unable to fetch commit summaries: %1").arg(error).toAscii()); } +void MainWindow::fetchedModifications() +{ + QList<CommitSummary> summaries; + mpModificationsThread->getSummaries(summaries); + GSVN_ASSERT(summaries.count() == 1); + mpModificationsModel->showModifications(summaries.at(0).modifications(), true); +} + +void MainWindow::fetchModificationsFailed(QString error) +{ + mpModificationsModel->showError(error); +} + QList<int> MainWindow::getSelectedRows(QAbstractItemView* pView) { // determine which rows are selected (remove duplicate rows, since an index is returned for each column) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-04 19:47:45
|
Revision: 84 http://svn.sourceforge.net/grandmas-svn/?rev=84&view=rev Author: matthiasmiller Date: 2006-11-04 11:47:41 -0800 (Sat, 04 Nov 2006) Log Message: ----------- fix MinGW compile warnings Modified Paths: -------------- trunk/include/svn/pool.h trunk/src/dialogs/progress.cpp Modified: trunk/include/svn/pool.h =================================================================== --- trunk/include/svn/pool.h 2006-11-04 19:41:20 UTC (rev 83) +++ trunk/include/svn/pool.h 2006-11-04 19:47:41 UTC (rev 84) @@ -38,4 +38,4 @@ apr_pool_t* mPool; }; -#endif \ No newline at end of file +#endif Modified: trunk/src/dialogs/progress.cpp =================================================================== --- trunk/src/dialogs/progress.cpp 2006-11-04 19:41:20 UTC (rev 83) +++ trunk/src/dialogs/progress.cpp 2006-11-04 19:47:41 UTC (rev 84) @@ -73,4 +73,4 @@ void ProgressDialog::reject() { mbShouldCancel = true; -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-11-05 01:44:14
|
Revision: 85 http://svn.sourceforge.net/grandmas-svn/?rev=85&view=rev Author: highjinx Date: 2006-11-04 17:43:02 -0800 (Sat, 04 Nov 2006) Log Message: ----------- * Fixed bug with working copy paths * Added add and revert functionality Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/dialogs/mainwindow.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/operation.cpp Added Paths: ----------- trunk/include/svn/add.h trunk/include/svn/revert.h trunk/src/svn/add.cpp trunk/src/svn/revert.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-11-04 19:47:41 UTC (rev 84) +++ trunk/grandmas_svn.pro 2006-11-05 01:43:02 UTC (rev 85) @@ -122,6 +122,7 @@ include/dialogs/util.h \ include/diff.h \ include/settings/userpaths.h \ + include/svn/add.h \ include/svn/commit_summary.h \ include/svn/commit_summary_thread.h \ include/svn/file_access.h \ @@ -129,6 +130,7 @@ include/svn/operation.h \ include/svn/operation_internal.h \ include/svn/pool.h \ + include/svn/revert.h \ include/svn/revision.h \ include/svn/server_access.h \ src/grandmas_svn.h @@ -145,12 +147,14 @@ src/dialogs/util.cpp \ src/diff.cpp \ src/settings/userpaths.cpp \ + src/svn/add.cpp \ src/svn/commit_summary.cpp \ src/svn/commit_summary_thread.cpp \ src/svn/file_access.cpp \ src/svn/operation.cpp \ src/svn/operation_internal.cpp \ src/svn/pool.cpp \ + src/svn/revert.cpp \ src/svn/revision.cpp \ src/svn/server_access.cpp \ src/grandmas_svn.cpp \ Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-11-04 19:47:41 UTC (rev 84) +++ trunk/include/dialogs/mainwindow.h 2006-11-05 01:43:02 UTC (rev 85) @@ -49,6 +49,8 @@ void commit(); void diff(); void diff(const QModelIndex& rcIndex); + void revert(); + void add(); void move(); void revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected); void fetchedCommittedRevisions(); Added: trunk/include/svn/add.h =================================================================== --- trunk/include/svn/add.h (rev 0) +++ trunk/include/svn/add.h 2006-11-05 01:43:02 UTC (rev 85) @@ -0,0 +1,27 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + +class SvnOperationContext; +class QString; + +namespace Svn +{ + bool add(SvnOperationContext& rContext, const QString& filePath, QString& rError); +}; Added: trunk/include/svn/revert.h =================================================================== --- trunk/include/svn/revert.h (rev 0) +++ trunk/include/svn/revert.h 2006-11-05 01:43:02 UTC (rev 85) @@ -0,0 +1,27 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + +class QString; +class SvnOperationContext; + +namespace Svn +{ + bool revert(SvnOperationContext& rContext, const QString& filePath, QString& rError); +}; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-04 19:47:41 UTC (rev 84) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-05 01:43:02 UTC (rev 85) @@ -26,9 +26,11 @@ #include "dialogs/progress.h" #include "dialogs/revisionsmodel.h" #include "diff.h" +#include "svn/add.h" #include "svn/commit_summary.h" #include "svn/commit_summary_thread.h" #include "svn/file_access.h" +#include "svn/revert.h" #include "svn/revision.h" #include "ui_mainwindow.h" @@ -61,6 +63,8 @@ connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); connect(mpUi->changesTreeView, SIGNAL(activated(const QModelIndex&)), this, SLOT(diff(const QModelIndex&))); connect(mpUi->diffButton, SIGNAL(clicked()), this, SLOT(diff())); + connect(mpUi->revertButton, SIGNAL(clicked()), this, SLOT(revert())); + connect(mpUi->addButton, SIGNAL(clicked()), this, SLOT(add())); connect(mpUi->moveButton, SIGNAL(clicked()), this, SLOT(move())); mpModificationsModel = new ModificationsModel(); @@ -193,6 +197,48 @@ diff(); } +void MainWindow::revert() +{ + QList<int> rows = getSelectedRows(mpUi->changesTreeView); + Q_FOREACH(int row, rows) + { + // Generate each side of the diff + QString error, leftPath, rightPath; + Modification mod; + if (!mpModificationsModel->getModificationForRow(row, mod)) + continue; + + QString fullFilePath = RepoFileAccess::getCanonicalPath(*mpContext, mPath, mod.getFilePath()); + if (!Svn::revert(*mpContext, fullFilePath, error)) + { + QMessageBox::critical(this, "", error); + return; + } + } + reloadModifications(); +} + +void MainWindow::add() +{ + QList<int> rows = getSelectedRows(mpUi->changesTreeView); + Q_FOREACH(int row, rows) + { + // Generate each side of the diff + QString error, leftPath, rightPath; + Modification mod; + if (!mpModificationsModel->getModificationForRow(row, mod)) + continue; + + QString fullFilePath = RepoFileAccess::getCanonicalPath(*mpContext, mPath, mod.getFilePath()); + if (!Svn::add(*mpContext, fullFilePath, error)) + { + QMessageBox::critical(this, "", error); + return; + } + } + reloadModifications(); +} + void MainWindow::move() { MoveDialog dlg(this); Added: trunk/src/svn/add.cpp =================================================================== --- trunk/src/svn/add.cpp (rev 0) +++ trunk/src/svn/add.cpp 2006-11-05 01:43:02 UTC (rev 85) @@ -0,0 +1,48 @@ +/*************************************************************************** + * 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/add.h" + +#include "svn/operation.h" +#include "svn/server_access.h" + +#include <svn_client.h> +#include <svn_path.h> +#include <Qt> + + +bool Svn::add(SvnOperationContext& rContext, const QString& filePath, QString& rError) +{ + const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); + + svn_client_ctx_t* ctx; + svn_client_create_context(&ctx, rContext.getAprPool()); + if (!Operation::initAuthProviders(rContext, ctx, rError)) + return false; + + svn_error_t* pError = svn_client_add2(fullCanonPath, true, false, ctx, rContext.getAprPool()); + if (pError) + { + rError = pError->message; + return false; + } + + return true; +} Modified: trunk/src/svn/operation.cpp =================================================================== --- trunk/src/svn/operation.cpp 2006-11-04 19:47:41 UTC (rev 84) +++ trunk/src/svn/operation.cpp 2006-11-05 01:43:02 UTC (rev 85) @@ -21,8 +21,9 @@ #include "svn/operation.h" #include "svn/server_access.h" +#include <svn_client.h> +#include <svn_path.h> #include <apr_pools.h> -#include <svn_client.h> #include <QString> @@ -85,7 +86,8 @@ public: bool getRepoCheckoutUrl(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()); + const char* fullCanonPath = svn_path_canonicalize(fullRepoPath.toAscii(), rContext.getAprPool()); + svn_error_t* pError = svn_client_info(fullCanonPath, NULL, NULL, infoCallback, this, false, ctx, rContext.getAprPool()); if (pError) { rError = pError->message; Added: trunk/src/svn/revert.cpp =================================================================== --- trunk/src/svn/revert.cpp (rev 0) +++ trunk/src/svn/revert.cpp 2006-11-05 01:43:02 UTC (rev 85) @@ -0,0 +1,50 @@ +/*************************************************************************** + * 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/revert.h" + +#include "svn/operation.h" +#include "svn/server_access.h" + +#include <svn_client.h> +#include <svn_path.h> +#include <Qt> + + +bool Svn::revert(SvnOperationContext& rContext, const QString& filePath, QString& rError) +{ + const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); + + svn_client_ctx_t* ctx; + svn_client_create_context(&ctx, rContext.getAprPool()); + if (!Operation::initAuthProviders(rContext, ctx, rError)) + return false; + + apr_array_header_t *array = apr_array_make(rContext.getAprPool(), 1, sizeof(const char*)); + APR_ARRAY_PUSH(array, const char*) = fullCanonPath; + svn_error_t* pError = svn_client_revert(array, true, ctx, rContext.getAprPool()); + if (pError) + { + rError = pError->message; + return false; + } + + return true; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-11-05 02:31:45
|
Revision: 86 http://svn.sourceforge.net/grandmas-svn/?rev=86&view=rev Author: highjinx Date: 2006-11-04 18:31:36 -0800 (Sat, 04 Nov 2006) Log Message: ----------- Implement update functionality. Progress dialog code is ugly, but I'll let matthiasm take care of that. :-) Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/svn/server_access.h trunk/src/dialogs/mainwindow.cpp trunk/src/svn/revision.cpp trunk/ui/progress.ui Added Paths: ----------- trunk/include/svn/update.h trunk/src/svn/update.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-11-05 01:43:02 UTC (rev 85) +++ trunk/grandmas_svn.pro 2006-11-05 02:31:36 UTC (rev 86) @@ -123,6 +123,7 @@ include/diff.h \ include/settings/userpaths.h \ include/svn/add.h \ + include/svn/svn_commit.h \ include/svn/commit_summary.h \ include/svn/commit_summary_thread.h \ include/svn/file_access.h \ @@ -133,6 +134,7 @@ include/svn/revert.h \ include/svn/revision.h \ include/svn/server_access.h \ + include/svn/update.h \ src/grandmas_svn.h SOURCES += src/commandline.cpp \ @@ -148,6 +150,7 @@ src/diff.cpp \ src/settings/userpaths.cpp \ src/svn/add.cpp \ + src/svn/svn_commit.cpp \ src/svn/commit_summary.cpp \ src/svn/commit_summary_thread.cpp \ src/svn/file_access.cpp \ @@ -157,6 +160,7 @@ src/svn/revert.cpp \ src/svn/revision.cpp \ src/svn/server_access.cpp \ + src/svn/update.cpp \ src/grandmas_svn.cpp \ src/main.cpp \ Modified: trunk/include/svn/server_access.h =================================================================== --- trunk/include/svn/server_access.h 2006-11-05 01:43:02 UTC (rev 85) +++ trunk/include/svn/server_access.h 2006-11-05 02:31:36 UTC (rev 86) @@ -103,6 +103,7 @@ // used by svn layer apr_pool_t* getAprPool() const { return mpSubPool; } + void setStatus(SvnOperationStatus* pStatus) { mpStatus = pStatus; } SvnOperationStatus* getStatus() const { return mpStatus; } SvnAuthentication* getAuthenticationCallback() const { return mpAuthentication; } Added: trunk/include/svn/update.h =================================================================== --- trunk/include/svn/update.h (rev 0) +++ trunk/include/svn/update.h 2006-11-05 02:31:36 UTC (rev 86) @@ -0,0 +1,28 @@ +/*************************************************************************** + * 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. * + ***************************************************************************/ + +class QString; +class SvnOperationContext; +class Revision; + +namespace Svn +{ + bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); +}; Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-05 01:43:02 UTC (rev 85) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-05 02:31:36 UTC (rev 86) @@ -32,6 +32,7 @@ #include "svn/file_access.h" #include "svn/revert.h" #include "svn/revision.h" +#include "svn/update.h" #include "ui_mainwindow.h" #include <QDir> @@ -125,36 +126,13 @@ void MainWindow::update() { ProgressDialog progress(this, tr("Updating Working Copy")); - QTime timer; - for (int i = 1; i <= 42; i++) - { - progress.update(tr("Checking server %1...").arg(i)); - - timer.restart(); - while (timer.elapsed() < 50) - { - if (progress.shouldCancel()) - { - qDebug("ProgressDialog cancelled."); - return; - } - } - } - - progress.update("Server found!"); - progress.update("Downloading..."); - - timer.restart(); - while (timer.elapsed() < 2000) - { - if (progress.shouldCancel()) - { - qDebug("cancelled"); - return; - } - } - - qDebug("ProgressDialog done."); + mpContext->setStatus(&progress); + QString error; + if (!Svn::update(*mpContext, mPath, Revision::head(), error)) + QMessageBox::critical(this, "", error); + mpContext->setStatus(NULL); + + reloadCommitSummaries(); } void MainWindow::commit() Modified: trunk/src/svn/revision.cpp =================================================================== --- trunk/src/svn/revision.cpp 2006-11-05 01:43:02 UTC (rev 85) +++ trunk/src/svn/revision.cpp 2006-11-05 02:31:36 UTC (rev 86) @@ -31,12 +31,12 @@ { } -Revision::Type Revision::getType() +Revision::Type Revision::getType() const { return mType; } -int Revision::getCommittedRevision() +int Revision::getCommittedRevision() const { GSVN_ASSERT(mType == Committed); return mCommittedRevision; @@ -63,7 +63,7 @@ } -svn_opt_revision_t Revision::getSvnRevision() +svn_opt_revision_t Revision::getSvnRevision() const { svn_opt_revision_t svnRev; svnRev.value.number = mCommittedRevision; Added: trunk/src/svn/update.cpp =================================================================== --- trunk/src/svn/update.cpp (rev 0) +++ trunk/src/svn/update.cpp 2006-11-05 02:31:36 UTC (rev 86) @@ -0,0 +1,84 @@ +/*************************************************************************** + * 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/update.h" + +#include "svn/operation.h" +#include "svn/revision.h" +#include "svn/server_access.h" + +#include <svn_client.h> +#include <svn_path.h> +#include <Qt> + +namespace Svn +{ + class Updater + { + public: + bool update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError); + + private: + static void updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t *pool); + + SvnOperationContext* pContext; + }; +} + +bool Svn::Updater::update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError) +{ + rError = ""; + pContext = &rContext; + + const char* fullCanonPath = svn_path_canonicalize(filePath.toAscii(), rContext.getAprPool()); + + svn_client_ctx_t* ctx; + svn_client_create_context(&ctx, rContext.getAprPool()); + if (!Operation::initAuthProviders(rContext, ctx, rError)) + return false; + + ctx->notify_func2 = updateNotifyCallback; + ctx->notify_baton2 = this; + + svn_opt_revision_t svnRev = revision.getSvnRevision(); + + apr_array_header_t *paths = apr_array_make(rContext.getAprPool(), 1, sizeof(const char*)); + APR_ARRAY_PUSH(paths, const char*) = fullCanonPath; + svn_error_t* pError = svn_client_update2(NULL, paths, &svnRev, true, false, ctx, rContext.getAprPool()); + if (pError) + { + rError = pError->message; + return false; + } + + return true; +} + +void Svn::Updater::updateNotifyCallback(void *baton, const svn_wc_notify_t *notify, apr_pool_t */*pool*/) +{ + Svn::Updater* pThis = (Svn::Updater*)baton; + pThis->pContext->getStatus()->update(QString("Updating ")+notify->path+"..."); +} + +bool Svn::update(SvnOperationContext& rContext, const QString& filePath, const Revision& revision, QString& rError) +{ + Svn::Updater updater; + return updater.update(rContext, filePath, revision, rError); +} Modified: trunk/ui/progress.ui =================================================================== --- trunk/ui/progress.ui 2006-11-05 01:43:02 UTC (rev 85) +++ trunk/ui/progress.ui 2006-11-05 02:31:36 UTC (rev 86) @@ -8,7 +8,7 @@ <rect> <x>0</x> <y>0</y> - <width>400</width> + <width>600</width> <height>226</height> </rect> </property> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-06 10:44:23
|
Revision: 87 http://svn.sourceforge.net/grandmas-svn/?rev=87&view=rev Author: matthiasmiller Date: 2006-11-06 02:44:18 -0800 (Mon, 06 Nov 2006) Log Message: ----------- fix build on the Mac Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/svn/revision.h Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-11-05 02:31:36 UTC (rev 86) +++ trunk/grandmas_svn.pro 2006-11-06 10:44:18 UTC (rev 87) @@ -123,7 +123,6 @@ include/diff.h \ include/settings/userpaths.h \ include/svn/add.h \ - include/svn/svn_commit.h \ include/svn/commit_summary.h \ include/svn/commit_summary_thread.h \ include/svn/file_access.h \ @@ -150,7 +149,6 @@ src/diff.cpp \ src/settings/userpaths.cpp \ src/svn/add.cpp \ - src/svn/svn_commit.cpp \ src/svn/commit_summary.cpp \ src/svn/commit_summary_thread.cpp \ src/svn/file_access.cpp \ Modified: trunk/include/svn/revision.h =================================================================== --- trunk/include/svn/revision.h 2006-11-05 02:31:36 UTC (rev 86) +++ trunk/include/svn/revision.h 2006-11-06 10:44:18 UTC (rev 87) @@ -59,12 +59,12 @@ return !(*this == rcOther); } - Type getType(); - int getCommittedRevision(); + Type getType() const; + int getCommittedRevision() const; // svn wrapper functions public: - svn_opt_revision_t getSvnRevision(); + svn_opt_revision_t getSvnRevision() const; private: Type mType; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-06 10:48:49
|
Revision: 88 http://svn.sourceforge.net/grandmas-svn/?rev=88&view=rev Author: matthiasmiller Date: 2006-11-06 02:48:43 -0800 (Mon, 06 Nov 2006) Log Message: ----------- download and cache modifications for historical revisions Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/include/dialogs/revisionsmodel.h trunk/include/svn/commit_summary.h trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/revisionsmodel.cpp Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-11-06 10:44:18 UTC (rev 87) +++ trunk/include/dialogs/mainwindow.h 2006-11-06 10:48:43 UTC (rev 88) @@ -22,6 +22,7 @@ #define DIALOGS_MAINWINDOW_H #include <QMainWindow> +#include "svn/commit_summary.h" #include "svn/revision.h" class CommitSummaryFetcherThread; @@ -67,7 +68,7 @@ SvnOperationContext* mpContext; QString mPath; ModificationsModel* mpModificationsModel; - Revision mDisplayedRevision; + CommitSummary mDisplayedCommitSummary; RevisionsModel* mpRevisionsModel; CommitSummaryFetcherThread* mpCommitSummaryThread; CommitSummaryFetcherThread* mpModificationsThread; Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2006-11-06 10:44:18 UTC (rev 87) +++ trunk/include/dialogs/revisionsmodel.h 2006-11-06 10:48:43 UTC (rev 88) @@ -32,7 +32,7 @@ void showUncommittedRevision(CommitSummary uncommittedRevision); void showCommittedRevisions(QList<CommitSummary> committedRevisions); - bool getRevisionForRow(int row, Revision& rRevision) const; + bool getCommitSummaryForRow(int row, CommitSummary& rSummary) const; QModelIndex getUncommittedRevision() const; virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; @@ -43,7 +43,6 @@ private: static QString getRevisionAsString(Revision rev); static QString getDateTimeAsString(QDateTime dateTime); - bool getCommitSummaryForRow(int row, CommitSummary& rSummary) const; QString mError; QList<CommitSummary> mUncommittedSummaries, mCommittedSummaries; Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-11-06 10:44:18 UTC (rev 87) +++ trunk/include/svn/commit_summary.h 2006-11-06 10:48:43 UTC (rev 88) @@ -18,6 +18,9 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifndef SVN_COMMIT_SUMMARY_H +#define SVN_COMMIT_SUMMARY_H + #include "debug.h" #include <svn/modification.h> @@ -72,3 +75,5 @@ 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); }; + +#endif Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-06 10:44:18 UTC (rev 87) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-06 10:48:43 UTC (rev 88) @@ -118,7 +118,7 @@ if (pEvent->type() == QEvent::ActivationChange && isActiveWindow()) { // Refresh the modifications if it doesn't require server access. - if (mpModificationsModel && mDisplayedRevision.getType() == Revision::Uncommitted) + if (mpModificationsModel && mDisplayedCommitSummary.getRevision().getType() == Revision::Uncommitted) reloadModifications(); } } @@ -246,12 +246,16 @@ } // load committed revisions - mpCommitSummaryThread->fetchSummaries(mPath, Revision::base(), Revision::committed(0), false); + mpCommitSummaryThread->fetchSummaries(mPath, Revision::base(), Revision::committed(0), true); } void MainWindow::reloadModifications() { - mpModificationsThread->fetchSummaries(mPath, mDisplayedRevision, mDisplayedRevision, true); + Revision rev = mDisplayedCommitSummary.getRevision(); + if (rev.getType() == Revision::Uncommitted) + mpModificationsThread->fetchSummaries(mPath, rev, rev, true); + else + mpModificationsModel->showModifications(mDisplayedCommitSummary.modifications(), true); } void MainWindow::revisionSelectionChanged(const QItemSelection& rcSelected, const QItemSelection& rcDeselected) @@ -264,10 +268,10 @@ return; GSVN_ASSERT(rows.count() == 1); - Revision revision; - if (mpRevisionsModel->getRevisionForRow(rows.at(0), revision)) + CommitSummary commitSummary; + if (mpRevisionsModel->getCommitSummaryForRow(rows.at(0), commitSummary)) { - mDisplayedRevision = revision; + mDisplayedCommitSummary = commitSummary; // clear the displayed mods QList<Modification> mods; Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2006-11-06 10:44:18 UTC (rev 87) +++ trunk/src/dialogs/revisionsmodel.cpp 2006-11-06 10:48:43 UTC (rev 88) @@ -54,20 +54,10 @@ emit layoutChanged(); } -bool RevisionsModel::getRevisionForRow(int row, Revision& rRevision) const -{ - CommitSummary summary; - if (!getCommitSummaryForRow(row, summary)) - return false; - - rRevision = summary.getRevision(); - return true; -} - QModelIndex RevisionsModel::getUncommittedRevision() const { - Revision rev; - if (!getRevisionForRow(0, rev) || rev.getType() != Revision::Uncommitted) + CommitSummary summary; + if (!getCommitSummaryForRow(0, summary) || summary.getRevision().getType() != Revision::Uncommitted) return QModelIndex(); return index(0, 0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-22 19:16:52
|
Revision: 90 http://svn.sourceforge.net/grandmas-svn/?rev=90&view=rev Author: matthiasmiller Date: 2006-11-22 11:16:50 -0800 (Wed, 22 Nov 2006) Log Message: ----------- add a username/password dialog and stub it into the update button Modified Paths: -------------- trunk/grandmas_svn.pro trunk/src/dialogs/mainwindow.cpp Added Paths: ----------- trunk/include/dialogs/authentication.h trunk/src/dialogs/authentication.cpp trunk/ui/authentication.ui Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-11-22 19:15:40 UTC (rev 89) +++ trunk/grandmas_svn.pro 2006-11-22 19:16:50 UTC (rev 90) @@ -100,7 +100,8 @@ INCLUDEPATH += include -FORMS += ui/commit.ui \ +FORMS += ui/authentication.ui \ + ui/commit.ui \ ui/mainwindow.ui \ ui/move.ui \ ui/open.ui \ @@ -112,6 +113,7 @@ HEADERS += include/commandline.h \ include/debug.h \ + include/dialogs/authentication.h \ include/dialogs/commit.h \ include/dialogs/mainwindow.h \ include/dialogs/modificationsmodel.h \ @@ -138,6 +140,7 @@ SOURCES += src/commandline.cpp \ src/debug.cpp \ + src/dialogs/authentication.cpp \ src/dialogs/commit.cpp \ src/dialogs/mainwindow.cpp \ src/dialogs/modificationsmodel.cpp \ Copied: trunk/include/dialogs/authentication.h (from rev 88, trunk/templates/h) =================================================================== --- trunk/include/dialogs/authentication.h (rev 0) +++ trunk/include/dialogs/authentication.h 2006-11-22 19:16:50 UTC (rev 90) @@ -0,0 +1,52 @@ +/*************************************************************************** + * 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/server_access.h" + +#include <QDialog> + +class Ui_AuthenticationDialog; + +class AuthenticationDialog : public QDialog +{ + Q_OBJECT + +public: + AuthenticationDialog(QWidget* pParent, QString username, QString password); + virtual ~AuthenticationDialog(); + + QString getUsername() const; + QString getPassword() const; + +private: + Ui_AuthenticationDialog* mpUi; +}; + +class SvnUiAuthentication : public SvnAuthentication +{ +public: + SvnUiAuthentication(QWidget* pParent); + + using SvnAuthentication::getAuthentication; + +private: + virtual bool getAuthentication(QString& rUsername, QString& rPassword); + QWidget* mpParent; +}; Copied: trunk/src/dialogs/authentication.cpp (from rev 88, trunk/templates/cpp) =================================================================== --- trunk/src/dialogs/authentication.cpp (rev 0) +++ trunk/src/dialogs/authentication.cpp 2006-11-22 19:16:50 UTC (rev 90) @@ -0,0 +1,66 @@ +/*************************************************************************** + * 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/authentication.h" +#include "dialogs/util.h" +#include "ui_authentication.h" + +AuthenticationDialog::AuthenticationDialog(QWidget* pParent, QString username, QString password) : QDialog(pParent, Qt::Sheet) +{ + mpUi = new Ui_AuthenticationDialog; + mpUi->setupUi(this); + mpUi->usernameEdit->setText(username); + mpUi->passwordEdit->setText(password); + +#ifdef Q_WS_MAC + exchangeWidgets(mpUi->hboxLayout, mpUi->okButton, mpUi->cancelButton); +#endif +} + +AuthenticationDialog::~AuthenticationDialog() +{ + delete mpUi; + mpUi = NULL; +} + +QString AuthenticationDialog::getUsername() const +{ + return mpUi->usernameEdit->text(); +} + +QString AuthenticationDialog::getPassword() const +{ + return mpUi->passwordEdit->text(); +} + +SvnUiAuthentication::SvnUiAuthentication(QWidget* pParent) +{ + mpParent = pParent; +} + +bool SvnUiAuthentication::getAuthentication(QString& rUsername, QString& rPassword) +{ + AuthenticationDialog dialog(mpParent, rUsername, rPassword); + if (dialog.exec() != QDialog::Accepted) + return false; + + rUsername = dialog.getUsername(); + rPassword = dialog.getPassword(); + return true; +} \ No newline at end of file Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-22 19:15:40 UTC (rev 89) +++ trunk/src/dialogs/mainwindow.cpp 2006-11-22 19:16:50 UTC (rev 90) @@ -20,6 +20,7 @@ #include "dialogs/mainwindow.h" +#include "dialogs/authentication.h" #include "dialogs/commit.h" #include "dialogs/modificationsmodel.h" #include "dialogs/move.h" @@ -125,6 +126,12 @@ void MainWindow::update() { + // BEGIN HARDCODE - prompt for username/password + SvnUiAuthentication auth(this); + if (!auth.getAuthentication(tr("default_username"))) + return; + // END HARDCODE + ProgressDialog progress(this, tr("Updating Working Copy")); mpContext->setStatus(&progress); QString error; Added: trunk/ui/authentication.ui =================================================================== --- trunk/ui/authentication.ui (rev 0) +++ trunk/ui/authentication.ui 2006-11-22 19:16:50 UTC (rev 90) @@ -0,0 +1,148 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>AuthenticationDialog</class> + <widget class="QDialog" name="AuthenticationDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>126</height> + </rect> + </property> + <property name="windowTitle" > + <string>Authentication</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="1" column="0" > + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Password:</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="passwordEdit" > + <property name="echoMode" > + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="usernameEdit" /> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="label" > + <property name="text" > + <string>Username:</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QCheckBox" name="saveAuthCheckBox" > + <property name="text" > + <string>Remember this username and password.</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>131</width> + <height>31</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton" > + <property name="text" > + <string>OK</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="cancelButton" > + <property name="text" > + <string>Cancel</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <pixmapfunction></pixmapfunction> + <tabstops> + <tabstop>usernameEdit</tabstop> + <tabstop>passwordEdit</tabstop> + <tabstop>saveAuthCheckBox</tabstop> + <tabstop>okButton</tabstop> + <tabstop>cancelButton</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>AuthenticationDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>278</x> + <y>253</y> + </hint> + <hint type="destinationlabel" > + <x>96</x> + <y>254</y> + </hint> + </hints> + </connection> + <connection> + <sender>cancelButton</sender> + <signal>clicked()</signal> + <receiver>AuthenticationDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>369</x> + <y>253</y> + </hint> + <hint type="destinationlabel" > + <x>179</x> + <y>282</y> + </hint> + </hints> + </connection> + </connections> +</ui> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-11-22 19:19:01
|
Revision: 91 http://svn.sourceforge.net/grandmas-svn/?rev=91&view=rev Author: matthiasmiller Date: 2006-11-22 11:18:58 -0800 (Wed, 22 Nov 2006) Log Message: ----------- provide a way to fetch selected modifications from the modifications model Modified Paths: -------------- trunk/include/dialogs/modificationsmodel.h trunk/src/dialogs/modificationsmodel.cpp Modified: trunk/include/dialogs/modificationsmodel.h =================================================================== --- trunk/include/dialogs/modificationsmodel.h 2006-11-22 19:16:50 UTC (rev 90) +++ trunk/include/dialogs/modificationsmodel.h 2006-11-22 19:18:58 UTC (rev 91) @@ -43,6 +43,7 @@ virtual Qt::ItemFlags flags(const QModelIndex& rcIndex) const; void setAllowSelections(bool allowSelections); + void getSelectedModifications(QList<Modification>& rModifications); bool hasCheckboxColumn() const; int getCheckboxColumn() const; Modified: trunk/src/dialogs/modificationsmodel.cpp =================================================================== --- trunk/src/dialogs/modificationsmodel.cpp 2006-11-22 19:16:50 UTC (rev 90) +++ trunk/src/dialogs/modificationsmodel.cpp 2006-11-22 19:18:58 UTC (rev 91) @@ -236,6 +236,17 @@ mAllowSelections = allowSelections; } +void ModificationsModel::getSelectedModifications(QList<Modification>& rModifications) +{ + GSVN_ASSERT(mAllowSelections); + rModifications.clear(); + Q_FOREACH(Modification mod, mAllModifications) + { + if (!mDeclinedModifications.contains(DeclinedMod::fromSvnMod(mod))) + rModifications.push_back(mod); + } +} + bool ModificationsModel::hasCheckboxColumn() const { return mError.isEmpty() && mAllowSelections; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-18 21:58:06
|
Revision: 96 http://svn.sourceforge.net/grandmas-svn/?rev=96&view=rev Author: matthiasmiller Date: 2006-12-18 13:57:59 -0800 (Mon, 18 Dec 2006) Log Message: ----------- first cut on the menu bar Modified Paths: -------------- trunk/include/dialogs/mainwindow.h trunk/src/dialogs/mainwindow.cpp trunk/src/grandmas_svn.cpp trunk/src/grandmas_svn.h trunk/ui/mainwindow.ui Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-11-23 22:21:29 UTC (rev 95) +++ trunk/include/dialogs/mainwindow.h 2006-12-18 21:57:59 UTC (rev 96) @@ -39,7 +39,9 @@ Q_OBJECT public: - MainWindow(SvnOperationContext* pContext, QString path); + // The window menu may be null on some platforms. + // This object will claim ownership of the menu. + MainWindow(SvnOperationContext* pContext, QString path, QMenu* pWindowMenu); ~MainWindow(); protected: Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-11-23 22:21:29 UTC (rev 95) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-18 21:57:59 UTC (rev 96) @@ -41,7 +41,7 @@ #include <QMessageBox> #include <QProcess> -MainWindow::MainWindow(SvnOperationContext* pContext, QString path) : mpModificationsModel(NULL) +MainWindow::MainWindow(SvnOperationContext* pContext, QString path, QMenu* pWindowMenu) : mpModificationsModel(NULL) { mpContext = pContext; mPath = path; @@ -60,6 +60,12 @@ mpUi->changesTreeView->setAllColumnsShowFocus(true); mpUi->revisionsTreeView->setAllColumnsShowFocus(true); #endif + if (pWindowMenu) + { + pWindowMenu->setParent(menuBar()); + QAction* pAction = menuBar()->addMenu(pWindowMenu); + pAction->setText(tr("&Window")); + } connect(mpUi->updateButton, SIGNAL(clicked()), this, SLOT(update())); connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); Modified: trunk/src/grandmas_svn.cpp =================================================================== --- trunk/src/grandmas_svn.cpp 2006-11-23 22:21:29 UTC (rev 95) +++ trunk/src/grandmas_svn.cpp 2006-12-18 21:57:59 UTC (rev 96) @@ -55,12 +55,37 @@ // Mac needs to have a default menu that it can display even when no windows are open mpAppMenu = new QMenuBar(); + QMenu* pFile = mpAppMenu->addMenu(tr("&File")); + pFile->addAction(tr("&Open"), this, SLOT(openWorkingCopy()), tr("Ctrl+O")); - QAction* pOpen = pFile->addAction(tr("&Open"), this, SLOT(openWorkingCopy())); - pOpen->setShortcut(tr("Ctrl+O")); + QMenu* pWindow = createWindowMenu(); + if (pWindow) + { + pWindow->setParent(mpAppMenu); + QAction* pAction = mpAppMenu->addMenu(pWindow); + pAction->setText(tr("&Window")); + } } +QMenu* GrandmasSVNApp::createWindowMenu() +{ +#ifdef Q_WS_MAC + QMenu* pWindowMenu = new QMenu; + pWindowMenu->addAction(tr("&Minimize"), this, SLOT(), tr("Ctrl+M")); + pWindowMenu->addAction(tr("&Zoom"), this, SLOT(), QKeySequence()); + pWindowMenu->addAction(tr("-"), this, SLOT(), QKeySequence()); + pWindowMenu->addAction(tr("&Previous"), this, SLOT(), tr("Ctrl+Left")); + pWindowMenu->addAction(tr("&Next"), this, SLOT(), tr("Ctrl+Right")); + pWindowMenu->addAction(tr("-"), this, SLOT(), QKeySequence()); + pWindowMenu->addAction(tr("&Close"), this, SLOT(), tr("Ctrl+W")); + pWindowMenu->addAction(tr("C&lose All"), this, SLOT(), tr("Shift+Ctrl+W")); + return pWindowMenu; +#else + return NULL; +#endif +} + QSettings* GrandmasSVNApp::createSettings() { return new QSettings(QSettings::IniFormat, QSettings::UserScope, QCoreApplication::organizationName(), QCoreApplication::applicationName()); @@ -87,7 +112,8 @@ void GrandmasSVNApp::openPath(QString path) { - MainWindow* pMainWnd = new MainWindow(mpContext, path); + QMenu* pWindowMenu = createWindowMenu(); + MainWindow* pMainWnd = new MainWindow(mpContext, path, pWindowMenu); pMainWnd->show(); } Modified: trunk/src/grandmas_svn.h =================================================================== --- trunk/src/grandmas_svn.h 2006-11-23 22:21:29 UTC (rev 95) +++ trunk/src/grandmas_svn.h 2006-12-18 21:57:59 UTC (rev 96) @@ -25,6 +25,7 @@ #include <QApplication> class OpenDialog; +class QMenu; class QMenuBar; class QSettings; class SvnOperationContext; @@ -42,6 +43,8 @@ private: void initMac(); + // may be NULL if the OS does not have a window menu + QMenu* createWindowMenu(); static QSettings* createSettings(); private slots: Modified: trunk/ui/mainwindow.ui =================================================================== --- trunk/ui/mainwindow.ui 2006-11-23 22:21:29 UTC (rev 95) +++ trunk/ui/mainwindow.ui 2006-12-18 21:57:59 UTC (rev 96) @@ -318,11 +318,113 @@ </layout> </widget> <widget class="QStatusBar" name="statusbar" /> + <widget class="QMenuBar" name="menuBar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>639</width> + <height>22</height> + </rect> + </property> + <widget class="QMenu" name="menu_Actions" > + <property name="title" > + <string>&Actions</string> + </property> + <addaction name="action_Update_All" /> + <addaction name="actionUpdate_Path_to_Revision" /> + <addaction name="action_Commit" /> + <addaction name="separator" /> + <addaction name="action_Diff" /> + <addaction name="action_Revert" /> + <addaction name="action_Add" /> + <addaction name="action_Delete" /> + <addaction name="action_Move_Rename" /> + <addaction name="separator" /> + <addaction name="action_Annotate" /> + </widget> + <widget class="QMenu" name="menu_File" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="action_Open" /> + </widget> + <addaction name="menu_File" /> + <addaction name="menu_Actions" /> + </widget> <action name="action_Close" > <property name="text" > <string>&Close</string> </property> </action> + <action name="action_Open" > + <property name="text" > + <string>&Open...</string> + </property> + <property name="shortcut" > + <string>Ctrl+O</string> + </property> + </action> + <action name="action_Update_All" > + <property name="text" > + <string>&Update All...</string> + </property> + <property name="shortcut" > + <string>Ctrl+U</string> + </property> + </action> + <action name="actionUpdate_Path_to_Revision" > + <property name="text" > + <string>Update &Path to Revision...</string> + </property> + <property name="shortcut" > + <string>Ctrl+Shift+U</string> + </property> + </action> + <action name="action_Commit" > + <property name="text" > + <string>&Commit...</string> + </property> + <property name="shortcut" > + <string>Ctrl+I</string> + </property> + </action> + <action name="action_Diff" > + <property name="text" > + <string>&Diff</string> + </property> + <property name="shortcut" > + <string>Ctrl+D</string> + </property> + </action> + <action name="action_Revert" > + <property name="text" > + <string>&Revert</string> + </property> + </action> + <action name="action_Add" > + <property name="text" > + <string>&Add</string> + </property> + </action> + <action name="action_Delete" > + <property name="text" > + <string>&Delete</string> + </property> + </action> + <action name="action_Move_Rename" > + <property name="text" > + <string>&Move/Rename...</string> + </property> + </action> + <action name="action_Annotate" > + <property name="text" > + <string>&Annotate</string> + </property> + <property name="shortcut" > + <string>Ctrl+T</string> + </property> + </action> </widget> <pixmapfunction></pixmapfunction> <tabstops> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-19 03:59:31
|
Revision: 100 http://svn.sourceforge.net/grandmas-svn/?rev=100&view=rev Author: matthiasmiller Date: 2006-12-18 19:59:31 -0800 (Mon, 18 Dec 2006) Log Message: ----------- start work on unit tests in Windows Modified Paths: -------------- trunk/grandmas_svn.pro trunk/tests/svn_test.cpp trunk/tests/svn_test.h Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist tags + *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist tags *.idb *.pdb Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-19 01:47:04 UTC (rev 99) +++ trunk/grandmas_svn.pro 2006-12-19 03:59:31 UTC (rev 100) @@ -101,6 +101,13 @@ -ladvapi32 \ -lshlwapi \ -lws2_32 + + # This is an ugly hack to get MSVC to use the release CRT even in debug mode, + # since there aren't any debug Subversion libraries to link against. + QMAKE_CFLAGS_DEBUG -= -MDd + QMAKE_CFLAGS_DEBUG += -MD + QMAKE_CXXFLAGS_DEBUG -= -MDd + QMAKE_CXXFLAGS_DEBUG += -MD } TARGET = bin/grandmas-svn Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-12-19 01:47:04 UTC (rev 99) +++ trunk/tests/svn_test.cpp 2006-12-19 03:59:31 UTC (rev 100) @@ -32,6 +32,30 @@ #include <iostream> +namespace +{ + bool clearReadOnlyFlag(QFileInfo file) + { +#ifdef Q_WS_WIN + const wchar_t* path = (const wchar_t*)file.absoluteFilePath().utf16(); + DWORD dwAttr = ::GetFileAttributes(path); + if (dwAttr == (DWORD)~0) + return false; + + if ((dwAttr & FILE_ATTRIBUTE_READONLY) != 0) + { + dwAttr &= ~FILE_ATTRIBUTE_READONLY; + if (!::SetFileAttributes(path, dwAttr)) + return false; + } + + return true; +#else + return false; //unimpl +#endif + } +} + SvnTester::SvnTester() { apr_pool_t* pool; @@ -68,13 +92,10 @@ return true; } -bool SvnTester::addFile(QString relFilePath) +svn_error_t* SvnTester::addFile(QString relFilePath) { QString fullPath = QDir::convertSeparators(getWcPath()+relFilePath); - svn_error_t* pError = svn_client_add2(fullPath.toAscii(), true, true, mpCtx, mpContext->getAprPool()); - if (pError) - std::cout << pError->message << "\n"; - return (pError == NULL); + return svn_client_add2(fullPath.toAscii(), true, true, mpCtx, mpContext->getAprPool()); } bool SvnTester::touchFile(QString relFilePath, QString fileText) @@ -104,13 +125,14 @@ } else { + clearReadOnlyFlag(entry); if (!QFile::remove(entry.absoluteFilePath())) return false; } } if (!dir.rmdir(filePath)) return false; - + return true; } @@ -140,22 +162,35 @@ return true; } -#define GSVN_VERIFY(command) \ +#define SVN_VERIFY(command) \ do { \ pError = (command); \ - if (pError) {\ + if (!pError)\ + break;\ qDebug("Condition failed: " #command "\n");\ - qDebug(pError->message);\ - QVERIFY(false); } \ + while (pError) {\ + qDebug(pError->message);\ + pError = pError->child;\ + }\ + QVERIFY(false); \ } while (0) +#define GSVN_VERIFY(command) \ + do { \ + if (!(command)) {\ + qDebug("Condition failed: " #command "\n");\ + qDebug(rError.toAscii());\ + QVERIFY(false); \ + }\ + } while (0) + void SvnTester::init() { apr_pool_t* pSubPool = svn_pool_create(mpContext->getAprPool()); svn_repos_t* pCreatedRepo; svn_error_t* pError = NULL; - GSVN_VERIFY(svn_repos_create(&pCreatedRepo, getRepoPath().toAscii(), NULL, NULL, NULL, NULL, pSubPool)); + SVN_VERIFY(svn_repos_create(&pCreatedRepo, getRepoPath().toAscii(), NULL, NULL, NULL, NULL, pSubPool)); apr_pool_destroy(pSubPool); @@ -163,13 +198,13 @@ revision.kind = svn_opt_revision_head; const char* repoPath = svn_path_canonicalize(QString("file://"+getRepoPath()).toAscii(), mpContext->getAprPool()); const char* wcPath = svn_path_canonicalize(getWcPath().toAscii(), mpContext->getAprPool()); - GSVN_VERIFY(svn_client_checkout2(NULL, repoPath, wcPath, &revision, &revision, true, false, mpCtx, mpContext->getAprPool())); + SVN_VERIFY(svn_client_checkout2(NULL, repoPath, wcPath, &revision, &revision, true, false, mpCtx, mpContext->getAprPool())); QVERIFY(touchFile("/first.txt", "This is the first file")); - QVERIFY(addFile("/first.txt")); + SVN_VERIFY(addFile("/first.txt")); QVERIFY(commitChanges("first commit")); QVERIFY(touchFile("/second.txt", "This is the second file")); - QVERIFY(addFile("/second.txt")); + SVN_VERIFY(addFile("/second.txt")); QVERIFY(updateWc()); } @@ -198,7 +233,7 @@ QString rError; Revision rev; rev = Revision::committed(1); - QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, true, summary, rError)); + GSVN_VERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, true, summary, rError)); const QList<Modification>& mods = summary.modifications(); @@ -208,7 +243,7 @@ QCOMPARE(summary.getRevision(), Revision::committed(1)); rev = Revision::uncommitted(); - QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, true, summary, rError)); + GSVN_VERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, true, summary, rError)); QCOMPARE(mods.size(), 1); QCOMPARE(mods[0].getFilePath(), QString("/second.txt")); @@ -222,14 +257,14 @@ QString filePath; Revision oldRev; oldRev = Revision::committed(1); - QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/first.txt"), oldRev, filePath, rError)); + GSVN_VERIFY(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! Revision newRev; newRev = Revision::uncommitted(); - QVERIFY(RepoFileAccess::getFile(*mpContext, QDir::convertSeparators(getWcPath()+"/second.txt"), newRev, filePath, rError)); - + GSVN_VERIFY(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")); @@ -237,7 +272,7 @@ 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)); + GSVN_VERIFY(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")); } @@ -251,8 +286,8 @@ CommitSummary summary; CommitSummaryFetcher fetcher; - QVERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, false, summary, rError)); - + GSVN_VERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, false, summary, rError)); + //QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); //QCOMPARE(summary.getCommitDate(), bogus); QCOMPARE(summary.getCommitLogMessage(), QString("first commit")); Modified: trunk/tests/svn_test.h =================================================================== --- trunk/tests/svn_test.h 2006-12-19 01:47:04 UTC (rev 99) +++ trunk/tests/svn_test.h 2006-12-19 03:59:31 UTC (rev 100) @@ -60,7 +60,7 @@ QString getWcPath() { return QDir::cleanPath(QDir::convertSeparators(QDir::tempPath()+"/gsvn_wc")); } bool commitChanges(QString commitMessage); - bool addFile(QString relFilePath); + svn_error_t* addFile(QString relFilePath); bool touchFile(QString relFilePath, QString fileText); // fails if the file exists bool updateWc(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mat...@us...> - 2006-12-19 16:02:29
|
Revision: 105 http://svn.sourceforge.net/grandmas-svn/?rev=105&view=rev Author: matthiasmiller Date: 2006-12-19 08:02:11 -0800 (Tue, 19 Dec 2006) Log Message: ----------- restructure temporary files and binaries Modified Paths: -------------- trunk/grandmas_svn.pro Property Changed: ---------------- trunk/ Property changes on: trunk ___________________________________________________________________ Name: svn:ignore - *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist tags *.idb *.pdb + *.pcs *.kdevses Makefile Makefile.Debug Makefile.Release bin build debug release object_script.grandmas-svn.Debug object_script.grandmas-svn.Release grandmas-svn.xcodeproj Info.plist tags tmp *.idb *.pdb Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-19 15:37:59 UTC (rev 104) +++ trunk/grandmas_svn.pro 2006-12-19 16:02:11 UTC (rev 105) @@ -110,14 +110,21 @@ QMAKE_CXXFLAGS_DEBUG += -MD } -TARGET = bin/grandmas-svn +# must set debug/release configuration immediately since it affects output directories. +CONFIG += debug -OBJECTS_DIR = build/obj -MOC_DIR = build/moc -UI_DIR = build/ui -RCC_DIR = build/rcc +debug: CONF_SUBDIR = debug +!debug: CONF_SUBDIR = release -CONFIG += debug \ +DESTDIR = bin/$${CONF_SUBDIR} +TARGET = grandmas-svn + +OBJECTS_DIR = tmp/$${CONF_SUBDIR}/obj +MOC_DIR = tmp/$${CONF_SUBDIR}/moc +UI_DIR = tmp/$${CONF_SUBDIR}/ui +RCC_DIR = tmp/$${CONF_SUBDIR}/rcc + +CONFIG += \ warn_on \ qt \ thread \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-12-19 16:02:34
|
Revision: 106 http://svn.sourceforge.net/grandmas-svn/?rev=106&view=rev Author: highjinx Date: 2006-12-19 08:02:21 -0800 (Tue, 19 Dec 2006) Log Message: ----------- Modified Paths: -------------- trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/svn/svn_commit.cpp trunk/ui/commit.ui Added Paths: ----------- trunk/include/svn/delete.h trunk/src/svn/delete.cpp Added: trunk/include/svn/delete.h =================================================================== Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-12-19 16:02:11 UTC (rev 105) +++ trunk/src/dialogs/commit.cpp 2006-12-19 16:02:21 UTC (rev 106) @@ -20,6 +20,7 @@ #include "dialogs/commit.h" #include "dialogs/modificationsmodel.h" +#include "dialogs/progress.h" #include "dialogs/util.h" #include "svn/commit_summary.h" #include "svn/file_access.h" @@ -49,7 +50,7 @@ mpUi->changesTreeView->header()->setMovable(false); mpUi->logTextEdit->setPlainText(mCommitMessage); - connect(mpUi->okButton, SIGNAL(clicked()), this, SLOT(commit())); + connect(mpUi->commitButton, SIGNAL(clicked()), this, SLOT(commit())); reload(); @@ -87,6 +88,9 @@ void CommitDialog::commit(bool bUpdate) { + ProgressDialog progress(this, tr("Committing changes")); + mpContext->setStatus(&progress); + QStringList files; foreach(Modification mod, mpModificationsModel->getSelectedModifications()) { @@ -95,10 +99,18 @@ QString error; if (!Svn::commit(*mpContext, mCommitMessage, files, error)) + { QMessageBox::critical(this, tr("Commit Error"), error); - + return; + } + if (bUpdate && !Svn::update(*mpContext, mPath, Revision::head(), error)) + { QMessageBox::critical(this, tr("Update Error"), error); + reject(); + } + + accept(); } void CommitDialog::reload() Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-19 16:02:11 UTC (rev 105) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-19 16:02:21 UTC (rev 106) @@ -152,6 +152,9 @@ { CommitDialog dlg(mpContext, mpUi->logEdit->toPlainText(), mPath, this); dlg.exec(); + reloadModifications(); + if (dlg.result() == QDialog::Accepted) + reloadCommitSummaries(); } void MainWindow::diff() Added: trunk/src/svn/delete.cpp =================================================================== Modified: trunk/src/svn/svn_commit.cpp =================================================================== --- trunk/src/svn/svn_commit.cpp 2006-12-19 16:02:11 UTC (rev 105) +++ trunk/src/svn/svn_commit.cpp 2006-12-19 16:02:21 UTC (rev 106) @@ -54,11 +54,12 @@ ctx->log_msg_baton2 = this; ctx->notify_func2 = updateNotifyCallback; ctx->notify_baton2 = this; - - apr_array_header_t *filesArray = apr_array_make(rContext.getAprPool(), 1, sizeof(const char*)); - foreach(QString file, filePaths) + + apr_array_header_t *filesArray = apr_array_make(rContext.getAprPool(), filePaths.size(), sizeof(const char*)); + for (int fileNum = 0; fileNum < filePaths.size(); fileNum++) { - APR_ARRAY_PUSH(filesArray, const char*) = file.toAscii(); + const char* target = apr_pstrdup(rContext.getAprPool(), filePaths[fileNum].toAscii()); + APR_ARRAY_PUSH(filesArray, const char*) = target; } svn_commit_info_t* pResultingInfo = NULL; Modified: trunk/ui/commit.ui =================================================================== --- trunk/ui/commit.ui 2006-12-19 16:02:11 UTC (rev 105) +++ trunk/ui/commit.ui 2006-12-19 16:02:21 UTC (rev 106) @@ -102,7 +102,7 @@ </spacer> </item> <item> - <widget class="QPushButton" name="okButton" > + <widget class="QPushButton" name="commitButton" > <property name="text" > <string>OK</string> </property> @@ -122,7 +122,7 @@ <tabstops> <tabstop>logTextEdit</tabstop> <tabstop>changesTreeView</tabstop> - <tabstop>okButton</tabstop> + <tabstop>commitButton</tabstop> <tabstop>cancelButton</tabstop> </tabstops> <resources> @@ -130,22 +130,6 @@ </resources> <connections> <connection> - <sender>okButton</sender> - <signal>clicked()</signal> - <receiver>CommitDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel" > - <x>278</x> - <y>253</y> - </hint> - <hint type="destinationlabel" > - <x>96</x> - <y>254</y> - </hint> - </hints> - </connection> - <connection> <sender>cancelButton</sender> <signal>clicked()</signal> <receiver>CommitDialog</receiver> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hig...@us...> - 2006-12-19 17:31:25
|
Revision: 109 http://svn.sourceforge.net/grandmas-svn/?rev=109&view=rev Author: highjinx Date: 2006-12-19 09:31:21 -0800 (Tue, 19 Dec 2006) Log Message: ----------- * Add helper function to deal with apr arrays * Move CommitSummary and CommitSummaryFetcher into Svn namespace Modified Paths: -------------- trunk/grandmas_svn.pro trunk/include/dialogs/mainwindow.h trunk/include/dialogs/revisionsmodel.h trunk/include/svn/commit_summary.h trunk/include/svn/commit_summary_thread.h trunk/include/svn/modification.h trunk/src/dialogs/authentication.cpp trunk/src/dialogs/commit.cpp trunk/src/dialogs/mainwindow.cpp trunk/src/dialogs/revisionsmodel.cpp trunk/src/svn/commit_summary.cpp trunk/src/svn/commit_summary_thread.cpp trunk/src/svn/revert.cpp trunk/src/svn/svn_commit.cpp trunk/src/svn/update.cpp trunk/tests/svn_test.cpp Added Paths: ----------- trunk/include/svn/helpers.h trunk/src/svn/helpers.cpp Modified: trunk/grandmas_svn.pro =================================================================== --- trunk/grandmas_svn.pro 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/grandmas_svn.pro 2006-12-19 17:31:21 UTC (rev 109) @@ -161,6 +161,7 @@ include/svn/commit_summary.h \ include/svn/commit_summary_thread.h \ include/svn/file_access.h \ + include/svn/helpers.h \ include/svn/modification.h \ include/svn/operation.h \ include/svn/operation_internal.h \ @@ -189,6 +190,7 @@ src/svn/commit_summary.cpp \ src/svn/commit_summary_thread.cpp \ src/svn/file_access.cpp \ + src/svn/helpers.cpp \ src/svn/operation.cpp \ src/svn/operation_internal.cpp \ src/svn/pool.cpp \ Modified: trunk/include/dialogs/mainwindow.h =================================================================== --- trunk/include/dialogs/mainwindow.h 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/include/dialogs/mainwindow.h 2006-12-19 17:31:21 UTC (rev 109) @@ -70,7 +70,7 @@ SvnOperationContext* mpContext; QString mPath; ModificationsModel* mpModificationsModel; - CommitSummary mDisplayedCommitSummary; + Svn::CommitSummary mDisplayedCommitSummary; RevisionsModel* mpRevisionsModel; CommitSummaryFetcherThread* mpCommitSummaryThread; CommitSummaryFetcherThread* mpModificationsThread; Modified: trunk/include/dialogs/revisionsmodel.h =================================================================== --- trunk/include/dialogs/revisionsmodel.h 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/include/dialogs/revisionsmodel.h 2006-12-19 17:31:21 UTC (rev 109) @@ -19,7 +19,10 @@ ***************************************************************************/ #include <QAbstractListModel> -class CommitSummary; +namespace Svn +{ + class CommitSummary; +}; class Revision; class RevisionsModel : public QAbstractListModel @@ -29,10 +32,10 @@ virtual ~RevisionsModel(); void showError(QString error); - void showUncommittedRevision(CommitSummary uncommittedRevision); - void showCommittedRevisions(QList<CommitSummary> committedRevisions); + void showUncommittedRevision(Svn::CommitSummary uncommittedRevision); + void showCommittedRevisions(QList<Svn::CommitSummary> committedRevisions); - bool getCommitSummaryForRow(int row, CommitSummary& rSummary) const; + bool getCommitSummaryForRow(int row, Svn::CommitSummary& rSummary) const; QModelIndex getUncommittedRevision() const; virtual int columnCount(const QModelIndex &rcParent = QModelIndex()) const; @@ -45,6 +48,6 @@ static QString getDateTimeAsString(QDateTime dateTime); QString mError; - QList<CommitSummary> mUncommittedSummaries, mCommittedSummaries; + QList<Svn::CommitSummary> mUncommittedSummaries, mCommittedSummaries; }; Modified: trunk/include/svn/commit_summary.h =================================================================== --- trunk/include/svn/commit_summary.h 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/include/svn/commit_summary.h 2006-12-19 17:31:21 UTC (rev 109) @@ -34,46 +34,50 @@ struct svn_error_t; struct apr_hash_t; struct svn_wc_status2_t; -class CommitSummaryFetcher; -class CommitSummary +namespace Svn { -public: - // These functions should only be called for committed revisions - QString getCommitAuthor() const { return mAuthor; } - QDateTime getCommitDate() const { return mDate; } - QString getCommitLogMessage() const { return mLogMessage; } - Revision getRevision() const { return mRevision; } - - // This function may be called for working copy revision - const QList<Modification>& modifications() const { return mModifications; } - -protected: - friend class CommitSummaryFetcher; - QString mAuthor; - QDateTime mDate; - QString mLogMessage; - QList<Modification> mModifications; - Revision mRevision; -}; + class CommitSummaryFetcher; -class CommitSummaryFetcher -{ -public: - // Must be passed a working copy path (TODO: support full repo path) - bool fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, - Revision startRevision, Revision endRevision, bool fetchModifications, - QList<CommitSummary>& rSummaries, QString& rError); - bool fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, - bool fetchModifications, CommitSummary& rSummary, QString& rError); + class CommitSummary + { + public: + // These functions should only be called for committed revisions + QString getCommitAuthor() const { return mAuthor; } + QDateTime getCommitDate() const { return mDate; } + QString getCommitLogMessage() const { return mLogMessage; } + Revision getRevision() const { return mRevision; } + + // This function may be called for working copy revision + const QList<Modification>& modifications() const { return mModifications; } + + protected: + friend class CommitSummaryFetcher; + QString mAuthor; + QDateTime mDate; + QString mLogMessage; + QList<Modification> mModifications; + Revision mRevision; + }; -protected: - QString mWcPath; - QList<CommitSummary> mSummaries; - -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); + class CommitSummaryFetcher + { + public: + // Must be passed a working copy path (TODO: support full repo path) + bool fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, + Revision startRevision, Revision endRevision, bool fetchModifications, + QList<CommitSummary>& rSummaries, QString& rError); + bool fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, + bool fetchModifications, CommitSummary& rSummary, QString& rError); + + protected: + QString mWcPath; + QList<CommitSummary> mSummaries; + + 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); + }; }; #endif Modified: trunk/include/svn/commit_summary_thread.h =================================================================== --- trunk/include/svn/commit_summary_thread.h 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/include/svn/commit_summary_thread.h 2006-12-19 17:31:21 UTC (rev 109) @@ -21,7 +21,10 @@ #include <QMutex> #include <QThread> -class CommitSummary; +namespace Svn +{ + class CommitSummary; +}; class Revision; class SvnOperationStatusUnimpl; @@ -35,7 +38,7 @@ // The caller should connect to the fetchedSummaries signal to receive the results. Any pending requests will be cancelled. void fetchSummaries(QString fullRepoPath, Revision startRevision, Revision endRevision, bool fetchModifications); - void getSummaries(QList<CommitSummary>& rSummaries); + void getSummaries(QList<Svn::CommitSummary>& rSummaries); void cancel(); @@ -51,5 +54,5 @@ SvnOperationStatusUnimpl* mpStatus; QMutex mMutex; Parms* mpParms; - QList<CommitSummary> mSummaries; + QList<Svn::CommitSummary> mSummaries; }; Added: trunk/include/svn/helpers.h =================================================================== --- trunk/include/svn/helpers.h (rev 0) +++ trunk/include/svn/helpers.h 2006-12-19 17:31:21 UTC (rev 109) @@ -0,0 +1,29 @@ +/*************************************************************************** + * 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 apr_array_header_t; + +class QStringList; +struct apr_pool_t; + +namespace Svn +{ + apr_array_header_t* aprArrayFromQStringList(const QStringList& rList, apr_pool_t* pPool); +}; Modified: trunk/include/svn/modification.h =================================================================== --- trunk/include/svn/modification.h 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/include/svn/modification.h 2006-12-19 17:31:21 UTC (rev 109) @@ -26,7 +26,10 @@ #include <QString> class SvnOperationContext; -class CommitSummaryFetcher; +namespace Svn +{ + class CommitSummaryFetcher; +}; class Modification { @@ -80,7 +83,7 @@ Revision getNewRevision() const { return mNewRevision; } private: - friend class CommitSummaryFetcher; + friend class Svn::CommitSummaryFetcher; Type mType; QString mFilePath; Modified: trunk/src/dialogs/authentication.cpp =================================================================== --- trunk/src/dialogs/authentication.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/dialogs/authentication.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -63,4 +63,4 @@ rUsername = dialog.getUsername(); rPassword = dialog.getPassword(); return true; -} \ No newline at end of file +} Modified: trunk/src/dialogs/commit.cpp =================================================================== --- trunk/src/dialogs/commit.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/dialogs/commit.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -115,8 +115,8 @@ void CommitDialog::reload() { - CommitSummary summary; - CommitSummaryFetcher fetcher; + Svn::CommitSummary summary; + Svn::CommitSummaryFetcher fetcher; QString error; if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), true, summary, error)) mpModificationsModel->showModifications(summary.modifications(), false); Modified: trunk/src/dialogs/mainwindow.cpp =================================================================== --- trunk/src/dialogs/mainwindow.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/dialogs/mainwindow.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -242,8 +242,8 @@ void MainWindow::reloadCommitSummaries() { // load uncommitted revisions - CommitSummaryFetcher fetcher; - CommitSummary uncommittedSummary; + Svn::CommitSummaryFetcher fetcher; + Svn::CommitSummary uncommittedSummary; QString error; if (fetcher.fetchSummary(*mpContext, mPath, Revision::uncommitted(), false, uncommittedSummary, error)) { @@ -285,7 +285,7 @@ return; GSVN_ASSERT(rows.count() == 1); - CommitSummary commitSummary; + Svn::CommitSummary commitSummary; if (mpRevisionsModel->getCommitSummaryForRow(rows.at(0), commitSummary)) { mDisplayedCommitSummary = commitSummary; @@ -299,7 +299,7 @@ void MainWindow::fetchedCommittedRevisions() { - QList<CommitSummary> summaries; + QList<Svn::CommitSummary> summaries; mpCommitSummaryThread->getSummaries(summaries); mpRevisionsModel->showCommittedRevisions(summaries); } @@ -311,7 +311,7 @@ void MainWindow::fetchedModifications() { - QList<CommitSummary> summaries; + QList<Svn::CommitSummary> summaries; mpModificationsThread->getSummaries(summaries); GSVN_ASSERT(summaries.count() == 1); mpModificationsModel->showModifications(summaries.at(0).modifications(), true); Modified: trunk/src/dialogs/revisionsmodel.cpp =================================================================== --- trunk/src/dialogs/revisionsmodel.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/dialogs/revisionsmodel.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -39,7 +39,7 @@ emit layoutChanged(); } -void RevisionsModel::showUncommittedRevision(CommitSummary uncommittedRevision) +void RevisionsModel::showUncommittedRevision(Svn::CommitSummary uncommittedRevision) { mError = QString(); mUncommittedSummaries.clear(); @@ -47,7 +47,7 @@ emit layoutChanged(); } -void RevisionsModel::showCommittedRevisions(QList<CommitSummary> committedRevisions) +void RevisionsModel::showCommittedRevisions(QList<Svn::CommitSummary> committedRevisions) { mError = QString(); mCommittedSummaries = committedRevisions; @@ -56,7 +56,7 @@ QModelIndex RevisionsModel::getUncommittedRevision() const { - CommitSummary summary; + Svn::CommitSummary summary; if (!getCommitSummaryForRow(0, summary) || summary.getRevision().getType() != Revision::Uncommitted) return QModelIndex(); @@ -141,7 +141,7 @@ if (!mError.isNull()) return mError; - CommitSummary summary; + Svn::CommitSummary summary; if (!rcIndex.isValid() || !getCommitSummaryForRow(rcIndex.row(), summary)) return QVariant(); @@ -164,7 +164,7 @@ return QVariant(); } -bool RevisionsModel::getCommitSummaryForRow(int row, CommitSummary& rSummary) const +bool RevisionsModel::getCommitSummaryForRow(int row, Svn::CommitSummary& rSummary) const { // showing error? if (!mError.isNull()) Modified: trunk/src/svn/commit_summary.cpp =================================================================== --- trunk/src/svn/commit_summary.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/svn/commit_summary.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -19,12 +19,17 @@ ***************************************************************************/ #include "svn/commit_summary.h" +#include "svn/helpers.h" #include "svn/operation.h" #include <svn_client.h> #include <svn_path.h> -bool CommitSummaryFetcher::fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, +#include <QStringList> + +using namespace Svn; + +bool Svn::CommitSummaryFetcher::fetchSummaries(SvnOperationContext& rContext, QString fullRepoPath, Revision startRevision, Revision endRevision, bool fetchModifications, QList<CommitSummary>& rSummaries, QString& rError) { @@ -45,8 +50,7 @@ svn_opt_revision_t startRev = startRevision.getSvnRevision(); svn_opt_revision_t endRev = endRevision.getSvnRevision(); - apr_array_header_t *array = apr_array_make(rContext.getAprPool(), 1, sizeof(const char*)); - APR_ARRAY_PUSH(array, const char*) = fullCanonPath; + apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); pError = svn_client_log2(array, &startRev, @@ -93,7 +97,7 @@ return true; } -bool CommitSummaryFetcher::fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, +bool Svn::CommitSummaryFetcher::fetchSummary(SvnOperationContext& rContext, QString fullRepoPath, Revision revision, bool fetchModifications, CommitSummary& rSummary, QString& rError) { QList<CommitSummary> summaries; @@ -105,7 +109,7 @@ return true; } -svn_error_t* CommitSummaryFetcher::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) +svn_error_t* Svn::CommitSummaryFetcher::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) { CommitSummaryFetcher* pThis = (CommitSummaryFetcher*)baton; @@ -159,7 +163,7 @@ return NULL; } -void CommitSummaryFetcher::statusCallback(void *baton, const char *path, svn_wc_status2_t *status) +void Svn::CommitSummaryFetcher::statusCallback(void *baton, const char *path, svn_wc_status2_t *status) { Modification mod; switch (status->text_status) Modified: trunk/src/svn/commit_summary_thread.cpp =================================================================== --- trunk/src/svn/commit_summary_thread.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/svn/commit_summary_thread.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -60,7 +60,7 @@ start(); } -void CommitSummaryFetcherThread::getSummaries(QList<CommitSummary>& rSummaries) +void CommitSummaryFetcherThread::getSummaries(QList<Svn::CommitSummary>& rSummaries) { mMutex.lock(); rSummaries = mSummaries; @@ -89,8 +89,8 @@ SvnOperationContext context(pool.getPool(), *mpStatus, auth); // fetch revisions - CommitSummaryFetcher fetcher; - QList<CommitSummary> summaries; + Svn::CommitSummaryFetcher fetcher; + QList<Svn::CommitSummary> summaries; QString error; if (fetcher.fetchSummaries(context, parms.mFullRepoPath, parms.mStartRevision, parms.mEndRevision, parms.mFetchModifications, summaries, error)) { Added: trunk/src/svn/helpers.cpp =================================================================== --- trunk/src/svn/helpers.cpp (rev 0) +++ trunk/src/svn/helpers.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -0,0 +1,42 @@ +/*************************************************************************** + * 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/helpers.h" + +#include <QString> +#include <QStringList> + +#include <apr_general.h> +#include <apr_strings.h> +#include <apr_tables.h> + +using namespace Svn; + +apr_array_header_t* Svn::aprArrayFromQStringList(const QStringList& rList, apr_pool_t* pPool) +{ + apr_array_header_t* array = apr_array_make(pPool, rList.size(), sizeof(const char*)); + foreach(QString item, rList) + { + const char* itemStr = apr_pstrdup(pPool, item.toAscii()); + (*((const char**)apr_array_push(array))) = itemStr; + } + + return array; +} Modified: trunk/src/svn/revert.cpp =================================================================== --- trunk/src/svn/revert.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/svn/revert.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -20,11 +20,13 @@ #include "svn/revert.h" +#include "svn/helpers.h" #include "svn/operation.h" #include "svn/server_access.h" #include <svn_client.h> #include <svn_path.h> +#include <QStringList> #include <Qt> @@ -37,8 +39,7 @@ if (!Operation::initAuthProviders(rContext, ctx, rError)) return false; - apr_array_header_t *array = apr_array_make(rContext.getAprPool(), 1, sizeof(const char*)); - APR_ARRAY_PUSH(array, const char*) = fullCanonPath; + apr_array_header_t *array = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); svn_error_t* pError = svn_client_revert(array, true, ctx, rContext.getAprPool()); if (pError) { Modified: trunk/src/svn/svn_commit.cpp =================================================================== --- trunk/src/svn/svn_commit.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/svn/svn_commit.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -22,6 +22,7 @@ #include "dialogs/modificationsmodel.h" #include "dialogs/util.h" #include "svn/commit_summary.h" +#include "svn/helpers.h" #include "svn/operation.h" #include "svn/revision.h" #include "ui_commit.h" @@ -55,12 +56,7 @@ ctx->notify_func2 = updateNotifyCallback; ctx->notify_baton2 = this; - apr_array_header_t *filesArray = apr_array_make(rContext.getAprPool(), filePaths.size(), sizeof(const char*)); - for (int fileNum = 0; fileNum < filePaths.size(); fileNum++) - { - const char* target = apr_pstrdup(rContext.getAprPool(), filePaths[fileNum].toAscii()); - APR_ARRAY_PUSH(filesArray, const char*) = target; - } + apr_array_header_t *filesArray = aprArrayFromQStringList(filePaths, rContext.getAprPool()); svn_commit_info_t* pResultingInfo = NULL; svn_error_t* pError = svn_client_commit3(&pResultingInfo, filesArray, true, true, ctx, rContext.getAprPool()); Modified: trunk/src/svn/update.cpp =================================================================== --- trunk/src/svn/update.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/src/svn/update.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -20,6 +20,7 @@ #include "svn/update.h" +#include "svn/helpers.h" #include "svn/operation.h" #include "svn/revision.h" #include "svn/server_access.h" @@ -27,7 +28,7 @@ #include <svn_client.h> #include <svn_path.h> #include <QObject> -#include <Qt> +#include <QStringList> namespace Svn { @@ -60,8 +61,7 @@ svn_opt_revision_t svnRev = revision.getSvnRevision(); - apr_array_header_t *paths = apr_array_make(rContext.getAprPool(), 1, sizeof(const char*)); - APR_ARRAY_PUSH(paths, const char*) = fullCanonPath; + apr_array_header_t *paths = aprArrayFromQStringList(QStringList() << fullCanonPath, rContext.getAprPool()); svn_error_t* pError = svn_client_update2(NULL, paths, &svnRev, true, false, ctx, rContext.getAprPool()); if (pError) { Modified: trunk/tests/svn_test.cpp =================================================================== --- trunk/tests/svn_test.cpp 2006-12-19 16:57:47 UTC (rev 108) +++ trunk/tests/svn_test.cpp 2006-12-19 17:31:21 UTC (rev 109) @@ -235,8 +235,8 @@ void SvnTester::testModifications() { - CommitSummary summary; - CommitSummaryFetcher fetcher; + Svn::CommitSummary summary; + Svn::CommitSummaryFetcher fetcher; QString rError; Revision rev; rev = Revision::committed(1); @@ -291,8 +291,8 @@ Revision rev; rev = Revision::committed(1); - CommitSummary summary; - CommitSummaryFetcher fetcher; + Svn::CommitSummary summary; + Svn::CommitSummaryFetcher fetcher; GSVN_VERIFY(fetcher.fetchSummary(*mpContext, getWcPath(), rev, false, summary, rError)); //QCOMPARE(summary.getCommitAuthor(), QString("billfrank")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |