mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-12-25 01:11:48 +01:00
dumping_dialog: Add a line edit for the options
So that users can just paste a set of parameters they found elsewhere.
This commit is contained in:
parent
0a4be71913
commit
c38202bd30
@ -21,33 +21,33 @@ DumpingDialog::DumpingDialog(QWidget* parent)
|
|||||||
accept();
|
accept();
|
||||||
});
|
});
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &DumpingDialog::reject);
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &DumpingDialog::reject);
|
||||||
connect(ui->formatOptionsButton, &QPushButton::clicked, [this] {
|
connect(ui->formatOptionsButton, &QToolButton::clicked, [this] {
|
||||||
OpenOptionsDialog(formats.at(ui->formatComboBox->currentData().toUInt()).options,
|
OpenOptionsDialog(formats.at(ui->formatComboBox->currentData().toUInt()).options,
|
||||||
format_options);
|
ui->formatOptionsLineEdit);
|
||||||
});
|
});
|
||||||
connect(ui->videoEncoderOptionsButton, &QPushButton::clicked, [this] {
|
connect(ui->videoEncoderOptionsButton, &QToolButton::clicked, [this] {
|
||||||
OpenOptionsDialog(
|
OpenOptionsDialog(
|
||||||
video_encoders.at(ui->videoEncoderComboBox->currentData().toUInt()).options,
|
video_encoders.at(ui->videoEncoderComboBox->currentData().toUInt()).options,
|
||||||
video_encoder_options);
|
ui->videoEncoderOptionsLineEdit);
|
||||||
});
|
});
|
||||||
connect(ui->audioEncoderOptionsButton, &QPushButton::clicked, [this] {
|
connect(ui->audioEncoderOptionsButton, &QToolButton::clicked, [this] {
|
||||||
OpenOptionsDialog(
|
OpenOptionsDialog(
|
||||||
audio_encoders.at(ui->audioEncoderComboBox->currentData().toUInt()).options,
|
audio_encoders.at(ui->audioEncoderComboBox->currentData().toUInt()).options,
|
||||||
audio_encoder_options);
|
ui->audioEncoderOptionsLineEdit);
|
||||||
});
|
});
|
||||||
|
|
||||||
SetConfiguration();
|
SetConfiguration();
|
||||||
|
|
||||||
connect(ui->formatComboBox, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
|
connect(ui->formatComboBox, qOverload<int>(&QComboBox::currentIndexChanged), [this] {
|
||||||
ui->pathLineEdit->setText(QString{});
|
ui->pathLineEdit->setText(QString{});
|
||||||
format_options.clear();
|
ui->formatOptionsLineEdit->clear();
|
||||||
PopulateEncoders();
|
PopulateEncoders();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->videoEncoderComboBox, qOverload<int>(&QComboBox::currentIndexChanged),
|
connect(ui->videoEncoderComboBox, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||||
[this] { video_encoder_options.clear(); });
|
[this] { ui->videoEncoderOptionsLineEdit->clear(); });
|
||||||
connect(ui->audioEncoderComboBox, qOverload<int>(&QComboBox::currentIndexChanged),
|
connect(ui->audioEncoderComboBox, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||||
[this] { audio_encoder_options.clear(); });
|
[this] { ui->audioEncoderOptionsLineEdit->clear(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
DumpingDialog::~DumpingDialog() = default;
|
DumpingDialog::~DumpingDialog() = default;
|
||||||
@ -174,21 +174,23 @@ void DumpingDialog::OnToolButtonClicked() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DumpingDialog::OpenOptionsDialog(const std::vector<VideoDumper::OptionInfo>& options,
|
void DumpingDialog::OpenOptionsDialog(const std::vector<VideoDumper::OptionInfo>& options,
|
||||||
std::string& current_value) {
|
QLineEdit* line_edit) {
|
||||||
OptionsDialog dialog(this, options, current_value);
|
OptionsDialog dialog(this, options, line_edit->text().toStdString());
|
||||||
if (dialog.exec() != QDialog::DialogCode::Accepted) {
|
if (dialog.exec() != QDialog::DialogCode::Accepted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_value = dialog.GetCurrentValue();
|
line_edit->setText(QString::fromStdString(dialog.GetCurrentValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpingDialog::SetConfiguration() {
|
void DumpingDialog::SetConfiguration() {
|
||||||
Populate();
|
Populate();
|
||||||
|
|
||||||
format_options = Settings::values.format_options;
|
ui->formatOptionsLineEdit->setText(QString::fromStdString(Settings::values.format_options));
|
||||||
video_encoder_options = Settings::values.video_encoder_options;
|
ui->videoEncoderOptionsLineEdit->setText(
|
||||||
audio_encoder_options = Settings::values.audio_encoder_options;
|
QString::fromStdString(Settings::values.video_encoder_options));
|
||||||
|
ui->audioEncoderOptionsLineEdit->setText(
|
||||||
|
QString::fromStdString(Settings::values.audio_encoder_options));
|
||||||
last_path = UISettings::values.video_dumping_path;
|
last_path = UISettings::values.video_dumping_path;
|
||||||
ui->videoBitrateSpinBox->setValue(static_cast<int>(Settings::values.video_bitrate));
|
ui->videoBitrateSpinBox->setValue(static_cast<int>(Settings::values.video_bitrate));
|
||||||
ui->audioBitrateSpinBox->setValue(static_cast<int>(Settings::values.audio_bitrate));
|
ui->audioBitrateSpinBox->setValue(static_cast<int>(Settings::values.audio_bitrate));
|
||||||
@ -196,14 +198,14 @@ void DumpingDialog::SetConfiguration() {
|
|||||||
|
|
||||||
void DumpingDialog::ApplyConfiguration() {
|
void DumpingDialog::ApplyConfiguration() {
|
||||||
Settings::values.output_format = formats.at(ui->formatComboBox->currentData().toUInt()).name;
|
Settings::values.output_format = formats.at(ui->formatComboBox->currentData().toUInt()).name;
|
||||||
Settings::values.format_options = format_options;
|
Settings::values.format_options = ui->formatOptionsLineEdit->text().toStdString();
|
||||||
Settings::values.video_encoder =
|
Settings::values.video_encoder =
|
||||||
video_encoders.at(ui->videoEncoderComboBox->currentData().toUInt()).name;
|
video_encoders.at(ui->videoEncoderComboBox->currentData().toUInt()).name;
|
||||||
Settings::values.video_encoder_options = video_encoder_options;
|
Settings::values.video_encoder_options = ui->videoEncoderOptionsLineEdit->text().toStdString();
|
||||||
Settings::values.video_bitrate = ui->videoBitrateSpinBox->value();
|
Settings::values.video_bitrate = ui->videoBitrateSpinBox->value();
|
||||||
Settings::values.audio_encoder =
|
Settings::values.audio_encoder =
|
||||||
audio_encoders.at(ui->audioEncoderComboBox->currentData().toUInt()).name;
|
audio_encoders.at(ui->audioEncoderComboBox->currentData().toUInt()).name;
|
||||||
Settings::values.audio_encoder_options = audio_encoder_options;
|
Settings::values.audio_encoder_options = ui->audioEncoderOptionsLineEdit->text().toStdString();
|
||||||
Settings::values.audio_bitrate = ui->audioBitrateSpinBox->value();
|
Settings::values.audio_bitrate = ui->audioBitrateSpinBox->value();
|
||||||
UISettings::values.video_dumping_path = last_path;
|
UISettings::values.video_dumping_path = last_path;
|
||||||
Settings::Apply();
|
Settings::Apply();
|
||||||
|
@ -10,6 +10,8 @@ namespace Ui {
|
|||||||
class DumpingDialog;
|
class DumpingDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QLineEdit;
|
||||||
|
|
||||||
class DumpingDialog : public QDialog {
|
class DumpingDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -26,12 +28,9 @@ private:
|
|||||||
void SetConfiguration();
|
void SetConfiguration();
|
||||||
void OnToolButtonClicked();
|
void OnToolButtonClicked();
|
||||||
void OpenOptionsDialog(const std::vector<VideoDumper::OptionInfo>& options,
|
void OpenOptionsDialog(const std::vector<VideoDumper::OptionInfo>& options,
|
||||||
std::string& current_value);
|
QLineEdit* line_edit);
|
||||||
|
|
||||||
std::unique_ptr<Ui::DumpingDialog> ui;
|
std::unique_ptr<Ui::DumpingDialog> ui;
|
||||||
std::string format_options;
|
|
||||||
std::string video_encoder_options;
|
|
||||||
std::string audio_encoder_options;
|
|
||||||
|
|
||||||
QString last_path;
|
QString last_path;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>360</height>
|
<height>420</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -30,24 +30,34 @@
|
|||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="formatComboBox"/>
|
<widget class="QComboBox" name="formatComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="formatOptionsButton">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Options...</string>
|
<string>Options:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="formatOptionsLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QToolButton" name="formatOptionsButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QLabel">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Path:</string>
|
<string>Path:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="pathLineEdit"/>
|
<widget class="QLineEdit" name="pathLineEdit"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QToolButton" name="pathExplore">
|
<widget class="QToolButton" name="pathExplore">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
@ -80,21 +90,31 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="videoEncoderOptionsButton">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Options...</string>
|
<string>Options:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="videoEncoderOptionsLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QToolButton" name="videoEncoderOptionsButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QLabel">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bitrate:</string>
|
<string>Bitrate:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="videoBitrateSpinBox">
|
<widget class="QSpinBox" name="videoBitrateSpinBox">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>10000000</number>
|
<number>10000000</number>
|
||||||
@ -104,7 +124,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QLabel">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>bps</string>
|
<string>bps</string>
|
||||||
@ -137,21 +157,31 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="audioEncoderOptionsButton">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Options...</string>
|
<string>Options:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="audioEncoderOptionsLineEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QToolButton" name="audioEncoderOptionsButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
<widget class="QLabel">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Bitrate:</string>
|
<string>Bitrate:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QSpinBox" name="audioBitrateSpinBox">
|
<widget class="QSpinBox" name="audioBitrateSpinBox">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>1000000</number>
|
<number>1000000</number>
|
||||||
@ -161,7 +191,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QLabel">
|
<widget class="QLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>bps</string>
|
<string>bps</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user