Mercurial > hg > easyhg
changeset 148:2fef6b0dfbe8
* Some implementation of right-button menu actions on changeset item
author | Chris Cannam |
---|---|
date | Wed, 01 Dec 2010 21:02:53 +0000 |
parents | 465c8d51c6d5 |
children | 38faf16df9b6 |
files | changesetitem.cpp changesetitem.h changesetscene.cpp changesetscene.h hgtabwidget.cpp hgtabwidget.h historywidget.cpp historywidget.h mainwindow.cpp mainwindow.h |
diffstat | 10 files changed, 66 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/changesetitem.cpp Wed Dec 01 20:19:21 2010 +0000 +++ b/changesetitem.cpp Wed Dec 01 21:02:53 2010 +0000 @@ -128,13 +128,13 @@ QAction *tag = menu->addAction(tr("Tag this revision")); connect(tag, SIGNAL(triggered()), this, SLOT(tagActivated())); - QAction *a = menu->exec(QCursor::pos()); + menu->exec(QCursor::pos()); + ungrabMouse(); - if (a) a->trigger(); } void ChangesetItem::updateActivated() { emit updateTo(getId()); } -void ChangesetItem::diffToPreviousActivated() { emit diffToPrevious(getId()); } +void ChangesetItem::diffToPreviousActivated() { emit diffToParent(getId(), m_changeset->parents()[0]); } //!!! no, this is most likely to be useful when something has more than one parent! void ChangesetItem::diffToCurrentActivated() { emit diffToCurrent(getId()); } void ChangesetItem::mergeActivated() { emit mergeFrom(getId()); } void ChangesetItem::tagActivated() { emit tag(getId()); }
--- a/changesetitem.h Wed Dec 01 20:19:21 2010 +0000 +++ b/changesetitem.h Wed Dec 01 21:02:53 2010 +0000 @@ -60,8 +60,8 @@ void detailHidden(); void updateTo(QString); - void diffToPrevious(QString); void diffToCurrent(QString); + void diffToParent(QString child, QString parent); void mergeFrom(QString); void tag(QString);
--- a/changesetscene.cpp Wed Dec 01 20:19:21 2010 +0000 +++ b/changesetscene.cpp Wed Dec 01 21:02:53 2010 +0000 @@ -38,8 +38,8 @@ connect(item, SIGNAL(diffToCurrent(QString)), this, SIGNAL(diffToCurrent(QString))); - connect(item, SIGNAL(diffToPrevious(QString)), - this, SIGNAL(diffToPrevious(QString))); + connect(item, SIGNAL(diffToParent(QString, QString)), + this, SIGNAL(diffToParent(QString, QString))); connect(item, SIGNAL(mergeFrom(QString)), this, SIGNAL(mergeFrom(QString)));
--- a/changesetscene.h Wed Dec 01 20:19:21 2010 +0000 +++ b/changesetscene.h Wed Dec 01 21:02:53 2010 +0000 @@ -39,7 +39,7 @@ void diffWorkingFolder(); void updateTo(QString id); - void diffToPrevious(QString id); + void diffToParent(QString id, QString parent); void diffToCurrent(QString id); void mergeFrom(QString id); void tag(QString id);
--- a/hgtabwidget.cpp Wed Dec 01 20:19:21 2010 +0000 +++ b/hgtabwidget.cpp Wed Dec 01 21:02:53 2010 +0000 @@ -58,8 +58,8 @@ connect(m_historyWidget, SIGNAL(diffToCurrent(QString)), this, SIGNAL(diffToCurrent(QString))); - connect(m_historyWidget, SIGNAL(diffToPrevious(QString)), - this, SIGNAL(diffToPrevious(QString))); + connect(m_historyWidget, SIGNAL(diffToParent(QString, QString)), + this, SIGNAL(diffToParent(QString, QString))); connect(m_historyWidget, SIGNAL(mergeFrom(QString)), this, SIGNAL(mergeFrom(QString)));
--- a/hgtabwidget.h Wed Dec 01 20:19:21 2010 +0000 +++ b/hgtabwidget.h Wed Dec 01 21:02:53 2010 +0000 @@ -80,7 +80,7 @@ void diffWorkingFolder(); void updateTo(QString id); - void diffToPrevious(QString id); + void diffToParent(QString id, QString parent); void diffToCurrent(QString id); void mergeFrom(QString id); void tag(QString id);
--- a/historywidget.cpp Wed Dec 01 20:19:21 2010 +0000 +++ b/historywidget.cpp Wed Dec 01 21:02:53 2010 +0000 @@ -250,8 +250,8 @@ connect(scene, SIGNAL(diffToCurrent(QString)), this, SIGNAL(diffToCurrent(QString))); - connect(scene, SIGNAL(diffToPrevious(QString)), - this, SIGNAL(diffToPrevious(QString))); + connect(scene, SIGNAL(diffToParent(QString, QString)), + this, SIGNAL(diffToParent(QString, QString))); connect(scene, SIGNAL(mergeFrom(QString)), this, SIGNAL(mergeFrom(QString)));
--- a/historywidget.h Wed Dec 01 20:19:21 2010 +0000 +++ b/historywidget.h Wed Dec 01 21:02:53 2010 +0000 @@ -49,7 +49,7 @@ void diffWorkingFolder(); void updateTo(QString id); - void diffToPrevious(QString id); + void diffToParent(QString id, QString parent); void diffToCurrent(QString id); void mergeFrom(QString id); void tag(QString id);
--- a/mainwindow.cpp Wed Dec 01 20:19:21 2010 +0000 +++ b/mainwindow.cpp Wed Dec 01 21:02:53 2010 +0000 @@ -447,37 +447,40 @@ // Diff parent against working folder (folder diff) - params << "--config" << "extensions.extdiff=" << "extdiff" << "-p"; - params << diffBinaryName; + params << "--config" << "extensions.extdiff=" << "extdiff"; + params << "--program" << diffBinaryName; runner->requestAction(HgAction(ACT_FOLDERDIFF, workFolderPath, params)); } -void MainWindow::hgChgSetDiff() +void MainWindow::hgDiffToCurrent(QString id) { - QStringList params; + QStringList params; - //Diff 2 history log versions against each other - QString revA; - QString revB; -/*!!! - hgTabs -> getHistoryDiffRevisions(revA, revB); + // Diff given revision against working folder - if ((!revA.isEmpty()) && (!revB.isEmpty())) - { - params << "kdiff3" << "--rev" << revA << "--rev" << revB; - runner -> startHgCommand(workFolderPath, params); - runningAction = ACT_CHGSETDIFF; - } - else - { - QMessageBox::information(this, tr("Changeset diff"), tr("Please select two changesets from history list or heads list first.")); - } - */ + params << "--config" << "extensions.extdiff=" << "extdiff"; + params << "--program" << diffBinaryName; + params << "--rev" << id; + + runner->requestAction(HgAction(ACT_FOLDERDIFF, workFolderPath, params)); } +void MainWindow::hgDiffToParent(QString child, QString parent) +{ + QStringList params; + + // Diff given revision against working folder + + params << "--config" << "extensions.extdiff=" << "extdiff"; + params << "--program" << diffBinaryName; + params << "--rev" << parent << "--rev" << child; + + runner->requestAction(HgAction(ACT_CHGSETDIFF, workFolderPath, params)); +} + void MainWindow::hgUpdate() { @@ -489,23 +492,13 @@ } -void MainWindow::hgUpdateToRev() +void MainWindow::hgUpdateToRev(QString id) { - QStringList params; - QString rev; -/*!!! - hgTabs -> getUpdateToRevRevision(rev); + QStringList params; - hgTabs -> setCurrentIndex(WORKTAB); - enableDisableActions(); + params << "update" << "--rev" << id << "--check"; - params << "update" << "--rev" << rev << "--clean"; - - runner -> startHgCommand(workFolderPath, params); - - runningAction = ACT_UPDATE; - */ - + runner->requestAction(HgAction(ACT_UPDATE, workFolderPath, params)); } @@ -553,6 +546,17 @@ } +void MainWindow::hgMergeFrom(QString id) +{ + QStringList params; + + params << "merge"; + params << "--rev" << id; + + runner->requestAction(HgAction(ACT_MERGE, workFolderPath, params)); +} + + void MainWindow::hgCloneFromRemote() { QStringList params; @@ -1391,7 +1395,7 @@ // connect(hgTabs, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); - connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev())); +// connect(hgUpdateToRevAct, SIGNAL(triggered()), this, SLOT(hgUpdateToRev())); connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate())); connect(hgResolveListAct, SIGNAL(triggered()), this, SLOT(hgResolveList())); connect(hgResolveMarkAct, SIGNAL(triggered()), this, SLOT(hgResolveMark())); @@ -1409,21 +1413,21 @@ connect(hgTabs, SIGNAL(diffWorkingFolder()), this, SLOT(hgFolderDiff())); -/*!!!! + connect(hgTabs, SIGNAL(updateTo(QString)), - this, SIGNAL(updateTo(QString))); + this, SLOT(hgUpdateToRev(QString))); connect(hgTabs, SIGNAL(diffToCurrent(QString)), - this, SIGNAL(diffToCurrent(QString))); + this, SLOT(hgDiffToCurrent(QString))); - connect(hgTabs, SIGNAL(diffToPrevious(QString)), - this, SIGNAL(diffToPrevious(QString))); + connect(hgTabs, SIGNAL(diffToParent(QString, QString)), + this, SLOT(hgDiffToParent(QString, QString))); connect(hgTabs, SIGNAL(mergeFrom(QString)), - this, SIGNAL(mergeFrom(QString))); - + this, SLOT(hgMergeFrom(QString))); +/* connect(hgTabs, SIGNAL(tag(QString)), - this, SIGNAL(tag(QString))); + this, SLOT(hgTag(QString))); */ } @@ -1635,9 +1639,9 @@ hgMergeAct->setStatusTip(tr("Merge two local repository changesets to working folder")); //Advanced actions - hgUpdateToRevAct = new QAction(tr("Update to revision"), this); +/* hgUpdateToRevAct = new QAction(tr("Update to revision"), this); hgUpdateToRevAct -> setStatusTip(tr("Update working folder to version selected from history list")); - +*/ hgAnnotateAct = new QAction(tr("Annotate"), this); hgAnnotateAct -> setStatusTip(tr("Show line-by-line version information for selected file"));
--- a/mainwindow.h Wed Dec 01 20:19:21 2010 +0000 +++ b/mainwindow.h Wed Dec 01 21:02:53 2010 +0000 @@ -76,7 +76,8 @@ void hgCommit(); void hgFileDiff(); void hgFolderDiff(); - void hgChgSetDiff(); + void hgDiffToCurrent(QString); + void hgDiffToParent(QString, QString); void hgUpdate(); void hgRevert(); void hgMerge(); @@ -86,7 +87,8 @@ void hgIncoming(); void hgPush(); void hgPull(); - void hgUpdateToRev(); + void hgUpdateToRev(QString); + void hgMergeFrom(QString); void hgAnnotate(); void hgResolveList(); void hgResolveMark();