Make it possible to save to the name of an existing template.
This commit is contained in:
parent
fa9488fb78
commit
d7d5f27756
Binary file not shown.
@ -409,7 +409,7 @@ const char *x264_version_time(void)
|
|||||||
|
|
||||||
bool x264_is_prerelease(void)
|
bool x264_is_prerelease(void)
|
||||||
{
|
{
|
||||||
return (VER_x264_PRE_RELEASE);
|
return (VER_X264_PRE_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -233,12 +233,12 @@ QModelIndex JobListModel::insertJob(EncodeThread *thread)
|
|||||||
|
|
||||||
switch(thread->options()->rcMode())
|
switch(thread->options()->rcMode())
|
||||||
{
|
{
|
||||||
case OptionsModel::RCMode_CQ:
|
|
||||||
config = QString("CQ@%1").arg(QString::number(thread->options()->quantizer()));
|
|
||||||
break;
|
|
||||||
case OptionsModel::RCMode_CRF:
|
case OptionsModel::RCMode_CRF:
|
||||||
config = QString("CRF@%1").arg(QString::number(thread->options()->quantizer()));
|
config = QString("CRF@%1").arg(QString::number(thread->options()->quantizer()));
|
||||||
break;
|
break;
|
||||||
|
case OptionsModel::RCMode_CQ:
|
||||||
|
config = QString("CQ@%1").arg(QString::number(qRound(thread->options()->quantizer())));
|
||||||
|
break;
|
||||||
case OptionsModel::RCMode_2Pass:
|
case OptionsModel::RCMode_2Pass:
|
||||||
config = QString("2Pass@%1").arg(QString::number(thread->options()->bitrate()));
|
config = QString("2Pass@%1").arg(QString::number(thread->options()->bitrate()));
|
||||||
break;
|
break;
|
||||||
|
@ -213,7 +213,7 @@ void EncodeThread::encode(void)
|
|||||||
log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!"));
|
log(tr("\nWARNING: Your revision of x264 uses an unsupported core (API) version, take care!"));
|
||||||
log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(VER_X264_CURRENT_API)));
|
log(tr("This application works best with x264 core (API) version %2.").arg(QString::number(VER_X264_CURRENT_API)));
|
||||||
}
|
}
|
||||||
if((revision_avs2yuv != UINT_MAX) && ((revision_avs2yuv % REV_MULT) != VER_x264_AVS2YUV_VER))
|
if((revision_avs2yuv != UINT_MAX) && ((revision_avs2yuv % REV_MULT) != VER_X264_AVS2YUV_VER))
|
||||||
{
|
{
|
||||||
log(tr("\nERROR: Your version of avs2yuv is unsupported (Required version: v0.24 BugMaster's mod 2)"));
|
log(tr("\nERROR: Your version of avs2yuv is unsupported (Required version: v0.24 BugMaster's mod 2)"));
|
||||||
log(tr("You can find the required version at: http://komisar.gin.by/tools/avs2yuv/"));
|
log(tr("You can find the required version at: http://komisar.gin.by/tools/avs2yuv/"));
|
||||||
|
@ -24,6 +24,6 @@
|
|||||||
|
|
||||||
#define VER_X264_MINIMUM_REV (2146)
|
#define VER_X264_MINIMUM_REV (2146)
|
||||||
#define VER_X264_CURRENT_API (120)
|
#define VER_X264_CURRENT_API (120)
|
||||||
#define VER_x264_AVS2YUV_VER (242)
|
#define VER_X264_AVS2YUV_VER (242)
|
||||||
|
|
||||||
#define VER_x264_PRE_RELEASE (0)
|
#define VER_X264_PRE_RELEASE (0)
|
||||||
|
@ -364,13 +364,19 @@ void AddJobDialog::saveTemplateButtonClicked(void)
|
|||||||
{
|
{
|
||||||
qDebug("Saving template");
|
qDebug("Saving template");
|
||||||
QString name = tr("New Template");
|
QString name = tr("New Template");
|
||||||
|
int n = 2;
|
||||||
|
|
||||||
|
while(OptionsModel::templateExists(name))
|
||||||
|
{
|
||||||
|
name = tr("New Template (%1)").arg(QString::number(n++));
|
||||||
|
}
|
||||||
|
|
||||||
OptionsModel *options = new OptionsModel();
|
OptionsModel *options = new OptionsModel();
|
||||||
saveOptions(options);
|
saveOptions(options);
|
||||||
|
|
||||||
if(options->equals(m_defaults))
|
if(options->equals(m_defaults))
|
||||||
{
|
{
|
||||||
QMessageBox::warning (this, tr("Default"), tr("It makes no sense to save the defaults!"));
|
QMessageBox::warning (this, tr("Oups"), tr("<nobr>It makes no sense to save the default settings!</nobr>"));
|
||||||
cbxTemplate->blockSignals(true);
|
cbxTemplate->blockSignals(true);
|
||||||
cbxTemplate->setCurrentIndex(0);
|
cbxTemplate->setCurrentIndex(0);
|
||||||
cbxTemplate->blockSignals(false);
|
cbxTemplate->blockSignals(false);
|
||||||
@ -386,7 +392,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!"));
|
QMessageBox::warning (this, tr("Oups"), tr("<nobr>There already is a template for the current settings!</nobr>"));
|
||||||
cbxTemplate->blockSignals(true);
|
cbxTemplate->blockSignals(true);
|
||||||
cbxTemplate->setCurrentIndex(i);
|
cbxTemplate->setCurrentIndex(i);
|
||||||
cbxTemplate->blockSignals(false);
|
cbxTemplate->blockSignals(false);
|
||||||
@ -400,7 +406,7 @@ void AddJobDialog::saveTemplateButtonClicked(void)
|
|||||||
forever
|
forever
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
name = QInputDialog::getText(this, tr("Save Template"), tr("Please enter the name of the template:").leftJustified(160, ' '), QLineEdit::Normal, name, &ok).simplified();
|
name = QInputDialog::getText(this, tr("Save Template"), tr("Please enter the name of the template:").leftJustified(144, ' '), QLineEdit::Normal, name, &ok).simplified();
|
||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
X264_DELETE(options);
|
X264_DELETE(options);
|
||||||
@ -408,7 +414,7 @@ void AddJobDialog::saveTemplateButtonClicked(void)
|
|||||||
}
|
}
|
||||||
if(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/') || name.contains('"'))
|
if(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/') || name.contains('"'))
|
||||||
{
|
{
|
||||||
QMessageBox::warning (this, tr("Invalid Name"), tr("Sorry, the name you have entered is invalid!"));
|
QMessageBox::warning (this, tr("Invalid Name"), tr("<nobr>Sorry, the name you have entered is invalid!</nobr>"));
|
||||||
while(name.contains('<')) name.remove('<');
|
while(name.contains('<')) name.remove('<');
|
||||||
while(name.contains('>')) name.remove('>');
|
while(name.contains('>')) name.remove('>');
|
||||||
while(name.contains('\\')) name.remove('\\');
|
while(name.contains('\\')) name.remove('\\');
|
||||||
@ -419,8 +425,11 @@ void AddJobDialog::saveTemplateButtonClicked(void)
|
|||||||
}
|
}
|
||||||
if(OptionsModel::templateExists(name))
|
if(OptionsModel::templateExists(name))
|
||||||
{
|
{
|
||||||
QMessageBox::warning (this, tr("Already Exists"), tr("Sorry, a template of that name already exists!"));
|
int ret = QMessageBox::warning (this, tr("Already Exists"), tr("<nobr>A template of that name already exists! Overwrite?</nobr>"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
continue;
|
if(ret != QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -434,8 +443,22 @@ void AddJobDialog::saveTemplateButtonClicked(void)
|
|||||||
|
|
||||||
int index = cbxTemplate->model()->rowCount();
|
int index = cbxTemplate->model()->rowCount();
|
||||||
cbxTemplate->blockSignals(true);
|
cbxTemplate->blockSignals(true);
|
||||||
cbxTemplate->insertItem(index, name, QVariant::fromValue<void*>(options));
|
for(int i = 0; i < cbxTemplate->count(); i++)
|
||||||
cbxTemplate->setCurrentIndex(index);
|
{
|
||||||
|
if(cbxTemplate->itemText(i).compare(name, Qt::CaseInsensitive) == 0)
|
||||||
|
{
|
||||||
|
index = -1; //Do not append new template
|
||||||
|
OptionsModel *oldItem = reinterpret_cast<OptionsModel*>(cbxTemplate->itemData(i).value<void*>());
|
||||||
|
cbxTemplate->setItemData(i, QVariant::fromValue<void*>(options));
|
||||||
|
cbxTemplate->setCurrentIndex(i);
|
||||||
|
X264_DELETE(oldItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(index >= 0)
|
||||||
|
{
|
||||||
|
cbxTemplate->insertItem(index, name, QVariant::fromValue<void*>(options));
|
||||||
|
cbxTemplate->setCurrentIndex(index);
|
||||||
|
}
|
||||||
cbxTemplate->blockSignals(false);
|
cbxTemplate->blockSignals(false);
|
||||||
|
|
||||||
REMOVE_USAFED_ITEM;
|
REMOVE_USAFED_ITEM;
|
||||||
@ -446,12 +469,19 @@ void AddJobDialog::deleteTemplateButtonClicked(void)
|
|||||||
const int index = cbxTemplate->currentIndex();
|
const int index = cbxTemplate->currentIndex();
|
||||||
QString name = cbxTemplate->itemText(index);
|
QString name = cbxTemplate->itemText(index);
|
||||||
|
|
||||||
if(name.contains('<') || name.contains('>'))
|
if(name.contains('<') || name.contains('>') || name.contains('\\') || name.contains('/'))
|
||||||
{
|
{
|
||||||
QMessageBox::warning (this, tr("Invalid Item"), tr("Sorry, the selected item cannot be deleted!"));
|
QMessageBox::warning (this, tr("Invalid Item"), tr("Sorry, the selected item cannot be deleted!"));
|
||||||
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);
|
||||||
|
if(ret != QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
OptionsModel::deleteTemplate(name);
|
OptionsModel::deleteTemplate(name);
|
||||||
OptionsModel *item = reinterpret_cast<OptionsModel*>(cbxTemplate->itemData(index).value<void*>());
|
OptionsModel *item = reinterpret_cast<OptionsModel*>(cbxTemplate->itemData(index).value<void*>());
|
||||||
cbxTemplate->removeItem(index);
|
cbxTemplate->removeItem(index);
|
||||||
|
@ -63,7 +63,7 @@ private:
|
|||||||
unsigned int countRunningJobs(void);
|
unsigned int countRunningJobs(void);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addButtonPressed(const QString &filePath = QString(), int fileNo = 0, int fileTotal = 0, bool *ok = NULL);
|
void addButtonPressed(const QString &filePath = QString(), int fileNo = -1, int fileTotal = 0, bool *ok = NULL);
|
||||||
void abortButtonPressed(void);
|
void abortButtonPressed(void);
|
||||||
void browseButtonPressed(void);
|
void browseButtonPressed(void);
|
||||||
void deleteButtonPressed(void);
|
void deleteButtonPressed(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user