Mercurial > hg > easyhg
diff mainwindow.cpp @ 168:4bad3c5c053a
* Add "Show summary" feature
* Add simplistic kinetic scrolling to history widget
author | Chris Cannam |
---|---|
date | Tue, 14 Dec 2010 17:20:10 +0000 |
parents | de39da2f9f4d |
children | c7fa56707ae9 |
line wrap: on
line diff
--- a/mainwindow.cpp Wed Dec 08 16:57:18 2010 +0000 +++ b/mainwindow.cpp Tue Dec 14 17:20:10 2010 +0000 @@ -305,7 +305,7 @@ tr("<h3>%1</h3><p>%2").arg(cf) .arg(tr("You are about to commit the following files:")), tr("<h3>%1</h3><p>%2").arg(cf) - .arg(tr("You are about to commit %n file(s):", "", reportFiles.size())), + .arg(tr("You are about to commit %n file(s).", "", reportFiles.size())), reportFiles, comment)) { @@ -438,6 +438,15 @@ mergeBinaryName = merge; } +void MainWindow::hgShowSummary() +{ + QStringList params; + + params << "diff" << "--stat"; + + runner->requestAction(HgAction(ACT_DIFF_SUMMARY, workFolderPath, params)); +} + void MainWindow::hgFolderDiff() { if (diffBinaryName == "") return; @@ -1166,15 +1175,16 @@ QString MainWindow::format3(QString head, QString intro, QString code) { + code = xmlEncode(code).replace("\n", "<br>").replace(" ", " "); if (intro == "") { - return QString("<qt><h3>%1</h3><code>%2</code>") - .arg(head).arg(xmlEncode(code).replace("\n", "<br>")); + return QString("<qt><h3>%1</h3><p><code>%2</code></p>") + .arg(head).arg(code); } else if (code == "") { return QString("<qt><h3>%1</h3><p>%2</p>") .arg(head).arg(intro); } else { - return QString("<qt><h3>%1</h3><p>%2</p><code>%3</code>") - .arg(head).arg(intro).arg(xmlEncode(code).replace("\n", "<br>")); + return QString("<qt><h3>%1</h3><p>%2</p><p><code>%3</code></p>") + .arg(head).arg(intro).arg(code); } } @@ -1431,6 +1441,13 @@ shouldHgStat = true; break; + case ACT_DIFF_SUMMARY: + QMessageBox::information(this, tr("Change summary"), + format3(tr("Summary of uncommitted changes"), + "", + output)); + break; + case ACT_FOLDERDIFF: case ACT_CHGSETDIFF: case ACT_SERVE: @@ -1576,6 +1593,9 @@ connect(hgTabs, SIGNAL(diffWorkingFolder()), this, SLOT(hgFolderDiff())); + + connect(hgTabs, SIGNAL(showSummary()), + this, SLOT(hgShowSummary())); connect(hgTabs, SIGNAL(updateTo(QString)), this, SLOT(hgUpdateToRev(QString)));