1
/* This file is part of Clementine.
2
Copyright 2010, David Sansome <me@davidsansome.com>
4
Clementine is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
9
Clementine is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
18
#include "transcoderoptionsvorbis.h"
19
#include "ui_transcoderoptionsvorbis.h"
23
const char* TranscoderOptionsVorbis::kSettingsGroup = "Transcoder/vorbisenc";
25
TranscoderOptionsVorbis::TranscoderOptionsVorbis(QWidget* parent)
26
: TranscoderOptionsInterface(parent),
27
ui_(new Ui_TranscoderOptionsVorbis)
32
TranscoderOptionsVorbis::~TranscoderOptionsVorbis() {
36
void TranscoderOptionsVorbis::Load() {
38
s.beginGroup(kSettingsGroup);
40
#define GET_BITRATE(variable, property) \
41
int variable = s.value(property, -1).toInt(); \
42
variable = variable == -1 ? 0 : variable / 1000
44
GET_BITRATE(bitrate, "bitrate");
45
GET_BITRATE(min_bitrate, "min-bitrate");
46
GET_BITRATE(max_bitrate, "max-bitrate");
49
ui_->quality_slider->setValue(s.value("quality", 0.3).toDouble() * 10);
50
ui_->managed->setChecked(s.value("managed", false).toBool());
51
ui_->max_bitrate_slider->setValue(max_bitrate);
52
ui_->min_bitrate_slider->setValue(min_bitrate);
53
ui_->bitrate_slider->setValue(bitrate);
56
void TranscoderOptionsVorbis::Save() {
58
s.beginGroup(kSettingsGroup);
60
#define GET_BITRATE(variable, ui_slider) \
61
int variable = ui_slider->value(); \
62
variable = variable == 0 ? -1 : variable * 1000
64
GET_BITRATE(bitrate, ui_->bitrate_slider);
65
GET_BITRATE(min_bitrate, ui_->min_bitrate_slider);
66
GET_BITRATE(max_bitrate, ui_->max_bitrate_slider);
69
s.setValue("quality", double(ui_->quality_slider->value()) / 10);
70
s.setValue("managed", ui_->managed->isChecked());
71
s.setValue("bitrate", bitrate);
72
s.setValue("min-bitrate", min_bitrate);
73
s.setValue("max-bitrate", max_bitrate);