diff options
-rw-r--r-- | desktop-widgets/preferences/CMakeLists.txt | 17 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.cpp | 7 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.h | 1 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_defaults.ui | 97 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_reset.cpp | 34 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_reset.h | 29 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_reset.ui | 77 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferencesdialog.cpp | 6 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferencesdialog.h | 2 | ||||
-rw-r--r-- | icons/pref_reset.png | bin | 0 -> 586 bytes | |||
-rw-r--r-- | subsurface.qrc | 2 |
11 files changed, 219 insertions, 53 deletions
diff --git a/desktop-widgets/preferences/CMakeLists.txt b/desktop-widgets/preferences/CMakeLists.txt index 2298db6b9..757e9940d 100644 --- a/desktop-widgets/preferences/CMakeLists.txt +++ b/desktop-widgets/preferences/CMakeLists.txt @@ -5,17 +5,18 @@ include_directories(. ) set(SUBSURFACE_PREFERENCES_UI - preferences_defaults.ui - preferences_graph.ui - preferences_network.ui preferences_cloud.ui - preferences_units.ui + preferences_dc.ui + preferences_defaults.ui + preferences_equipment.ui preferences_georeference.ui + preferences_graph.ui preferences_language.ui - preferences_media.ui - preferences_equipment.ui - preferences_dc.ui preferences_log.ui + preferences_media.ui + preferences_network.ui + preferences_reset.ui + preferences_units.ui ) qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI}) @@ -45,6 +46,8 @@ set(SUBSURFACE_PREFERENCES_LIB_SRCS preferences_media.h preferences_network.cpp preferences_network.h + preferences_reset.cpp + preferences_reset.h preferences_units.cpp preferences_units.h preferencesdialog.cpp diff --git a/desktop-widgets/preferences/preferences_defaults.cpp b/desktop-widgets/preferences/preferences_defaults.cpp index dbf1091e4..7b3c16148 100644 --- a/desktop-widgets/preferences/preferences_defaults.cpp +++ b/desktop-widgets/preferences/preferences_defaults.cpp @@ -2,6 +2,7 @@ #include "preferences_defaults.h" #include "ui_preferences_defaults.h" #include "core/dive.h" +#include "preferencesdialog.h" #include "core/settings/qPrefGeneral.h" #include "core/settings/qPrefDisplay.h" #include "core/settings/qPrefCloudStorage.h" @@ -21,6 +22,12 @@ PreferencesDefaults::~PreferencesDefaults() delete ui; } +/*void PreferencesDefaults::on_resetSettings_clicked() +{ + auto dialog = PreferencesDialog::instance(); + dialog->defaultsRequested(); +} */ + void PreferencesDefaults::refreshSettings() { ui->font->setCurrentFont(qPrefDisplay::divelist_font()); diff --git a/desktop-widgets/preferences/preferences_defaults.h b/desktop-widgets/preferences/preferences_defaults.h index cc92ade40..44856a6fa 100644 --- a/desktop-widgets/preferences/preferences_defaults.h +++ b/desktop-widgets/preferences/preferences_defaults.h @@ -16,6 +16,7 @@ public: ~PreferencesDefaults(); void refreshSettings() override; void syncSettings() override; + public slots: private: diff --git a/desktop-widgets/preferences/preferences_defaults.ui b/desktop-widgets/preferences/preferences_defaults.ui index 3d9e45c98..030bb77d6 100644 --- a/desktop-widgets/preferences/preferences_defaults.ui +++ b/desktop-widgets/preferences/preferences_defaults.ui @@ -14,15 +14,17 @@ <string>Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> + <item> <widget class="QGroupBox" name="groupBox_2"> <property name="title"> - <string>Lists and tables</string> + <string>Font for lists and tables</string> </property> <layout class="QHBoxLayout" name="horizontalLayout_1"> <property name="margin"> <number>5</number> </property> + <item> <widget class="QLabel" name="label_7"> <property name="text"> @@ -33,6 +35,18 @@ <item> <widget class="QFontComboBox" name="font"/> </item> + + <item> + <widget class="QLabel" name="label_default1"> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </item> + <item> <widget class="QLabel" name="label_8"> <property name="text"> @@ -43,6 +57,7 @@ <item> <widget class="QDoubleSpinBox" name="fontsize"/> </item> + </layout> </widget> </item> @@ -52,43 +67,55 @@ <property name="title"> <string>Animations</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout_4"> + <layout class="QVBoxLayout" name="verticalLayout_4"> <property name="margin"> <number>5</number> </property> + <item> - <widget class="QLabel" name="label_15"> - <property name="text"> - <string>Speed</string> + <widget class="QLabel" name="label_help4"> + <property name="toolTip"> + <string extracomment="Help info 1"/> </property> - </widget> - </item> - <item> - <widget class="QSlider" name="velocitySlider"> - <property name="maximum"> - <number>500</number> + <property name="wordWrap"> + <bool>true</bool> </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <property name="text"> + <string>In some actions, e.g. when zooming the dive profile, the changing axis values are animated. Select the speed with which this animation should occur (maximum = 500):</string> </property> </widget> </item> - <item> - <widget class="QSpinBox" name="velocitySpinBox"> - <property name="maximum"> - <number>500</number> - </property> - </widget> + + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QLabel" name="label_15"> + <property name="text"> + <string>Speed</string> + </property> + </widget> + </item> + <item> + <widget class="QSlider" name="velocitySlider"> + <property name="maximum"> + <number>500</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="velocitySpinBox"> + <property name="maximum"> + <number>500</number> + </property> + </widget> + </item> + </layout> </item> - </layout> - </widget> - </item> - <item> - <widget class="QPushButton" name="resetSettings"> - <property name="text"> - <string>Reset all settings to their default value</string> - </property> + </layout> </widget> </item> @@ -110,22 +137,6 @@ <resources/> <connections> <connection> - <sender>btnUseDefaultFile</sender> - <signal>toggled(bool)</signal> - <receiver>chooseFile</receiver> - <slot>setHidden(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>462</x> - <y>136</y> - </hint> - <hint type="destinationlabel"> - <x>528</x> - <y>145</y> - </hint> - </hints> - </connection> - <connection> <sender>velocitySlider</sender> <signal>valueChanged(int)</signal> <receiver>velocitySpinBox</receiver> diff --git a/desktop-widgets/preferences/preferences_reset.cpp b/desktop-widgets/preferences/preferences_reset.cpp new file mode 100644 index 000000000..2ebfef91a --- /dev/null +++ b/desktop-widgets/preferences/preferences_reset.cpp @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0 +#include "preferences_reset.h" +#include "ui_preferences_reset.h" +#include "core/dive.h" +#include "preferencesdialog.h" + +PreferencesReset::PreferencesReset(): AbstractPreferencesWidget(tr("Reset"), QIcon(":preferences-reset-icon"), 11 ), ui(new Ui::PreferencesReset()) +{ + ui->setupUi(this); + + int h = 2 * ui->resetWarningIcon->height(); + QPixmap warning (":preferences-reset-warning-icon"); + ui->resetWarningIcon->setPixmap(warning.scaled(h,h,Qt::KeepAspectRatio)); +} + +PreferencesReset::~PreferencesReset() +{ + delete ui; +} + +void PreferencesReset::on_resetSettings_clicked() +{ + auto dialog = PreferencesDialog::instance(); + dialog->defaultsRequested(); +} + +void PreferencesReset::refreshSettings() +{ +} + +void PreferencesReset::syncSettings() +{ +} + diff --git a/desktop-widgets/preferences/preferences_reset.h b/desktop-widgets/preferences/preferences_reset.h new file mode 100644 index 000000000..bf5af593b --- /dev/null +++ b/desktop-widgets/preferences/preferences_reset.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef PREFERENCES_RESET_H +#define PREFERENCES_RESET_H + +#include "abstractpreferenceswidget.h" +#include "core/pref.h" + +namespace Ui { + class PreferencesReset; +} + +class PreferencesReset : public AbstractPreferencesWidget { + Q_OBJECT +public: + PreferencesReset(); + ~PreferencesReset(); + void refreshSettings() override; + void syncSettings() override; + +public slots: + void on_resetSettings_clicked(); + +private: + Ui::PreferencesReset *ui; +}; + + +#endif + diff --git a/desktop-widgets/preferences/preferences_reset.ui b/desktop-widgets/preferences/preferences_reset.ui new file mode 100644 index 000000000..c9e53dd5f --- /dev/null +++ b/desktop-widgets/preferences/preferences_reset.ui @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PreferencesReset</class> + <widget class="QWidget" name="PreferencesReset"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>561</width> + <height>558</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + + + + + <item row="0" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout"> + + <item> + <widget class="QLabel" name="resetWarningIcon"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + </sizepolicy> + </property> + </widget> + </item> + + <item> + <widget class="QLabel" name="warningLabel"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Selecting this button will reset all settings to their default values</string> + </property> + </widget> + </item> + + </layout> + </item> + + <item row="1" column="0"> + <widget class="QPushButton" name="resetSettings"> + <property name="text"> + <string>Reset all settings</string> + </property> + </widget> + </item> + + <item row="2" column="0">> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>195</height> + </size> + </property> + </spacer> + </item> + + </layout> + </widget> + <resources/> + <connections> + </connections> +</ui> diff --git a/desktop-widgets/preferences/preferencesdialog.cpp b/desktop-widgets/preferences/preferencesdialog.cpp index 7602a3817..7f9f91dd4 100644 --- a/desktop-widgets/preferences/preferencesdialog.cpp +++ b/desktop-widgets/preferences/preferencesdialog.cpp @@ -13,6 +13,7 @@ #include "preferences_media.h" #include "preferences_dc.h" #include "preferences_log.h" +#include "preferences_reset.h" #include "core/qthelper.h" @@ -52,8 +53,8 @@ PreferencesDialog::PreferencesDialog() QDialogButtonBox::Apply | QDialogButtonBox::Cancel); - pagesList->setMinimumWidth(120); - pagesList->setMaximumWidth(120); + pagesList->setMinimumWidth(140); + pagesList->setMaximumWidth(140); QHBoxLayout *h = new QHBoxLayout(); h->addWidget(pagesList); @@ -75,6 +76,7 @@ PreferencesDialog::PreferencesDialog() addPreferencePage(new PreferencesMedia()); addPreferencePage(new PreferencesDc()); addPreferencePage(new PreferencesLog()); + addPreferencePage(new PreferencesReset()); refreshPages(); diff --git a/desktop-widgets/preferences/preferencesdialog.h b/desktop-widgets/preferences/preferencesdialog.h index 2a1b53315..569733436 100644 --- a/desktop-widgets/preferences/preferencesdialog.h +++ b/desktop-widgets/preferences/preferencesdialog.h @@ -19,13 +19,13 @@ public: void addPreferencePage(AbstractPreferencesWidget *page); void refreshPages(); void emitSettingsChanged(); + void defaultsRequested(); signals: void settingsChanged(); private: PreferencesDialog(); void cancelRequested(); void applyRequested(bool closeIt); - void defaultsRequested(); void buttonClicked(QAbstractButton *btn); QList<AbstractPreferencesWidget*> pages; QListWidget *pagesList; diff --git a/icons/pref_reset.png b/icons/pref_reset.png Binary files differnew file mode 100644 index 000000000..cb6277a1a --- /dev/null +++ b/icons/pref_reset.png diff --git a/subsurface.qrc b/subsurface.qrc index 15d627e5c..f15428ae0 100644 --- a/subsurface.qrc +++ b/subsurface.qrc @@ -18,6 +18,8 @@ <file alias="preferences-dc-icon">icons/pref_dc.png</file> <file alias="preferences-log-icon">icons/pref_log.png</file> <file alias="preferences-display-icon">icons/pref_display.png</file> + <file alias="preferences-reset-icon">icons/pref_reset.png</file> + <file alias="preferences-reset-warning-icon">icons/warning.png</file> <file alias="scale-graph-icon">icons/graph.png</file> <file alias="value-minimum-icon">icons/minimum.png</file> <file alias="value-maximum-icon">icons/maximum.png</file> |