Added template support. Saving user-defined templates not implemented yet.
This commit is contained in:
parent
a3ff0fda24
commit
6410bdbaac
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>640</width>
|
||||||
<height>494</height>
|
<height>569</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -36,7 +36,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -138,7 +138,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -147,6 +147,109 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_5">
|
||||||
|
<property name="title">
|
||||||
|
<string> Configuration </string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Template:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cbxTemplate">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>256</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_9">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>8</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonSaveTemplate">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save As...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../res/resources.qrc">
|
||||||
|
<normaloff>:/buttons/disk.png</normaloff>:/buttons/disk.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="buttonDeleteTemplate">
|
||||||
|
<property name="text">
|
||||||
|
<string>Delete</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../res/resources.qrc">
|
||||||
|
<normaloff>:/buttons/cross.png</normaloff>:/buttons/cross.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_10">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>4</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -660,11 +763,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="cbxCustomParams">
|
<widget class="QLineEdit" name="editCustomParams"/>
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@ -684,6 +783,9 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
@ -768,7 +870,6 @@
|
|||||||
<tabstop>cbxPreset</tabstop>
|
<tabstop>cbxPreset</tabstop>
|
||||||
<tabstop>cbxTuning</tabstop>
|
<tabstop>cbxTuning</tabstop>
|
||||||
<tabstop>cbxProfile</tabstop>
|
<tabstop>cbxProfile</tabstop>
|
||||||
<tabstop>cbxCustomParams</tabstop>
|
|
||||||
<tabstop>checkBoxRun</tabstop>
|
<tabstop>checkBoxRun</tabstop>
|
||||||
<tabstop>buttonAccept</tabstop>
|
<tabstop>buttonAccept</tabstop>
|
||||||
<tabstop>buttonCancel</tabstop>
|
<tabstop>buttonCancel</tabstop>
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
<file>buttons/cancel.png</file>
|
<file>buttons/cancel.png</file>
|
||||||
<file>buttons/clock_pause.png</file>
|
<file>buttons/clock_pause.png</file>
|
||||||
<file>buttons/clock_stop.png</file>
|
<file>buttons/clock_stop.png</file>
|
||||||
|
<file>buttons/cross.png</file>
|
||||||
|
<file>buttons/disk.png</file>
|
||||||
<file>buttons/door_in.png</file>
|
<file>buttons/door_in.png</file>
|
||||||
<file>buttons/error.png</file>
|
<file>buttons/error.png</file>
|
||||||
<file>buttons/exclamation.png</file>
|
<file>buttons/exclamation.png</file>
|
||||||
|
@ -57,3 +57,18 @@ QString OptionsModel::rcMode2String(RCMode mode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OptionsModel::equals(OptionsModel *model)
|
||||||
|
{
|
||||||
|
bool equal = true;
|
||||||
|
|
||||||
|
if(this->m_rcMode != model->m_rcMode) equal = false;
|
||||||
|
if(this->m_bitrate!= model->m_bitrate) equal = false;
|
||||||
|
if(this->m_quantizer != model->m_quantizer) equal = false;
|
||||||
|
if(this->m_preset.compare(model->m_preset, Qt::CaseInsensitive)) equal = false;
|
||||||
|
if(this->m_tune.compare(model->m_tune, Qt::CaseInsensitive)) equal = false;
|
||||||
|
if(this->m_profile.compare(model->m_profile, Qt::CaseInsensitive)) equal = false;
|
||||||
|
if(this->m_custom.compare(model->m_custom, Qt::CaseInsensitive)) equal = false;
|
||||||
|
|
||||||
|
return equal;
|
||||||
|
}
|
||||||
|
@ -56,6 +56,9 @@ public:
|
|||||||
void setProfile(const QString &profile) { m_profile = profile.trimmed(); }
|
void setProfile(const QString &profile) { m_profile = profile.trimmed(); }
|
||||||
void setCustom(const QString &custom) { m_custom = custom.trimmed(); }
|
void setCustom(const QString &custom) { m_custom = custom.trimmed(); }
|
||||||
|
|
||||||
|
//Stuff
|
||||||
|
bool equals(OptionsModel *model);
|
||||||
|
|
||||||
//Helper
|
//Helper
|
||||||
static QString rcMode2String(RCMode mode);
|
static QString rcMode2String(RCMode mode);
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ class StringValidator : public QValidator
|
|||||||
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
|
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
|
||||||
:
|
:
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
|
m_defaults(new OptionsModel()),
|
||||||
m_options(options)
|
m_options(options)
|
||||||
{
|
{
|
||||||
//Init the dialog, from the .ui file
|
//Init the dialog, from the .ui file
|
||||||
@ -92,11 +93,13 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
|
|||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
|
|
||||||
//Fix dialog size
|
//Fix dialog size
|
||||||
|
buttonSaveTemplate->setMaximumHeight(20);
|
||||||
|
buttonDeleteTemplate->setMaximumHeight(20);
|
||||||
resize(width(), minimumHeight());
|
resize(width(), minimumHeight());
|
||||||
setMinimumSize(size());
|
setMinimumSize(size());
|
||||||
setMaximumHeight(height());
|
setMaximumHeight(height());
|
||||||
|
|
||||||
//Activate combobox
|
//Monitor RC mode combobox
|
||||||
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int)));
|
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int)));
|
||||||
|
|
||||||
//Activate buttons
|
//Activate buttons
|
||||||
@ -104,16 +107,35 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
|
|||||||
connect(buttonBrowseOutput, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
|
connect(buttonBrowseOutput, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
|
||||||
|
|
||||||
//Setup validator
|
//Setup validator
|
||||||
cbxCustomParams->setValidator(new StringValidator());
|
editCustomParams->setValidator(new StringValidator());
|
||||||
cbxCustomParams->addItem("--bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 25 --open-gop --slices 4");
|
editCustomParams->clear();
|
||||||
cbxCustomParams->clearEditText();
|
|
||||||
|
|
||||||
//Install event filter
|
//Install event filter
|
||||||
labelHelpScreen->installEventFilter(this);
|
labelHelpScreen->installEventFilter(this);
|
||||||
|
|
||||||
|
//Monitor for options changes
|
||||||
|
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
|
||||||
|
connect(spinQuantizer, SIGNAL(valueChanged(int)), this, SLOT(configurationChanged()));
|
||||||
|
connect(spinBitrate, SIGNAL(valueChanged(int)), this, SLOT(configurationChanged()));
|
||||||
|
connect(cbxPreset, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
|
||||||
|
connect(cbxTuning, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
|
||||||
|
connect(cbxProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(configurationChanged()));
|
||||||
|
connect(editCustomParams, SIGNAL(textChanged(QString)), this, SLOT(configurationChanged()));
|
||||||
|
|
||||||
|
//Monitor template
|
||||||
|
cbxTemplate->insertItem(0, tr("<Default>"), QVariant::fromValue<void*>(m_defaults));
|
||||||
|
cbxTemplate->setCurrentIndex(0);
|
||||||
|
if(!m_options->equals(m_defaults))
|
||||||
|
{
|
||||||
|
cbxTemplate->insertItem(1, tr("<Recently Used>"), QVariant::fromValue<void*>(m_options));
|
||||||
|
cbxTemplate->setCurrentIndex(1);
|
||||||
|
}
|
||||||
|
connect(cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AddJobDialog::~AddJobDialog(void)
|
AddJobDialog::~AddJobDialog(void)
|
||||||
{
|
{
|
||||||
|
X264_DELETE(m_defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -123,8 +145,7 @@ AddJobDialog::~AddJobDialog(void)
|
|||||||
void AddJobDialog::showEvent(QShowEvent *event)
|
void AddJobDialog::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event);
|
||||||
restoreOptions(m_options);
|
templateSelected();
|
||||||
modeIndexChanged(cbxRateControlMode->currentIndex());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
|
bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
|
||||||
@ -232,6 +253,41 @@ void AddJobDialog::browseButtonClicked(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddJobDialog::configurationChanged(void)
|
||||||
|
{
|
||||||
|
OptionsModel* options = reinterpret_cast<OptionsModel*>(cbxTemplate->itemData(cbxTemplate->currentIndex()).value<void*>());
|
||||||
|
if(options)
|
||||||
|
{
|
||||||
|
cbxTemplate->blockSignals(true);
|
||||||
|
cbxTemplate->insertItem(0, tr("<Unsaved Configuration>"), QVariant::fromValue<void*>(NULL));
|
||||||
|
cbxTemplate->setCurrentIndex(0);
|
||||||
|
cbxTemplate->blockSignals(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddJobDialog::templateSelected(void)
|
||||||
|
{
|
||||||
|
OptionsModel* options = reinterpret_cast<OptionsModel*>(cbxTemplate->itemData(cbxTemplate->currentIndex()).value<void*>());
|
||||||
|
if(options)
|
||||||
|
{
|
||||||
|
qDebug("Loading options!");
|
||||||
|
for(int i = 0; i < cbxTemplate->model()->rowCount(); i++)
|
||||||
|
{
|
||||||
|
OptionsModel* temp = reinterpret_cast<OptionsModel*>(cbxTemplate->itemData(i).value<void*>());
|
||||||
|
if(temp == NULL)
|
||||||
|
{
|
||||||
|
cbxTemplate->blockSignals(true);
|
||||||
|
cbxTemplate->removeItem(i);
|
||||||
|
cbxTemplate->blockSignals(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
restoreOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
modeIndexChanged(cbxRateControlMode->currentIndex());
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Public functions
|
// Public functions
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -264,13 +320,29 @@ void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text)
|
|||||||
|
|
||||||
void AddJobDialog::restoreOptions(OptionsModel *options)
|
void AddJobDialog::restoreOptions(OptionsModel *options)
|
||||||
{
|
{
|
||||||
|
cbxRateControlMode->blockSignals(true);
|
||||||
|
spinQuantizer->blockSignals(true);
|
||||||
|
spinBitrate->blockSignals(true);
|
||||||
|
cbxPreset->blockSignals(true);
|
||||||
|
cbxTuning->blockSignals(true);
|
||||||
|
cbxProfile->blockSignals(true);
|
||||||
|
editCustomParams->blockSignals(true);
|
||||||
|
|
||||||
cbxRateControlMode->setCurrentIndex(options->rcMode());
|
cbxRateControlMode->setCurrentIndex(options->rcMode());
|
||||||
spinQuantizer->setValue(options->quantizer());
|
spinQuantizer->setValue(options->quantizer());
|
||||||
spinBitrate->setValue(options->bitrate());
|
spinBitrate->setValue(options->bitrate());
|
||||||
updateComboBox(cbxPreset, options->preset());
|
updateComboBox(cbxPreset, options->preset());
|
||||||
updateComboBox(cbxTuning, options->tune());
|
updateComboBox(cbxTuning, options->tune());
|
||||||
updateComboBox(cbxProfile, options->profile());
|
updateComboBox(cbxProfile, options->profile());
|
||||||
cbxCustomParams->setEditText(options->custom());
|
editCustomParams->setText(options->custom());
|
||||||
|
|
||||||
|
cbxRateControlMode->blockSignals(false);
|
||||||
|
spinQuantizer->blockSignals(false);
|
||||||
|
spinBitrate->blockSignals(false);
|
||||||
|
cbxPreset->blockSignals(false);
|
||||||
|
cbxTuning->blockSignals(false);
|
||||||
|
cbxProfile->blockSignals(false);
|
||||||
|
editCustomParams->blockSignals(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddJobDialog::saveOptions(OptionsModel *options)
|
void AddJobDialog::saveOptions(OptionsModel *options)
|
||||||
@ -281,7 +353,7 @@ void AddJobDialog::saveOptions(OptionsModel *options)
|
|||||||
options->setPreset(cbxPreset->model()->data(cbxPreset->model()->index(cbxPreset->currentIndex(), 0)).toString());
|
options->setPreset(cbxPreset->model()->data(cbxPreset->model()->index(cbxPreset->currentIndex(), 0)).toString());
|
||||||
options->setTune(cbxTuning->model()->data(cbxTuning->model()->index(cbxTuning->currentIndex(), 0)).toString());
|
options->setTune(cbxTuning->model()->data(cbxTuning->model()->index(cbxTuning->currentIndex(), 0)).toString());
|
||||||
options->setProfile(cbxProfile->model()->data(cbxProfile->model()->index(cbxProfile->currentIndex(), 0)).toString());
|
options->setProfile(cbxProfile->model()->data(cbxProfile->model()->index(cbxProfile->currentIndex(), 0)).toString());
|
||||||
options->setCustom(cbxCustomParams->currentText());
|
options->setCustom(editCustomParams->text().simplified());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AddJobDialog::makeFileFilter(void)
|
QString AddJobDialog::makeFileFilter(void)
|
||||||
|
@ -38,12 +38,13 @@ public:
|
|||||||
QString preset(void) { return cbxPreset->itemText(cbxPreset->currentIndex()); }
|
QString preset(void) { return cbxPreset->itemText(cbxPreset->currentIndex()); }
|
||||||
QString tuning(void) { return cbxTuning->itemText(cbxTuning->currentIndex()); }
|
QString tuning(void) { return cbxTuning->itemText(cbxTuning->currentIndex()); }
|
||||||
QString profile(void) { return cbxProfile->itemText(cbxProfile->currentIndex()); }
|
QString profile(void) { return cbxProfile->itemText(cbxProfile->currentIndex()); }
|
||||||
QString params(void) { return cbxCustomParams->currentText().simplified(); }
|
QString params(void) { return editCustomParams->text().simplified(); }
|
||||||
bool runImmediately(void) { return checkBoxRun->isChecked(); }
|
bool runImmediately(void) { return checkBoxRun->isChecked(); }
|
||||||
void setRunImmediately(bool run) { checkBoxRun->setChecked(run); }
|
void setRunImmediately(bool run) { checkBoxRun->setChecked(run); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
OptionsModel *m_options;
|
OptionsModel *m_options;
|
||||||
|
OptionsModel *m_defaults;
|
||||||
|
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
virtual bool eventFilter(QObject *o, QEvent *e);
|
virtual bool eventFilter(QObject *o, QEvent *e);
|
||||||
@ -51,6 +52,8 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
void modeIndexChanged(int index);
|
void modeIndexChanged(int index);
|
||||||
void browseButtonClicked(void);
|
void browseButtonClicked(void);
|
||||||
|
void configurationChanged(void);
|
||||||
|
void templateSelected(void);
|
||||||
|
|
||||||
virtual void accept(void);
|
virtual void accept(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user