mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-01 20:06:53 +01:00
transcoder: Change TranscoderOptionsDialog constructor
Take a reference to a TranscoderPreset object instead of the the type. This will allow the dialog to provide better information and correct options.
This commit is contained in:
parent
66ea25bca9
commit
b735f5d1c3
@ -186,7 +186,7 @@ void RipCDDialog::Options() {
|
|||||||
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
||||||
.value<TranscoderPreset>();
|
.value<TranscoderPreset>();
|
||||||
|
|
||||||
TranscoderOptionsDialog dialog(preset.type_, this);
|
TranscoderOptionsDialog dialog(preset, this);
|
||||||
if (dialog.is_valid()) {
|
if (dialog.is_valid()) {
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ void TranscodeDialog::Options() {
|
|||||||
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
||||||
.value<TranscoderPreset>();
|
.value<TranscoderPreset>();
|
||||||
|
|
||||||
TranscoderOptionsDialog dialog(preset.type_, this);
|
TranscoderOptionsDialog dialog(preset, this);
|
||||||
if (dialog.is_valid()) {
|
if (dialog.is_valid()) {
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include "transcoderoptionsdialog.h"
|
#include "transcoderoptionsdialog.h"
|
||||||
|
|
||||||
|
#include "transcoder.h"
|
||||||
#include "transcoderoptionsaac.h"
|
#include "transcoderoptionsaac.h"
|
||||||
#include "transcoderoptionsflac.h"
|
#include "transcoderoptionsflac.h"
|
||||||
#include "transcoderoptionsmp3.h"
|
#include "transcoderoptionsmp3.h"
|
||||||
@ -26,12 +27,12 @@
|
|||||||
#include "transcoderoptionswma.h"
|
#include "transcoderoptionswma.h"
|
||||||
#include "ui_transcoderoptionsdialog.h"
|
#include "ui_transcoderoptionsdialog.h"
|
||||||
|
|
||||||
TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type,
|
TranscoderOptionsDialog::TranscoderOptionsDialog(const TranscoderPreset& preset,
|
||||||
QWidget* parent)
|
QWidget* parent)
|
||||||
: QDialog(parent), ui_(new Ui_TranscoderOptionsDialog), options_(nullptr) {
|
: QDialog(parent), ui_(new Ui_TranscoderOptionsDialog), options_(nullptr) {
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
switch (type) {
|
switch (preset.type_) {
|
||||||
case Song::Type_Flac:
|
case Song::Type_Flac:
|
||||||
case Song::Type_OggFlac:
|
case Song::Type_OggFlac:
|
||||||
options_ = new TranscoderOptionsFlac(this);
|
options_ = new TranscoderOptionsFlac(this);
|
||||||
@ -59,7 +60,7 @@ TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (options_) {
|
if (options_) {
|
||||||
setWindowTitle(windowTitle() + " - " + Song::TextForFiletype(type));
|
setWindowTitle(windowTitle() + " - " + Song::TextForFiletype(preset.type_));
|
||||||
options_->layout()->setContentsMargins(0, 0, 0, 0);
|
options_->layout()->setContentsMargins(0, 0, 0, 0);
|
||||||
ui_->verticalLayout->insertWidget(0, options_);
|
ui_->verticalLayout->insertWidget(0, options_);
|
||||||
resize(width(), minimumHeight());
|
resize(width(), minimumHeight());
|
||||||
|
@ -20,16 +20,17 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
#include "core/song.h"
|
|
||||||
#include "transcoderoptionsinterface.h"
|
#include "transcoderoptionsinterface.h"
|
||||||
|
|
||||||
class Ui_TranscoderOptionsDialog;
|
class Ui_TranscoderOptionsDialog;
|
||||||
|
struct TranscoderPreset;
|
||||||
|
|
||||||
class TranscoderOptionsDialog : public QDialog {
|
class TranscoderOptionsDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TranscoderOptionsDialog(Song::FileType type, QWidget* parent = nullptr);
|
TranscoderOptionsDialog(const TranscoderPreset& preset,
|
||||||
|
QWidget* parent = nullptr);
|
||||||
~TranscoderOptionsDialog();
|
~TranscoderOptionsDialog();
|
||||||
|
|
||||||
bool is_valid() const { return options_; }
|
bool is_valid() const { return options_; }
|
||||||
|
@ -204,7 +204,7 @@ void NetworkRemoteSettingsPage::Options() {
|
|||||||
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
||||||
.value<TranscoderPreset>();
|
.value<TranscoderPreset>();
|
||||||
|
|
||||||
TranscoderOptionsDialog dialog(preset.type_, this);
|
TranscoderOptionsDialog dialog(preset, this);
|
||||||
dialog.set_settings_postfix(NetworkRemote::kTranscoderSettingPostfix);
|
dialog.set_settings_postfix(NetworkRemote::kTranscoderSettingPostfix);
|
||||||
if (dialog.is_valid()) {
|
if (dialog.is_valid()) {
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user