Add a load of options to the transcoders. Fixes issue 415.

This commit is contained in:
David Sansome 2011-04-16 23:04:15 +00:00
parent 9030c5a49e
commit 5ed1fcd5e1
33 changed files with 2436 additions and 12 deletions

View File

@ -305,5 +305,6 @@
<file>providers/musicbrainz.png</file>
<file>last.fm/as_disabled.png</file>
<file>last.fm/as_light.png</file>
<file>icons/32x32/tools-wizard.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -215,6 +215,13 @@ set(SOURCES
transcoder/transcodedialog.cpp
transcoder/transcoder.cpp
transcoder/transcoderoptionsaac.cpp
transcoder/transcoderoptionsdialog.cpp
transcoder/transcoderoptionsflac.cpp
transcoder/transcoderoptionsmp3.cpp
transcoder/transcoderoptionsspeex.cpp
transcoder/transcoderoptionsvorbis.cpp
transcoder/transcoderoptionswma.cpp
ui/about.cpp
ui/addstreamdialog.cpp
@ -407,6 +414,8 @@ set(HEADERS
transcoder/transcodedialog.h
transcoder/transcoder.h
transcoder/transcoderoptionsdialog.h
transcoder/transcoderoptionsmp3.h
ui/about.h
ui/addstreamdialog.h
@ -489,6 +498,13 @@ set(UI
transcoder/transcodedialog.ui
transcoder/transcodelogdialog.ui
transcoder/transcoderoptionsaac.ui
transcoder/transcoderoptionsdialog.ui
transcoder/transcoderoptionsflac.ui
transcoder/transcoderoptionsmp3.ui
transcoder/transcoderoptionsspeex.ui
transcoder/transcoderoptionsvorbis.ui
transcoder/transcoderoptionswma.ui
ui/about.ui
ui/addstreamdialog.ui

View File

@ -17,6 +17,7 @@
#include "transcodedialog.h"
#include "transcoder.h"
#include "transcoderoptionsdialog.h"
#include "ui_transcodedialog.h"
#include "ui_transcodelogdialog.h"
#include "ui/mainwindow.h"
@ -97,6 +98,7 @@ TranscodeDialog::TranscodeDialog(QWidget *parent)
connect(cancel_button_, SIGNAL(clicked()), SLOT(Cancel()));
connect(close_button_, SIGNAL(clicked()), SLOT(hide()));
connect(ui_->details, SIGNAL(clicked()), log_dialog_, SLOT(show()));
connect(ui_->options, SIGNAL(clicked()), SLOT(Options()));
connect(transcoder_, SIGNAL(JobComplete(QString,bool)), SLOT(JobComplete(QString,bool)));
connect(transcoder_, SIGNAL(LogLine(QString)), SLOT(LogLine(QString)));
@ -243,3 +245,13 @@ void TranscodeDialog::timerEvent(QTimerEvent* e) {
UpdateProgress();
}
}
void TranscodeDialog::Options() {
TranscoderPreset preset = ui_->format->itemData(
ui_->format->currentIndex()).value<TranscoderPreset>();
TranscoderOptionsDialog dialog(preset.type_, this);
if (dialog.is_valid()) {
dialog.exec();
}
}

View File

@ -48,6 +48,7 @@ class TranscodeDialog : public QDialog {
void JobComplete(const QString& filename, bool success);
void LogLine(const QString& message);
void AllJobsComplete();
void Options();
private:
void SetWorking(bool working);

View File

@ -14,7 +14,7 @@
<string>Transcode Music</string>
</property>
<property name="windowIcon">
<iconset resource="../../data/data.qrc">
<iconset>
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -104,7 +104,25 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="format"/>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="format">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="options">
<property name="text">
<string>Options...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
@ -178,8 +196,6 @@
<tabstop>destination</tabstop>
<tabstop>button_box</tabstop>
</tabstops>
<resources>
<include location="../../data/data.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

View File

@ -20,6 +20,7 @@
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QSettings>
#include <QThread>
#include <QtDebug>
@ -60,6 +61,8 @@ GstElement* Transcoder::CreateElement(const QString &factory_name,
tr("Could not create the GStreamer element \"%1\" -"
" make sure you have all the required GStreamer plugins installed")
.arg(factory_name));
} else {
SetElementProperties(factory_name, G_OBJECT(ret));
}
return ret;
@ -146,8 +149,6 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type,
if (best.name_ == "lamemp3enc") {
// Special case: we need to add xingmux and id3v2mux to the pipeline when
// using lamemp3enc because it doesn't write the VBR or ID3v2 headers itself.
// We also turn off VBR since it isn't compatible with some music players.
// TODO: Should make settings like these configurable.
LogLine("Adding xingmux and id3v2mux to the pipeline");
@ -164,10 +165,6 @@ GstElement* Transcoder::CreateElementForMimeType(const QString& element_type,
return NULL;
}
// Configure the lame element
g_object_set(G_OBJECT(lame), "target", 1, NULL); // 1 == bitrate
g_object_set(G_OBJECT(lame), "cbr", true, NULL);
// Link the elements together
gst_element_link_many(lame, xing, id3v2, NULL);
@ -210,6 +207,17 @@ Transcoder::Transcoder(QObject* parent)
{
if (JobFinishedEvent::sEventType == -1)
JobFinishedEvent::sEventType = QEvent::registerEventType();
// Initialise some settings for the lamemp3enc element.
QSettings s;
s.beginGroup("Transcoder/lamemp3enc");
if (s.value("target").isNull()) {
s.setValue("target", 1); // 1 == bitrate
}
if (s.value("cbr").isNull()) {
s.setValue("cbr", true);
}
}
QList<TranscoderPreset> Transcoder::GetAllPresets() {
@ -535,3 +543,32 @@ QMap<QString, float> Transcoder::GetProgress() const {
return ret;
}
void Transcoder::SetElementProperties(const QString& name, GObject* object) {
QSettings s;
s.beginGroup("Transcoder/" + name);
guint properties_count = 0;
GParamSpec** properties = g_object_class_list_properties(
G_OBJECT_GET_CLASS(object), &properties_count);
for (int i=0 ; i<properties_count ; ++i) {
GParamSpec* property = properties[i];
const QVariant value = s.value(property->name);
if (value.isNull())
continue;
LogLine(QString("Setting %1 property: %2 = %3").arg(name, property->name, value.toString()));
switch (property->value_type) {
case G_TYPE_DOUBLE: g_object_set(object, property->name, value.toDouble(), NULL); break;
case G_TYPE_FLOAT: g_object_set(object, property->name, value.toFloat(), NULL); break;
case G_TYPE_BOOLEAN: g_object_set(object, property->name, value.toInt(), NULL); break;
case G_TYPE_INT:
default: g_object_set(object, property->name, value.toInt(), NULL); break;
}
}
g_free(properties);
}

View File

@ -129,6 +129,7 @@ class Transcoder : public QObject {
GstElement* CreateElementForMimeType(const QString& element_type,
const QString& mime_type,
GstElement* bin = NULL);
void SetElementProperties(const QString& name, GObject* element);
static void NewPadCallback(GstElement*, GstPad* pad, gboolean, gpointer data);
static gboolean BusCallback(GstBus*, GstMessage* msg, gpointer data);

View File

@ -0,0 +1,56 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transcoderoptionsaac.h"
#include "ui_transcoderoptionsaac.h"
#include <QSettings>
const char* TranscoderOptionsAAC::kSettingsGroup = "Transcoder/faac";
TranscoderOptionsAAC::TranscoderOptionsAAC(QWidget* parent)
: TranscoderOptionsInterface(parent),
ui_(new Ui_TranscoderOptionsAAC)
{
ui_->setupUi(this);
}
TranscoderOptionsAAC::~TranscoderOptionsAAC() {
delete ui_;
}
void TranscoderOptionsAAC::Load() {
QSettings s;
s.beginGroup(kSettingsGroup);
ui_->bitrate_slider->setValue(s.value("bitrate", 128000).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());
}
void TranscoderOptionsAAC::Save() {
QSettings s;
s.beginGroup(kSettingsGroup);
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());
}

View File

@ -0,0 +1,39 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSAAC_H
#define TRANSCODEROPTIONSAAC_H
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsAAC;
class TranscoderOptionsAAC : public TranscoderOptionsInterface {
public:
TranscoderOptionsAAC(QWidget* parent = 0);
~TranscoderOptionsAAC();
void Load();
void Save();
private:
static const char* kSettingsGroup;
Ui_TranscoderOptionsAAC* ui_;
};
#endif // TRANSCODEROPTIONSAAC_H

View File

@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsAAC</class>
<widget class="QWidget" name="TranscoderOptionsAAC">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>344</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Bitrate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="bitrate_slider">
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="value">
<number>128</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bitrate_spinbox">
<property name="suffix">
<string> kbps</string>
</property>
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Profile</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="profile">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Main profile (MAIN)</string>
</property>
</item>
<item>
<property name="text">
<string>Low complexity profile (LC)</string>
</property>
</item>
<item>
<property name="text">
<string>Scalable sampling rate profile (SSR)</string>
</property>
</item>
<item>
<property name="text">
<string>Long term prediction profile (LTP)</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="tns">
<property name="text">
<string>Use temporal noise shaping</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="midside">
<property name="text">
<string>Allow mid/side encoding</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Block type</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="shortctl">
<item>
<property name="text">
<string>Normal block type</string>
</property>
</item>
<item>
<property name="text">
<string>No short blocks</string>
</property>
</item>
<item>
<property name="text">
<string>No long blocks</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>bitrate_slider</tabstop>
<tabstop>bitrate_spinbox</tabstop>
<tabstop>profile</tabstop>
<tabstop>shortctl</tabstop>
<tabstop>tns</tabstop>
<tabstop>midside</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>170</x>
<y>29</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>24</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>407</x>
<y>18</y>
</hint>
<hint type="destinationlabel">
<x>191</x>
<y>29</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,70 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transcoderoptionsaac.h"
#include "transcoderoptionsdialog.h"
#include "transcoderoptionsflac.h"
#include "transcoderoptionsmp3.h"
#include "transcoderoptionsspeex.h"
#include "transcoderoptionsvorbis.h"
#include "transcoderoptionswma.h"
#include "ui_transcoderoptionsdialog.h"
TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type, QWidget* parent)
: QDialog(parent),
ui_(new Ui_TranscoderOptionsDialog),
options_(NULL)
{
ui_->setupUi(this);
switch (type) {
case Song::Type_Flac:
case Song::Type_OggFlac: options_ = new TranscoderOptionsFlac(this); break;
case Song::Type_Mp4: options_ = new TranscoderOptionsAAC(this); break;
case Song::Type_Mpeg: options_ = new TranscoderOptionsMP3(this); break;
case Song::Type_OggVorbis: options_ = new TranscoderOptionsVorbis(this); break;
case Song::Type_OggSpeex: options_ = new TranscoderOptionsSpeex(this); break;
case Song::Type_Asf: options_ = new TranscoderOptionsWma(this); break;
default:
break;
}
if (options_) {
setWindowTitle(windowTitle() + " - " + Song::TextForFiletype(type));
options_->layout()->setContentsMargins(0, 0, 0, 0);
ui_->verticalLayout->insertWidget(0, options_);
resize(width(), minimumHeight());
}
}
TranscoderOptionsDialog::~TranscoderOptionsDialog() {
delete ui_;
}
void TranscoderOptionsDialog::showEvent(QShowEvent* e) {
if (options_) {
options_->Load();
}
}
void TranscoderOptionsDialog::accept() {
if (options_) {
options_->Save();
}
QDialog::accept();
}

View File

@ -0,0 +1,47 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSDIALOG_H
#define TRANSCODEROPTIONSDIALOG_H
#include <QDialog>
#include "transcoderoptionsinterface.h"
#include "core/song.h"
class Ui_TranscoderOptionsDialog;
class TranscoderOptionsDialog : public QDialog {
Q_OBJECT
public:
TranscoderOptionsDialog(Song::FileType type, QWidget* parent = 0);
~TranscoderOptionsDialog();
bool is_valid() const { return options_; }
void accept();
protected:
void showEvent(QShowEvent* e);
private:
Ui_TranscoderOptionsDialog* ui_;
TranscoderOptionsInterface* options_;
};
#endif // TRANSCODEROPTIONSDIALOG_H

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsDialog</class>
<widget class="QDialog" name="TranscoderOptionsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Transcoding options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>TranscoderOptionsDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>TranscoderOptionsDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,48 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transcoderoptionsflac.h"
#include "ui_transcoderoptionsflac.h"
#include <QSettings>
const char* TranscoderOptionsFlac::kSettingsGroup = "Transcoder/flacenc";
TranscoderOptionsFlac::TranscoderOptionsFlac(QWidget* parent)
: TranscoderOptionsInterface(parent),
ui_(new Ui_TranscoderOptionsFlac)
{
ui_->setupUi(this);
}
TranscoderOptionsFlac::~TranscoderOptionsFlac() {
delete ui_;
}
void TranscoderOptionsFlac::Load() {
QSettings s;
s.beginGroup(kSettingsGroup);
ui_->quality->setValue(s.value("quality", 5).toInt());
}
void TranscoderOptionsFlac::Save() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("quality", ui_->quality->value());
}

View File

@ -0,0 +1,39 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSFLAC_H
#define TRANSCODEROPTIONSFLAC_H
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsFlac;
class TranscoderOptionsFlac : public TranscoderOptionsInterface {
public:
TranscoderOptionsFlac(QWidget* parent = 0);
~TranscoderOptionsFlac();
void Load();
void Save();
private:
static const char* kSettingsGroup;
Ui_TranscoderOptionsFlac* ui_;
};
#endif // TRANSCODEROPTIONSFLAC_H

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsFlac</class>
<widget class="QWidget" name="TranscoderOptionsFlac">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>102</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Quality</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Fast</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="quality">
<property name="maximum">
<number>9</number>
</property>
<property name="value">
<number>5</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Best</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,32 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSINTERFACE_H
#define TRANSCODEROPTIONSINTERFACE_H
#include <QWidget>
class TranscoderOptionsInterface : public QWidget {
public:
TranscoderOptionsInterface(QWidget* parent) : QWidget(parent) {}
virtual ~TranscoderOptionsInterface() {}
virtual void Load() = 0;
virtual void Save() = 0;
};
#endif // TRANSCODEROPTIONSINTERFACE_H

View File

@ -0,0 +1,74 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transcoderoptionsmp3.h"
#include "ui_transcoderoptionsmp3.h"
#include <QSettings>
const char* TranscoderOptionsMP3::kSettingsGroup = "Transcoder/lamemp3enc";
TranscoderOptionsMP3::TranscoderOptionsMP3(QWidget* parent)
: TranscoderOptionsInterface(parent),
ui_(new Ui_TranscoderOptionsMP3)
{
ui_->setupUi(this);
connect(ui_->quality_slider, SIGNAL(valueChanged(int)), SLOT(QualitySliderChanged(int)));
connect(ui_->quality_spinbox, SIGNAL(valueChanged(double)), SLOT(QualitySpinboxChanged(double)));
}
TranscoderOptionsMP3::~TranscoderOptionsMP3() {
delete ui_;
}
void TranscoderOptionsMP3::Load() {
QSettings s;
s.beginGroup(kSettingsGroup);;
if (s.value("target", 1).toInt() == 0) {
ui_->target_quality->setChecked(true);
} else {
ui_->target_bitrate->setChecked(true);
}
ui_->quality_spinbox->setValue(s.value("quality", 4.0).toFloat());
ui_->bitrate_slider->setValue(s.value("bitrate", 128).toInt());
ui_->cbr->setChecked(s.value("cbr", true).toBool());
ui_->encoding_engine_quality->setCurrentIndex(s.value("encoding-engine-quality", 1).toInt());
ui_->mono->setChecked(s.value("mono", false).toBool());
}
void TranscoderOptionsMP3::Save() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("target", ui_->target_quality->isChecked() ? 0 : 1);
s.setValue("quality", ui_->quality_spinbox->value());
s.setValue("bitrate", ui_->bitrate_slider->value());
s.setValue("cbr", ui_->cbr->isChecked());
s.setValue("encoding-engine-quality", ui_->encoding_engine_quality->currentIndex());
s.setValue("mono", ui_->mono->isChecked());
}
void TranscoderOptionsMP3::QualitySliderChanged(int value) {
ui_->quality_spinbox->setValue(float(value) / 100);
}
void TranscoderOptionsMP3::QualitySpinboxChanged(double value) {
ui_->quality_slider->setValue(value * 100);
}

View File

@ -0,0 +1,45 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSMP3_H
#define TRANSCODEROPTIONSMP3_H
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsMP3;
class TranscoderOptionsMP3 : public TranscoderOptionsInterface {
Q_OBJECT
public:
TranscoderOptionsMP3(QWidget* parent = 0);
~TranscoderOptionsMP3();
void Load();
void Save();
private slots:
void QualitySliderChanged(int value);
void QualitySpinboxChanged(double value);
private:
static const char* kSettingsGroup;
Ui_TranscoderOptionsMP3* ui_;
};
#endif // TRANSCODEROPTIONSMP3_H

View File

@ -0,0 +1,291 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsMP3</class>
<widget class="QWidget" name="TranscoderOptionsMP3">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>557</width>
<height>486</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="target_quality">
<property name="text">
<string>Optimize for quality</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QWidget" name="widget" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>32</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Quality</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="quality_slider">
<property name="maximum">
<number>999</number>
</property>
<property name="value">
<number>400</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>100</number>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="quality_spinbox">
<property name="maximum">
<double>9.990000000000000</double>
</property>
<property name="value">
<double>4.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="target_bitrate">
<property name="text">
<string>Optimize for bitrate</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QWidget" name="widget_2" native="true">
<layout class="QFormLayout" name="formLayout">
<property name="leftMargin">
<number>32</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Bitrate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSlider" name="bitrate_slider">
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="value">
<number>128</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>32</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bitrate_spinbox">
<property name="suffix">
<string> kbps</string>
</property>
<property name="minimum">
<number>8</number>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="cbr">
<property name="text">
<string>Constant bitrate</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Encoding engine quality</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="encoding_engine_quality">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Fast</string>
</property>
</item>
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="mono">
<property name="text">
<string>Force mono encoding</string>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>target_quality</tabstop>
<tabstop>quality_slider</tabstop>
<tabstop>quality_spinbox</tabstop>
<tabstop>target_bitrate</tabstop>
<tabstop>bitrate_slider</tabstop>
<tabstop>bitrate_spinbox</tabstop>
<tabstop>cbr</tabstop>
<tabstop>encoding_engine_quality</tabstop>
<tabstop>mono</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>191</x>
<y>109</y>
</hint>
<hint type="destinationlabel">
<x>492</x>
<y>115</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>485</x>
<y>115</y>
</hint>
<hint type="destinationlabel">
<x>182</x>
<y>113</y>
</hint>
</hints>
</connection>
<connection>
<sender>target_quality</sender>
<signal>toggled(bool)</signal>
<receiver>widget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>65</x>
<y>23</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>49</y>
</hint>
</hints>
</connection>
<connection>
<sender>target_bitrate</sender>
<signal>toggled(bool)</signal>
<receiver>widget_2</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>46</x>
<y>87</y>
</hint>
<hint type="destinationlabel">
<x>22</x>
<y>122</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,64 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transcoderoptionsspeex.h"
#include "ui_transcoderoptionsspeex.h"
#include <QSettings>
const char* TranscoderOptionsSpeex::kSettingsGroup = "Transcoder/speexenc";
TranscoderOptionsSpeex::TranscoderOptionsSpeex(QWidget* parent)
: TranscoderOptionsInterface(parent),
ui_(new Ui_TranscoderOptionsSpeex)
{
ui_->setupUi(this);
}
TranscoderOptionsSpeex::~TranscoderOptionsSpeex() {
delete ui_;
}
void TranscoderOptionsSpeex::Load() {
QSettings s;
s.beginGroup(kSettingsGroup);
ui_->quality_slider->setValue(s.value("quality", 8).toInt());
ui_->bitrate_slider->setValue(s.value("bitrate", 0).toInt() / 1000);
ui_->mode->setCurrentIndex(s.value("mode", 0).toInt());
ui_->vbr->setChecked(s.value("vbr", false).toBool());
ui_->abr_slider->setValue(s.value("abr", 0).toInt() / 1000);
ui_->vad->setChecked(s.value("vad", false).toBool());
ui_->dtx->setChecked(s.value("dtx", false).toBool());
ui_->complexity->setValue(s.value("complexity", 3).toInt());
ui_->nframes->setValue(s.value("nframes", 1).toInt());
}
void TranscoderOptionsSpeex::Save() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("quality", ui_->quality_slider->value());
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
s.setValue("mode", ui_->mode->currentIndex());
s.setValue("vbr", ui_->vbr->isChecked());
s.setValue("abr", ui_->abr_slider->value() * 1000);
s.setValue("vad", ui_->vad->isChecked());
s.setValue("dtx", ui_->dtx->isChecked());
s.setValue("complexity", ui_->complexity->value());
s.setValue("nframes", ui_->nframes->value());
}

