mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Preferences UI: add reset tab
Add a separate preferences tab for resetting all preferences to their default values. One or two very small alterations to other sections of the preferences UI code. Signed-off-by: willemferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b6c3cdb20c
commit
75b5be8f40
11 changed files with 227 additions and 61 deletions
|
@ -5,17 +5,18 @@ include_directories(.
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SUBSURFACE_PREFERENCES_UI
|
set(SUBSURFACE_PREFERENCES_UI
|
||||||
preferences_defaults.ui
|
|
||||||
preferences_graph.ui
|
|
||||||
preferences_network.ui
|
|
||||||
preferences_cloud.ui
|
preferences_cloud.ui
|
||||||
preferences_units.ui
|
|
||||||
preferences_georeference.ui
|
|
||||||
preferences_language.ui
|
|
||||||
preferences_media.ui
|
|
||||||
preferences_equipment.ui
|
|
||||||
preferences_dc.ui
|
preferences_dc.ui
|
||||||
|
preferences_defaults.ui
|
||||||
|
preferences_equipment.ui
|
||||||
|
preferences_georeference.ui
|
||||||
|
preferences_graph.ui
|
||||||
|
preferences_language.ui
|
||||||
preferences_log.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})
|
qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI})
|
||||||
|
@ -45,6 +46,8 @@ set(SUBSURFACE_PREFERENCES_LIB_SRCS
|
||||||
preferences_media.h
|
preferences_media.h
|
||||||
preferences_network.cpp
|
preferences_network.cpp
|
||||||
preferences_network.h
|
preferences_network.h
|
||||||
|
preferences_reset.cpp
|
||||||
|
preferences_reset.h
|
||||||
preferences_units.cpp
|
preferences_units.cpp
|
||||||
preferences_units.h
|
preferences_units.h
|
||||||
preferencesdialog.cpp
|
preferencesdialog.cpp
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "preferences_defaults.h"
|
#include "preferences_defaults.h"
|
||||||
#include "ui_preferences_defaults.h"
|
#include "ui_preferences_defaults.h"
|
||||||
#include "core/dive.h"
|
#include "core/dive.h"
|
||||||
|
#include "preferencesdialog.h"
|
||||||
#include "core/settings/qPrefGeneral.h"
|
#include "core/settings/qPrefGeneral.h"
|
||||||
#include "core/settings/qPrefDisplay.h"
|
#include "core/settings/qPrefDisplay.h"
|
||||||
#include "core/settings/qPrefCloudStorage.h"
|
#include "core/settings/qPrefCloudStorage.h"
|
||||||
|
@ -21,6 +22,12 @@ PreferencesDefaults::~PreferencesDefaults()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*void PreferencesDefaults::on_resetSettings_clicked()
|
||||||
|
{
|
||||||
|
auto dialog = PreferencesDialog::instance();
|
||||||
|
dialog->defaultsRequested();
|
||||||
|
} */
|
||||||
|
|
||||||
void PreferencesDefaults::refreshSettings()
|
void PreferencesDefaults::refreshSettings()
|
||||||
{
|
{
|
||||||
ui->font->setCurrentFont(qPrefDisplay::divelist_font());
|
ui->font->setCurrentFont(qPrefDisplay::divelist_font());
|
||||||
|
|
|
@ -16,6 +16,7 @@ public:
|
||||||
~PreferencesDefaults();
|
~PreferencesDefaults();
|
||||||
void refreshSettings() override;
|
void refreshSettings() override;
|
||||||
void syncSettings() override;
|
void syncSettings() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -14,15 +14,17 @@
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Lists and tables</string>
|
<string>Font for lists and tables</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
<layout class="QHBoxLayout" name="horizontalLayout_1">
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -33,6 +35,18 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFontComboBox" name="font"/>
|
<widget class="QFontComboBox" name="font"/>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_default1">
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -43,6 +57,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDoubleSpinBox" name="fontsize"/>
|
<widget class="QDoubleSpinBox" name="fontsize"/>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -52,43 +67,55 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Animations</string>
|
<string>Animations</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<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>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="resetSettings">
|
<widget class="QLabel" name="label_help4">
|
||||||
<property name="text">
|
<property name="toolTip">
|
||||||
<string>Reset all settings to their default value</string>
|
<string extracomment="Help info 1"/>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<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>
|
||||||
|
<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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
@ -109,22 +136,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<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>
|
<connection>
|
||||||
<sender>velocitySlider</sender>
|
<sender>velocitySlider</sender>
|
||||||
<signal>valueChanged(int)</signal>
|
<signal>valueChanged(int)</signal>
|
||||||
|
|
34
desktop-widgets/preferences/preferences_reset.cpp
Normal file
34
desktop-widgets/preferences/preferences_reset.cpp
Normal file
|
@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
29
desktop-widgets/preferences/preferences_reset.h
Normal file
29
desktop-widgets/preferences/preferences_reset.h
Normal file
|
@ -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
|
||||||
|
|
77
desktop-widgets/preferences/preferences_reset.ui
Normal file
77
desktop-widgets/preferences/preferences_reset.ui
Normal file
|
@ -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>
|
|
@ -13,6 +13,7 @@
|
||||||
#include "preferences_media.h"
|
#include "preferences_media.h"
|
||||||
#include "preferences_dc.h"
|
#include "preferences_dc.h"
|
||||||
#include "preferences_log.h"
|
#include "preferences_log.h"
|
||||||
|
#include "preferences_reset.h"
|
||||||
|
|
||||||
#include "core/qthelper.h"
|
#include "core/qthelper.h"
|
||||||
|
|
||||||
|
@ -52,8 +53,8 @@ PreferencesDialog::PreferencesDialog()
|
||||||
QDialogButtonBox::Apply |
|
QDialogButtonBox::Apply |
|
||||||
QDialogButtonBox::Cancel);
|
QDialogButtonBox::Cancel);
|
||||||
|
|
||||||
pagesList->setMinimumWidth(120);
|
pagesList->setMinimumWidth(140);
|
||||||
pagesList->setMaximumWidth(120);
|
pagesList->setMaximumWidth(140);
|
||||||
|
|
||||||
QHBoxLayout *h = new QHBoxLayout();
|
QHBoxLayout *h = new QHBoxLayout();
|
||||||
h->addWidget(pagesList);
|
h->addWidget(pagesList);
|
||||||
|
@ -75,6 +76,7 @@ PreferencesDialog::PreferencesDialog()
|
||||||
addPreferencePage(new PreferencesMedia());
|
addPreferencePage(new PreferencesMedia());
|
||||||
addPreferencePage(new PreferencesDc());
|
addPreferencePage(new PreferencesDc());
|
||||||
addPreferencePage(new PreferencesLog());
|
addPreferencePage(new PreferencesLog());
|
||||||
|
addPreferencePage(new PreferencesReset());
|
||||||
|
|
||||||
refreshPages();
|
refreshPages();
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@ public:
|
||||||
void addPreferencePage(AbstractPreferencesWidget *page);
|
void addPreferencePage(AbstractPreferencesWidget *page);
|
||||||
void refreshPages();
|
void refreshPages();
|
||||||
void emitSettingsChanged();
|
void emitSettingsChanged();
|
||||||
|
void defaultsRequested();
|
||||||
signals:
|
signals:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
private:
|
private:
|
||||||
PreferencesDialog();
|
PreferencesDialog();
|
||||||
void cancelRequested();
|
void cancelRequested();
|
||||||
void applyRequested(bool closeIt);
|
void applyRequested(bool closeIt);
|
||||||
void defaultsRequested();
|
|
||||||
void buttonClicked(QAbstractButton *btn);
|
void buttonClicked(QAbstractButton *btn);
|
||||||
QList<AbstractPreferencesWidget*> pages;
|
QList<AbstractPreferencesWidget*> pages;
|
||||||
QListWidget *pagesList;
|
QListWidget *pagesList;
|
||||||
|
|
BIN
icons/pref_reset.png
Normal file
BIN
icons/pref_reset.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 586 B |
|
@ -18,6 +18,8 @@
|
||||||
<file alias="preferences-dc-icon">icons/pref_dc.png</file>
|
<file alias="preferences-dc-icon">icons/pref_dc.png</file>
|
||||||
<file alias="preferences-log-icon">icons/pref_log.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-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="scale-graph-icon">icons/graph.png</file>
|
||||||
<file alias="value-minimum-icon">icons/minimum.png</file>
|
<file alias="value-minimum-icon">icons/minimum.png</file>
|
||||||
<file alias="value-maximum-icon">icons/maximum.png</file>
|
<file alias="value-maximum-icon">icons/maximum.png</file>
|
||||||
|
|
Loading…
Add table
Reference in a new issue