Gerrit: Simplify loop in setRemoteBranches

Change-Id: I9f32080c15ca48a2eb9feb1693eabcc1d8f20dd5
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-02-12 15:07:48 +02:00
committed by Orgad Shaneh
parent 53b4da93a2
commit 9fd5c44f4b

View File

@@ -221,15 +221,13 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
bool blocked = m_ui->targetBranchComboBox->blockSignals(true);
m_ui->targetBranchComboBox->clear();
const QString remoteName = selectedRemoteName();
int i = 0;
bool excluded = false;
for (RemoteBranchesMap::const_iterator it = m_remoteBranches.constBegin(),
end = m_remoteBranches.constEnd();
it != end; ++it) {
if (it.key() == selectedRemoteName()) {
const BranchDate &bd = it.value();
foreach (const BranchDate &bd, m_remoteBranches.values(remoteName)) {
const bool isSuggested = bd.first == m_suggestedRemoteBranch;
if (includeOld || bd.second.daysTo(QDate::currentDate()) <= 60 || isSuggested) {
if (includeOld || isSuggested || !bd.second.isValid()
|| bd.second.daysTo(QDate::currentDate()) <= 60) {
m_ui->targetBranchComboBox->addItem(bd.first);
if (isSuggested)
m_ui->targetBranchComboBox->setCurrentIndex(i);
@@ -238,7 +236,6 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
excluded = true;
}
}
}
if (excluded)
m_ui->targetBranchComboBox->addItem(tr("... Include older branches ..."), 1);
setChangeRange();