View File

@ -0,0 +1,39 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSSPEEX_H
#define TRANSCODEROPTIONSSPEEX_H
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsSpeex;
class TranscoderOptionsSpeex : public TranscoderOptionsInterface {
public:
TranscoderOptionsSpeex(QWidget* parent = 0);
~TranscoderOptionsSpeex();
void Load();
void Save();
private:
static const char* kSettingsGroup;
Ui_TranscoderOptionsSpeex* ui_;
};
#endif // TRANSCODEROPTIONSSPEEX_H

View File

@ -0,0 +1,353 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsSpeex</class>
<widget class="QWidget" name="TranscoderOptionsSpeex">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>555</width>
<height>424</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Quality</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSlider" name="quality_slider">
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>8</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="quality_spinbox">
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>8</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Bitrate</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="bitrate_slider">
<property name="maximum">
<number>320</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
<property name="pageStep">
<number>32</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bitrate_spinbox">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="specialValueText">
<string>automatic</string>
</property>
<property name="suffix">
<string> kbps</string>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Average bitrate</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSlider" name="abr_slider">
<property name="maximum">
<number>320</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
<property name="pageStep">
<number>32</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="abr_spinbox">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="specialValueText">
<string>disabled</string>
</property>
<property name="suffix">
<string> kbps</string>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="singleStep">
<number>8</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Encoding mode</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="mode">
<item>
<property name="text">
<string>Auto</string>
</property>
</item>
<item>
<property name="text">
<string>Ultra wide band (UWB)</string>
</property>
</item>
<item>
<property name="text">
<string>Wide band (WB)</string>
</property>
</item>
<item>
<property name="text">
<string>Narrow band (NB)</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="vbr">
<property name="text">
<string>Variable bit rate</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="vad">
<property name="text">
<string>Voice activity detection</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="dtx">
<property name="text">
<string>Discontinuous transmission</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Encoding complexity</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QSpinBox" name="complexity">
<property name="maximum">
<number>10000</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Frames per buffer</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="nframes">
<property name="maximum">
<number>10000</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>quality_slider</tabstop>
<tabstop>quality_spinbox</tabstop>
<tabstop>bitrate_slider</tabstop>
<tabstop>bitrate_spinbox</tabstop>
<tabstop>abr_slider</tabstop>
<tabstop>abr_spinbox</tabstop>
<tabstop>mode</tabstop>
<tabstop>vbr</tabstop>
<tabstop>vad</tabstop>
<tabstop>dtx</tabstop>
<tabstop>complexity</tabstop>
<tabstop>nframes</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>quality_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>quality_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>232</x>
<y>29</y>
</hint>
<hint type="destinationlabel">
<x>525</x>
<y>23</y>
</hint>
</hints>
</connection>
<connection>
<sender>quality_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>quality_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>517</x>
<y>25</y>
</hint>
<hint type="destinationlabel">
<x>248</x>
<y>31</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>185</x>
<y>66</y>
</hint>
<hint type="destinationlabel">
<x>445</x>
<y>51</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>471</x>
<y>68</y>
</hint>
<hint type="destinationlabel">
<x>214</x>
<y>56</y>
</hint>
</hints>
</connection>
<connection>
<sender>abr_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>abr_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>323</x>
<y>90</y>
</hint>
<hint type="destinationlabel">
<x>500</x>
<y>95</y>
</hint>
</hints>
</connection>
<connection>
<sender>abr_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>abr_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>493</x>
<y>84</y>
</hint>
<hint type="destinationlabel">
<x>339</x>
<y>94</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,74 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transcoderoptionsvorbis.h"
#include "ui_transcoderoptionsvorbis.h"
#include <QSettings>
const char* TranscoderOptionsVorbis::kSettingsGroup = "Transcoder/vorbisenc";
TranscoderOptionsVorbis::TranscoderOptionsVorbis(QWidget* parent)
: TranscoderOptionsInterface(parent),
ui_(new Ui_TranscoderOptionsVorbis)
{
ui_->setupUi(this);
}
TranscoderOptionsVorbis::~TranscoderOptionsVorbis() {
delete ui_;
}
void TranscoderOptionsVorbis::Load() {
QSettings s;
s.beginGroup(kSettingsGroup);
#define GET_BITRATE(variable, property) \
int variable = s.value(property, -1).toInt(); \
variable = variable == -1 ? 0 : variable / 1000
GET_BITRATE(bitrate, "bitrate");
GET_BITRATE(min_bitrate, "min-bitrate");
GET_BITRATE(max_bitrate, "max-bitrate");
#undef GET_BITRATE
ui_->quality_slider->setValue(s.value("quality", 0.3).toDouble() * 10);
ui_->managed->setChecked(s.value("managed", false).toBool());
ui_->max_bitrate_slider->setValue(max_bitrate);
ui_->min_bitrate_slider->setValue(min_bitrate);
ui_->bitrate_slider->setValue(bitrate);
}
void TranscoderOptionsVorbis::Save() {
QSettings s;
s.beginGroup(kSettingsGroup);
#define GET_BITRATE(variable, ui_slider) \
int variable = ui_slider->value(); \
variable = variable == 0 ? -1 : variable * 1000
GET_BITRATE(bitrate, ui_->bitrate_slider);
GET_BITRATE(min_bitrate, ui_->min_bitrate_slider);
GET_BITRATE(max_bitrate, ui_->max_bitrate_slider);
#undef GET_BITRATE
s.setValue("quality", double(ui_->quality_slider->value()) / 10);
s.setValue("managed", ui_->managed->isChecked());
s.setValue("bitrate", bitrate);
s.setValue("min-bitrate", min_bitrate);
s.setValue("max-bitrate", max_bitrate);
}

