mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-18 12:32:09 +01:00
transcoder: Apply transcoder option fixes to settings page
Dynamically add tabs to the transcoder settings page. Use the same mechanism that is used in the options dialog to select an options page based on the best encoder element for a mime type.
This commit is contained in:
parent
79d81283a8
commit
e84f87f625
@ -17,6 +17,8 @@
|
||||
|
||||
#include "transcodersettingspage.h"
|
||||
|
||||
#include "transcoder.h"
|
||||
#include "transcoderoptionsdialog.h"
|
||||
#include "ui/iconloader.h"
|
||||
#include "ui_transcodersettingspage.h"
|
||||
|
||||
@ -24,26 +26,44 @@ TranscoderSettingsPage::TranscoderSettingsPage(SettingsDialog* dialog)
|
||||
: SettingsPage(dialog), ui_(new Ui_TranscoderSettingsPage) {
|
||||
ui_->setupUi(this);
|
||||
setWindowIcon(IconLoader::Load("tools-wizard", IconLoader::Base));
|
||||
|
||||
AddTab(tr("FLAC"), Transcoder::Codec_Flac);
|
||||
AddTab(tr("AAC"), Transcoder::Codec_Mp4);
|
||||
AddTab(tr("MP3"), Transcoder::Codec_Mp3);
|
||||
AddTab(tr("Vorbis"), Transcoder::Codec_Vorbis);
|
||||
AddTab(tr("Speex"), Transcoder::Codec_Speex);
|
||||
AddTab(tr("Opus"), Transcoder::Codec_Opus);
|
||||
AddTab(tr("WMA"), Transcoder::Codec_Wma);
|
||||
}
|
||||
|
||||
TranscoderSettingsPage::~TranscoderSettingsPage() { delete ui_; }
|
||||
|
||||
void TranscoderSettingsPage::AddTab(const QString& label,
|
||||
Transcoder::CodecType codec) {
|
||||
const QString mime_type = Transcoder::MimeType(codec);
|
||||
|
||||
TranscoderOptionsInterface* tab =
|
||||
TranscoderOptionsDialog::MakeOptionsPage(mime_type);
|
||||
options_pages_ << tab;
|
||||
|
||||
// Insert in localized alphabetical order
|
||||
for (int i = 0; i < ui_->optionTabs->count(); i++) {
|
||||
if (label.localeAwareCompare(ui_->optionTabs->tabText(i)) < 0) {
|
||||
ui_->optionTabs->insertTab(i, tab, label);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ui_->optionTabs->addTab(tab, label);
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::Load() {
|
||||
ui_->transcoding_aac->Load();
|
||||
ui_->transcoding_flac->Load();
|
||||
ui_->transcoding_mp3->Load();
|
||||
ui_->transcoding_speex->Load();
|
||||
ui_->transcoding_vorbis->Load();
|
||||
ui_->transcoding_wma->Load();
|
||||
ui_->transcoding_opus->Load();
|
||||
for (TranscoderOptionsInterface* options : options_pages_) {
|
||||
options->Load();
|
||||
}
|
||||
}
|
||||
|
||||
void TranscoderSettingsPage::Save() {
|
||||
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_->transcoding_opus->Save();
|
||||
for (TranscoderOptionsInterface* options : options_pages_) {
|
||||
options->Save();
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,10 @@
|
||||
#ifndef TRANSCODERSETTINGSPAGE_H
|
||||
#define TRANSCODERSETTINGSPAGE_H
|
||||
|
||||
#include "transcoder.h"
|
||||
#include "ui/settingspage.h"
|
||||
|
||||
class TranscoderOptionsInterface;
|
||||
class Ui_TranscoderSettingsPage;
|
||||
|
||||
class TranscoderSettingsPage : public SettingsPage {
|
||||
@ -33,7 +35,9 @@ class TranscoderSettingsPage : public SettingsPage {
|
||||
void Save();
|
||||
|
||||
private:
|
||||
void AddTab(const QString& label, Transcoder::CodecType mime_type);
|
||||
Ui_TranscoderSettingsPage* ui_;
|
||||
QList<TranscoderOptionsInterface*> options_pages_;
|
||||
};
|
||||
|
||||
#endif // TRANSCODERSETTINGSPAGE_H
|
||||
|
@ -25,170 +25,14 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<widget class="QTabWidget" name="optionTabs">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>-1</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 class="QWidget" name="tab_7">
|
||||
<attribute name="title">
|
||||
<string>Opus</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_26">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TranscoderOptionsOpus" name="transcoding_opus" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<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>
|
||||
<customwidget>
|
||||
<class>TranscoderOptionsOpus</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>transcoder/transcoderoptionsopus.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user