comparison mainwindow.cpp @ 311:4811eb34e819 new-branches-with-status-outside-tabs

Add Start New Branch and Cancel New Branch to uncommitted item menu; add branch name to Commit dialog
author Chris Cannam
date Tue, 01 Mar 2011 14:22:29 +0000
parents 7f50c040e13d
children f98c8ece3035
comparison
equal deleted inserted replaced
308:7f50c040e13d 311:4811eb34e819
427 subsetNote = tr("<p><b>Note:</b> you are committing only the files you have selected, not all of the files that have been changed!"); 427 subsetNote = tr("<p><b>Note:</b> you are committing only the files you have selected, not all of the files that have been changed!");
428 } 428 }
429 429
430 QString cf(tr("Commit files")); 430 QString cf(tr("Commit files"));
431 431
432 QString branchText;
433 if (m_currentBranch == "" || m_currentBranch == "default") {
434 branchText = tr("the default branch");
435 } else {
436 branchText = tr("branch \"%1\"").arg(m_currentBranch);
437 }
438
432 if (ConfirmCommentDialog::confirmAndGetLongComment 439 if (ConfirmCommentDialog::confirmAndGetLongComment
433 (this, 440 (this,
434 cf, 441 cf,
435 tr("<h3>%1</h3><p>%2%3").arg(cf) 442 tr("<h3>%1</h3><p>%2%3").arg(cf)
436 .arg(tr("You are about to commit the following files.")) 443 .arg(tr("You are about to commit the following files to %1.").arg(branchText))
437 .arg(subsetNote), 444 .arg(subsetNote),
438 tr("<h3>%1</h3><p>%2%3").arg(cf) 445 tr("<h3>%1</h3><p>%2%3").arg(cf)
439 .arg(tr("You are about to commit %n file(s).", "", reportFiles.size())) 446 .arg(tr("You are about to commit %n file(s) to %1.", "", reportFiles.size()).arg(branchText))
440 .arg(subsetNote), 447 .arg(subsetNote),
441 reportFiles, 448 reportFiles,
442 comment, 449 comment,
443 tr("Commit"))) { 450 tr("Commit"))) {
444 451
470 } 477 }
471 return tag; 478 return tag;
472 } 479 }
473 480
474 481
475 void MainWindow::hgNewBranch(QString id) 482 void MainWindow::hgNewBranch()
476 { 483 {
477 QStringList params; 484 QStringList params;
478 QString branch; 485 QString branch;
479 486
480 if (ConfirmCommentDialog::confirmAndGetShortComment 487 if (ConfirmCommentDialog::confirmAndGetShortComment
487 494
488 params << "branch" << filterTag(branch); 495 params << "branch" << filterTag(branch);
489 m_runner->requestAction(HgAction(ACT_NEW_BRANCH, m_workFolderPath, params)); 496 m_runner->requestAction(HgAction(ACT_NEW_BRANCH, m_workFolderPath, params));
490 } 497 }
491 } 498 }
499 }
500
501
502 void MainWindow::hgNoBranch()
503 {
504 if (m_currentParents.empty()) return;
505
506 QString parentBranch = m_currentParents[0]->branch();
507 if (parentBranch == "") parentBranch = "default";
508
509 QStringList params;
510 params << "branch" << parentBranch;
511 m_runner->requestAction(HgAction(ACT_NEW_BRANCH, m_workFolderPath, params));
492 } 512 }
493 513
494 514
495 void MainWindow::hgTag(QString id) 515 void MainWindow::hgTag(QString id)
496 { 516 {
2171 connect(m_hgTabs, SIGNAL(diffWorkingFolder()), 2191 connect(m_hgTabs, SIGNAL(diffWorkingFolder()),
2172 this, SLOT(hgFolderDiff())); 2192 this, SLOT(hgFolderDiff()));
2173 2193
2174 connect(m_hgTabs, SIGNAL(showSummary()), 2194 connect(m_hgTabs, SIGNAL(showSummary()),
2175 this, SLOT(hgShowSummary())); 2195 this, SLOT(hgShowSummary()));
2196
2197 connect(m_hgTabs, SIGNAL(newBranch()),
2198 this, SLOT(hgNewBranch()));
2199
2200 connect(m_hgTabs, SIGNAL(noBranch()),
2201 this, SLOT(hgNoBranch()));
2176 2202
2177 connect(m_hgTabs, SIGNAL(updateTo(QString)), 2203 connect(m_hgTabs, SIGNAL(updateTo(QString)),
2178 this, SLOT(hgUpdateToRev(QString))); 2204 this, SLOT(hgUpdateToRev(QString)));
2179 2205
2180 connect(m_hgTabs, SIGNAL(diffToCurrent(QString)), 2206 connect(m_hgTabs, SIGNAL(diffToCurrent(QString)),
2188 2214
2189 connect(m_hgTabs, SIGNAL(mergeFrom(QString)), 2215 connect(m_hgTabs, SIGNAL(mergeFrom(QString)),
2190 this, SLOT(hgMergeFrom(QString))); 2216 this, SLOT(hgMergeFrom(QString)));
2191 2217
2192 connect(m_hgTabs, SIGNAL(newBranch(QString)), 2218 connect(m_hgTabs, SIGNAL(newBranch(QString)),
2193 this, SLOT(hgNewBranch(QString))); 2219 this, SLOT(hgNewBranch()));
2194 2220
2195 connect(m_hgTabs, SIGNAL(tag(QString)), 2221 connect(m_hgTabs, SIGNAL(tag(QString)),
2196 this, SLOT(hgTag(QString))); 2222 this, SLOT(hgTag(QString)));
2197 } 2223 }
2198 2224