View File

@ -0,0 +1,39 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSVORBIS_H
#define TRANSCODEROPTIONSVORBIS_H
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsVorbis;
class TranscoderOptionsVorbis : public TranscoderOptionsInterface {
public:
TranscoderOptionsVorbis(QWidget* parent = 0);
~TranscoderOptionsVorbis();
void Load();
void Save();
private:
static const char* kSettingsGroup;
Ui_TranscoderOptionsVorbis* ui_;
};
#endif // TRANSCODEROPTIONSVORBIS_H

View File

@ -0,0 +1,365 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsVorbis</class>
<widget class="QWidget" name="TranscoderOptionsVorbis">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Quality</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QSlider" name="quality_slider">
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>3</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition">
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="quality_spinbox">
<property name="minimum">
<number>-1</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>3</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="managed">
<property name="text">
<string>Use bitrate management engine</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QWidget" name="widget" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="leftMargin">
<number>32</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Target bitrate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="bitrate_slider">
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>128</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bitrate_spinbox">
<property name="suffix">
<string> kbps</string>
</property>
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Minimum bitrate</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSlider" name="min_bitrate_slider">
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="min_bitrate_spinbox">
<property name="specialValueText">
<string>disabled</string>
</property>
<property name="suffix">
<string> kbps</string>
</property>
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Maximum bitrate</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QSlider" name="max_bitrate_slider">
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="max_bitrate_spinbox">
<property name="specialValueText">
<string>disabled</string>
</property>
<property name="suffix">
<string> kbps</string>
</property>
<property name="maximum">
<number>250</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>quality_slider</tabstop>
<tabstop>quality_spinbox</tabstop>
<tabstop>managed</tabstop>
<tabstop>bitrate_slider</tabstop>
<tabstop>bitrate_spinbox</tabstop>
<tabstop>min_bitrate_slider</tabstop>
<tabstop>min_bitrate_spinbox</tabstop>
<tabstop>max_bitrate_slider</tabstop>
<tabstop>max_bitrate_spinbox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>quality_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>quality_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>176</x>
<y>29</y>
</hint>
<hint type="destinationlabel">
<x>365</x>
<y>31</y>
</hint>
</hints>
</connection>
<connection>
<sender>quality_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>quality_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>358</x>
<y>19</y>
</hint>
<hint type="destinationlabel">
<x>136</x>
<y>29</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>255</x>
<y>83</y>
</hint>
<hint type="destinationlabel">
<x>344</x>
<y>88</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>341</x>
<y>77</y>
</hint>
<hint type="destinationlabel">
<x>244</x>
<y>80</y>
</hint>
</hints>
</connection>
<connection>
<sender>min_bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>min_bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>324</x>
<y>122</y>
</hint>
<hint type="destinationlabel">
<x>265</x>
<y>115</y>
</hint>
</hints>
</connection>
<connection>
<sender>min_bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>min_bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>217</x>
<y>122</y>
</hint>
<hint type="destinationlabel">
<x>347</x>
<y>124</y>
</hint>
</hints>
</connection>
<connection>
<sender>max_bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>max_bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>278</x>
<y>157</y>
</hint>
<hint type="destinationlabel">
<x>323</x>
<y>155</y>
</hint>
</hints>
</connection>
<connection>
<sender>max_bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>max_bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>344</x>
<y>166</y>
</hint>
<hint type="destinationlabel">
<x>216</x>
<y>155</y>
</hint>
</hints>
</connection>
<connection>
<sender>managed</sender>
<signal>toggled(bool)</signal>
<receiver>widget</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>55</x>
<y>58</y>
</hint>
<hint type="destinationlabel">
<x>25</x>
<y>86</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,48 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#include "transcoderoptionswma.h"
#include "ui_transcoderoptionswma.h"
#include <QSettings>
const char* TranscoderOptionsWma::kSettingsGroup = "Transcoder/ffenc_wmav2";
TranscoderOptionsWma::TranscoderOptionsWma(QWidget* parent)
: TranscoderOptionsInterface(parent),
ui_(new Ui_TranscoderOptionsWma)
{
ui_->setupUi(this);
}
TranscoderOptionsWma::~TranscoderOptionsWma() {
delete ui_;
}
void TranscoderOptionsWma::Load() {
QSettings s;
s.beginGroup(kSettingsGroup);
ui_->bitrate_slider->setValue(s.value("bitrate", 128000).toInt() / 1000);
}
void TranscoderOptionsWma::Save() {
QSettings s;
s.beginGroup(kSettingsGroup);
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
}

