Only save settings that has been changed
This commit is contained in:
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user