Disable automatic conversions from 8-bit strings
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
|
||||
#include "core/iconloader.h"
|
||||
#include "core/mainwindow.h"
|
||||
#include "core/settings.h"
|
||||
#include "utilities/screenutils.h"
|
||||
#include "widgets/fileview.h"
|
||||
#include "transcodedialog.h"
|
||||
@@ -71,8 +72,11 @@
|
||||
#endif
|
||||
|
||||
const char *TranscodeDialog::kSettingsGroup = "Transcoder";
|
||||
const int TranscodeDialog::kProgressInterval = 500;
|
||||
const int TranscodeDialog::kMaxDestinationItems = 10;
|
||||
|
||||
namespace {
|
||||
constexpr int kProgressInterval = 500;
|
||||
constexpr int kMaxDestinationItems = 10;
|
||||
}
|
||||
|
||||
static bool ComparePresetsByName(const TranscoderPreset &left, const TranscoderPreset &right) {
|
||||
return left.name_ < right.name_;
|
||||
@@ -107,11 +111,11 @@ TranscodeDialog::TranscodeDialog(QMainWindow *mainwindow, QWidget *parent)
|
||||
}
|
||||
|
||||
// Load settings
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
last_add_dir_ = s.value("last_add_dir", QDir::homePath()).toString();
|
||||
last_import_dir_ = s.value("last_import_dir", QDir::homePath()).toString();
|
||||
QString last_output_format = s.value("last_output_format", "audio/x-vorbis").toString();
|
||||
QString last_output_format = s.value("last_output_format", QStringLiteral("audio/x-vorbis")).toString();
|
||||
s.endGroup();
|
||||
|
||||
for (int i = 0; i < ui_->format->count(); ++i) {
|
||||
@@ -186,7 +190,7 @@ void TranscodeDialog::reject() {
|
||||
|
||||
void TranscodeDialog::LoadGeometry() {
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
if (s.contains("geometry")) {
|
||||
restoreGeometry(s.value("geometry").toByteArray());
|
||||
@@ -200,7 +204,7 @@ void TranscodeDialog::LoadGeometry() {
|
||||
|
||||
void TranscodeDialog::SaveGeometry() {
|
||||
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("geometry", saveGeometry());
|
||||
s.endGroup();
|
||||
@@ -253,7 +257,7 @@ void TranscodeDialog::Start() {
|
||||
transcoder_->Start();
|
||||
|
||||
// Save the last output format
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("last_output_format", preset.codec_mimetype_);
|
||||
s.endGroup();
|
||||
@@ -299,15 +303,15 @@ void TranscodeDialog::UpdateStatusText() {
|
||||
QStringList sections;
|
||||
|
||||
if (queued_) {
|
||||
sections << "<font color=\"#3467c8\">" + tr("%n remaining", "", queued_) + "</font>";
|
||||
sections << QStringLiteral("<font color=\"#3467c8\">") + tr("%n remaining", "", queued_) + QStringLiteral("</font>");
|
||||
}
|
||||
|
||||
if (finished_success_) {
|
||||
sections << "<font color=\"#02b600\">" + tr("%n finished", "", finished_success_) + "</font>";
|
||||
sections << QStringLiteral("<font color=\"#02b600\">") + tr("%n finished", "", finished_success_) + QStringLiteral("</font>");
|
||||
}
|
||||
|
||||
if (finished_failed_) {
|
||||
sections << "<font color=\"#b60000\">" + tr("%n failed", "", finished_failed_) + "</font>";
|
||||
sections << QStringLiteral("<font color=\"#b60000\">") + tr("%n failed", "", finished_failed_) + QStringLiteral("</font>");
|
||||
}
|
||||
|
||||
ui_->progress_text->setText(sections.join(QStringLiteral(", ")));
|
||||
@@ -322,14 +326,14 @@ void TranscodeDialog::Add() {
|
||||
|
||||
QStringList filenames = QFileDialog::getOpenFileNames(
|
||||
this, tr("Add files to transcode"), last_add_dir_,
|
||||
QStringLiteral("%1 (%2);;%3").arg(tr("Music"), FileView::kFileFilter, tr(MainWindow::kAllFilesFilterSpec)));
|
||||
QStringLiteral("%1 (%2);;%3").arg(tr("Music"), QLatin1String(FileView::kFileFilter), tr(MainWindow::kAllFilesFilterSpec)));
|
||||
|
||||
if (filenames.isEmpty()) return;
|
||||
|
||||
SetFilenames(filenames);
|
||||
|
||||
last_add_dir_ = filenames[0];
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("last_add_dir", last_add_dir_);
|
||||
s.endGroup();
|
||||
@@ -345,9 +349,9 @@ void TranscodeDialog::Import() {
|
||||
QStringList filenames;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
QStringList audioTypes = QString(FileView::kFileFilter).split(QStringLiteral(" "), Qt::SkipEmptyParts);
|
||||
QStringList audioTypes = QString::fromLatin1(FileView::kFileFilter).split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
#else
|
||||
QStringList audioTypes = QString(FileView::kFileFilter).split(" ", QString::SkipEmptyParts);
|
||||
QStringList audioTypes = QString::fromLatin1(FileView::kFileFilter).split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
#endif
|
||||
|
||||
QDirIterator files(path, audioTypes, QDir::Files | QDir::Readable, QDirIterator::Subdirectories);
|
||||
@@ -359,7 +363,7 @@ void TranscodeDialog::Import() {
|
||||
SetFilenames(filenames);
|
||||
|
||||
last_import_dir_ = path;
|
||||
QSettings s;
|
||||
Settings s;
|
||||
s.beginGroup(kSettingsGroup);
|
||||
s.setValue("last_import_dir", last_import_dir_);
|
||||
s.endGroup();
|
||||
@@ -369,8 +373,8 @@ void TranscodeDialog::Import() {
|
||||
void TranscodeDialog::SetFilenames(const QStringList &filenames) {
|
||||
|
||||
for (const QString &filename : filenames) {
|
||||
QString name = filename.section('/', -1, -1);
|
||||
QString path = filename.section('/', 0, -2);
|
||||
QString name = filename.section(QLatin1Char('/'), -1, -1);
|
||||
QString path = filename.section(QLatin1Char('/'), 0, -2);
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui_->files, QStringList() << name << path);
|
||||
item->setData(0, Qt::UserRole, filename);
|
||||
@@ -438,7 +442,7 @@ void TranscodeDialog::AddDestination() {
|
||||
|
||||
// Returns the rightmost non-empty part of 'path'.
|
||||
QString TranscodeDialog::TrimPath(const QString &path) {
|
||||
return path.section('/', -1, -1, QString::SectionSkipEmpty);
|
||||
return path.section(QLatin1Char('/'), -1, -1, QString::SectionSkipEmpty);
|
||||
}
|
||||
|
||||
QString TranscodeDialog::GetOutputFileName(const QString &input_filepath, const TranscoderPreset &preset) const {
|
||||
@@ -447,12 +451,12 @@ QString TranscodeDialog::GetOutputFileName(const QString &input_filepath, const
|
||||
QString output_filepath;
|
||||
if (destination_path.isEmpty()) {
|
||||
// Keep the original path.
|
||||
output_filepath = input_filepath.section('.', 0, -2) + '.' + preset.extension_;
|
||||
output_filepath = input_filepath.section(QLatin1Char('.'), 0, -2) + QLatin1Char('.') + preset.extension_;
|
||||
}
|
||||
else {
|
||||
QString filename = TrimPath(input_filepath);
|
||||
filename = filename.section('.', 0, -2);
|
||||
output_filepath = destination_path + '/' + filename + '.' + preset.extension_;
|
||||
filename = filename.section(QLatin1Char('.'), 0, -2);
|
||||
output_filepath = destination_path + QLatin1Char('/') + filename + QLatin1Char('.') + preset.extension_;
|
||||
}
|
||||
|
||||
if (output_filepath.isEmpty()) return QString();
|
||||
|
||||
@@ -49,8 +49,6 @@ class TranscodeDialog : public QDialog {
|
||||
~TranscodeDialog() override;
|
||||
|
||||
static const char *kSettingsGroup;
|
||||
static const int kProgressInterval;
|
||||
static const int kMaxDestinationItems;
|
||||
|
||||
void SetFilenames(const QStringList &filenames);
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "core/logging.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/signalchecker.h"
|
||||
#include "core/settings.h"
|
||||
#include "transcoder.h"
|
||||
|
||||
using std::make_shared;
|
||||
@@ -94,7 +95,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
|
||||
if (mime_type.isEmpty()) return nullptr;
|
||||
|
||||
// HACK: Force mp4mux because it doesn't set any useful src caps
|
||||
if (mime_type == "audio/mp4") {
|
||||
if (mime_type == QStringLiteral("audio/mp4")) {
|
||||
emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(QStringLiteral("mp4mux")).arg(-1));
|
||||
return CreateElement(QStringLiteral("mp4mux"), bin);
|
||||
}
|
||||
@@ -127,7 +128,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
|
||||
if (intersection) {
|
||||
if (!gst_caps_is_empty(intersection)) {
|
||||
int rank = static_cast<int>(gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory)));
|
||||
QString name = GST_OBJECT_NAME(factory);
|
||||
const QString name = QString::fromUtf8(GST_OBJECT_NAME(factory));
|
||||
|
||||
if (name.startsWith(QLatin1String("ffmux")) || name.startsWith(QLatin1String("ffenc"))) {
|
||||
rank = -1; // ffmpeg usually sucks
|
||||
@@ -152,7 +153,7 @@ GstElement *Transcoder::CreateElementForMimeType(const QString &element_type, co
|
||||
|
||||
emit LogLine(QStringLiteral("Using '%1' (rank %2)").arg(best.name_).arg(best.rank_));
|
||||
|
||||
if (best.name_ == "lamemp3enc") {
|
||||
if (best.name_ == QStringLiteral("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.
|
||||
|
||||
emit LogLine(QStringLiteral("Adding xingmux and id3v2mux to the pipeline"));
|
||||
@@ -212,8 +213,8 @@ Transcoder::Transcoder(QObject *parent, const QString &settings_postfix)
|
||||
JobFinishedEvent::sEventType = QEvent::registerEventType();
|
||||
|
||||
// Initialize some settings for the lamemp3enc element.
|
||||
QSettings s;
|
||||
s.beginGroup("Transcoder/lamemp3enc" + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QStringLiteral("Transcoder/lamemp3enc") + settings_postfix_);
|
||||
|
||||
if (s.value("target").isNull()) {
|
||||
s.setValue("target", 1); // 1 == bitrate
|
||||
@@ -301,10 +302,10 @@ QString Transcoder::GetFile(const QString &input, const TranscoderPreset &preset
|
||||
|
||||
if (!fileinfo_output.isFile() || fileinfo_output.filePath().isEmpty() || fileinfo_output.path().isEmpty() || fileinfo_output.fileName().isEmpty() || fileinfo_output.suffix().isEmpty()) {
|
||||
QFileInfo fileinfo_input(input);
|
||||
QString temp_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/transcoder";
|
||||
QString temp_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/transcoder");
|
||||
if (!QDir(temp_dir).exists()) QDir().mkpath(temp_dir);
|
||||
QString filename = fileinfo_input.completeBaseName() + "." + preset.extension_;
|
||||
fileinfo_output.setFile(temp_dir + "/" + filename);
|
||||
QString filename = fileinfo_input.completeBaseName() + QLatin1Char('.') + preset.extension_;
|
||||
fileinfo_output.setFile(temp_dir + QLatin1Char('/') + filename);
|
||||
}
|
||||
|
||||
// Never overwrite existing files
|
||||
@@ -571,8 +572,8 @@ QMap<QString, float> Transcoder::GetProgress() const {
|
||||
|
||||
void Transcoder::SetElementProperties(const QString &name, GObject *object) {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup("Transcoder/" + name + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QStringLiteral("Transcoder/") + name + settings_postfix_);
|
||||
|
||||
guint properties_count = 0;
|
||||
GParamSpec **properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(object), &properties_count);
|
||||
@@ -580,16 +581,16 @@ void Transcoder::SetElementProperties(const QString &name, GObject *object) {
|
||||
for (uint i = 0; i < properties_count; ++i) {
|
||||
GParamSpec *property = properties[i];
|
||||
|
||||
if (!s.contains(property->name)) {
|
||||
if (!s.contains(QString::fromUtf8(property->name))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const QVariant value = s.value(property->name);
|
||||
const QVariant value = s.value(QString::fromUtf8(property->name));
|
||||
if (value.isNull()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
emit LogLine(QStringLiteral("Setting %1 property: %2 = %3").arg(name, property->name, value.toString()));
|
||||
emit LogLine(QStringLiteral("Setting %1 property: %2 = %3").arg(name, QString::fromUtf8(property->name), value.toString()));
|
||||
|
||||
switch (property->value_type) {
|
||||
case G_TYPE_FLOAT:{
|
||||
|
||||
@@ -30,7 +30,11 @@
|
||||
#include "transcoderoptionsaac.h"
|
||||
#include "ui_transcoderoptionsaac.h"
|
||||
|
||||
const char *TranscoderOptionsAAC::kSettingsGroup = "Transcoder/faac";
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/faac";
|
||||
}
|
||||
|
||||
TranscoderOptionsAAC::TranscoderOptionsAAC(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsAAC) {
|
||||
ui_->setupUi(this);
|
||||
@@ -42,8 +46,8 @@ TranscoderOptionsAAC::~TranscoderOptionsAAC() {
|
||||
|
||||
void TranscoderOptionsAAC::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(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());
|
||||
@@ -55,8 +59,8 @@ void TranscoderOptionsAAC::Load() {
|
||||
|
||||
void TranscoderOptionsAAC::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
s.setValue("profile", ui_->profile->currentIndex() + 1);
|
||||
s.setValue("tns", ui_->tns->isChecked());
|
||||
|
||||
@@ -40,8 +40,6 @@ class TranscoderOptionsAAC : public TranscoderOptionsInterface {
|
||||
void Save() override;
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsAAC *ui_;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,11 +25,15 @@
|
||||
#include <QSlider>
|
||||
#include <QSettings>
|
||||
|
||||
#include "transcoder/transcoderoptionsinterface.h"
|
||||
#include "transcoderoptionsinterface.h"
|
||||
#include "transcoderoptionsasf.h"
|
||||
#include "ui_transcoderoptionsasf.h"
|
||||
|
||||
const char *TranscoderOptionsASF::kSettingsGroup = "Transcoder/ffenc_wmav2";
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/ffenc_wmav2";
|
||||
}
|
||||
|
||||
TranscoderOptionsASF::TranscoderOptionsASF(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsASF) {
|
||||
ui_->setupUi(this);
|
||||
@@ -41,8 +45,8 @@ TranscoderOptionsASF::~TranscoderOptionsASF() {
|
||||
|
||||
void TranscoderOptionsASF::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).toInt() / 1000);
|
||||
s.endGroup();
|
||||
|
||||
@@ -50,8 +54,8 @@ void TranscoderOptionsASF::Load() {
|
||||
|
||||
void TranscoderOptionsASF::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
s.endGroup();
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ class TranscoderOptionsASF : public TranscoderOptionsInterface {
|
||||
void Save() override;
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsASF *ui_;
|
||||
};
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type, QWidget *p
|
||||
}
|
||||
|
||||
if (options_) {
|
||||
setWindowTitle(windowTitle() + " - " + Song::TextForFiletype(type));
|
||||
setWindowTitle(windowTitle() + QStringLiteral(" - ") + Song::TextForFiletype(type));
|
||||
options_->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
ui_->verticalLayout->insertWidget(0, options_);
|
||||
resize(width(), minimumHeight());
|
||||
|
||||
@@ -29,7 +29,11 @@
|
||||
#include "transcoderoptionsflac.h"
|
||||
#include "ui_transcoderoptionsflac.h"
|
||||
|
||||
const char *TranscoderOptionsFLAC::kSettingsGroup = "Transcoder/flacenc";
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/flacenc";
|
||||
}
|
||||
|
||||
TranscoderOptionsFLAC::TranscoderOptionsFLAC(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsFLAC) {
|
||||
ui_->setupUi(this);
|
||||
@@ -41,8 +45,8 @@ TranscoderOptionsFLAC::~TranscoderOptionsFLAC() {
|
||||
|
||||
void TranscoderOptionsFLAC::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
ui_->quality->setValue(s.value("quality", 5).toInt());
|
||||
s.endGroup();
|
||||
|
||||
@@ -50,8 +54,8 @@ void TranscoderOptionsFLAC::Load() {
|
||||
|
||||
void TranscoderOptionsFLAC::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
s.setValue("quality", ui_->quality->value());
|
||||
s.endGroup();
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ class TranscoderOptionsFLAC : public TranscoderOptionsInterface {
|
||||
void Save() override;
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsFLAC *ui_;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,11 @@
|
||||
#include "transcoderoptionsmp3.h"
|
||||
#include "ui_transcoderoptionsmp3.h"
|
||||
|
||||
const char *TranscoderOptionsMP3::kSettingsGroup = "Transcoder/lamemp3enc";
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/lamemp3enc";
|
||||
}
|
||||
|
||||
TranscoderOptionsMP3::TranscoderOptionsMP3(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsMP3) {
|
||||
|
||||
@@ -50,8 +54,8 @@ TranscoderOptionsMP3::~TranscoderOptionsMP3() {
|
||||
|
||||
void TranscoderOptionsMP3::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
|
||||
if (s.value("target", 1).toInt() == 0) {
|
||||
ui_->target_quality->setChecked(true);
|
||||
@@ -72,8 +76,8 @@ void TranscoderOptionsMP3::Load() {
|
||||
|
||||
void TranscoderOptionsMP3::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
|
||||
s.setValue("target", ui_->target_quality->isChecked() ? 0 : 1);
|
||||
s.setValue("quality", ui_->quality_spinbox->value());
|
||||
|
||||
@@ -46,8 +46,6 @@ class TranscoderOptionsMP3 : public TranscoderOptionsInterface {
|
||||
void QualitySpinboxChanged(const double value);
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsMP3 *ui_;
|
||||
};
|
||||
|
||||
|
||||
@@ -29,9 +29,13 @@
|
||||
#include "transcoderoptionsopus.h"
|
||||
#include "ui_transcoderoptionsopus.h"
|
||||
|
||||
#include "core/settings.h"
|
||||
|
||||
// TODO: Add more options than only bitrate as soon as gst doesn't crash anymore while using the cbr parameter (like cbr=false)
|
||||
|
||||
const char *TranscoderOptionsOpus::kSettingsGroup = "Transcoder/opusenc";
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/opusenc";
|
||||
}
|
||||
|
||||
TranscoderOptionsOpus::TranscoderOptionsOpus(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsOpus) {
|
||||
ui_->setupUi(this);
|
||||
@@ -43,8 +47,8 @@ TranscoderOptionsOpus::~TranscoderOptionsOpus() {
|
||||
|
||||
void TranscoderOptionsOpus::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
ui_->bitrate_slider->setValue(s.value("bitrate", 320000).toInt() / 1000);
|
||||
s.endGroup();
|
||||
|
||||
@@ -52,8 +56,8 @@ void TranscoderOptionsOpus::Load() {
|
||||
|
||||
void TranscoderOptionsOpus::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
s.endGroup();
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ class TranscoderOptionsOpus : public TranscoderOptionsInterface {
|
||||
void Save() override;
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsOpus *ui_;
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,11 @@
|
||||
#include "transcoderoptionsspeex.h"
|
||||
#include "ui_transcoderoptionsspeex.h"
|
||||
|
||||
const char *TranscoderOptionsSpeex::kSettingsGroup = "Transcoder/speexenc";
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/speexenc";
|
||||
}
|
||||
|
||||
TranscoderOptionsSpeex::TranscoderOptionsSpeex(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsSpeex) {
|
||||
ui_->setupUi(this);
|
||||
@@ -44,8 +48,8 @@ TranscoderOptionsSpeex::~TranscoderOptionsSpeex() {
|
||||
|
||||
void TranscoderOptionsSpeex::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
|
||||
ui_->quality_slider->setValue(s.value("quality", 10).toInt());
|
||||
ui_->bitrate_slider->setValue(s.value("bitrate", 0).toInt() / 1000);
|
||||
@@ -63,8 +67,8 @@ void TranscoderOptionsSpeex::Load() {
|
||||
|
||||
void TranscoderOptionsSpeex::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
|
||||
s.setValue("quality", ui_->quality_slider->value());
|
||||
s.setValue("bitrate", ui_->bitrate_slider->value() * 1000);
|
||||
|
||||
@@ -40,8 +40,6 @@ class TranscoderOptionsSpeex : public TranscoderOptionsInterface {
|
||||
void Save() override;
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsSpeex *ui_;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,11 @@
|
||||
#include "transcoderoptionsvorbis.h"
|
||||
#include "ui_transcoderoptionsvorbis.h"
|
||||
|
||||
const char *TranscoderOptionsVorbis::kSettingsGroup = "Transcoder/vorbisenc";
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/vorbisenc";
|
||||
}
|
||||
|
||||
TranscoderOptionsVorbis::TranscoderOptionsVorbis(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsVorbis) {
|
||||
ui_->setupUi(this);
|
||||
@@ -42,8 +46,8 @@ TranscoderOptionsVorbis::~TranscoderOptionsVorbis() {
|
||||
|
||||
void TranscoderOptionsVorbis::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
|
||||
int bitrate = s.value("bitrate", -1).toInt();
|
||||
bitrate = bitrate == -1 ? 0 : bitrate / 1000;
|
||||
@@ -66,8 +70,8 @@ void TranscoderOptionsVorbis::Load() {
|
||||
|
||||
void TranscoderOptionsVorbis::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
|
||||
int bitrate = ui_->bitrate_slider->value();
|
||||
bitrate = bitrate == 0 ? -1 : bitrate * 1000;
|
||||
|
||||
@@ -40,8 +40,6 @@ class TranscoderOptionsVorbis : public TranscoderOptionsInterface {
|
||||
void Save() override;
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsVorbis *ui_;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,7 +27,11 @@
|
||||
#include "transcoderoptionswavpack.h"
|
||||
#include "ui_transcoderoptionswavpack.h"
|
||||
|
||||
const char *TranscoderOptionsWavPack::kSettingsGroup = "Transcoder/wavpackenc";
|
||||
#include "core/settings.h"
|
||||
|
||||
namespace {
|
||||
constexpr char kSettingsGroup[] = "Transcoder/wavpackenc";
|
||||
}
|
||||
|
||||
TranscoderOptionsWavPack::TranscoderOptionsWavPack(QWidget *parent) : TranscoderOptionsInterface(parent), ui_(new Ui_TranscoderOptionsWavPack) {
|
||||
ui_->setupUi(this);
|
||||
@@ -39,16 +43,16 @@ TranscoderOptionsWavPack::~TranscoderOptionsWavPack() {
|
||||
|
||||
void TranscoderOptionsWavPack::Load() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
void TranscoderOptionsWavPack::Save() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(kSettingsGroup + settings_postfix_);
|
||||
Settings s;
|
||||
s.beginGroup(QLatin1String(kSettingsGroup) + settings_postfix_);
|
||||
s.endGroup();
|
||||
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@ class TranscoderOptionsWavPack : public TranscoderOptionsInterface {
|
||||
void Save() override;
|
||||
|
||||
private:
|
||||
static const char *kSettingsGroup;
|
||||
|
||||
Ui_TranscoderOptionsWavPack *ui_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user