2011-08-14 01:07:10 +02:00
|
|
|
/* 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 "transcodersettingspage.h"
|
2020-09-18 16:15:19 +02:00
|
|
|
|
2021-02-05 08:59:12 +01:00
|
|
|
#include "transcoder.h"
|
|
|
|
#include "transcoderoptionsdialog.h"
|
2011-08-14 01:07:10 +02:00
|
|
|
#include "ui/iconloader.h"
|
2020-09-18 16:15:19 +02:00
|
|
|
#include "ui_transcodersettingspage.h"
|
2011-08-14 01:07:10 +02:00
|
|
|
|
|
|
|
TranscoderSettingsPage::TranscoderSettingsPage(SettingsDialog* dialog)
|
2014-02-07 16:34:20 +01:00
|
|
|
: SettingsPage(dialog), ui_(new Ui_TranscoderSettingsPage) {
|
2011-08-14 01:07:10 +02:00
|
|
|
ui_->setupUi(this);
|
2015-10-14 03:01:08 +02:00
|
|
|
setWindowIcon(IconLoader::Load("tools-wizard", IconLoader::Base));
|
2021-02-05 08:59:12 +01:00
|
|
|
|
|
|
|
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);
|
2011-08-14 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
TranscoderSettingsPage::~TranscoderSettingsPage() { delete ui_; }
|
2011-08-14 01:07:10 +02:00
|
|
|
|
2021-02-05 08:59:12 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-08-14 01:07:10 +02:00
|
|
|
void TranscoderSettingsPage::Load() {
|
2021-02-05 08:59:12 +01:00
|
|
|
for (TranscoderOptionsInterface* options : options_pages_) {
|
|
|
|
options->Load();
|
|
|
|
}
|
2011-08-14 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void TranscoderSettingsPage::Save() {
|
2021-02-05 08:59:12 +01:00
|
|
|
for (TranscoderOptionsInterface* options : options_pages_) {
|
|
|
|
options->Save();
|
|
|
|
}
|
2011-08-14 01:07:10 +02:00
|
|
|
}
|