Some more tweaking to template loading code. Also added some backward-compatibility fixes.
This commit is contained in:
parent
5967add59c
commit
ae5374f68b
@ -178,6 +178,14 @@ bool OptionsModel::loadTemplate(OptionsModel *model, const QString &name)
|
|||||||
settings.sync();
|
settings.sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(settings.value(KEY_PROFILE_NAME).toString().compare("auto", Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
settings.setValue(KEY_PROFILE_NAME, QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED));
|
||||||
|
}
|
||||||
|
if(settings.value(KEY_TUNING_NAME).toString().compare("none", Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
settings.setValue(KEY_TUNING_NAME, QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED));
|
||||||
|
}
|
||||||
|
|
||||||
bool complete = true;
|
bool complete = true;
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#define VER_X264_MAJOR 2
|
#define VER_X264_MAJOR 2
|
||||||
#define VER_X264_MINOR 3
|
#define VER_X264_MINOR 3
|
||||||
#define VER_X264_PATCH 5
|
#define VER_X264_PATCH 6
|
||||||
#define VER_X264_BUILD 821
|
#define VER_X264_BUILD 824
|
||||||
|
|
||||||
#define VER_X264_PORTABLE_EDITION (0)
|
#define VER_X264_PORTABLE_EDITION (0)
|
||||||
|
|
||||||
|
@ -79,22 +79,6 @@
|
|||||||
WIDGET->addAction(_action); \
|
WIDGET->addAction(_action); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BLOCK_SIGNALS(FLAG) do \
|
|
||||||
{ \
|
|
||||||
ui->cbxEncoderType->blockSignals(FLAG); \
|
|
||||||
ui->cbxEncoderArch->blockSignals(FLAG); \
|
|
||||||
ui->cbxEncoderVariant->blockSignals(FLAG); \
|
|
||||||
ui->cbxRateControlMode->blockSignals(FLAG); \
|
|
||||||
ui->spinQuantizer->blockSignals(FLAG); \
|
|
||||||
ui->spinBitrate->blockSignals(FLAG); \
|
|
||||||
ui->cbxPreset->blockSignals(FLAG); \
|
|
||||||
ui->cbxTuning->blockSignals(FLAG); \
|
|
||||||
ui->cbxProfile->blockSignals(FLAG); \
|
|
||||||
ui->editCustomX264Params->blockSignals(FLAG); \
|
|
||||||
ui->editCustomAvs2YUVParams->blockSignals(FLAG); \
|
|
||||||
} \
|
|
||||||
while(0)
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(const void*)
|
Q_DECLARE_METATYPE(const void*)
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -231,7 +215,8 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl
|
|||||||
m_sysinfo(sysinfo),
|
m_sysinfo(sysinfo),
|
||||||
m_preferences(preferences),
|
m_preferences(preferences),
|
||||||
m_defaults(new OptionsModel(sysinfo)),
|
m_defaults(new OptionsModel(sysinfo)),
|
||||||
ui(new Ui::AddJobDialog())
|
ui(new Ui::AddJobDialog()),
|
||||||
|
m_monitorConfigChanges(true)
|
||||||
{
|
{
|
||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
@ -668,11 +653,16 @@ void AddJobDialog::browseButtonClicked(void)
|
|||||||
|
|
||||||
void AddJobDialog::configurationChanged(void)
|
void AddJobDialog::configurationChanged(void)
|
||||||
{
|
{
|
||||||
|
if(!m_monitorConfigChanges)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const OptionsModel* options = reinterpret_cast<const OptionsModel*>(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value<const void*>());
|
const OptionsModel* options = reinterpret_cast<const OptionsModel*>(ui->cbxTemplate->itemData(ui->cbxTemplate->currentIndex()).value<const void*>());
|
||||||
if(options)
|
if(options)
|
||||||
{
|
{
|
||||||
ui->cbxTemplate->blockSignals(true);
|
ui->cbxTemplate->blockSignals(true);
|
||||||
ui->cbxTemplate->insertItem(0, tr("<Unsaved Configuration>"), QVariant::fromValue<const void*>(NULL));
|
ui->cbxTemplate->insertItem(0, tr("<Modified Configuration>"), QVariant::fromValue<const void*>(NULL));
|
||||||
ui->cbxTemplate->setCurrentIndex(0);
|
ui->cbxTemplate->setCurrentIndex(0);
|
||||||
ui->cbxTemplate->blockSignals(false);
|
ui->cbxTemplate->blockSignals(false);
|
||||||
}
|
}
|
||||||
@ -726,7 +716,7 @@ void AddJobDialog::saveTemplateButtonClicked(void)
|
|||||||
{
|
{
|
||||||
if(options->equals(test))
|
if(options->equals(test))
|
||||||
{
|
{
|
||||||
QMessageBox::warning (this, tr("Oups"), tr("<nobr>There already is a template for the current settings!</nobr>"));
|
QMessageBox::information (this, tr("Oups"), tr("<nobr>The current settings are already saved as template:<br><b>%1</b></nobr>").arg(ui->cbxTemplate->itemText(i)));
|
||||||
ui->cbxTemplate->blockSignals(true);
|
ui->cbxTemplate->blockSignals(true);
|
||||||
ui->cbxTemplate->setCurrentIndex(i);
|
ui->cbxTemplate->setCurrentIndex(i);
|
||||||
ui->cbxTemplate->blockSignals(false);
|
ui->cbxTemplate->blockSignals(false);
|
||||||
@ -825,13 +815,12 @@ void AddJobDialog::deleteTemplateButtonClicked(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = QMessageBox::question (this, tr("Delete Template"), tr("<nobr>Do you really want to delete the selected template?</nobr>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
int ret = QMessageBox::question (this, tr("Delete Template"), tr("<nobr>Do you really want to delete the selected template?<br><b>%1</b></nobr>").arg(name), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
if(ret != QMessageBox::Yes)
|
if(ret != QMessageBox::Yes)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OptionsModel::deleteTemplate(name);
|
OptionsModel::deleteTemplate(name);
|
||||||
const OptionsModel *item = reinterpret_cast<const OptionsModel*>(ui->cbxTemplate->itemData(index).value<const void*>());
|
const OptionsModel *item = reinterpret_cast<const OptionsModel*>(ui->cbxTemplate->itemData(index).value<const void*>());
|
||||||
ui->cbxTemplate->removeItem(index);
|
ui->cbxTemplate->removeItem(index);
|
||||||
@ -977,24 +966,26 @@ void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text)
|
|||||||
|
|
||||||
void AddJobDialog::restoreOptions(const OptionsModel *options)
|
void AddJobDialog::restoreOptions(const OptionsModel *options)
|
||||||
{
|
{
|
||||||
BLOCK_SIGNALS(false);
|
//Ignore config changes while restoring template!
|
||||||
|
m_monitorConfigChanges = false;
|
||||||
|
|
||||||
ui->cbxEncoderType ->setCurrentIndex(options->encType());
|
ui->cbxEncoderType ->setCurrentIndex(options->encType());
|
||||||
ui->cbxEncoderArch ->setCurrentIndex(options->encArch());
|
ui->cbxEncoderArch ->setCurrentIndex(options->encArch());
|
||||||
ui->cbxEncoderVariant ->setCurrentIndex(options->encVariant());
|
ui->cbxEncoderVariant ->setCurrentIndex(options->encVariant());
|
||||||
ui->cbxRateControlMode->setCurrentIndex(options->rcMode());
|
ui->cbxRateControlMode->setCurrentIndex(options->rcMode());
|
||||||
|
|
||||||
BLOCK_SIGNALS(true);
|
|
||||||
|
|
||||||
ui->spinQuantizer->setValue(options->quantizer());
|
ui->spinQuantizer->setValue(options->quantizer());
|
||||||
ui->spinBitrate ->setValue(options->bitrate());
|
ui->spinBitrate ->setValue(options->bitrate());
|
||||||
|
|
||||||
updateComboBox(ui->cbxPreset, options->preset());
|
updateComboBox(ui->cbxPreset, options->preset());
|
||||||
updateComboBox(ui->cbxTuning, options->tune());
|
updateComboBox(ui->cbxTuning, options->tune());
|
||||||
updateComboBox(ui->cbxProfile, options->profile());
|
updateComboBox(ui->cbxProfile, options->profile());
|
||||||
|
|
||||||
ui->editCustomX264Params ->setText(options->customEncParams());
|
ui->editCustomX264Params ->setText(options->customEncParams());
|
||||||
ui->editCustomAvs2YUVParams->setText(options->customAvs2YUV());
|
ui->editCustomAvs2YUVParams->setText(options->customAvs2YUV());
|
||||||
|
|
||||||
BLOCK_SIGNALS(false);
|
//Make sure we will monitor config changes again!
|
||||||
|
m_monitorConfigChanges = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddJobDialog::saveOptions(OptionsModel *options)
|
void AddJobDialog::saveOptions(OptionsModel *options)
|
||||||
|
@ -91,6 +91,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AddJobDialog *const ui;
|
Ui::AddJobDialog *const ui;
|
||||||
|
bool m_monitorConfigChanges;
|
||||||
|
|
||||||
void loadTemplateList(void);
|
void loadTemplateList(void);
|
||||||
void restoreOptions(const OptionsModel *options);
|
void restoreOptions(const OptionsModel *options);
|
||||||
|
Loading…
Reference in New Issue
Block a user