Skip to content

Commit 1e02258

Browse files
committed
Add setting to move ascent title label in ascent viewer
Includes translation
1 parent aa8c452 commit 1e02258

File tree

6 files changed

+136
-78
lines changed

6 files changed

+136
-78
lines changed

src/settings/settings.h

+4
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,10 @@ class Settings {
360360
/** Enable the start and end date fields for new trips by default. */
361361
inline static const Setting<bool> tripDialog_datesEnabledInitially = Setting<bool> ("tripDialog/datesEnabledInitially", true);
362362

363+
// Ascent viewer
364+
/** Show the ascent title below the peak name in the peak info box instead of the ascent info box in the ascent viewer. */
365+
inline static const Setting<bool> ascentViewer_ascentTitleUnderPeakName = Setting<bool> ("ascentViewer/ascentTitleUnderPeakName", false);
366+
363367

364368
// === IMPLICIT ===
365369

src/settings/settings_window.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ void SettingsWindow::loadSettings()
123123

124124
tripDatesCheckbox ->setChecked (tripDialog_datesEnabledInitially .get());
125125

126+
ascentTitleUnderPeakNameCheckbox ->setChecked (ascentViewer_ascentTitleUnderPeakName .get());
127+
126128
updateEnabled();
127129
}
128130

@@ -163,6 +165,8 @@ void SettingsWindow::loadDefaults()
163165

164166
tripDatesCheckbox ->setChecked (tripDialog_datesEnabledInitially .getDefault());
165167

168+
ascentTitleUnderPeakNameCheckbox ->setChecked (ascentViewer_ascentTitleUnderPeakName .getDefault());
169+
166170
updateEnabled();
167171
}
168172

@@ -211,6 +215,8 @@ void SettingsWindow::saveSettings()
211215

212216
tripDialog_datesEnabledInitially .set(tripDatesCheckbox ->isChecked());
213217

218+
ascentViewer_ascentTitleUnderPeakName .set(ascentTitleUnderPeakNameCheckbox ->isChecked());
219+
214220
if (languageBefore != language.get()) {
215221
QString title = tr("Language setting changed");
216222
QString message = tr("Changing the language requires a restart.");
@@ -391,4 +397,4 @@ void SettingsWindow::applyStyle(QString styleString)
391397
void SettingsWindow::reject()
392398
{
393399
handle_cancel();
394-
}
400+
}

src/ui/ascent_viewer.ui

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<x>0</x>
6363
<y>0</y>
6464
<width>422</width>
65-
<height>844</height>
65+
<height>836</height>
6666
</rect>
6767
</property>
6868
<property name="sizePolicy">
@@ -524,7 +524,7 @@
524524
<widget class="QLabel" name="ascentTitleLabel">
525525
<property name="font">
526526
<font>
527-
<pointsize>20</pointsize>
527+
<pointsize>16</pointsize>
528528
</font>
529529
</property>
530530
<property name="text">

src/ui/settings_window.ui

+35-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>400</width>
10-
<height>823</height>
10+
<height>895</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -45,7 +45,7 @@
4545
<number>10</number>
4646
</property>
4747
<item>
48-
<layout class="QFormLayout" name="topSettingsLayout">
48+
<layout class="QFormLayout" name="mainSettingsLayout">
4949
<property name="horizontalSpacing">
5050
<number>10</number>
5151
</property>
@@ -317,11 +317,11 @@
317317
</widget>
318318
</item>
319319
<item>
320-
<widget class="QGroupBox" name="defaultValuesSettingsBox">
320+
<widget class="QGroupBox" name="defaultValuesBox">
321321
<property name="title">
322322
<string>Default values for new items</string>
323323
</property>
324-
<layout class="QVBoxLayout" name="defaultValuesSettingsBoxLayout">
324+
<layout class="QVBoxLayout" name="defaultValuesBoxLayout">
325325
<property name="spacing">
326326
<number>5</number>
327327
</property>
@@ -594,6 +594,37 @@
594594
</layout>
595595
</widget>
596596
</item>
597+
<item>
598+
<widget class="QGroupBox" name="ascentViewerBox">
599+
<property name="title">
600+
<string>Ascent Viewer</string>
601+
</property>
602+
<layout class="QVBoxLayout" name="ascentViewerBoxLayout">
603+
<property name="spacing">
604+
<number>5</number>
605+
</property>
606+
<property name="leftMargin">
607+
<number>10</number>
608+
</property>
609+
<property name="topMargin">
610+
<number>5</number>
611+
</property>
612+
<property name="rightMargin">
613+
<number>10</number>
614+
</property>
615+
<property name="bottomMargin">
616+
<number>5</number>
617+
</property>
618+
<item>
619+
<widget class="QCheckBox" name="ascentTitleUnderPeakNameCheckbox">
620+
<property name="text">
621+
<string>Show ascent title below peak name, not in ascent box</string>
622+
</property>
623+
</widget>
624+
</item>
625+
</layout>
626+
</widget>
627+
</item>
597628
<item>
598629
<spacer name="bottomSpacer">
599630
<property name="orientation">

src/viewer/ascent_viewer.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ void AscentViewer::additionalUISetup()
9898
rightSplitter ->setSizes({ rightSplitter->size().width() / 2, rightSplitter->size().width() / 2 });
9999

100100

101+
// Move ascent title label if settings dictate
102+
if (Settings::ascentViewer_ascentTitleUnderPeakName.get()) {
103+
peakInfoBoxLayout->insertWidget(1, ascentInfoLine);
104+
peakInfoBoxLayout->insertWidget(2, ascentTitleLabel);
105+
}
106+
107+
101108
// Set icons for info boxes
102109
tripInfoBox ->setIcon(QIcon(":/icons/trip.svg"), 28, 28);
103110
peakInfoBox ->setIcon(QIcon(":/icons/peak.svg"), 28, 28);

0 commit comments

Comments
 (0)