View File

@ -0,0 +1,39 @@
/* This file is part of Clementine.
Copyright 2010, David Sansome <me@davidsansome.com>
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRANSCODEROPTIONSWMA_H
#define TRANSCODEROPTIONSWMA_H
#include "transcoderoptionsinterface.h"
class Ui_TranscoderOptionsWma;
class TranscoderOptionsWma : public TranscoderOptionsInterface {
public:
TranscoderOptionsWma(QWidget* parent = 0);
~TranscoderOptionsWma();
void Load();
void Save();
private:
static const char* kSettingsGroup;
Ui_TranscoderOptionsWma* ui_;
};
#endif // TRANSCODEROPTIONSWMA_H

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TranscoderOptionsWma</class>
<widget class="QWidget" name="TranscoderOptionsWma">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Bitrate</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="bitrate_slider">
<property name="maximum">
<number>320</number>
</property>
<property name="value">
<number>128</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bitrate_spinbox">
<property name="suffix">
<string> kbps</string>
</property>
<property name="maximum">
<number>320</number>
</property>
<property name="value">
<number>128</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>bitrate_slider</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_spinbox</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>166</x>
<y>25</y>
</hint>
<hint type="destinationlabel">
<x>323</x>
<y>24</y>
</hint>
</hints>
</connection>
<connection>
<sender>bitrate_spinbox</sender>
<signal>valueChanged(int)</signal>
<receiver>bitrate_slider</receiver>
<slot>setValue(int)</slot>
<hints>
<hint type="sourcelabel">
<x>325</x>
<y>14</y>
</hint>
<hint type="destinationlabel">
<x>190</x>
<y>31</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -145,6 +145,7 @@ SettingsDialog::SettingsDialog(BackgroundStreams* streams, QWidget* parent)
ui_->list->item(Page_Library)->setIcon(IconLoader::Load("folder-sound"));
ui_->list->item(Page_BackgroundStreams)->setIcon(QIcon(":/icons/32x32/weather-showers-scattered.png"));
ui_->list->item(Page_Proxy)->setIcon(IconLoader::Load("applications-internet"));
ui_->list->item(Page_Transcoding)->setIcon(IconLoader::Load("tools-wizard"));
AddStreams();
@ -438,6 +439,14 @@ void SettingsDialog::accept() {
s.setValue("password", ui_->proxy_password->text());
s.endGroup();
// Transcoding
ui_->transcoding_aac->Save();
ui_->transcoding_flac->Save();
ui_->transcoding_mp3->Save();
ui_->transcoding_speex->Save();
ui_->transcoding_vorbis->Save();
ui_->transcoding_wma->Save();
ui_->library_config->Save();
ui_->magnatune->Save();
ui_->global_shortcuts->Save();
@ -629,6 +638,14 @@ void SettingsDialog::showEvent(QShowEvent*) {
ui_->proxy_password->setText(s.value("password").toString());
s.endGroup();
// Transcoding
ui_->transcoding_aac->Load();
ui_->transcoding_flac->Load();
ui_->transcoding_mp3->Load();
ui_->transcoding_speex->Load();
ui_->transcoding_vorbis->Load();
ui_->transcoding_wma->Load();
loading_settings_ = false;
}

View File

@ -67,6 +67,7 @@ class SettingsDialog : public QDialog {
Page_Magnatune,
Page_BackgroundStreams,
Page_Proxy,
Page_Transcoding,
#ifdef HAVE_REMOTE
Page_Remote,
#endif

View File

@ -103,6 +103,11 @@
<string>Network Proxy</string>
</property>
</item>
<item>
<property name="text">
<string>Transcoding</string>
</property>
</item>
</widget>
</item>
<item>
@ -120,7 +125,7 @@
<item>
<widget class="QStackedWidget" name="stacked_widget">
<property name="currentIndex">
<number>1</number>
<number>9</number>
</property>
<widget class="QWidget" name="playback_page">
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -1104,6 +1109,123 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="transcoding_page">
<layout class="QVBoxLayout" name="verticalLayout_19">
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>These settings are used in the &quot;Transcode Music&quot; dialog, and when converting music before copying it to a device.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>MP3</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_20">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="TranscoderOptionsMP3" name="transcoding_mp3" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Vorbis</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_25">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="TranscoderOptionsVorbis" name="transcoding_vorbis" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>FLAC</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_24">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="TranscoderOptionsFlac" name="transcoding_flac" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Speex</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_23">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="TranscoderOptionsSpeex" name="transcoding_speex" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_5">
<attribute name="title">
<string>AAC</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_22">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="TranscoderOptionsAAC" name="transcoding_aac" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_6">
<attribute name="title">
<string>WMA</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_21">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="TranscoderOptionsWma" name="transcoding_wma" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
@ -1159,6 +1281,42 @@
<header>songinfo/lyricsettings.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsMP3</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionsmp3.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsVorbis</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionsvorbis.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsSpeex</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionsspeex.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsAAC</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionsaac.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsFlac</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionsflac.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>TranscoderOptionsWma</class>
<extends>QWidget</extends>
<header>transcoder/transcoderoptionswma.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>list</tabstop>