comparison 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
comparison
equal deleted inserted replaced
167:94be1e218655 168:4bad3c5c053a
303 (this, 303 (this,
304 cf, 304 cf,
305 tr("<h3>%1</h3><p>%2").arg(cf) 305 tr("<h3>%1</h3><p>%2").arg(cf)
306 .arg(tr("You are about to commit the following files:")), 306 .arg(tr("You are about to commit the following files:")),
307 tr("<h3>%1</h3><p>%2").arg(cf) 307 tr("<h3>%1</h3><p>%2").arg(cf)
308 .arg(tr("You are about to commit %n file(s):", "", reportFiles.size())), 308 .arg(tr("You are about to commit %n file(s).", "", reportFiles.size())),
309 reportFiles, 309 reportFiles,
310 comment)) { 310 comment)) {
311 311
312 if (!justMerged && !files.empty()) { 312 if (!justMerged && !files.empty()) {
313 // User wants to commit selected file(s) (and this is not 313 // User wants to commit selected file(s) (and this is not
434 } else { 434 } else {
435 merge = ""; 435 merge = "";
436 } 436 }
437 } 437 }
438 mergeBinaryName = merge; 438 mergeBinaryName = merge;
439 }
440
441 void MainWindow::hgShowSummary()
442 {
443 QStringList params;
444
445 params << "diff" << "--stat";
446
447 runner->requestAction(HgAction(ACT_DIFF_SUMMARY, workFolderPath, params));
439 } 448 }
440 449
441 void MainWindow::hgFolderDiff() 450 void MainWindow::hgFolderDiff()
442 { 451 {
443 if (diffBinaryName == "") return; 452 if (diffBinaryName == "") return;
1164 hgStat(); 1173 hgStat();
1165 } 1174 }
1166 1175
1167 QString MainWindow::format3(QString head, QString intro, QString code) 1176 QString MainWindow::format3(QString head, QString intro, QString code)
1168 { 1177 {
1178 code = xmlEncode(code).replace("\n", "<br>").replace(" ", "&nbsp;");
1169 if (intro == "") { 1179 if (intro == "") {
1170 return QString("<qt><h3>%1</h3><code>%2</code>") 1180 return QString("<qt><h3>%1</h3><p><code>%2</code></p>")
1171 .arg(head).arg(xmlEncode(code).replace("\n", "<br>")); 1181 .arg(head).arg(code);
1172 } else if (code == "") { 1182 } else if (code == "") {
1173 return QString("<qt><h3>%1</h3><p>%2</p>") 1183 return QString("<qt><h3>%1</h3><p>%2</p>")
1174 .arg(head).arg(intro); 1184 .arg(head).arg(intro);
1175 } else { 1185 } else {
1176 return QString("<qt><h3>%1</h3><p>%2</p><code>%3</code>") 1186 return QString("<qt><h3>%1</h3><p>%2</p><p><code>%3</code></p>")
1177 .arg(head).arg(intro).arg(xmlEncode(code).replace("\n", "<br>")); 1187 .arg(head).arg(intro).arg(code);
1178 } 1188 }
1179 } 1189 }
1180 1190
1181 void MainWindow::showIncoming(QString output) 1191 void MainWindow::showIncoming(QString output)
1182 { 1192 {
1429 case ACT_TAG: 1439 case ACT_TAG:
1430 needNewLog = true; 1440 needNewLog = true;
1431 shouldHgStat = true; 1441 shouldHgStat = true;
1432 break; 1442 break;
1433 1443
1444 case ACT_DIFF_SUMMARY:
1445 QMessageBox::information(this, tr("Change summary"),
1446 format3(tr("Summary of uncommitted changes"),
1447 "",
1448 output));
1449 break;
1450
1434 case ACT_FOLDERDIFF: 1451 case ACT_FOLDERDIFF:
1435 case ACT_CHGSETDIFF: 1452 case ACT_CHGSETDIFF:
1436 case ACT_SERVE: 1453 case ACT_SERVE:
1437 case ACT_HG_IGNORE: 1454 case ACT_HG_IGNORE:
1438 shouldHgStat = true; 1455 shouldHgStat = true;
1574 connect(hgTabs, SIGNAL(revert()), 1591 connect(hgTabs, SIGNAL(revert()),
1575 this, SLOT(hgRevert())); 1592 this, SLOT(hgRevert()));
1576 1593
1577 connect(hgTabs, SIGNAL(diffWorkingFolder()), 1594 connect(hgTabs, SIGNAL(diffWorkingFolder()),
1578 this, SLOT(hgFolderDiff())); 1595 this, SLOT(hgFolderDiff()));
1596
1597 connect(hgTabs, SIGNAL(showSummary()),
1598 this, SLOT(hgShowSummary()));
1579 1599
1580 connect(hgTabs, SIGNAL(updateTo(QString)), 1600 connect(hgTabs, SIGNAL(updateTo(QString)),
1581 this, SLOT(hgUpdateToRev(QString))); 1601 this, SLOT(hgUpdateToRev(QString)));
1582 1602
1583 connect(hgTabs, SIGNAL(diffToCurrent(QString)), 1603 connect(hgTabs, SIGNAL(diffToCurrent(QString)),