mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-21 22:25:39 +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())
|
||||
.value<TranscoderPreset>();
|
||||
|
||||
TranscoderOptionsDialog dialog(preset.type_, this);
|
||||
TranscoderOptionsDialog dialog(preset, this);
|
||||
if (dialog.is_valid()) {
|
||||
dialog.exec();
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void TranscodeDialog::Options() {
|
||||
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
||||
.value<TranscoderPreset>();
|
||||
|
||||
TranscoderOptionsDialog dialog(preset.type_, this);
|
||||
TranscoderOptionsDialog dialog(preset, this);
|
||||
if (dialog.is_valid()) {
|
||||
dialog.exec();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "transcoderoptionsdialog.h"
|
||||
|
||||
#include "transcoder.h"
|
||||
#include "transcoderoptionsaac.h"
|
||||
#include "transcoderoptionsflac.h"
|
||||
#include "transcoderoptionsmp3.h"
|
||||
@ -26,12 +27,12 @@
|
||||
#include "transcoderoptionswma.h"
|
||||
#include "ui_transcoderoptionsdialog.h"
|
||||
|
||||
TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type,
|
||||
TranscoderOptionsDialog::TranscoderOptionsDialog(const TranscoderPreset& preset,
|
||||
QWidget* parent)
|
||||
: QDialog(parent), ui_(new Ui_TranscoderOptionsDialog), options_(nullptr) {
|
||||
ui_->setupUi(this);
|
||||
|
||||
switch (type) {
|
||||
switch (preset.type_) {
|
||||
case Song::Type_Flac:
|
||||
case Song::Type_OggFlac:
|
||||
options_ = new TranscoderOptionsFlac(this);
|
||||
@ -59,7 +60,7 @@ TranscoderOptionsDialog::TranscoderOptionsDialog(Song::FileType type,
|
||||
}
|
||||
|
||||
if (options_) {
|
||||
setWindowTitle(windowTitle() + " - " + Song::TextForFiletype(type));
|
||||
setWindowTitle(windowTitle() + " - " + Song::TextForFiletype(preset.type_));
|
||||
options_->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
ui_->verticalLayout->insertWidget(0, options_);
|
||||
resize(width(), minimumHeight());
|
||||
|
@ -20,16 +20,17 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "transcoderoptionsinterface.h"
|
||||
|
||||
class Ui_TranscoderOptionsDialog;
|
||||
struct TranscoderPreset;
|
||||
|
||||
class TranscoderOptionsDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TranscoderOptionsDialog(Song::FileType type, QWidget* parent = nullptr);
|
||||
TranscoderOptionsDialog(const TranscoderPreset& preset,
|
||||
QWidget* parent = nullptr);
|
||||
~TranscoderOptionsDialog();
|
||||
|
||||
bool is_valid() const { return options_; }
|
||||
|
@ -204,7 +204,7 @@ void NetworkRemoteSettingsPage::Options() {
|
||||
TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
|
||||
.value<TranscoderPreset>();
|
||||
|
||||
TranscoderOptionsDialog dialog(preset.type_, this);
|
||||
TranscoderOptionsDialog dialog(preset, this);
|
||||
dialog.set_settings_postfix(NetworkRemote::kTranscoderSettingPostfix);
|
||||
if (dialog.is_valid()) {
|
||||
dialog.exec();
|
||||
|
Loading…
Reference in New Issue
Block a user