Only save settings that has been changed
This commit is contained in:
parent
0489b312a3
commit
5f1002894e
@ -188,6 +188,8 @@ void AppearanceSettingsPage::Load() {
|
||||
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_appearancesettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::Save() {
|
||||
@ -269,6 +271,8 @@ void AppearanceSettingsPage::SelectForegroundColor() {
|
||||
|
||||
UpdateColorSelectorColor(ui_->select_foreground_color, color_selected);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::SelectBackgroundColor() {
|
||||
@ -281,6 +285,8 @@ void AppearanceSettingsPage::SelectBackgroundColor() {
|
||||
|
||||
UpdateColorSelectorColor(ui_->select_background_color, color_selected);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void AppearanceSettingsPage::UseCustomColorSetOptionChanged(bool checked) {
|
||||
|
@ -182,6 +182,8 @@ void BackendSettingsPage::Load() {
|
||||
FadingOptionsChanged();
|
||||
RgPreampChanged(ui_->stickslider_replaygainpreamp->value());
|
||||
|
||||
Init(ui_->layout_backendsettings->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
bool BackendSettingsPage::EngineInitialised() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Backend</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="layout_backendsettings">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_audio_output">
|
||||
<property name="title">
|
||||
|
@ -196,6 +196,8 @@ void BehaviourSettingsPage::Load() {
|
||||
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_behavioursettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void BehaviourSettingsPage::Save() {
|
||||
|
@ -105,10 +105,16 @@ void CollectionSettingsPage::Add() {
|
||||
}
|
||||
|
||||
settings.setValue("last_path", path);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void CollectionSettingsPage::Remove() {
|
||||
|
||||
dialog()->collection_directory_model()->RemoveDirectory(ui_->list->currentIndex());
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void CollectionSettingsPage::CurrentRowChanged(const QModelIndex& index) {
|
||||
@ -178,6 +184,8 @@ void CollectionSettingsPage::Load() {
|
||||
|
||||
ui_->disk_cache_in_use->setText((dialog()->app()->collection_model()->icon_cache_disk_size() == 0 ? "empty" : Utilities::PrettySize(dialog()->app()->collection_model()->icon_cache_disk_size())));
|
||||
|
||||
Init(ui_->layout_collectionsettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void CollectionSettingsPage::Save() {
|
||||
|
@ -310,6 +310,12 @@ If there are no matches then it will use the largest image in the directory.</st
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
@ -328,6 +334,12 @@ If there are no matches then it will use the largest image in the directory.</st
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
@ -381,6 +393,12 @@ If there are no matches then it will use the largest image in the directory.</st
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
@ -419,6 +437,12 @@ If there are no matches then it will use the largest image in the directory.</st
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -154,6 +154,8 @@ void ContextSettingsPage::Load() {
|
||||
ui_->checkbox_search_cover->setChecked(s.value("search_for_cover_auto", true).toBool());
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_contextsettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void ContextSettingsPage::Save() {
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>780</height>
|
||||
<height>809</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -85,6 +85,8 @@ void CoversSettingsPage::Load() {
|
||||
item->setForeground(provider->is_enabled() ? palette().color(QPalette::Active, QPalette::Text) : palette().color(QPalette::Disabled, QPalette::Text));
|
||||
}
|
||||
|
||||
Init(ui_->layout_coverssettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void CoversSettingsPage::Save() {
|
||||
@ -171,12 +173,16 @@ void CoversSettingsPage::ProvidersMove(const int d) {
|
||||
ui_->providers->insertItem(row + d, item);
|
||||
ui_->providers->setCurrentRow(row + d);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void CoversSettingsPage::ItemChanged(QListWidgetItem *item) {
|
||||
|
||||
item->setForeground((item->checkState() == Qt::Checked) ? palette().color(QPalette::Active, QPalette::Text) : palette().color(QPalette::Disabled, QPalette::Text));
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void CoversSettingsPage::NoProviderSelected() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Covers</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_tidalsettingspage">
|
||||
<layout class="QVBoxLayout" name="layout_coverssettingspage">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_providers">
|
||||
<property name="sizePolicy">
|
||||
|
@ -85,6 +85,8 @@ void LyricsSettingsPage::Load() {
|
||||
item->setForeground(provider->is_enabled() ? palette().color(QPalette::Active, QPalette::Text) : palette().color(QPalette::Disabled, QPalette::Text));
|
||||
}
|
||||
|
||||
Init(ui_->layout_lyricssettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void LyricsSettingsPage::Save() {
|
||||
@ -165,12 +167,16 @@ void LyricsSettingsPage::ProvidersMove(const int d) {
|
||||
ui_->providers->insertItem(row + d, item);
|
||||
ui_->providers->setCurrentRow(row + d);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void LyricsSettingsPage::ItemChanged(QListWidgetItem *item) {
|
||||
|
||||
item->setForeground((item->checkState() == Qt::Checked) ? palette().color(QPalette::Active, QPalette::Text) : palette().color(QPalette::Disabled, QPalette::Text));
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void LyricsSettingsPage::NoProviderSelected() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Lyrics</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_tidalsettingspage">
|
||||
<layout class="QVBoxLayout" name="layout_lyricssettingspage">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupbox_providers">
|
||||
<property name="sizePolicy">
|
||||
|
@ -75,6 +75,8 @@ void MoodbarSettingsPage::Load() {
|
||||
|
||||
InitMoodbarPreviews();
|
||||
|
||||
Init(ui_->layout_moodbarsettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void MoodbarSettingsPage::Save() {
|
||||
|
@ -51,6 +51,19 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="spacer_bottom">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -77,6 +77,8 @@ void NetworkProxySettingsPage::Load() {
|
||||
ui_->proxy_password->setText(s.value("password").toString());
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_networkproxysettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void NetworkProxySettingsPage::Save() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Network Proxy</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layout_networkproxysettingsPage">
|
||||
<layout class="QVBoxLayout" name="layout_networkproxysettingspage">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="proxy_system">
|
||||
<property name="text">
|
||||
|
@ -196,6 +196,8 @@ void NotificationsSettingsPage::Load() {
|
||||
ui_->notifications_disable_duration->setChecked(pretty_popup_->disable_duration());
|
||||
UpdatePopupVisible();
|
||||
|
||||
Init(ui_->layout_notificationssettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void NotificationsSettingsPage::Save() {
|
||||
|
@ -85,6 +85,8 @@ void PlaylistSettingsPage::Load() {
|
||||
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_playlistsettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void PlaylistSettingsPage::Save() {
|
||||
|
@ -107,6 +107,8 @@ void ScrobblerSettingsPage::Load() {
|
||||
ui_->lineedit_listenbrainz_user_token->setText(listenbrainzscrobbler_->user_token());
|
||||
ListenBrainz_RefreshControls(listenbrainzscrobbler_->IsAuthenticated());
|
||||
|
||||
Init(ui_->layout_scrobblersettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void ScrobblerSettingsPage::Save() {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Scrobbler</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="layout_scrobblersettingspage">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_enable">
|
||||
<property name="enabled">
|
||||
|
@ -201,7 +201,11 @@ void SettingsDialog::closeEvent(QCloseEvent*) {
|
||||
|
||||
void SettingsDialog::accept() {
|
||||
|
||||
Save();
|
||||
for (const PageData &page : pages_.values()) {
|
||||
page.page_->Accept();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
|
||||
SaveGeometry();
|
||||
|
||||
QDialog::accept();
|
||||
@ -212,7 +216,7 @@ void SettingsDialog::reject() {
|
||||
|
||||
// Notify each page that user clicks on Cancel
|
||||
for (const PageData &page : pages_.values()) {
|
||||
page.page_->Cancel();
|
||||
page.page_->Reject();
|
||||
}
|
||||
SaveGeometry();
|
||||
|
||||
@ -309,18 +313,23 @@ void SettingsDialog::AddPage(Page id, SettingsPage *page, QTreeWidgetItem *paren
|
||||
void SettingsDialog::Save() {
|
||||
|
||||
for (const PageData &page : pages_.values()) {
|
||||
page.page_->Save();
|
||||
page.page_->Apply();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SettingsDialog::DialogButtonClicked(QAbstractButton *button) {
|
||||
|
||||
// While we only connect Apply at the moment, this might change in the future
|
||||
if (ui_->buttonBox->button(QDialogButtonBox::Apply) == button) {
|
||||
Save();
|
||||
for (const PageData &page : pages_.values()) {
|
||||
page.page_->Apply();
|
||||
}
|
||||
emit ReloadSettings();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SettingsDialog::OpenAtPage(Page page) {
|
||||
|
@ -133,6 +133,7 @@ class SettingsDialog : public QDialog {
|
||||
QTreeWidgetItem *AddCategory(const QString &name);
|
||||
void AddPage(Page id, SettingsPage *page, QTreeWidgetItem *parent = nullptr);
|
||||
|
||||
void Apply();
|
||||
void Save();
|
||||
|
||||
signals:
|
||||
|
@ -19,8 +19,119 @@
|
||||
*/
|
||||
|
||||
#include <QWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
#include <QRadioButton>
|
||||
#include <QSlider>
|
||||
#include <QLineEdit>
|
||||
#include <QShowEvent>
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
#include "settingsdialog.h"
|
||||
#include "settingspage.h"
|
||||
|
||||
SettingsPage::SettingsPage(SettingsDialog *dialog) : QWidget(dialog), dialog_(dialog) { }
|
||||
SettingsPage::SettingsPage(SettingsDialog *dialog) : QWidget(dialog), dialog_(dialog), ui_widget_(nullptr), changed_(false) {}
|
||||
|
||||
void SettingsPage::showEvent(QShowEvent *e) {
|
||||
|
||||
changed_ = false;
|
||||
|
||||
QWidget::showEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void SettingsPage::Init(QWidget *ui_widget) {
|
||||
|
||||
if (!ui_widget) return;
|
||||
|
||||
ui_widget_ = ui_widget;
|
||||
changed_ = false;
|
||||
|
||||
checkboxes_.clear();
|
||||
radiobuttons_.clear();
|
||||
comboboxes_.clear();
|
||||
spinboxes_.clear();
|
||||
sliders_.clear();
|
||||
lineedits_.clear();
|
||||
|
||||
QList<QWidget*> list = ui_widget_->findChildren<QWidget*>(QString(), Qt::FindChildrenRecursively);
|
||||
for (QWidget *w : list) {
|
||||
if (QCheckBox *checkbox = qobject_cast<QCheckBox*>(w)) {
|
||||
checkboxes_ << qMakePair(checkbox, checkbox->checkState());
|
||||
}
|
||||
else if (QRadioButton *radiobutton = qobject_cast<QRadioButton*>(w)) {
|
||||
radiobuttons_ << qMakePair(radiobutton, radiobutton->isChecked());
|
||||
}
|
||||
else if (QComboBox *combobox = qobject_cast<QComboBox*>(w)) {
|
||||
comboboxes_ << qMakePair(combobox, combobox->currentText());
|
||||
}
|
||||
else if (QSpinBox *spinbox = qobject_cast<QSpinBox*>(w)) {
|
||||
spinboxes_ << qMakePair(spinbox, spinbox->value());
|
||||
}
|
||||
else if (QLineEdit *lineedit = qobject_cast<QLineEdit*>(w)) {
|
||||
lineedits_ << qMakePair(lineedit, lineedit->text());
|
||||
}
|
||||
else if (QSlider *slider = qobject_cast<QSlider*>(w)) {
|
||||
sliders_ << qMakePair(slider, slider->value());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SettingsPage::Accept() {
|
||||
Apply();
|
||||
}
|
||||
|
||||
void SettingsPage::Reject() {
|
||||
Cancel();
|
||||
changed_ = false;
|
||||
}
|
||||
|
||||
void SettingsPage::Apply() {
|
||||
|
||||
if (!ui_widget_) {
|
||||
qLog(Error) << windowTitle() << "is not initialized!";
|
||||
changed_ = true;
|
||||
}
|
||||
|
||||
for (QPair<QCheckBox*, Qt::CheckState> &checkbox : checkboxes_) {
|
||||
if (checkbox.first->checkState() == checkbox.second) continue;
|
||||
changed_ = true;
|
||||
qLog(Info) << checkbox.first->objectName() << "is changed for" << windowTitle() << "settings.";
|
||||
}
|
||||
for (QPair<QRadioButton*, bool> &radiobutton : radiobuttons_) {
|
||||
if (radiobutton.first->isChecked() == radiobutton.second) continue;
|
||||
changed_ = true;
|
||||
qLog(Info) << radiobutton.first->objectName() << "is changed for" << windowTitle() << "settings.";
|
||||
}
|
||||
for (QPair<QComboBox*, QString> &combobox : comboboxes_) {
|
||||
if (combobox.first->currentText() == combobox.second) continue;
|
||||
changed_ = true;
|
||||
qLog(Info) << combobox.first->objectName() << "is changed for" << windowTitle() << "settings.";
|
||||
}
|
||||
for (QPair<QSpinBox*, int> &spinbox : spinboxes_) {
|
||||
if (spinbox.first->value() == spinbox.second) continue;
|
||||
changed_ = true;
|
||||
qLog(Info) << spinbox.first->objectName() << "is changed for" << windowTitle() << "settings.";
|
||||
}
|
||||
for (QPair<QLineEdit*, QString> &lineedit : lineedits_) {
|
||||
if (lineedit.first->text() == lineedit.second) continue;
|
||||
changed_ = true;
|
||||
if (lineedit.first->objectName().isEmpty()) continue;
|
||||
qLog(Info) << lineedit.first->objectName() << "is changed for" << windowTitle() << "settings.";
|
||||
}
|
||||
for (QPair<QSlider*, int> &slider : sliders_) {
|
||||
if (slider.first->value() == slider.second) continue;
|
||||
changed_ = true;
|
||||
qLog(Info) << slider.first->objectName() << "is changed for" << windowTitle() << "settings.";
|
||||
}
|
||||
|
||||
if (changed_) {
|
||||
qLog(Info) << "Saving settings for" << windowTitle();
|
||||
Save();
|
||||
Init(ui_widget_);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,10 +25,21 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QPair>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
|
||||
#include "widgets/osd.h"
|
||||
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QRadioButton;
|
||||
class QSpinBox;
|
||||
class QSlider;
|
||||
class QLineEdit;
|
||||
class QShowEvent;
|
||||
|
||||
class SettingsDialog;
|
||||
|
||||
class SettingsPage : public QWidget {
|
||||
@ -37,23 +48,42 @@ class SettingsPage : public QWidget {
|
||||
public:
|
||||
explicit SettingsPage(SettingsDialog *dialog);
|
||||
|
||||
void Init(QWidget *ui_widget);
|
||||
|
||||
// Return false to grey out the page's item in the list.
|
||||
virtual bool IsEnabled() const { return true; }
|
||||
|
||||
// Load is called when the dialog is shown, Save when the user clicks OK, and
|
||||
// Cancel when the user clicks on Cancel
|
||||
virtual void Load() = 0;
|
||||
virtual void Save() = 0;
|
||||
virtual void Cancel() {}
|
||||
|
||||
void Accept();
|
||||
void Reject();
|
||||
void Apply();
|
||||
|
||||
// The dialog that this page belongs to.
|
||||
SettingsDialog *dialog() const { return dialog_; }
|
||||
|
||||
void set_changed() { changed_ = true; }
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *e);
|
||||
|
||||
private:
|
||||
virtual void Save() = 0;
|
||||
virtual void Cancel() {}
|
||||
|
||||
signals:
|
||||
void NotificationPreview(OSD::Behaviour, QString, QString);
|
||||
|
||||
private:
|
||||
SettingsDialog *dialog_;
|
||||
QWidget *ui_widget_;
|
||||
bool changed_;
|
||||
QList<QPair<QCheckBox*, Qt::CheckState>> checkboxes_;
|
||||
QList<QPair<QRadioButton*, bool>> radiobuttons_;
|
||||
QList<QPair<QComboBox*, QString>> comboboxes_;
|
||||
QList<QPair<QSpinBox*, int>> spinboxes_;
|
||||
QList<QPair<QSlider*, int>> sliders_;
|
||||
QList<QPair<QLineEdit*, QString>> lineedits_;
|
||||
};
|
||||
|
||||
#endif // SETTINGSPAGE_H
|
||||
|
@ -174,6 +174,8 @@ void GlobalShortcutsSettingsPage::Load() {
|
||||
ui_->label_macos_mavericks->setVisible(macos_version >= 9);
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
Init(ui_->layout_globalshortcutssettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void GlobalShortcutsSettingsPage::Save() {
|
||||
@ -279,11 +281,17 @@ void GlobalShortcutsSettingsPage::ItemClicked(QTreeWidgetItem *item) {
|
||||
}
|
||||
|
||||
void GlobalShortcutsSettingsPage::NoneClicked() {
|
||||
|
||||
SetShortcut(current_id_, QKeySequence());
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void GlobalShortcutsSettingsPage::DefaultClicked() {
|
||||
|
||||
SetShortcut(current_id_, shortcuts_[current_id_].s.default_key);
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void GlobalShortcutsSettingsPage::ChangeClicked() {
|
||||
@ -303,6 +311,8 @@ void GlobalShortcutsSettingsPage::ChangeClicked() {
|
||||
ui_->radio_custom->setChecked(true);
|
||||
SetShortcut(current_id_, key);
|
||||
|
||||
set_changed();
|
||||
|
||||
}
|
||||
|
||||
void GlobalShortcutsSettingsPage::X11Warning() {
|
||||
|
@ -77,6 +77,8 @@ void SubsonicSettingsPage::Load() {
|
||||
ui_->checkbox_download_album_covers->setChecked(s.value("downloadalbumcovers", true).toBool());
|
||||
s.endGroup();
|
||||
|
||||
Init(ui_->layout_subsonicsettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void SubsonicSettingsPage::Save() {
|
||||
|
@ -105,15 +105,15 @@
|
||||
<property name="title">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="layout_preferences">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_verify_certificate">
|
||||
<property name="text">
|
||||
<string>Verify server certificate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_download_album_covers">
|
||||
<property name="text">
|
||||
<string>Download album covers</string>
|
||||
|
@ -117,6 +117,8 @@ void TidalSettingsPage::Load() {
|
||||
OAuthClicked(ui_->oauth->isChecked());
|
||||
if (service_->authenticated()) ui_->login_state->SetLoggedIn(LoginStateWidget::LoggedIn);
|
||||
|
||||
Init(ui_->layout_tidalsettingspage->parentWidget());
|
||||
|
||||
}
|
||||
|
||||
void TidalSettingsPage::Save() {
|
||||
|
@ -37,15 +37,26 @@ class SettingsDialog;
|
||||
|
||||
TranscoderSettingsPage::TranscoderSettingsPage(SettingsDialog *dialog)
|
||||
: SettingsPage(dialog), ui_(new Ui_TranscoderSettingsPage) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("tools-wizard"));
|
||||
|
||||
}
|
||||
|
||||
TranscoderSettingsPage::~TranscoderSettingsPage() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::showEvent(QShowEvent *e) {
|
||||
|
||||
set_changed();
|
||||
|
||||
QWidget::showEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::Load() {
|
||||
|
||||
ui_->transcoding_flac->Load();
|
||||
ui_->transcoding_wavpack->Load();
|
||||
ui_->transcoding_vorbis->Load();
|
||||
@ -54,9 +65,14 @@ void TranscoderSettingsPage::Load() {
|
||||
ui_->transcoding_aac->Load();
|
||||
ui_->transcoding_asf->Load();
|
||||
ui_->transcoding_mp3->Load();
|
||||
|
||||
Init(ui_->layout_transcodersettingspage->parentWidget());
|
||||
if (isVisible()) set_changed();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::Save() {
|
||||
|
||||
ui_->transcoding_flac->Save();
|
||||
ui_->transcoding_wavpack->Save();
|
||||
ui_->transcoding_vorbis->Save();
|
||||
@ -65,4 +81,5 @@ void TranscoderSettingsPage::Save() {
|
||||
ui_->transcoding_aac->Save();
|
||||
ui_->transcoding_asf->Save();
|
||||
ui_->transcoding_mp3->Save();
|
||||
|
||||
}
|
||||
|
@ -43,6 +43,9 @@ class TranscoderSettingsPage : public SettingsPage {
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *e);
|
||||
|
||||
private:
|
||||
Ui_TranscoderSettingsPage* ui_;
|
||||
};
|
||||
|
@ -43,23 +43,27 @@ TranscoderOptionsAAC::~TranscoderOptionsAAC() {
|
||||
}
|
||||
|
||||
void TranscoderOptionsAAC::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).toInt() / 1000);
|
||||
ui_->profile->setCurrentIndex(s.value("profile", 2).toInt() - 1);
|
||||
ui_->tns->setChecked(s.value("tns", false).toBool());
|
||||
ui_->midside->setChecked(s.value("midside", true).toBool());
|
||||
ui_->shortctl->setCurrentIndex(s.value("shortctl", 0).toInt());
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsAAC::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
s.setValue("profile", ui_->profile->currentIndex() + 1);
|
||||
s.setValue("tns", ui_->tns->isChecked());
|
||||
s.setValue("midside", ui_->midside->isChecked());
|
||||
s.setValue("shortctl", ui_->shortctl->currentIndex());
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ void TranscoderOptionsASF::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).toInt() / 1000);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ void TranscoderOptionsASF::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
@ -75,21 +75,27 @@ TranscoderOptionsDialog::~TranscoderOptionsDialog() {
|
||||
}
|
||||
|
||||
void TranscoderOptionsDialog::showEvent(QShowEvent *e) {
|
||||
|
||||
Q_UNUSED(e);
|
||||
if (options_) {
|
||||
options_->Load();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsDialog::accept() {
|
||||
|
||||
if (options_) {
|
||||
options_->Save();
|
||||
}
|
||||
QDialog::accept();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsDialog::set_settings_postfix(const QString &settings_postfix) {
|
||||
|
||||
if (options_) {
|
||||
options_->settings_postfix_ = settings_postfix;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -43,15 +43,19 @@ TranscoderOptionsFLAC::~TranscoderOptionsFLAC() {
|
||||
}
|
||||
|
||||
void TranscoderOptionsFLAC::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
ui_->quality->setValue(s.value("quality", 5).toInt());
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsFLAC::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
s.setValue("quality", ui_->quality->value());
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
@ -56,7 +56,8 @@ void TranscoderOptionsMP3::Load() {
|
||||
|
||||
if (s.value("target", 1).toInt() == 0) {
|
||||
ui_->target_quality->setChecked(true);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ui_->target_bitrate->setChecked(true);
|
||||
}
|
||||
|
||||
@ -66,6 +67,8 @@ void TranscoderOptionsMP3::Load() {
|
||||
ui_->encoding_engine_quality->setCurrentIndex(s.value("encoding-engine-quality", 1).toInt());
|
||||
ui_->mono->setChecked(s.value("mono", false).toBool());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsMP3::Save() {
|
||||
@ -80,6 +83,8 @@ void TranscoderOptionsMP3::Save() {
|
||||
s.setValue("encoding-engine-quality", ui_->encoding_engine_quality->currentIndex());
|
||||
s.setValue("mono", ui_->mono->isChecked());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsMP3::QualitySliderChanged(int value) {
|
||||
|
@ -44,15 +44,19 @@ TranscoderOptionsOpus::~TranscoderOptionsOpus() {
|
||||
}
|
||||
|
||||
void TranscoderOptionsOpus::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).toInt() / 1000);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsOpus::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ void TranscoderOptionsSpeex::Load() {
|
||||
ui_->complexity->setValue(s.value("complexity", 3).toInt());
|
||||
ui_->nframes->setValue(s.value("nframes", 1).toInt());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsSpeex::Save() {
|
||||
@ -77,4 +79,6 @@ void TranscoderOptionsSpeex::Save() {
|
||||
s.setValue("complexity", ui_->complexity->value());
|
||||
s.setValue("nframes", ui_->nframes->value());
|
||||
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ void TranscoderOptionsVorbis::Load() {
|
||||
ui_->min_bitrate_slider->setValue(min_bitrate);
|
||||
ui_->bitrate_slider->setValue(bitrate);
|
||||
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsVorbis::Save() {
|
||||
@ -85,4 +87,6 @@ void TranscoderOptionsVorbis::Save() {
|
||||
s.setValue("min-bitrate", min_bitrate);
|
||||
s.setValue("max-bitrate", max_bitrate);
|
||||
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
@ -39,13 +39,17 @@ TranscoderOptionsWavPack::~TranscoderOptionsWavPack() {
|
||||
}
|
||||
|
||||
void TranscoderOptionsWavPack::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsWavPack::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user