diff --git a/gui/win_addJob.ui b/gui/win_addJob.ui
index e97863c..2f74712 100644
--- a/gui/win_addJob.ui
+++ b/gui/win_addJob.ui
@@ -7,7 +7,7 @@
0
0
640
- 494
+ 569
@@ -36,7 +36,7 @@
- 20
+ 0
0
@@ -87,7 +87,7 @@
- 20
+ 0
0
@@ -138,7 +138,7 @@
- 20
+ 0
0
@@ -148,539 +148,641 @@
-
-
-
-
- 0
- 0
-
-
+
- Rate Control
+ Configuration
-
+
-
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
- -
-
+
-
-
-
-
-
-
- Mode:
-
-
-
- -
-
-
- 0
-
-
-
-
- CRF
-
-
- -
-
- CQ
-
-
- -
-
- 2-Pass
-
-
- -
-
- ABR
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 16
- 0
-
-
-
-
- -
-
-
-
-
-
- Quantizer/CRF:
-
-
-
- -
-
-
- 52
-
-
- 22
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 16
- 0
-
-
-
-
- -
-
-
-
-
-
- Target Bitrate (kbps):
-
-
-
- -
-
-
- 100
-
-
- 250000
-
-
- 1200
-
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Basic Encoder Options
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
- -
-
-
-
-
-
-
-
-
- Preset:
-
-
-
- -
-
-
- 5
-
-
-
-
- Ultrafast
-
-
- -
-
- Superfast
-
-
- -
-
- Veryfast
-
-
- -
-
- Faster
-
-
- -
-
- Fast
-
-
- -
-
- Medium
-
-
- -
-
- Slow
-
-
- -
-
- Slower
-
-
- -
-
- Veryslow
-
-
- -
-
- Placebo
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 16
- 20
-
-
-
-
- -
-
-
-
-
-
- Tuning:
-
-
-
- -
-
-
- 1
-
-
-
-
- None
-
-
- -
-
- Film
-
-
- -
-
- Animation
-
-
- -
-
- Grain
-
-
- -
-
- Stillimage
-
-
- -
-
- PSNR
-
-
- -
-
- SSIM
-
-
- -
-
- Fastdecode
-
-
- -
-
- Zerolatency
-
-
- -
-
- Touhou
-
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 16
- 20
-
-
-
-
- -
-
-
-
-
-
- Profile:
-
-
-
- -
-
-
- 0
-
-
-
-
- High
-
-
- -
-
- Main
-
-
- -
-
- Baseline
-
-
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Advanced Encoder Options
-
-
-
-
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
-
-
- Custom x264 Parameters:
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
-
-
-
-
- 0
- 0
- 255
-
-
-
-
-
-
-
-
- 0
- 0
- 255
-
-
-
-
-
-
-
-
- 120
- 120
- 120
-
-
-
-
-
-
-
-
- true
-
-
-
- PointingHandCursor
-
-
- Show Help Screen
-
-
-
-
-
- -
-
-
- true
+
+
+ Template:
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 256
+ 0
+
+
+
+ -1
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 8
+ 20
+
+
+
+
+ -
+
+
+ Save As...
+
+
+
+ :/buttons/disk.png:/buttons/disk.png
+
+
+
+ -
+
+
+ Delete
+
+
+
+ :/buttons/cross.png:/buttons/cross.png
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 10
+ 20
+
+
+
+
-
-
+
Qt::Vertical
+
+ QSizePolicy::Fixed
+
20
- 0
+ 4
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Rate Control
+
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Mode:
+
+
+
+ -
+
+
+ 0
+
+
-
+
+ CRF
+
+
+ -
+
+ CQ
+
+
+ -
+
+ 2-Pass
+
+
+ -
+
+ ABR
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 16
+ 0
+
+
+
+
+ -
+
+
-
+
+
+ Quantizer/CRF:
+
+
+
+ -
+
+
+ 52
+
+
+ 22
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 16
+ 0
+
+
+
+
+ -
+
+
-
+
+
+ Target Bitrate (kbps):
+
+
+
+ -
+
+
+ 100
+
+
+ 250000
+
+
+ 1200
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Basic Encoder Options
+
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+ -
+
+
-
+
+
-
+
+
+ Preset:
+
+
+
+ -
+
+
+ 5
+
+
-
+
+ Ultrafast
+
+
+ -
+
+ Superfast
+
+
+ -
+
+ Veryfast
+
+
+ -
+
+ Faster
+
+
+ -
+
+ Fast
+
+
+ -
+
+ Medium
+
+
+ -
+
+ Slow
+
+
+ -
+
+ Slower
+
+
+ -
+
+ Veryslow
+
+
+ -
+
+ Placebo
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 16
+ 20
+
+
+
+
+ -
+
+
-
+
+
+ Tuning:
+
+
+
+ -
+
+
+ 1
+
+
-
+
+ None
+
+
+ -
+
+ Film
+
+
+ -
+
+ Animation
+
+
+ -
+
+ Grain
+
+
+ -
+
+ Stillimage
+
+
+ -
+
+ PSNR
+
+
+ -
+
+ SSIM
+
+
+ -
+
+ Fastdecode
+
+
+ -
+
+ Zerolatency
+
+
+ -
+
+ Touhou
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 16
+ 20
+
+
+
+
+ -
+
+
-
+
+
+ Profile:
+
+
+
+ -
+
+
+ 0
+
+
-
+
+ High
+
+
+ -
+
+ Main
+
+
+ -
+
+ Baseline
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Advanced Encoder Options
+
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
-
+
+
+ Custom x264 Parameters:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 255
+
+
+
+
+
+
+
+
+ 120
+ 120
+ 120
+
+
+
+
+
+
+
+
+ true
+
+
+
+ PointingHandCursor
+
+
+ Show Help Screen
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 0
+
+
+
+
+
+
+
@@ -768,7 +870,6 @@
cbxPreset
cbxTuning
cbxProfile
- cbxCustomParams
checkBoxRun
buttonAccept
buttonCancel
diff --git a/res/resources.qrc b/res/resources.qrc
index 432135d..25eea1f 100644
--- a/res/resources.qrc
+++ b/res/resources.qrc
@@ -8,6 +8,8 @@
buttons/cancel.png
buttons/clock_pause.png
buttons/clock_stop.png
+ buttons/cross.png
+ buttons/disk.png
buttons/door_in.png
buttons/error.png
buttons/exclamation.png
diff --git a/src/model_options.cpp b/src/model_options.cpp
index 021901b..c3bec41 100644
--- a/src/model_options.cpp
+++ b/src/model_options.cpp
@@ -57,3 +57,18 @@ QString OptionsModel::rcMode2String(RCMode mode)
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;
+}
diff --git a/src/model_options.h b/src/model_options.h
index 1bd3e56..69a3886 100644
--- a/src/model_options.h
+++ b/src/model_options.h
@@ -56,6 +56,9 @@ public:
void setProfile(const QString &profile) { m_profile = profile.trimmed(); }
void setCustom(const QString &custom) { m_custom = custom.trimmed(); }
+ //Stuff
+ bool equals(OptionsModel *model);
+
//Helper
static QString rcMode2String(RCMode mode);
diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp
index 97d299c..f4445cc 100644
--- a/src/win_addJob.cpp
+++ b/src/win_addJob.cpp
@@ -85,6 +85,7 @@ class StringValidator : public QValidator
AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
:
QDialog(parent),
+ m_defaults(new OptionsModel()),
m_options(options)
{
//Init the dialog, from the .ui file
@@ -92,11 +93,13 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
//Fix dialog size
+ buttonSaveTemplate->setMaximumHeight(20);
+ buttonDeleteTemplate->setMaximumHeight(20);
resize(width(), minimumHeight());
setMinimumSize(size());
setMaximumHeight(height());
- //Activate combobox
+ //Monitor RC mode combobox
connect(cbxRateControlMode, SIGNAL(currentIndexChanged(int)), this, SLOT(modeIndexChanged(int)));
//Activate buttons
@@ -104,16 +107,35 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *options)
connect(buttonBrowseOutput, SIGNAL(clicked()), this, SLOT(browseButtonClicked()));
//Setup validator
- cbxCustomParams->setValidator(new StringValidator());
- cbxCustomParams->addItem("--bluray-compat --vbv-maxrate 40000 --vbv-bufsize 30000 --level 4.1 --keyint 25 --open-gop --slices 4");
- cbxCustomParams->clearEditText();
+ editCustomParams->setValidator(new StringValidator());
+ editCustomParams->clear();
//Install event filter
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(""), QVariant::fromValue(m_defaults));
+ cbxTemplate->setCurrentIndex(0);
+ if(!m_options->equals(m_defaults))
+ {
+ cbxTemplate->insertItem(1, tr(""), QVariant::fromValue(m_options));
+ cbxTemplate->setCurrentIndex(1);
+ }
+ connect(cbxTemplate, SIGNAL(currentIndexChanged(int)), this, SLOT(templateSelected()));
}
AddJobDialog::~AddJobDialog(void)
{
+ X264_DELETE(m_defaults);
}
///////////////////////////////////////////////////////////////////////////////
@@ -123,8 +145,7 @@ AddJobDialog::~AddJobDialog(void)
void AddJobDialog::showEvent(QShowEvent *event)
{
QDialog::showEvent(event);
- restoreOptions(m_options);
- modeIndexChanged(cbxRateControlMode->currentIndex());
+ templateSelected();
}
bool AddJobDialog::eventFilter(QObject *o, QEvent *e)
@@ -232,6 +253,41 @@ void AddJobDialog::browseButtonClicked(void)
}
}
+void AddJobDialog::configurationChanged(void)
+{
+ OptionsModel* options = reinterpret_cast(cbxTemplate->itemData(cbxTemplate->currentIndex()).value());
+ if(options)
+ {
+ cbxTemplate->blockSignals(true);
+ cbxTemplate->insertItem(0, tr(""), QVariant::fromValue(NULL));
+ cbxTemplate->setCurrentIndex(0);
+ cbxTemplate->blockSignals(false);
+ }
+}
+
+void AddJobDialog::templateSelected(void)
+{
+ OptionsModel* options = reinterpret_cast(cbxTemplate->itemData(cbxTemplate->currentIndex()).value());
+ if(options)
+ {
+ qDebug("Loading options!");
+ for(int i = 0; i < cbxTemplate->model()->rowCount(); i++)
+ {
+ OptionsModel* temp = reinterpret_cast(cbxTemplate->itemData(i).value());
+ if(temp == NULL)
+ {
+ cbxTemplate->blockSignals(true);
+ cbxTemplate->removeItem(i);
+ cbxTemplate->blockSignals(false);
+ break;
+ }
+ }
+ restoreOptions(options);
+ }
+
+ modeIndexChanged(cbxRateControlMode->currentIndex());
+}
+
///////////////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////////////////////////////////////////////////////
@@ -264,13 +320,29 @@ void AddJobDialog::updateComboBox(QComboBox *cbox, const QString &text)
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());
spinQuantizer->setValue(options->quantizer());
spinBitrate->setValue(options->bitrate());
updateComboBox(cbxPreset, options->preset());
updateComboBox(cbxTuning, options->tune());
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)
@@ -281,7 +353,7 @@ void AddJobDialog::saveOptions(OptionsModel *options)
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->setProfile(cbxProfile->model()->data(cbxProfile->model()->index(cbxProfile->currentIndex(), 0)).toString());
- options->setCustom(cbxCustomParams->currentText());
+ options->setCustom(editCustomParams->text().simplified());
}
QString AddJobDialog::makeFileFilter(void)
diff --git a/src/win_addJob.h b/src/win_addJob.h
index 6b0e725..267fa65 100644
--- a/src/win_addJob.h
+++ b/src/win_addJob.h
@@ -38,12 +38,13 @@ public:
QString preset(void) { return cbxPreset->itemText(cbxPreset->currentIndex()); }
QString tuning(void) { return cbxTuning->itemText(cbxTuning->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(); }
void setRunImmediately(bool run) { checkBoxRun->setChecked(run); }
protected:
OptionsModel *m_options;
+ OptionsModel *m_defaults;
virtual void showEvent(QShowEvent *event);
virtual bool eventFilter(QObject *o, QEvent *e);
@@ -51,6 +52,8 @@ protected:
private slots:
void modeIndexChanged(int index);
void browseButtonClicked(void);
+ void configurationChanged(void);
+ void templateSelected(void);
virtual void accept(void);