From 7bfae8a398f743f3e7bdc02a13d197895860d03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Thu, 13 Apr 2023 23:51:25 +0200 Subject: [PATCH] Code cleanup --- src/GUI/optionsdialog.cpp | 12 +++++++++--- src/GUI/projectioncombobox.cpp | 5 +---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/GUI/optionsdialog.cpp b/src/GUI/optionsdialog.cpp index 378e5b1d..3415006b 100644 --- a/src/GUI/optionsdialog.cpp +++ b/src/GUI/optionsdialog.cpp @@ -45,6 +45,8 @@ static QFrame *line() } #endif // Q_OS_MAC +typedef QList > ProjectionList; + void OptionsDialog::automaticPauseDetectionSet(bool set) { _pauseInterval->setEnabled(!set); @@ -53,11 +55,15 @@ void OptionsDialog::automaticPauseDetectionSet(bool set) QWidget *OptionsDialog::createMapPage() { - _outputProjection = new ProjectionComboBox(GCS::WGS84List() - + Conversion::list()); + ProjectionList outputProjections(GCS::WGS84List() + Conversion::list()); + ProjectionList inputProjections(GCS::list() + PCS::list()); + std::sort(outputProjections.begin(), outputProjections.end()); + std::sort(inputProjections.begin(), inputProjections.end()); + + _outputProjection = new ProjectionComboBox(outputProjections); _outputProjection->setCurrentIndex(_outputProjection->findData( _options.outputProjection)); - _inputProjection = new ProjectionComboBox(GCS::list() + PCS::list()); + _inputProjection = new ProjectionComboBox(inputProjections); _inputProjection->setCurrentIndex(_inputProjection->findData( _options.inputProjection)); diff --git a/src/GUI/projectioncombobox.cpp b/src/GUI/projectioncombobox.cpp index 193cbbff..9c59cdfe 100644 --- a/src/GUI/projectioncombobox.cpp +++ b/src/GUI/projectioncombobox.cpp @@ -6,11 +6,8 @@ ProjectionComboBox::ProjectionComboBox(const QList > &list, setSizeAdjustPolicy(AdjustToMinimumContentsLengthWithIcon); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - QList > projs(list); - std::sort(projs.begin(), projs.end()); - for (int i = 0; i < list.size(); i++) { - const KV &proj = projs.at(i); + const KV &proj = list.at(i); QString text = QString::number(proj.key()) + " - " + proj.value(); addItem(text, QVariant(proj.key())); }