1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2023-04-13 23:51:25 +02:00
parent fea1f61235
commit 7bfae8a398
2 changed files with 10 additions and 7 deletions

View File

@ -45,6 +45,8 @@ static QFrame *line()
} }
#endif // Q_OS_MAC #endif // Q_OS_MAC
typedef QList<KV<int, QString> > ProjectionList;
void OptionsDialog::automaticPauseDetectionSet(bool set) void OptionsDialog::automaticPauseDetectionSet(bool set)
{ {
_pauseInterval->setEnabled(!set); _pauseInterval->setEnabled(!set);
@ -53,11 +55,15 @@ void OptionsDialog::automaticPauseDetectionSet(bool set)
QWidget *OptionsDialog::createMapPage() QWidget *OptionsDialog::createMapPage()
{ {
_outputProjection = new ProjectionComboBox(GCS::WGS84List() ProjectionList outputProjections(GCS::WGS84List() + Conversion::list());
+ 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( _outputProjection->setCurrentIndex(_outputProjection->findData(
_options.outputProjection)); _options.outputProjection));
_inputProjection = new ProjectionComboBox(GCS::list() + PCS::list()); _inputProjection = new ProjectionComboBox(inputProjections);
_inputProjection->setCurrentIndex(_inputProjection->findData( _inputProjection->setCurrentIndex(_inputProjection->findData(
_options.inputProjection)); _options.inputProjection));

View File

@ -6,11 +6,8 @@ ProjectionComboBox::ProjectionComboBox(const QList<KV<int, QString> > &list,
setSizeAdjustPolicy(AdjustToMinimumContentsLengthWithIcon); setSizeAdjustPolicy(AdjustToMinimumContentsLengthWithIcon);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
QList<KV<int, QString> > projs(list);
std::sort(projs.begin(), projs.end());
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
const KV<int, QString> &proj = projs.at(i); const KV<int, QString> &proj = list.at(i);
QString text = QString::number(proj.key()) + " - " + proj.value(); QString text = QString::number(proj.key()) + " - " + proj.value();
addItem(text, QVariant(proj.key())); addItem(text, QVariant(proj.key()));
} }