Map Short Names - add preference setting

Adds a preference setting in the "Default" settings tab to toggle whether
to display shortened names in the Map.

TODO: instead of using the generic "settingsChanged" signal, it would be much
more efficient to only update items based on the actual setting which was
changed.

Signed-off-by: Michael WERLE <micha@michaelwerle.com>
This commit is contained in:
Michael Werle 2022-08-17 09:17:04 +09:00 committed by Dirk Hohndel
parent 3dbba5ae69
commit efb1832db8
7 changed files with 44 additions and 3 deletions

View file

@ -29,6 +29,7 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
connect(this, &QQuickWidget::statusChanged, this, &MapWidget::doneLoading);
connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &MapWidget::divesChanged);
connect(&diveListNotifier, &DiveListNotifier::dataReset, this, &MapWidget::reload);
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &MapWidget::reload);
setSource(urlMapWidget);
}

View file

@ -32,6 +32,8 @@ void PreferencesDefaults::refreshSettings()
ui->grid3MBased->setChecked(true);
else
ui->gridGeneric->setChecked(true);
ui->checkBox_map_short_names->setChecked(qPrefDisplay::map_short_names());
}
void PreferencesDefaults::syncSettings()
@ -40,4 +42,5 @@ void PreferencesDefaults::syncSettings()
qPrefDisplay::set_font_size(ui->fontsize->value());
qPrefDisplay::set_animation_speed(ui->velocitySlider->value());
qPrefDisplay::set_three_m_based_grid(ui->grid3MBased->isChecked());
qPrefDisplay::set_map_short_names(ui->checkBox_map_short_names->isChecked());
}

View file

@ -86,12 +86,12 @@
</widget>
</item>
<item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_15">
<property name="text">
<string>Speed</string>
<string>Speed</string>
</property>
</widget>
</item>
@ -149,6 +149,29 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Map Display Options</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Short Names:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_map_short_names">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">