diff --git a/src/plugins/git/gerrit/gerritpushdialog.cpp b/src/plugins/git/gerrit/gerritpushdialog.cpp index b981f69b52f81342bfde1c3cab27041e2bdb8aec..a959688a421b6449813893a58e401ae1d8b38fac 100644 --- a/src/plugins/git/gerrit/gerritpushdialog.cpp +++ b/src/plugins/git/gerrit/gerritpushdialog.cpp @@ -42,7 +42,6 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, QWidget *parent) : QDialog(parent), m_workingDir(workingDir), m_ui(new Ui::GerritPushDialog), - m_remoteBranches(new QMap<QString,QString>()), m_localChangesFound(false), m_valid(false) { @@ -103,12 +102,12 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, QWidget *parent) : continue; int refBranchIndex = reference.indexOf(QLatin1Char('/')); - m_remoteBranches->insertMulti(reference.left(refBranchIndex).trimmed(), + m_remoteBranches.insertMulti(reference.left(refBranchIndex).trimmed(), reference.mid(refBranchIndex + 1).trimmed()); } int currIndex = 0; - QStringList remotes = m_remoteBranches->keys(); + QStringList remotes = m_remoteBranches.keys(); remotes.removeDuplicates(); foreach (const QString &remote, remotes) { m_ui->remoteComboBox->addItem(remote); @@ -133,7 +132,6 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, QWidget *parent) : GerritPushDialog::~GerritPushDialog() { delete m_ui; - delete m_remoteBranches; } @@ -179,9 +177,10 @@ void GerritPushDialog::setRemoteBranches() { m_ui->branchComboBox->clear(); - QMap<QString, QString>::const_iterator it; int i = 0; - for (it = m_remoteBranches->constBegin(); it != m_remoteBranches->constEnd(); ++it) { + for (RemoteBranchesMap::const_iterator it = m_remoteBranches.constBegin(), + end = m_remoteBranches.constEnd(); + it != end; ++it) { if (it.key() == selectedRemoteName()) { m_ui->branchComboBox->addItem(it.value()); if (it.value() == m_suggestedRemoteBranch) diff --git a/src/plugins/git/gerrit/gerritpushdialog.h b/src/plugins/git/gerrit/gerritpushdialog.h index 8bbddcaaf1f38bede86c298107d9edf02087ea3c..30259ee66e1dae0a87387ef46a51b0f2649da912 100644 --- a/src/plugins/git/gerrit/gerritpushdialog.h +++ b/src/plugins/git/gerrit/gerritpushdialog.h @@ -31,6 +31,7 @@ #define GERRITPUSHDIALOG_H #include <QDialog> +#include <QMultiMap> namespace Gerrit { namespace Internal { @@ -60,12 +61,14 @@ private slots: void setRemoteBranches(); private: + typedef QMultiMap<QString, QString> RemoteBranchesMap; + QString calculateChangeRange(); QString m_workingDir; QString m_suggestedRemoteName; QString m_suggestedRemoteBranch; Ui::GerritPushDialog *m_ui; - QMap<QString,QString> *m_remoteBranches; + RemoteBranchesMap m_remoteBranches; bool m_localChangesFound; bool m_valid; }; @@ -73,4 +76,5 @@ private: } // namespace Internal } // namespace Gerrit + #endif // GERRITPUSHDIALOG_H