Mercurial > hg > easyhg
changeset 293:7b4f42cfc596
Merge from branch "more_information_dialog"
author | Chris Cannam |
---|---|
date | Mon, 21 Feb 2011 18:17:18 +0000 |
parents | a1c8630a0057 (diff) 2e34e7ee7baf (current diff) |
children | fc9d411ff6e7 |
files | mainwindow.cpp mainwindow.h |
diffstat | 16 files changed, 642 insertions(+), 506 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Mon Feb 21 15:55:39 2011 +0000 +++ b/.hgtags Mon Feb 21 18:17:18 2011 +0000 @@ -4,3 +4,4 @@ 3f4ba5e4b4becad1bdb704b7f30869f0ccbbf1c6 easyhg_v0.2 c02515e33b5d785ebb30814147587e4269cb5b1b easyhg_v0.3 a7843b03b4cfa23f65adc693d6f82fdffc20f221 easyhg_v0.3.1 +cc95394e2392684217d6c19a12bd9bb56bf081a3 easyhg_v0.3.2
--- a/changesetitem.cpp Mon Feb 21 15:55:39 2011 +0000 +++ b/changesetitem.cpp Mon Feb 21 18:17:18 2011 +0000 @@ -16,6 +16,7 @@ */ #include "changesetitem.h" +#include "changesetscene.h" #include "changesetdetailitem.h" #include "changeset.h" #include "textabbrev.h" @@ -107,6 +108,7 @@ ChangesetItem::activateMenu() { m_parentDiffActions.clear(); + m_summaryActions.clear(); QMenu *menu = new QMenu; QLabel *label = new QLabel(tr("<qt><b> Revision: </b>%1</qt>") @@ -119,25 +121,59 @@ QAction *copyId = menu->addAction(tr("Copy identifier to clipboard")); connect(copyId, SIGNAL(triggered()), this, SLOT(copyIdActivated())); + QAction *stat = menu->addAction(tr("Summarise changes")); + connect(stat, SIGNAL(triggered()), this, SLOT(showSummaryActivated())); + menu->addSeparator(); - if (m_changeset->parents().size() > 1) { + QStringList parents = m_changeset->parents(); - foreach (QString parentId, m_changeset->parents()) { - QAction *diffParent = - menu->addAction(tr("Diff to parent %1") - .arg(Changeset::hashOf(parentId))); - connect(diffParent, SIGNAL(triggered()), - this, SLOT(diffToParentActivated())); - m_parentDiffActions[diffParent] = parentId; + QString leftId, rightId; + bool havePositions = false; + + if (parents.size() > 1) { + ChangesetScene *cs = dynamic_cast<ChangesetScene *>(scene()); + if (cs && parents.size() == 2) { + ChangesetItem *i0 = cs->getItemById(parents[0]); + ChangesetItem *i1 = cs->getItemById(parents[1]); + if (i0 && i1) { + if (i0->x() < i1->x()) { + leftId = parents[0]; + rightId = parents[1]; + } else { + leftId = parents[1]; + rightId = parents[0]; + } + havePositions = true; + } + } + } + + if (parents.size() > 1) { + if (havePositions) { + + QAction *diff = menu->addAction(tr("Diff to left parent")); + connect(diff, SIGNAL(triggered()), this, SLOT(diffToParentActivated())); + m_parentDiffActions[diff] = leftId; + + diff = menu->addAction(tr("Diff to right parent")); + connect(diff, SIGNAL(triggered()), this, SLOT(diffToParentActivated())); + m_parentDiffActions[diff] = rightId; + + } else { + + foreach (QString parentId, parents) { + QString text = tr("Diff to parent %1").arg(Changeset::hashOf(parentId)); + QAction *diff = menu->addAction(text); + connect(diff, SIGNAL(triggered()), this, SLOT(diffToParentActivated())); + m_parentDiffActions[diff] = parentId; + } } } else { - QAction *diffParent = - menu->addAction(tr("Diff to parent")); - connect(diffParent, SIGNAL(triggered()), - this, SLOT(diffToParentActivated())); + QAction *diff = menu->addAction(tr("Diff to parent")); + connect(diff, SIGNAL(triggered()), this, SLOT(diffToParentActivated())); } QAction *diffCurrent = menu->addAction(tr("Diff to current working folder")); @@ -186,14 +222,18 @@ emit diffToParent(getId(), parentId); } +void ChangesetItem::showSummaryActivated() +{ + emit showSummary(m_changeset); +} + void ChangesetItem::updateActivated() { emit updateTo(getId()); } void ChangesetItem::diffToCurrentActivated() { emit diffToCurrent(getId()); } void ChangesetItem::mergeActivated() { emit mergeFrom(getId()); } void ChangesetItem::tagActivated() { emit tag(getId()); } void -ChangesetItem::paint(QPainter *paint, const QStyleOptionGraphicsItem *option, - QWidget *w) +ChangesetItem::paint(QPainter *paint, const QStyleOptionGraphicsItem *, QWidget *) { paint->save();
--- a/changesetitem.h Mon Feb 21 15:55:39 2011 +0000 +++ b/changesetitem.h Mon Feb 21 18:17:18 2011 +0000 @@ -63,6 +63,7 @@ void updateTo(QString); void diffToCurrent(QString); void diffToParent(QString child, QString parent); + void showSummary(Changeset *); void mergeFrom(QString); void tag(QString); @@ -74,6 +75,7 @@ void copyIdActivated(); void updateActivated(); void diffToParentActivated(); + void showSummaryActivated(); void diffToCurrentActivated(); void mergeActivated(); void tagActivated(); @@ -95,6 +97,7 @@ bool m_new; QMap<QAction *, QString> m_parentDiffActions; + QMap<QAction *, QString> m_summaryActions; }; #endif // CHANGESETITEM_H
--- a/changesetscene.cpp Mon Feb 21 15:55:39 2011 +0000 +++ b/changesetscene.cpp Mon Feb 21 18:17:18 2011 +0000 @@ -45,6 +45,9 @@ connect(item, SIGNAL(diffToParent(QString, QString)), this, SIGNAL(diffToParent(QString, QString))); + connect(item, SIGNAL(showSummary(Changeset *)), + this, SIGNAL(showSummary(Changeset *))); + connect(item, SIGNAL(mergeFrom(QString)), this, SIGNAL(mergeFrom(QString))); @@ -108,3 +111,14 @@ } } +ChangesetItem * +ChangesetScene::getItemById(QString id) +{ + foreach (QGraphicsItem *it, items()) { + ChangesetItem *csit = dynamic_cast<ChangesetItem *>(it); + if (csit && csit->getId() == id) return csit; + } + return 0; +} + +
--- a/changesetscene.h Mon Feb 21 15:55:39 2011 +0000 +++ b/changesetscene.h Mon Feb 21 18:17:18 2011 +0000 @@ -21,6 +21,7 @@ #include <QGraphicsScene> class ChangesetItem; +class Changeset; class UncommittedItem; class DateItem; @@ -35,6 +36,8 @@ void addUncommittedItem(UncommittedItem *item); void addDateItem(DateItem *item); + ChangesetItem *getItemById(QString id); // Slow: traversal required + signals: void commit(); void revert(); @@ -44,6 +47,7 @@ void updateTo(QString id); void diffToParent(QString id, QString parent); + void showSummary(Changeset *); void diffToCurrent(QString id); void mergeFrom(QString id); void tag(QString id);
--- a/easyhg-extdiff.sh Mon Feb 21 15:55:39 2011 +0000 +++ b/easyhg-extdiff.sh Mon Feb 21 18:17:18 2011 +0000 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x p=`dirname $0` if [ $# -lt 2 ]; then echo Insufficient arguments: $@ @@ -13,11 +13,18 @@ found=true "$p/$d" "$1" "$2" break + elif [ -x "$(type -path $d)" ]; then + found=true + "$d" "$1" "$2" + break; fi done if [ -z "$found" ]; then od=/usr/bin/opendiff if [ -x "$od" ]; then + found=true "$od" "$1" "$2" | cat fi fi +[ -n "$found" ] +
--- a/easyhg-merge.sh Mon Feb 21 15:55:39 2011 +0000 +++ b/easyhg-merge.sh Mon Feb 21 18:17:18 2011 +0000 @@ -18,11 +18,17 @@ found=true "$p/$d" "$ancestor" "$left" "$right" -o "$out" break + elif [ -x "$(type -path $d)" ]; then + found=true + "$d" "$ancestor" "$left" "$right" -o "$out" + break; fi done if [ -z "$found" ]; then fm=/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge if [ -x "$fm" ]; then + found=true "$fm" -left "$left" -merge "$out" -ancestor "$ancestor" -right "$right" fi fi +[ -n "$found" ]
--- a/hgaction.h Mon Feb 21 15:55:39 2011 +0000 +++ b/hgaction.h Mon Feb 21 18:17:18 2011 +0000 @@ -43,6 +43,7 @@ ACT_INIT, ACT_COMMIT, ACT_ANNOTATE, + ACT_UNCOMMITTED_SUMMARY, ACT_DIFF_SUMMARY, ACT_FOLDERDIFF, ACT_CHGSETDIFF, @@ -62,15 +63,20 @@ QString workingDir; QStringList params; QString executable; // empty for normal Hg, but gets filled in by hgrunner + void *extraData; HgAction() : action(ACT_NONE) { } HgAction(HGACTIONS _action, QString _wd, QStringList _params) : - action(_action), workingDir(_wd), params(_params) { } + action(_action), workingDir(_wd), params(_params), extraData(0) { } + + HgAction(HGACTIONS _action, QString _wd, QStringList _params, void *_d) : + action(_action), workingDir(_wd), params(_params), extraData(_d) { } bool operator==(const HgAction &a) { return (a.action == action && a.workingDir == workingDir && - a.params == params && a.executable == executable); + a.params == params && a.executable == executable && + a.extraData == extraData); } bool shouldBeFast() const {
--- a/hgtabwidget.cpp Mon Feb 21 15:55:39 2011 +0000 +++ b/hgtabwidget.cpp Mon Feb 21 18:17:18 2011 +0000 @@ -69,6 +69,9 @@ connect(m_historyWidget, SIGNAL(diffToParent(QString, QString)), this, SIGNAL(diffToParent(QString, QString))); + connect(m_historyWidget, SIGNAL(showSummary(Changeset *)), + this, SIGNAL(showSummary(Changeset *))); + connect(m_historyWidget, SIGNAL(mergeFrom(QString)), this, SIGNAL(mergeFrom(QString)));
--- a/hgtabwidget.h Mon Feb 21 15:55:39 2011 +0000 +++ b/hgtabwidget.h Mon Feb 21 18:17:18 2011 +0000 @@ -91,6 +91,7 @@ void updateTo(QString id); void diffToParent(QString id, QString parent); + void showSummary(Changeset *); void diffToCurrent(QString id); void mergeFrom(QString id); void tag(QString id);
--- a/historywidget.cpp Mon Feb 21 15:55:39 2011 +0000 +++ b/historywidget.cpp Mon Feb 21 18:17:18 2011 +0000 @@ -277,6 +277,9 @@ connect(scene, SIGNAL(diffToParent(QString, QString)), this, SIGNAL(diffToParent(QString, QString))); + connect(scene, SIGNAL(showSummary(Changeset *)), + this, SIGNAL(showSummary(Changeset *))); + connect(scene, SIGNAL(mergeFrom(QString)), this, SIGNAL(mergeFrom(QString)));
--- a/historywidget.h Mon Feb 21 15:55:39 2011 +0000 +++ b/historywidget.h Mon Feb 21 18:17:18 2011 +0000 @@ -54,6 +54,7 @@ void updateTo(QString id); void diffToParent(QString id, QString parent); + void showSummary(Changeset *); void diffToCurrent(QString id); void mergeFrom(QString id); void tag(QString id);
--- a/mainwindow.cpp Mon Feb 21 15:55:39 2011 +0000 +++ b/mainwindow.cpp Mon Feb 21 18:17:18 2011 +0000 @@ -57,39 +57,39 @@ QString wndTitle; - showAllFiles = false; - - fsWatcher = 0; - commitsSincePush = 0; - shouldHgStat = true; + m_showAllFiles = false; + + m_fsWatcher = 0; + m_commitsSincePush = 0; + m_shouldHgStat = true; createActions(); createMenus(); createToolBars(); createStatusBar(); - runner = new HgRunner(myDirPath, this); - connect(runner, SIGNAL(commandStarting(HgAction)), + m_runner = new HgRunner(m_myDirPath, this); + connect(m_runner, SIGNAL(commandStarting(HgAction)), this, SLOT(commandStarting(HgAction))); - connect(runner, SIGNAL(commandCompleted(HgAction, QString)), + connect(m_runner, SIGNAL(commandCompleted(HgAction, QString)), this, SLOT(commandCompleted(HgAction, QString))); - connect(runner, SIGNAL(commandFailed(HgAction, QString)), + connect(m_runner, SIGNAL(commandFailed(HgAction, QString)), this, SLOT(commandFailed(HgAction, QString))); - statusBar()->addPermanentWidget(runner); + statusBar()->addPermanentWidget(m_runner); setWindowTitle(tr("EasyMercurial")); - remoteRepoPath = ""; - workFolderPath = ""; + m_remoteRepoPath = ""; + m_workFolderPath = ""; readSettings(); - justMerged = false; + m_justMerged = false; QWidget *central = new QWidget(this); setCentralWidget(central); - hgTabs = new HgTabWidget(central, remoteRepoPath, workFolderPath); + m_hgTabs = new HgTabWidget(central, m_remoteRepoPath, m_workFolderPath); connectTabsSignals(); // Instead of setting the tab widget as our central widget @@ -97,15 +97,15 @@ // around it on the Mac where it looks very strange without QGridLayout *cl = new QGridLayout(central); - cl->addWidget(hgTabs, 0, 0); + cl->addWidget(m_hgTabs, 0, 0); #ifndef Q_OS_MAC cl->setMargin(0); #endif - connect(hgTabs, SIGNAL(selectionChanged()), + connect(m_hgTabs, SIGNAL(selectionChanged()), this, SLOT(enableDisableActions())); - connect(hgTabs, SIGNAL(showAllChanged(bool)), + connect(m_hgTabs, SIGNAL(showAllChanged(bool)), this, SLOT(showAllChanged(bool))); setUnifiedTitleAndToolBarOnMac(true); @@ -113,7 +113,7 @@ clearState(); enableDisableActions(); - if (firstStart) { + if (m_firstStart) { startupDialog(); } @@ -132,7 +132,7 @@ void MainWindow::closeEvent(QCloseEvent *) { writeSettings(); - delete fsWatcher; + delete m_fsWatcher; } @@ -196,12 +196,12 @@ void MainWindow::clearSelections() { - hgTabs->clearSelections(); + m_hgTabs->clearSelections(); } void MainWindow::showAllChanged(bool s) { - showAllFiles = s; + m_showAllFiles = s; hgQueryPaths(); } @@ -217,36 +217,36 @@ //!!! should we test version output? Really we want at least 1.7.x //!!! for options such as merge --tool params << "--version"; - runner->requestAction(HgAction(ACT_TEST_HG, m_myDirPath, params)); + m_runner->requestAction(HgAction(ACT_TEST_HG, m_myDirPath, params)); } void MainWindow::hgTestExtension() { QStringList params; params << "--version"; - runner->requestAction(HgAction(ACT_TEST_HG_EXT, m_myDirPath, params)); + m_runner->requestAction(HgAction(ACT_TEST_HG_EXT, m_myDirPath, params)); } void MainWindow::hgStat() { QStringList params; - if (showAllFiles) { + if (m_showAllFiles) { params << "stat" << "-A"; } else { params << "stat" << "-ardum"; } - lastStatOutput = ""; - - runner->requestAction(HgAction(ACT_STAT, workFolderPath, params)); + m_lastStatOutput = ""; + + m_runner->requestAction(HgAction(ACT_STAT, m_workFolderPath, params)); } void MainWindow::hgQueryPaths() { // Quickest is to just read the file - QFileInfo hgrc(workFolderPath + "/.hg/hgrc"); + QFileInfo hgrc(m_workFolderPath + "/.hg/hgrc"); QString path; @@ -256,12 +256,12 @@ path = s.value("default").toString(); } - remoteRepoPath = path; + m_remoteRepoPath = path; // We have to do this here, because commandCompleted won't be called - MultiChoiceDialog::addRecentArgument("local", workFolderPath); - MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); - hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); + MultiChoiceDialog::addRecentArgument("local", m_workFolderPath); + MultiChoiceDialog::addRecentArgument("remote", m_remoteRepoPath); + m_hgTabs->setWorkFolderAndRepoNames(m_workFolderPath, m_remoteRepoPath); hgQueryBranch(); return; @@ -270,7 +270,7 @@ QStringList params; params << "paths"; - runner->requestAction(HgAction(ACT_QUERY_PATHS, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_QUERY_PATHS, m_workFolderPath, params)); */ } @@ -278,7 +278,7 @@ { // Quickest is to just read the file - QFile hgbr(workFolderPath + "/.hg/branch"); + QFile hgbr(m_workFolderPath + "/.hg/branch"); QString br = "default"; @@ -287,7 +287,7 @@ br = QString::fromUtf8(ba).trimmed(); } - currentBranch = br; + m_currentBranch = br; // We have to do this here, because commandCompleted won't be called hgStat(); @@ -297,7 +297,7 @@ QStringList params; params << "branch"; - runner->requestAction(HgAction(ACT_QUERY_BRANCH, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_QUERY_BRANCH, m_workFolderPath, params)); */ } @@ -310,7 +310,7 @@ // incremental log will end up with spurious stuff in it because // we won't be pruning at the ends of closed branches params << "heads" << "--closed"; - runner->requestAction(HgAction(ACT_QUERY_HEADS, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_QUERY_HEADS, m_workFolderPath, params)); } void MainWindow::hgLog() @@ -320,7 +320,7 @@ params << "--template"; params << Changeset::getLogTemplate(); - runner->requestAction(HgAction(ACT_LOG, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_LOG, m_workFolderPath, params)); } void MainWindow::hgLogIncremental(QStringList prune) @@ -335,26 +335,26 @@ params << "--template"; params << Changeset::getLogTemplate(); - runner->requestAction(HgAction(ACT_LOG_INCREMENTAL, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_LOG_INCREMENTAL, m_workFolderPath, params)); } void MainWindow::hgQueryParents() { QStringList params; params << "parents"; - runner->requestAction(HgAction(ACT_QUERY_PARENTS, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_QUERY_PARENTS, m_workFolderPath, params)); } void MainWindow::hgAnnotate() { QStringList params; - QString currentFile;//!!! = hgTabs -> getCurrentFileListLine(); + QString currentFile;//!!! = m_hgTabs -> getCurrentFileListLine(); if (!currentFile.isEmpty()) { params << "annotate" << "--" << currentFile.mid(2); //Jump over status marker characters (e.g "M ") - runner->requestAction(HgAction(ACT_ANNOTATE, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_ANNOTATE, m_workFolderPath, params)); } } @@ -363,7 +363,7 @@ QStringList params; params << "resolve" << "--list"; - runner->requestAction(HgAction(ACT_RESOLVE_LIST, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_RESOLVE_LIST, m_workFolderPath, params)); } void MainWindow::hgAdd() @@ -373,11 +373,11 @@ // hgExplorer permitted adding "all" files -- I'm not sure // that one is a good idea, let's require the user to select - QStringList files = hgTabs->getSelectedAddableFiles(); + QStringList files = m_hgTabs->getSelectedAddableFiles(); if (!files.empty()) { params << "add" << "--" << files; - runner->requestAction(HgAction(ACT_ADD, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_ADD, m_workFolderPath, params)); } } @@ -386,11 +386,11 @@ { QStringList params; - QStringList files = hgTabs->getSelectedRemovableFiles(); + QStringList files = m_hgTabs->getSelectedRemovableFiles(); if (!files.empty()) { params << "remove" << "--after" << "--force" << "--" << files; - runner->requestAction(HgAction(ACT_REMOVE, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_REMOVE, m_workFolderPath, params)); } } @@ -399,12 +399,12 @@ QStringList params; QString comment; - if (justMerged) { - comment = mergeCommitComment; + if (m_justMerged) { + comment = m_mergeCommitComment; } - QStringList files = hgTabs->getSelectedCommittableFiles(); - QStringList allFiles = hgTabs->getAllCommittableFiles(); + QStringList files = m_hgTabs->getSelectedCommittableFiles(); + QStringList allFiles = m_hgTabs->getAllCommittableFiles(); QStringList reportFiles = files; if (reportFiles.empty()) { reportFiles = allFiles; @@ -430,7 +430,7 @@ comment, tr("Commit"))) { - if (!justMerged && !files.empty()) { + if (!m_justMerged && !files.empty()) { // User wants to commit selected file(s) (and this is not // merge commit, which would fail if we selected files) params << "commit" << "--message" << comment @@ -441,8 +441,8 @@ << "--user" << getUserInfo(); } - runner->requestAction(HgAction(ACT_COMMIT, workFolderPath, params)); - mergeCommitComment = ""; + m_runner->requestAction(HgAction(ACT_COMMIT, m_workFolderPath, params)); + m_mergeCommitComment = ""; } } @@ -479,7 +479,7 @@ params << "tag" << "--user" << getUserInfo(); params << "--rev" << Changeset::hashOf(id) << filterTag(tag); - runner->requestAction(HgAction(ACT_TAG, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_TAG, m_workFolderPath, params)); } } } @@ -490,10 +490,10 @@ QString hgIgnorePath; QStringList params; - hgIgnorePath = workFolderPath; + hgIgnorePath = m_workFolderPath; hgIgnorePath += "/.hgignore"; - if (!QDir(workFolderPath).exists()) return; + if (!QDir(m_workFolderPath).exists()) return; QFile f(hgIgnorePath); if (!f.exists()) { f.open(QFile::WriteOnly); @@ -513,10 +513,10 @@ return; } - HgAction action(ACT_HG_IGNORE, workFolderPath, params); + HgAction action(ACT_HG_IGNORE, m_workFolderPath, params); action.executable = editor; - runner->requestAction(action); + m_runner->requestAction(action); } QString MainWindow::getDiffBinaryName() @@ -546,7 +546,7 @@ params << "diff" << "--stat"; - runner->requestAction(HgAction(ACT_DIFF_SUMMARY, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_UNCOMMITTED_SUMMARY, m_workFolderPath, params)); } void MainWindow::hgFolderDiff() @@ -561,9 +561,9 @@ params << "--config" << "extensions.extdiff=" << "extdiff"; params << "--program" << diff; - params << hgTabs->getSelectedCommittableFiles(); // may be none: whole dir - - runner->requestAction(HgAction(ACT_FOLDERDIFF, workFolderPath, params)); + params << m_hgTabs->getSelectedCommittableFiles(); // may be none: whole dir + + m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, params)); } @@ -580,7 +580,7 @@ params << "--program" << diff; params << "--rev" << Changeset::hashOf(id); - runner->requestAction(HgAction(ACT_FOLDERDIFF, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_FOLDERDIFF, m_workFolderPath, params)); } @@ -591,14 +591,28 @@ QStringList params; - // Diff given revision against working folder + // Diff given revision against parent revision params << "--config" << "extensions.extdiff=" << "extdiff"; params << "--program" << diff; params << "--rev" << Changeset::hashOf(parent) << "--rev" << Changeset::hashOf(child); - runner->requestAction(HgAction(ACT_CHGSETDIFF, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_CHGSETDIFF, m_workFolderPath, params)); +} + + +void MainWindow::hgShowSummaryFor(Changeset *cs) +{ + QStringList params; + + // This will pick a default parent if there is more than one + // (whereas with diff we need to supply one). But it does need a + // bit more parsing + params << "log" << "--stat" << "--rev" << Changeset::hashOf(cs->id()); + + m_runner->requestAction(HgAction(ACT_DIFF_SUMMARY, m_workFolderPath, + params, cs)); } @@ -608,7 +622,7 @@ params << "update"; - runner->requestAction(HgAction(ACT_UPDATE, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_UPDATE, m_workFolderPath, params)); } @@ -618,7 +632,7 @@ params << "update" << "--rev" << Changeset::hashOf(id) << "--check"; - runner->requestAction(HgAction(ACT_UPDATE, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_UPDATE, m_workFolderPath, params)); } @@ -628,8 +642,8 @@ QString comment; bool all = false; - QStringList files = hgTabs->getSelectedRevertableFiles(); - QStringList allFiles = hgTabs->getAllRevertableFiles(); + QStringList files = m_hgTabs->getSelectedRevertableFiles(); + QStringList allFiles = m_hgTabs->getAllRevertableFiles(); if (files.empty() || files == allFiles) { files = allFiles; all = true; @@ -645,9 +659,9 @@ // Set up params before asking for confirmation, because there is // a failure case here that we would need to report on early - DEBUG << "hgRevert: justMerged = " << justMerged << ", mergeTargetRevision = " << mergeTargetRevision << endl; - - if (justMerged) { + DEBUG << "hgRevert: m_justMerged = " << m_justMerged << ", m_mergeTargetRevision = " << m_mergeTargetRevision << endl; + + if (m_justMerged) { // This is a little fiddly. The proper way to "revert" the // whole of an uncommitted merge is with "hg update --clean ." @@ -661,9 +675,9 @@ if (all) { params << "update" << "--clean" << "."; } else { - if (mergeTargetRevision != "") { + if (m_mergeTargetRevision != "") { params << "revert" << "--rev" - << Changeset::hashOf(mergeTargetRevision) + << Changeset::hashOf(m_mergeTargetRevision) << "--" << files; } else { QMessageBox::information @@ -688,9 +702,9 @@ files, tr("Revert"))) { - lastRevertedFiles = files; + m_lastRevertedFiles = files; - runner->requestAction(HgAction(ACT_REVERT, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_REVERT, m_workFolderPath, params)); } } @@ -707,7 +721,7 @@ params << "--" << files; } - runner->requestAction(HgAction(ACT_RESOLVE_MARK, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_RESOLVE_MARK, m_workFolderPath, params)); } @@ -722,26 +736,26 @@ params << "--tool" << merge; } - QStringList files = hgTabs->getSelectedUnresolvedFiles(); + QStringList files = m_hgTabs->getSelectedUnresolvedFiles(); if (files.empty()) { params << "--all"; } else { params << "--" << files; } - if (currentParents.size() == 1) { - mergeTargetRevision = currentParents[0]->id(); + if (m_currentParents.size() == 1) { + m_mergeTargetRevision = m_currentParents[0]->id(); } - runner->requestAction(HgAction(ACT_RETRY_MERGE, workFolderPath, params)); - - mergeCommitComment = tr("Merge"); + m_runner->requestAction(HgAction(ACT_RETRY_MERGE, m_workFolderPath, params)); + + m_mergeCommitComment = tr("Merge"); } void MainWindow::hgMerge() { - if (hgTabs->canResolve()) { + if (m_hgTabs->canResolve()) { hgRetryMerge(); return; } @@ -755,13 +769,13 @@ params << "--tool" << merge; } - if (currentParents.size() == 1) { - mergeTargetRevision = currentParents[0]->id(); + if (m_currentParents.size() == 1) { + m_mergeTargetRevision = m_currentParents[0]->id(); } - runner->requestAction(HgAction(ACT_MERGE, workFolderPath, params)); - - mergeCommitComment = tr("Merge"); + m_runner->requestAction(HgAction(ACT_MERGE, m_workFolderPath, params)); + + m_mergeCommitComment = tr("Merge"); } @@ -777,26 +791,26 @@ params << "--tool" << merge; } - if (currentParents.size() == 1) { - mergeTargetRevision = currentParents[0]->id(); + if (m_currentParents.size() == 1) { + m_mergeTargetRevision = m_currentParents[0]->id(); } - runner->requestAction(HgAction(ACT_MERGE, workFolderPath, params)); - - mergeCommitComment = ""; - - foreach (Changeset *cs, currentHeads) { - if (cs->id() == id && !cs->isOnBranch(currentBranch)) { + m_runner->requestAction(HgAction(ACT_MERGE, m_workFolderPath, params)); + + m_mergeCommitComment = ""; + + foreach (Changeset *cs, m_currentHeads) { + if (cs->id() == id && !cs->isOnBranch(m_currentBranch)) { if (cs->branch() == "" || cs->branch() == "default") { - mergeCommitComment = tr("Merge from the default branch"); + m_mergeCommitComment = tr("Merge from the default branch"); } else { - mergeCommitComment = tr("Merge from branch \"%1\"").arg(cs->branch()); + m_mergeCommitComment = tr("Merge from branch \"%1\"").arg(cs->branch()); } } } - if (mergeCommitComment == "") { - mergeCommitComment = tr("Merge from %1").arg(id); + if (m_mergeCommitComment == "") { + m_mergeCommitComment = tr("Merge from %1").arg(id); } } @@ -805,21 +819,21 @@ { QStringList params; - if (!QDir(workFolderPath).exists()) { - if (!QDir().mkpath(workFolderPath)) { + if (!QDir(m_workFolderPath).exists()) { + if (!QDir().mkpath(m_workFolderPath)) { DEBUG << "hgCloneFromRemote: Failed to create target path " - << workFolderPath << endl; + << m_workFolderPath << endl; //!!! report error return; } } - params << "clone" << remoteRepoPath << workFolderPath; + params << "clone" << m_remoteRepoPath << m_workFolderPath; - hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); - hgTabs->updateWorkFolderFileList(""); - - runner->requestAction(HgAction(ACT_CLONEFROMREMOTE, workFolderPath, params)); + m_hgTabs->setWorkFolderAndRepoNames(m_workFolderPath, m_remoteRepoPath); + m_hgTabs->updateWorkFolderFileList(""); + + m_runner->requestAction(HgAction(ACT_CLONEFROMREMOTE, m_workFolderPath, params)); } void MainWindow::hgInit() @@ -827,19 +841,19 @@ QStringList params; params << "init"; - params << workFolderPath; - - runner->requestAction(HgAction(ACT_INIT, workFolderPath, params)); + params << m_workFolderPath; + + m_runner->requestAction(HgAction(ACT_INIT, m_workFolderPath, params)); } void MainWindow::hgIncoming() { QStringList params; - params << "incoming" << "--newest-first" << remoteRepoPath; + params << "incoming" << "--newest-first" << m_remoteRepoPath; params << "--template" << Changeset::getLogTemplate(); - runner->requestAction(HgAction(ACT_INCOMING, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_INCOMING, m_workFolderPath, params)); } void MainWindow::hgPull() @@ -848,12 +862,12 @@ (this, tr("Confirm pull"), format3(tr("Pull from remote repository?"), tr("You are about to pull changes from the following remote repository:"), - remoteRepoPath), + m_remoteRepoPath), tr("Pull"))) { QStringList params; - params << "pull" << remoteRepoPath; - runner->requestAction(HgAction(ACT_PULL, workFolderPath, params)); + params << "pull" << m_remoteRepoPath; + m_runner->requestAction(HgAction(ACT_PULL, m_workFolderPath, params)); } } @@ -863,12 +877,12 @@ (this, tr("Confirm push"), format3(tr("Push to remote repository?"), tr("You are about to push your changes to the following remote repository:"), - remoteRepoPath), + m_remoteRepoPath), tr("Push"))) { QStringList params; - params << "push" << "--new-branch" << remoteRepoPath; - runner->requestAction(HgAction(ACT_PUSH, workFolderPath, params)); + params << "push" << "--new-branch" << m_remoteRepoPath; + m_runner->requestAction(HgAction(ACT_PUSH, m_workFolderPath, params)); } } @@ -894,24 +908,24 @@ void MainWindow::clearState() { - foreach (Changeset *cs, currentParents) delete cs; - currentParents.clear(); - foreach (Changeset *cs, currentHeads) delete cs; - currentHeads.clear(); - currentBranch = ""; - lastStatOutput = ""; - lastRevertedFiles.clear(); - mergeTargetRevision = ""; - mergeCommitComment = ""; - stateUnknown = true; - needNewLog = true; - if (fsWatcher) { + foreach (Changeset *cs, m_currentParents) delete cs; + m_currentParents.clear(); + foreach (Changeset *cs, m_currentHeads) delete cs; + m_currentHeads.clear(); + m_currentBranch = ""; + m_lastStatOutput = ""; + m_lastRevertedFiles.clear(); + m_mergeTargetRevision = ""; + m_mergeCommitComment = ""; + m_stateUnknown = true; + m_needNewLog = true; + if (m_fsWatcher) { delete m_fsWatcherGeneralTimer; m_fsWatcherGeneralTimer = 0; delete m_fsWatcherRestoreTimer; m_fsWatcherRestoreTimer = 0; - delete fsWatcher; - fsWatcher = 0; + delete m_fsWatcher; + m_fsWatcher = 0; } } @@ -941,17 +955,17 @@ params << "serve"; - runner->requestAction(HgAction(ACT_SERVE, workFolderPath, params)); + m_runner->requestAction(HgAction(ACT_SERVE, m_workFolderPath, params)); QMessageBox::information(this, tr("Serve"), msg, QMessageBox::Close); - runner->killCurrentActions(); + m_runner->killCurrentActions(); } void MainWindow::startupDialog() { StartupDialog *dlg = new StartupDialog(this); - if (dlg->exec()) firstStart = false; + if (dlg->exec()) m_firstStart = false; } void MainWindow::open() @@ -1029,13 +1043,13 @@ { // This will involve rewriting the local .hgrc - QDir hgDir(workFolderPath + "/.hg"); + QDir hgDir(m_workFolderPath + "/.hg"); if (!hgDir.exists()) { //!!! visible error! return; } - QFileInfo hgrc(workFolderPath + "/.hg/hgrc"); + QFileInfo hgrc(m_workFolderPath + "/.hg/hgrc"); if (hgrc.exists() && !hgrc.isWritable()) { //!!! visible error! return; @@ -1064,7 +1078,7 @@ s.setValue("default", d->getArgument()); } - stateUnknown = true; + m_stateUnknown = true; hgQueryPaths(); } @@ -1282,8 +1296,8 @@ return complainAboutFilePath(local); } - workFolderPath = local; - remoteRepoPath = ""; + m_workFolderPath = local; + m_remoteRepoPath = ""; return true; } @@ -1315,8 +1329,8 @@ if (local == "") return false; } - workFolderPath = local; - remoteRepoPath = remote; + m_workFolderPath = local; + m_remoteRepoPath = remote; hgCloneFromRemote(); return true; @@ -1347,8 +1361,8 @@ return complainAboutUnknownFolder(local); } - workFolderPath = local; - remoteRepoPath = ""; + m_workFolderPath = local; + m_remoteRepoPath = ""; hgInit(); return true; } @@ -1359,7 +1373,7 @@ settingsDlg->exec(); if (settingsDlg->presentationChanged()) { - hgTabs->updateFileStates(); + m_hgTabs->updateFileStates(); updateToolBarStyle(); hgRefresh(); } @@ -1411,8 +1425,8 @@ void MainWindow::updateFileSystemWatcher() { bool justCreated = false; - if (!fsWatcher) { - fsWatcher = new QFileSystemWatcher(); + if (!m_fsWatcher) { + m_fsWatcher = new QFileSystemWatcher(); justCreated = true; } @@ -1422,18 +1436,18 @@ // annoying because it would be the normal case for us. So we'll // check for duplicates ourselves. QSet<QString> alreadyWatched; - QStringList dl(fsWatcher->directories()); + QStringList dl(m_fsWatcher->directories()); foreach (QString d, dl) alreadyWatched.insert(d); std::deque<QString> pending; - pending.push_back(workFolderPath); + pending.push_back(m_workFolderPath); while (!pending.empty()) { QString path = pending.front(); pending.pop_front(); if (!alreadyWatched.contains(path)) { - fsWatcher->addPath(path); + m_fsWatcher->addPath(path); DEBUG << "Added to file system watcher: " << path << endl; } @@ -1460,9 +1474,9 @@ m_fsWatcherGeneralTimer->start(); if (justCreated) { - connect(fsWatcher, SIGNAL(directoryChanged(QString)), + connect(m_fsWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(fsDirectoryChanged(QString))); - connect(fsWatcher, SIGNAL(fileChanged(QString)), + connect(m_fsWatcher, SIGNAL(fileChanged(QString)), this, SLOT(fsFileChanged(QString))); } } @@ -1470,7 +1484,7 @@ void MainWindow::suspendFileSystemWatcher() { DEBUG << "MainWindow::suspendFileSystemWatcher" << endl; - if (fsWatcher) { + if (m_fsWatcher) { m_fsWatcherSuspended = true; if (m_fsWatcherRestoreTimer) { delete m_fsWatcherRestoreTimer; @@ -1502,7 +1516,7 @@ void MainWindow::actuallyRestoreFileSystemWatcher() { DEBUG << "MainWindow::actuallyRestoreFileSystemWatcher" << endl; - if (fsWatcher) { + if (m_fsWatcher) { m_fsWatcherSuspended = false; m_fsWatcherGeneralTimer->start(); } @@ -1557,7 +1571,7 @@ void MainWindow::showIncoming(QString output) { - runner->hide(); + m_runner->hide(); IncomingDialog *d = new IncomingDialog(this, output); d->exec(); delete d; @@ -1591,7 +1605,7 @@ } else { head = tr("Push complete"); } - runner->hide(); + m_runner->hide(); MoreInformationDialog::information(this, tr("Push complete"), head, report, output); @@ -1611,6 +1625,7 @@ } else { head = tr("Pull complete"); } + m_runner->hide(); runner->hide(); @@ -1622,19 +1637,19 @@ { bool headsAreLocal = false; - if (currentParents.size() == 1) { - int currentBranchHeads = 0; + if (m_currentParents.size() == 1) { + int m_currentBranchHeads = 0; bool parentIsHead = false; - Changeset *parent = currentParents[0]; - foreach (Changeset *head, currentHeads) { - if (head->isOnBranch(currentBranch)) { - ++currentBranchHeads; + Changeset *parent = m_currentParents[0]; + foreach (Changeset *head, m_currentHeads) { + if (head->isOnBranch(m_currentBranch)) { + ++m_currentBranchHeads; } if (parent->id() == head->id()) { parentIsHead = true; } } - if (currentBranchHeads == 2 && parentIsHead) { + if (m_currentBranchHeads == 2 && parentIsHead) { headsAreLocal = true; } } @@ -1707,13 +1722,13 @@ return; case ACT_CLONEFROMREMOTE: // if clone fails, we have no repo - workFolderPath = ""; + m_workFolderPath = ""; enableDisableActions(); break; case ACT_INCOMING: // returns non-zero code and no output if the check was // successful but there are no changes pending - if (output.trimmed() == "") { + if (output.replace(QRegExp("(^|\\n)warning: [^\\n]*\\n"), "").trimmed() == "") { showIncoming(""); return; } @@ -1789,23 +1804,23 @@ LogList ll = lp.parse(); DEBUG << ll.size() << " results" << endl; if (!ll.empty()) { - remoteRepoPath = lp.parse()[0]["default"].trimmed(); - DEBUG << "Set remote path to " << remoteRepoPath << endl; + m_remoteRepoPath = lp.parse()[0]["default"].trimmed(); + DEBUG << "Set remote path to " << m_remoteRepoPath << endl; } else { - remoteRepoPath = ""; + m_remoteRepoPath = ""; } - MultiChoiceDialog::addRecentArgument("local", workFolderPath); - MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); - hgTabs->setWorkFolderAndRepoNames(workFolderPath, remoteRepoPath); + MultiChoiceDialog::addRecentArgument("local", m_workFolderPath); + MultiChoiceDialog::addRecentArgument("remote", m_remoteRepoPath); + m_hgTabs->setWorkFolderAndRepoNames(m_workFolderPath, m_remoteRepoPath); break; } case ACT_QUERY_BRANCH: - currentBranch = output.trimmed(); + m_currentBranch = output.trimmed(); break; case ACT_STAT: - lastStatOutput = output; + m_lastStatOutput = output; updateFileSystemWatcher(); break; @@ -1820,13 +1835,13 @@ } output = winnowed.join("\n"); } - DEBUG << "lastStatOutput = " << lastStatOutput << endl; + DEBUG << "m_lastStatOutput = " << m_lastStatOutput << endl; DEBUG << "resolve output = " << output << endl; - hgTabs->updateWorkFolderFileList(lastStatOutput + output); + m_hgTabs->updateWorkFolderFileList(m_lastStatOutput + output); break; case ACT_RESOLVE_MARK: - shouldHgStat = true; + m_shouldHgStat = true; break; case ACT_INCOMING: @@ -1835,12 +1850,12 @@ case ACT_ANNOTATE: presentLongStdoutToUser(output); - shouldHgStat = true; + m_shouldHgStat = true; break; case ACT_PULL: showPullResult(output); - shouldHgStat = true; + m_shouldHgStat = true; break; case ACT_PUSH: @@ -1848,16 +1863,16 @@ break; case ACT_INIT: - MultiChoiceDialog::addRecentArgument("init", workFolderPath); - MultiChoiceDialog::addRecentArgument("local", workFolderPath); + MultiChoiceDialog::addRecentArgument("init", m_workFolderPath); + MultiChoiceDialog::addRecentArgument("local", m_workFolderPath); enableDisableActions(); - shouldHgStat = true; + m_shouldHgStat = true; break; case ACT_CLONEFROMREMOTE: - MultiChoiceDialog::addRecentArgument("local", workFolderPath); - MultiChoiceDialog::addRecentArgument("remote", remoteRepoPath); - MultiChoiceDialog::addRecentArgument("remote", workFolderPath, true); + MultiChoiceDialog::addRecentArgument("local", m_workFolderPath); + MultiChoiceDialog::addRecentArgument("remote", m_remoteRepoPath); + MultiChoiceDialog::addRecentArgument("remote", m_workFolderPath, true); MoreInformationDialog::information (this, tr("Clone"), @@ -1865,94 +1880,123 @@ tr("The remote repository <pre>%1</pre> was successfully cloned to the local folder <pre>%2</pre>.").arg(remoteRepoPath).arg(workFolderPath), output); enableDisableActions(); - shouldHgStat = true; + m_shouldHgStat = true; break; case ACT_LOG: - hgTabs->setNewLog(output); - needNewLog = false; + m_hgTabs->setNewLog(output); + m_needNewLog = false; break; case ACT_LOG_INCREMENTAL: - hgTabs->addIncrementalLog(output); + m_hgTabs->addIncrementalLog(output); break; case ACT_QUERY_PARENTS: { - foreach (Changeset *cs, currentParents) delete cs; - currentParents = Changeset::parseChangesets(output); - QStringList parentIds = Changeset::getIds(currentParents); - hgTabs->setCurrent(parentIds, currentBranch); + foreach (Changeset *cs, m_currentParents) delete cs; + m_currentParents = Changeset::parseChangesets(output); + QStringList parentIds = Changeset::getIds(m_currentParents); + m_hgTabs->setCurrent(parentIds, m_currentBranch); } break; case ACT_QUERY_HEADS: { - oldHeadIds = Changeset::getIds(currentHeads); + oldHeadIds = Changeset::getIds(m_currentHeads); Changesets newHeads = Changeset::parseChangesets(output); QStringList newHeadIds = Changeset::getIds(newHeads); if (oldHeadIds != newHeadIds) { DEBUG << "Heads changed, will prompt an incremental log if appropriate" << endl; headsChanged = true; - foreach (Changeset *cs, currentHeads) delete cs; - currentHeads = newHeads; + foreach (Changeset *cs, m_currentHeads) delete cs; + m_currentHeads = newHeads; } } break; case ACT_COMMIT: - hgTabs->clearSelections(); - justMerged = false; - shouldHgStat = true; + m_hgTabs->clearSelections(); + m_justMerged = false; + m_shouldHgStat = true; break; case ACT_REVERT: - hgMarkResolved(lastRevertedFiles); - justMerged = false; + hgMarkResolved(m_lastRevertedFiles); + m_justMerged = false; break; case ACT_REMOVE: case ACT_ADD: - hgTabs->clearSelections(); - shouldHgStat = true; + m_hgTabs->clearSelections(); + m_shouldHgStat = true; break; case ACT_TAG: - needNewLog = true; - shouldHgStat = true; + m_needNewLog = true; + m_shouldHgStat = true; break; - case ACT_DIFF_SUMMARY: + case ACT_UNCOMMITTED_SUMMARY: QMessageBox::information(this, tr("Change summary"), format3(tr("Summary of uncommitted changes"), "", output)); break; + case ACT_DIFF_SUMMARY: + { + // Output has log info first, diff following after a blank line + output.replace("\r\n", "\n"); + QStringList olist = output.split("\n\n", QString::SkipEmptyParts); + if (olist.size() > 1) output = olist[1]; + + Changeset *cs = (Changeset *)completedAction.extraData; + if (cs) { + QMessageBox::information + (this, tr("Change summary"), + format3(tr("Summary of changes"), + cs->formatHtml(), + output)); + } else if (output == "") { + // Can happen, for a merge commit (depending on parent) + QMessageBox::information(this, tr("Change summary"), + format3(tr("Summary of changes"), + tr("No changes"), + output)); + } else { + QMessageBox::information(this, tr("Change summary"), + format3(tr("Summary of changes"), + "", + output)); + } + break; + } + case ACT_FOLDERDIFF: case ACT_CHGSETDIFF: case ACT_SERVE: case ACT_HG_IGNORE: - shouldHgStat = true; + m_shouldHgStat = true; break; case ACT_UPDATE: QMessageBox::information(this, tr("Update"), tr("<qt><h3>Update successful</h3><p>%1</p>").arg(xmlEncode(output))); - shouldHgStat = true; + m_shouldHgStat = true; break; case ACT_MERGE: //!!! use format3? QMessageBox::information(this, tr("Merge"), tr("<qt><h3>Merge successful</h3><pre>%1</pre>").arg(xmlEncode(output))); - shouldHgStat = true; - justMerged = true; + m_shouldHgStat = true; + m_justMerged = true; break; case ACT_RETRY_MERGE: QMessageBox::information(this, tr("Resolved"), tr("<qt><h3>Merge resolved</h3><p>Merge resolved successfully.</p>")); - shouldHgStat = true; - justMerged = true; + m_shouldHgStat = true; + m_justMerged = true; break; default: @@ -1979,7 +2023,7 @@ settings.beginGroup("General"); if (settings.value("useextension", true).toBool()) { hgTestExtension(); - } else if (workFolderPath == "") { + } else if (m_workFolderPath == "") { open(); } else { hgQueryPaths(); @@ -1988,7 +2032,7 @@ } case ACT_TEST_HG_EXT: - if (workFolderPath == "") { + if (m_workFolderPath == "") { open(); } else{ hgQueryPaths(); @@ -2012,7 +2056,7 @@ break; case ACT_QUERY_HEADS: - if (headsChanged && !needNewLog) { + if (headsChanged && !m_needNewLog) { hgLogIncremental(oldHeadIds); } else { hgQueryParents(); @@ -2024,7 +2068,7 @@ break; case ACT_QUERY_PARENTS: - if (needNewLog) { + if (m_needNewLog) { hgLog(); } else { // we're done @@ -2038,8 +2082,8 @@ break; default: - if (shouldHgStat) { - shouldHgStat = false; + if (m_shouldHgStat) { + m_shouldHgStat = false; hgQueryPaths(); } else { noMore = true; @@ -2048,66 +2092,69 @@ } if (noMore) { - stateUnknown = false; + m_stateUnknown = false; enableDisableActions(); - hgTabs->updateHistory(); + m_hgTabs->updateHistory(); } } void MainWindow::connectActions() { - connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); - connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); - - connect(hgRefreshAct, SIGNAL(triggered()), this, SLOT(hgRefresh())); - connect(hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove())); - connect(hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd())); - connect(hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit())); - connect(hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); - connect(hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate())); - connect(hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert())); - connect(hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge())); - connect(hgIgnoreAct, SIGNAL(triggered()), this, SLOT(hgIgnore())); - - connect(settingsAct, SIGNAL(triggered()), this, SLOT(settings())); - connect(openAct, SIGNAL(triggered()), this, SLOT(open())); - connect(changeRemoteRepoAct, SIGNAL(triggered()), this, SLOT(changeRemoteRepo())); - - connect(hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming())); - connect(hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull())); - connect(hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush())); - - connect(hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate())); - connect(hgServeAct, SIGNAL(triggered()), this, SLOT(hgServe())); + connect(m_exitAct, SIGNAL(triggered()), this, SLOT(close())); + connect(m_aboutAct, SIGNAL(triggered()), this, SLOT(about())); + + connect(m_hgRefreshAct, SIGNAL(triggered()), this, SLOT(hgRefresh())); + connect(m_hgRemoveAct, SIGNAL(triggered()), this, SLOT(hgRemove())); + connect(m_hgAddAct, SIGNAL(triggered()), this, SLOT(hgAdd())); + connect(m_hgCommitAct, SIGNAL(triggered()), this, SLOT(hgCommit())); + connect(m_hgFolderDiffAct, SIGNAL(triggered()), this, SLOT(hgFolderDiff())); + connect(m_hgUpdateAct, SIGNAL(triggered()), this, SLOT(hgUpdate())); + connect(m_hgRevertAct, SIGNAL(triggered()), this, SLOT(hgRevert())); + connect(m_hgMergeAct, SIGNAL(triggered()), this, SLOT(hgMerge())); + connect(m_hgIgnoreAct, SIGNAL(triggered()), this, SLOT(hgIgnore())); + + connect(m_settingsAct, SIGNAL(triggered()), this, SLOT(settings())); + connect(m_openAct, SIGNAL(triggered()), this, SLOT(open())); + connect(m_changeRemoteRepoAct, SIGNAL(triggered()), this, SLOT(changeRemoteRepo())); + + connect(m_hgIncomingAct, SIGNAL(triggered()), this, SLOT(hgIncoming())); + connect(m_hgPullAct, SIGNAL(triggered()), this, SLOT(hgPull())); + connect(m_hgPushAct, SIGNAL(triggered()), this, SLOT(hgPush())); + + connect(m_hgAnnotateAct, SIGNAL(triggered()), this, SLOT(hgAnnotate())); + connect(m_hgServeAct, SIGNAL(triggered()), this, SLOT(hgServe())); } void MainWindow::connectTabsSignals() { - connect(hgTabs, SIGNAL(commit()), + connect(m_hgTabs, SIGNAL(commit()), this, SLOT(hgCommit())); - connect(hgTabs, SIGNAL(revert()), + connect(m_hgTabs, SIGNAL(revert()), this, SLOT(hgRevert())); - connect(hgTabs, SIGNAL(diffWorkingFolder()), + connect(m_hgTabs, SIGNAL(diffWorkingFolder()), this, SLOT(hgFolderDiff())); - connect(hgTabs, SIGNAL(showSummary()), + connect(m_hgTabs, SIGNAL(showSummary()), this, SLOT(hgShowSummary())); - connect(hgTabs, SIGNAL(updateTo(QString)), + connect(m_hgTabs, SIGNAL(updateTo(QString)), this, SLOT(hgUpdateToRev(QString))); - connect(hgTabs, SIGNAL(diffToCurrent(QString)), + connect(m_hgTabs, SIGNAL(diffToCurrent(QString)), this, SLOT(hgDiffToCurrent(QString))); - connect(hgTabs, SIGNAL(diffToParent(QString, QString)), + connect(m_hgTabs, SIGNAL(diffToParent(QString, QString)), this, SLOT(hgDiffToParent(QString, QString))); - connect(hgTabs, SIGNAL(mergeFrom(QString)), + connect(m_hgTabs, SIGNAL(showSummary(Changeset *)), + this, SLOT(hgShowSummaryFor(Changeset *))); + + connect(m_hgTabs, SIGNAL(mergeFrom(QString)), this, SLOT(hgMergeFrom(QString))); - connect(hgTabs, SIGNAL(tag(QString)), + connect(m_hgTabs, SIGNAL(tag(QString)), this, SLOT(hgTag(QString))); } @@ -2115,7 +2162,7 @@ { DEBUG << "MainWindow::enableDisableActions" << endl; - QString dirname = QDir(workFolderPath).dirName(); + QString dirname = QDir(m_workFolderPath).dirName(); if (dirname != "") { setWindowTitle(tr("EasyMercurial: %1").arg(dirname)); } else { @@ -2130,32 +2177,32 @@ bool workFolderExist = true; bool localRepoExist = true; - remoteRepoActionsEnabled = true; - if (remoteRepoPath.isEmpty()) { - remoteRepoActionsEnabled = false; + m_remoteRepoActionsEnabled = true; + if (m_remoteRepoPath.isEmpty()) { + m_remoteRepoActionsEnabled = false; } - localRepoActionsEnabled = true; - if (workFolderPath.isEmpty()) { - localRepoActionsEnabled = false; + m_localRepoActionsEnabled = true; + if (m_workFolderPath.isEmpty()) { + m_localRepoActionsEnabled = false; workFolderExist = false; } - if (workFolderPath == "" || !workFolderDir.exists(workFolderPath)) { - localRepoActionsEnabled = false; + if (m_workFolderPath == "" || !workFolderDir.exists(m_workFolderPath)) { + m_localRepoActionsEnabled = false; workFolderExist = false; } else { workFolderExist = true; } - if (!localRepoDir.exists(workFolderPath + "/.hg")) { - localRepoActionsEnabled = false; + if (!localRepoDir.exists(m_workFolderPath + "/.hg")) { + m_localRepoActionsEnabled = false; localRepoExist = false; } - hgIncomingAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled); - hgPullAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled); - hgPushAct -> setEnabled(remoteRepoActionsEnabled && remoteRepoActionsEnabled); + m_hgIncomingAct -> setEnabled(m_remoteRepoActionsEnabled && m_remoteRepoActionsEnabled); + m_hgPullAct -> setEnabled(m_remoteRepoActionsEnabled && m_remoteRepoActionsEnabled); + m_hgPushAct -> setEnabled(m_remoteRepoActionsEnabled && m_remoteRepoActionsEnabled); bool haveDiff = false; QSettings settings; @@ -2165,26 +2212,26 @@ } settings.endGroup(); - hgRefreshAct -> setEnabled(localRepoActionsEnabled); - hgFolderDiffAct -> setEnabled(localRepoActionsEnabled && haveDiff); - hgRevertAct -> setEnabled(localRepoActionsEnabled); - hgAddAct -> setEnabled(localRepoActionsEnabled); - hgRemoveAct -> setEnabled(localRepoActionsEnabled); - hgUpdateAct -> setEnabled(localRepoActionsEnabled); - hgCommitAct -> setEnabled(localRepoActionsEnabled); - hgMergeAct -> setEnabled(localRepoActionsEnabled); - hgAnnotateAct -> setEnabled(localRepoActionsEnabled); - hgServeAct -> setEnabled(localRepoActionsEnabled); - hgIgnoreAct -> setEnabled(localRepoActionsEnabled); - - DEBUG << "localRepoActionsEnabled = " << localRepoActionsEnabled << endl; - DEBUG << "canCommit = " << hgTabs->canCommit() << endl; - - hgAddAct->setEnabled(localRepoActionsEnabled && hgTabs->canAdd()); - hgRemoveAct->setEnabled(localRepoActionsEnabled && hgTabs->canRemove()); - hgCommitAct->setEnabled(localRepoActionsEnabled && hgTabs->canCommit()); - hgRevertAct->setEnabled(localRepoActionsEnabled && hgTabs->canRevert()); - hgFolderDiffAct->setEnabled(localRepoActionsEnabled && hgTabs->canDiff()); + m_hgRefreshAct -> setEnabled(m_localRepoActionsEnabled); + m_hgFolderDiffAct -> setEnabled(m_localRepoActionsEnabled && haveDiff); + m_hgRevertAct -> setEnabled(m_localRepoActionsEnabled); + m_hgAddAct -> setEnabled(m_localRepoActionsEnabled); + m_hgRemoveAct -> setEnabled(m_localRepoActionsEnabled); + m_hgUpdateAct -> setEnabled(m_localRepoActionsEnabled); + m_hgCommitAct -> setEnabled(m_localRepoActionsEnabled); + m_hgMergeAct -> setEnabled(m_localRepoActionsEnabled); + m_hgAnnotateAct -> setEnabled(m_localRepoActionsEnabled); + m_hgServeAct -> setEnabled(m_localRepoActionsEnabled); + m_hgIgnoreAct -> setEnabled(m_localRepoActionsEnabled); + + DEBUG << "m_localRepoActionsEnabled = " << m_localRepoActionsEnabled << endl; + DEBUG << "canCommit = " << m_hgTabs->canCommit() << endl; + + m_hgAddAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canAdd()); + m_hgRemoveAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canRemove()); + m_hgCommitAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canCommit()); + m_hgRevertAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canRevert()); + m_hgFolderDiffAct->setEnabled(m_localRepoActionsEnabled && m_hgTabs->canDiff()); // A default merge makes sense if: // * there is only one parent (if there are two, we have an uncommitted merge) and @@ -2201,24 +2248,24 @@ bool emptyRepo = false; bool noWorkingCopy = false; bool newBranch = false; - int currentBranchHeads = 0; - - if (currentParents.size() == 1) { + int m_currentBranchHeads = 0; + + if (m_currentParents.size() == 1) { bool parentIsHead = false; - Changeset *parent = currentParents[0]; - foreach (Changeset *head, currentHeads) { - DEBUG << "head branch " << head->branch() << ", current branch " << currentBranch << endl; - if (head->isOnBranch(currentBranch)) { - ++currentBranchHeads; + Changeset *parent = m_currentParents[0]; + foreach (Changeset *head, m_currentHeads) { + DEBUG << "head branch " << head->branch() << ", current branch " << m_currentBranch << endl; + if (head->isOnBranch(m_currentBranch)) { + ++m_currentBranchHeads; } if (parent->id() == head->id()) { parentIsHead = true; } } - if (currentBranchHeads == 2 && parentIsHead) { + if (m_currentBranchHeads == 2 && parentIsHead) { canMerge = true; } - if (currentBranchHeads == 0 && parentIsHead) { + if (m_currentBranchHeads == 0 && parentIsHead) { // Just created a new branch newBranch = true; } @@ -2226,13 +2273,13 @@ canUpdate = true; DEBUG << "parent id = " << parent->id() << endl; DEBUG << " head ids "<<endl; - foreach (Changeset *h, currentHeads) { + foreach (Changeset *h, m_currentHeads) { DEBUG << "head id = " << h->id() << endl; } } - justMerged = false; - } else if (currentParents.size() == 0) { - if (currentHeads.size() == 0) { + m_justMerged = false; + } else if (m_currentParents.size() == 0) { + if (m_currentHeads.size() == 0) { // No heads -> empty repo emptyRepo = true; } else { @@ -2242,125 +2289,125 @@ noWorkingCopy = true; canUpdate = true; } - justMerged = false; + m_justMerged = false; } else { haveMerge = true; - justMerged = true; + m_justMerged = true; } - hgMergeAct->setEnabled(localRepoActionsEnabled && - (canMerge || hgTabs->canResolve())); - hgUpdateAct->setEnabled(localRepoActionsEnabled && - (canUpdate && !hgTabs->haveChangesToCommit())); + m_hgMergeAct->setEnabled(m_localRepoActionsEnabled && + (canMerge || m_hgTabs->canResolve())); + m_hgUpdateAct->setEnabled(m_localRepoActionsEnabled && + (canUpdate && !m_hgTabs->haveChangesToCommit())); // Set the state field on the file status widget QString branchText; - if (currentBranch == "" || currentBranch == "default") { + if (m_currentBranch == "" || m_currentBranch == "default") { branchText = tr("the default branch"); } else { - branchText = tr("branch \"%1\"").arg(currentBranch); + branchText = tr("branch \"%1\"").arg(m_currentBranch); } - if (stateUnknown) { - if (workFolderPath == "") { - hgTabs->setState(tr("No repository open")); + if (m_stateUnknown) { + if (m_workFolderPath == "") { + m_hgTabs->setState(tr("No repository open")); } else { - hgTabs->setState(tr("(Examining repository)")); + m_hgTabs->setState(tr("(Examining repository)")); } } else if (emptyRepo) { - hgTabs->setState(tr("Nothing committed to this repository yet")); + m_hgTabs->setState(tr("Nothing committed to this repository yet")); } else if (noWorkingCopy) { - hgTabs->setState(tr("No working copy yet: consider updating")); + m_hgTabs->setState(tr("No working copy yet: consider updating")); } else if (canMerge) { - hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); - } else if (!hgTabs->getAllUnresolvedFiles().empty()) { - hgTabs->setState(tr("Have unresolved files following merge on %1").arg(branchText)); + m_hgTabs->setState(tr("<b>Awaiting merge</b> on %1").arg(branchText)); + } else if (!m_hgTabs->getAllUnresolvedFiles().empty()) { + m_hgTabs->setState(tr("Have unresolved files following merge on %1").arg(branchText)); } else if (haveMerge) { - hgTabs->setState(tr("Have merged but not yet committed on %1").arg(branchText)); + m_hgTabs->setState(tr("Have merged but not yet committed on %1").arg(branchText)); } else if (newBranch) { - hgTabs->setState(tr("On %1. New branch: has not yet been committed").arg(branchText)); + m_hgTabs->setState(tr("On %1. New branch: has not yet been committed").arg(branchText)); } else if (canUpdate) { - if (hgTabs->haveChangesToCommit()) { + if (m_hgTabs->haveChangesToCommit()) { // have uncommitted changes - hgTabs->setState(tr("On %1. Not at the head of the branch").arg(branchText)); + m_hgTabs->setState(tr("On %1. Not at the head of the branch").arg(branchText)); } else { // no uncommitted changes - hgTabs->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText)); + m_hgTabs->setState(tr("On %1. Not at the head of the branch: consider updating").arg(branchText)); } - } else if (currentBranchHeads > 1) { - hgTabs->setState(tr("At one of %n heads of %1", "", currentBranchHeads).arg(branchText)); + } else if (m_currentBranchHeads > 1) { + m_hgTabs->setState(tr("At one of %n heads of %1", "", m_currentBranchHeads).arg(branchText)); } else { - hgTabs->setState(tr("At the head of %1").arg(branchText)); + m_hgTabs->setState(tr("At the head of %1").arg(branchText)); } } void MainWindow::createActions() { //File actions - openAct = new QAction(QIcon(":/images/fileopen.png"), tr("Open..."), this); - openAct -> setStatusTip(tr("Open an existing repository or working folder")); - - changeRemoteRepoAct = new QAction(tr("Change Remote Location..."), this); - changeRemoteRepoAct->setStatusTip(tr("Change the default remote repository for pull and push actions")); - - settingsAct = new QAction(QIcon(":/images/settings.png"), tr("Settings..."), this); - settingsAct -> setStatusTip(tr("View and change application settings")); - - exitAct = new QAction(QIcon(":/images/exit.png"), tr("Quit"), this); - exitAct->setShortcuts(QKeySequence::Quit); - exitAct->setStatusTip(tr("Quit EasyMercurial")); + m_openAct = new QAction(QIcon(":/images/fileopen.png"), tr("Open..."), this); + m_openAct -> setStatusTip(tr("Open an existing repository or working folder")); + + m_changeRemoteRepoAct = new QAction(tr("Change Remote Location..."), this); + m_changeRemoteRepoAct->setStatusTip(tr("Change the default remote repository for pull and push actions")); + + m_settingsAct = new QAction(QIcon(":/images/settings.png"), tr("Settings..."), this); + m_settingsAct -> setStatusTip(tr("View and change application settings")); + + m_exitAct = new QAction(QIcon(":/images/exit.png"), tr("Quit"), this); + m_exitAct->setShortcuts(QKeySequence::Quit); + m_exitAct->setStatusTip(tr("Quit EasyMercurial")); //Repository actions - hgRefreshAct = new QAction(QIcon(":/images/status.png"), tr("Refresh"), this); - hgRefreshAct->setStatusTip(tr("Refresh the window to show the current state of the working folder")); - - hgIncomingAct = new QAction(QIcon(":/images/incoming.png"), tr("Preview"), this); - hgIncomingAct -> setStatusTip(tr("See what changes are available in the remote repository waiting to be pulled")); - - hgPullAct = new QAction(QIcon(":/images/pull.png"), tr("Pull"), this); - hgPullAct -> setStatusTip(tr("Pull changes from the remote repository to the local repository")); - - hgPushAct = new QAction(QIcon(":/images/push.png"), tr("Push"), this); - hgPushAct->setStatusTip(tr("Push changes from the local repository to the remote repository")); + m_hgRefreshAct = new QAction(QIcon(":/images/status.png"), tr("Refresh"), this); + m_hgRefreshAct->setStatusTip(tr("Refresh the window to show the current state of the working folder")); + + m_hgIncomingAct = new QAction(QIcon(":/images/incoming.png"), tr("Preview"), this); + m_hgIncomingAct -> setStatusTip(tr("See what changes are available in the remote repository waiting to be pulled")); + + m_hgPullAct = new QAction(QIcon(":/images/pull.png"), tr("Pull"), this); + m_hgPullAct -> setStatusTip(tr("Pull changes from the remote repository to the local repository")); + + m_hgPushAct = new QAction(QIcon(":/images/push.png"), tr("Push"), this); + m_hgPushAct->setStatusTip(tr("Push changes from the local repository to the remote repository")); //Workfolder actions - hgFolderDiffAct = new QAction(QIcon(":/images/folderdiff.png"), tr("Diff"), this); - hgFolderDiffAct->setStatusTip(tr("See what has changed in the working folder compared with the last committed state")); - - hgRevertAct = new QAction(QIcon(":/images/undo.png"), tr("Revert"), this); - hgRevertAct->setStatusTip(tr("Throw away your changes and return to the last committed state")); - - hgAddAct = new QAction(QIcon(":/images/add.png"), tr("Add"), this); - hgAddAct -> setStatusTip(tr("Mark the selected file(s) to be added on the next commit")); + m_hgFolderDiffAct = new QAction(QIcon(":/images/folderdiff.png"), tr("Diff"), this); + m_hgFolderDiffAct->setStatusTip(tr("See what has changed in the working folder compared with the last committed state")); + + m_hgRevertAct = new QAction(QIcon(":/images/undo.png"), tr("Revert"), this); + m_hgRevertAct->setStatusTip(tr("Throw away your changes and return to the last committed state")); + + m_hgAddAct = new QAction(QIcon(":/images/add.png"), tr("Add"), this); + m_hgAddAct -> setStatusTip(tr("Mark the selected file(s) to be added on the next commit")); //!!! needs to be modified for number - hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("Remove"), this); - hgRemoveAct -> setStatusTip(tr("Mark the selected file(s) to be removed from version control on the next commit")); - - hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("Update"), this); - hgUpdateAct->setStatusTip(tr("Update the working folder to the head of the current repository branch")); + m_hgRemoveAct = new QAction(QIcon(":/images/remove.png"), tr("Remove"), this); + m_hgRemoveAct -> setStatusTip(tr("Mark the selected file(s) to be removed from version control on the next commit")); + + m_hgUpdateAct = new QAction(QIcon(":/images/update.png"), tr("Update"), this); + m_hgUpdateAct->setStatusTip(tr("Update the working folder to the head of the current repository branch")); //!!! needs to be modified when files selected - hgCommitAct = new QAction(QIcon(":/images/commit.png"), tr("Commit"), this); - hgCommitAct->setStatusTip(tr("Commit your changes to the local repository")); - - hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("Merge"), this); - hgMergeAct->setStatusTip(tr("Merge the two independent sets of changes in the local repository into the working folder")); + m_hgCommitAct = new QAction(QIcon(":/images/commit.png"), tr("Commit"), this); + m_hgCommitAct->setStatusTip(tr("Commit your changes to the local repository")); + + m_hgMergeAct = new QAction(QIcon(":/images/merge.png"), tr("Merge"), this); + m_hgMergeAct->setStatusTip(tr("Merge the two independent sets of changes in the local repository into the working folder")); //Advanced actions //!!! needs to be modified for number - hgAnnotateAct = new QAction(tr("Annotate"), this); - hgAnnotateAct -> setStatusTip(tr("Show line-by-line version information for selected file")); - - hgIgnoreAct = new QAction(tr("Edit .hgignore File"), this); - hgIgnoreAct -> setStatusTip(tr("Edit the .hgignore file, containing the names of files that should be ignored by Mercurial")); - - hgServeAct = new QAction(tr("Serve via HTTP"), this); - hgServeAct -> setStatusTip(tr("Serve local repository via http for workgroup access")); + m_hgAnnotateAct = new QAction(tr("Annotate"), this); + m_hgAnnotateAct -> setStatusTip(tr("Show line-by-line version information for selected file")); + + m_hgIgnoreAct = new QAction(tr("Edit .hgignore File"), this); + m_hgIgnoreAct -> setStatusTip(tr("Edit the .hgignore file, containing the names of files that should be ignored by Mercurial")); + + m_hgServeAct = new QAction(tr("Serve via HTTP"), this); + m_hgServeAct -> setStatusTip(tr("Serve local repository via http for workgroup access")); //Help actions - aboutAct = new QAction(tr("About EasyMercurial"), this); + m_aboutAct = new QAction(tr("About EasyMercurial"), this); // Miscellaneous QShortcut *clearSelectionsShortcut = new QShortcut(Qt::Key_Escape, this); @@ -2370,56 +2417,56 @@ void MainWindow::createMenus() { - fileMenu = menuBar()->addMenu(tr("File")); - - fileMenu -> addAction(openAct); - fileMenu -> addAction(changeRemoteRepoAct); - fileMenu -> addSeparator(); - - advancedMenu = fileMenu->addMenu(tr("Advanced")); - - fileMenu -> addAction(settingsAct); - - fileMenu -> addSeparator(); - fileMenu -> addAction(exitAct); - - advancedMenu -> addAction(hgIgnoreAct); - advancedMenu -> addSeparator(); - advancedMenu -> addAction(hgServeAct); - - helpMenu = menuBar()->addMenu(tr("Help")); - helpMenu->addAction(aboutAct); + m_fileMenu = menuBar()->addMenu(tr("File")); + + m_fileMenu -> addAction(m_openAct); + m_fileMenu -> addAction(m_changeRemoteRepoAct); + m_fileMenu -> addSeparator(); + + m_advancedMenu = m_fileMenu->addMenu(tr("Advanced")); + + m_fileMenu -> addAction(m_settingsAct); + + m_fileMenu -> addSeparator(); + m_fileMenu -> addAction(m_exitAct); + + m_advancedMenu -> addAction(m_hgIgnoreAct); + m_advancedMenu -> addSeparator(); + m_advancedMenu -> addAction(m_hgServeAct); + + m_helpMenu = menuBar()->addMenu(tr("Help")); + m_helpMenu->addAction(m_aboutAct); } void MainWindow::createToolBars() { - fileToolBar = addToolBar(tr("File")); - fileToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); - fileToolBar -> addAction(openAct); - fileToolBar -> addAction(hgRefreshAct); - fileToolBar -> addSeparator(); - fileToolBar -> setMovable(false); - - repoToolBar = addToolBar(tr(REPOMENU_TITLE)); - repoToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); - repoToolBar->addAction(hgIncomingAct); - repoToolBar->addAction(hgPullAct); - repoToolBar->addAction(hgPushAct); - repoToolBar -> setMovable(false); - - workFolderToolBar = addToolBar(tr(WORKFOLDERMENU_TITLE)); - addToolBar(Qt::LeftToolBarArea, workFolderToolBar); - workFolderToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); - workFolderToolBar->addAction(hgFolderDiffAct); - workFolderToolBar->addSeparator(); - workFolderToolBar->addAction(hgRevertAct); - workFolderToolBar->addAction(hgUpdateAct); - workFolderToolBar->addAction(hgCommitAct); - workFolderToolBar->addAction(hgMergeAct); - workFolderToolBar->addSeparator(); - workFolderToolBar->addAction(hgAddAct); - workFolderToolBar->addAction(hgRemoveAct); - workFolderToolBar -> setMovable(false); + m_fileToolBar = addToolBar(tr("File")); + m_fileToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); + m_fileToolBar -> addAction(m_openAct); + m_fileToolBar -> addAction(m_hgRefreshAct); + m_fileToolBar -> addSeparator(); + m_fileToolBar -> setMovable(false); + + m_repoToolBar = addToolBar(tr(REPOMENU_TITLE)); + m_repoToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); + m_repoToolBar->addAction(m_hgIncomingAct); + m_repoToolBar->addAction(m_hgPullAct); + m_repoToolBar->addAction(m_hgPushAct); + m_repoToolBar -> setMovable(false); + + m_workFolderToolBar = addToolBar(tr(WORKFOLDERMENU_TITLE)); + addToolBar(Qt::LeftToolBarArea, m_workFolderToolBar); + m_workFolderToolBar -> setIconSize(QSize(MY_ICON_SIZE, MY_ICON_SIZE)); + m_workFolderToolBar->addAction(m_hgFolderDiffAct); + m_workFolderToolBar->addSeparator(); + m_workFolderToolBar->addAction(m_hgRevertAct); + m_workFolderToolBar->addAction(m_hgUpdateAct); + m_workFolderToolBar->addAction(m_hgCommitAct); + m_workFolderToolBar->addAction(m_hgMergeAct); + m_workFolderToolBar->addSeparator(); + m_workFolderToolBar->addAction(m_hgAddAct); + m_workFolderToolBar->addAction(m_hgRemoveAct); + m_workFolderToolBar -> setMovable(false); updateToolBarStyle(); } @@ -2452,16 +2499,16 @@ QSettings settings; - remoteRepoPath = settings.value("remoterepopath", "").toString(); - workFolderPath = settings.value("workfolderpath", "").toString(); - if (!workFolder.exists(workFolderPath)) + m_remoteRepoPath = settings.value("remoterepopath", "").toString(); + m_workFolderPath = settings.value("workfolderpath", "").toString(); + if (!workFolder.exists(m_workFolderPath)) { - workFolderPath = ""; + m_workFolderPath = ""; } QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint(); QSize size = settings.value("size", QSize(400, 400)).toSize(); - firstStart = settings.value("firststart", QVariant(true)).toBool(); + m_firstStart = settings.value("firststart", QVariant(true)).toBool(); //!!! initialFileTypesBits = (unsigned char) settings.value("viewFileTypes", QVariant(DEFAULT_HG_STAT_BITS)).toInt(); resize(size); @@ -2474,10 +2521,10 @@ QSettings settings; settings.setValue("pos", pos()); settings.setValue("size", size()); - settings.setValue("remoterepopath", remoteRepoPath); - settings.setValue("workfolderpath", workFolderPath); - settings.setValue("firststart", firstStart); - //!!!settings.setValue("viewFileTypes", hgTabs -> getFileTypesBits()); + settings.setValue("remoterepopath", m_remoteRepoPath); + settings.setValue("workfolderpath", m_workFolderPath); + settings.setValue("firststart", m_firstStart); + //!!!settings.setValue("viewFileTypes", m_hgTabs -> getFileTypesBits()); }
--- a/mainwindow.h Mon Feb 21 15:55:39 2011 +0000 +++ b/mainwindow.h Mon Feb 21 18:17:18 2011 +0000 @@ -40,20 +40,6 @@ public: MainWindow(QString myDirPath); - HgTabWidget *hgTabs; - void writeSettings(); - - //Paths to remote repo & workfolder - //Local repo is directory "./hg/" under work folder - QString remoteRepoPath; - QString workFolderPath; - QString currentBranch; - Changesets currentHeads; - Changesets currentParents; - int commitsSincePush; - bool stateUnknown; - bool hgIsOK; - bool needNewLog; protected: void closeEvent(QCloseEvent *event); @@ -83,6 +69,7 @@ void hgAdd(); void hgCommit(); void hgShowSummary(); + void hgShowSummaryFor(Changeset *); void hgFolderDiff(); void hgDiffToCurrent(QString); void hgDiffToParent(QString, QString); @@ -126,6 +113,7 @@ void splitChangeSets(QStringList *list, QString hgLogOutput); void reportNewRemoteHeads(QString); void presentLongStdoutToUser(QString stdo); + void writeSettings(); QStringList listAllUpIpV4Addresses(); QString filterTag(QString tag); @@ -163,71 +151,83 @@ void suspendFileSystemWatcher(); void restoreFileSystemWatcher(); - bool firstStart; + HgTabWidget *m_hgTabs; - bool showAllFiles; + QString m_remoteRepoPath; + QString m_workFolderPath; + QString m_currentBranch; + Changesets m_currentHeads; + Changesets m_currentParents; + int m_commitsSincePush; + bool m_stateUnknown; + bool m_hgIsOK; + bool m_needNewLog; + + bool m_firstStart; + + bool m_showAllFiles; //Actions enabled flags - bool remoteRepoActionsEnabled; - bool localRepoActionsEnabled; + bool m_remoteRepoActionsEnabled; + bool m_localRepoActionsEnabled; QString m_myDirPath; - //File menu actions - QAction *openAct; - QAction *changeRemoteRepoAct; - QAction *settingsAct; - QAction *exitAct; + // File menu actions + QAction *m_openAct; + QAction *m_changeRemoteRepoAct; + QAction *m_settingsAct; + QAction *m_exitAct; - //Repo actions - QAction *hgIncomingAct; - QAction *hgPushAct; - QAction *hgPullAct; - QAction *hgRefreshAct; - QAction *hgFolderDiffAct; - QAction *hgChgSetDiffAct; - QAction *hgRevertAct; - QAction *hgAddAct; - QAction *hgRemoveAct; - QAction *hgUpdateAct; - QAction *hgCommitAct; - QAction *hgMergeAct; - QAction *hgUpdateToRevAct; - QAction *hgAnnotateAct; - QAction *hgIgnoreAct; - QAction *hgServeAct; + // Repo actions + QAction *m_hgIncomingAct; + QAction *m_hgPushAct; + QAction *m_hgPullAct; + QAction *m_hgRefreshAct; + QAction *m_hgFolderDiffAct; + QAction *m_hgChgSetDiffAct; + QAction *m_hgRevertAct; + QAction *m_hgAddAct; + QAction *m_hgRemoveAct; + QAction *m_hgUpdateAct; + QAction *m_hgCommitAct; + QAction *m_hgMergeAct; + QAction *m_hgUpdateToRevAct; + QAction *m_hgAnnotateAct; + QAction *m_hgIgnoreAct; + QAction *m_hgServeAct; - //Menus - QMenu *fileMenu; - QMenu *advancedMenu; - QMenu *helpMenu; + // Menus + QMenu *m_fileMenu; + QMenu *m_advancedMenu; + QMenu *m_helpMenu; - //Help menu actions - QAction *aboutAct; + // Help menu actions + QAction *m_aboutAct; - QToolBar *fileToolBar; - QToolBar *repoToolBar; - QToolBar *workFolderToolBar; + QToolBar *m_fileToolBar; + QToolBar *m_repoToolBar; + QToolBar *m_workFolderToolBar; - HgRunner *runner; + HgRunner *m_runner; - bool shouldHgStat; + bool m_shouldHgStat; QString getDiffBinaryName(); QString getMergeBinaryName(); QString getEditorBinaryName(); - QFileSystemWatcher *fsWatcher; + QFileSystemWatcher *m_fsWatcher; QTimer *m_fsWatcherGeneralTimer; QTimer *m_fsWatcherRestoreTimer; bool m_fsWatcherSuspended; - QString lastStatOutput; - QStringList lastRevertedFiles; + QString m_lastStatOutput; + QStringList m_lastRevertedFiles; - bool justMerged; - QString mergeTargetRevision; - QString mergeCommitComment; + bool m_justMerged; + QString m_mergeTargetRevision; + QString m_mergeCommitComment; }; #endif