Updated AddJob dialog for the recent AbstractEncoderInfo changes + various fixes.

This commit is contained in:
LoRd_MuldeR 2016-05-08 16:30:31 +02:00
parent 36ecf72d93
commit 6ca6b0ca11
12 changed files with 131 additions and 90 deletions

View File

@ -303,11 +303,6 @@ static T getElementAt(const QList<T> &list, const quint32 &index)
return list[index]; return list[index];
} }
const AbstractEncoderInfo& AbstractEncoder::getEncoderInfo(void)
{
MUTILS_THROW("[getEncoderInfo] This function must be overwritten in sub-classes!");
}
QStringList AbstractEncoderInfo::getDependencies(const SysinfoModel *sysinfo, const quint32 &encArch, const quint32 &encVariant) const QStringList AbstractEncoderInfo::getDependencies(const SysinfoModel *sysinfo, const quint32 &encArch, const quint32 &encVariant) const
{ {
return QStringList(); return QStringList();
@ -320,7 +315,12 @@ QString AbstractEncoderInfo::getFullName(const quint32 &encArch, const quint32 &
QString AbstractEncoderInfo::archToString(const quint32 &index) const QString AbstractEncoderInfo::archToString(const quint32 &index) const
{ {
return getElementAt(getArchitectures(), index); return getElementAt(getArchitectures(), index).first;
}
AbstractEncoderInfo::ArchBit AbstractEncoderInfo::archToType(const quint32 &index) const
{
return getElementAt(getArchitectures(), index).second;
} }
QString AbstractEncoderInfo::variantToString(const quint32 &index) const QString AbstractEncoderInfo::variantToString(const quint32 &index) const

View File

@ -40,11 +40,19 @@ public:
} }
RCType; RCType;
typedef QPair<QString, RCType> RCMode; typedef enum _ArchBit
{
ARCH_TYPE_X86 = 0,
ARCH_TYPE_X64 = 1,
}
ArchBit;
typedef QPair<QString, RCType> RCMode;
typedef QPair<QString, ArchBit> ArchId;
virtual QString getName(void) const = 0; virtual QString getName(void) const = 0;
virtual QString getFullName(const quint32 &encArch, const quint32 &encVariant) const; virtual QString getFullName(const quint32 &encArch, const quint32 &encVariant) const;
virtual QStringList getArchitectures(void) const = 0; virtual QList<ArchId> getArchitectures(void) const = 0;
virtual QStringList getVariants(void) const = 0; virtual QStringList getVariants(void) const = 0;
virtual QList<RCMode> getRCModes(void) const = 0; virtual QList<RCMode> getRCModes(void) const = 0;
virtual QStringList getProfiles(const quint32 &variant) const = 0; virtual QStringList getProfiles(const quint32 &variant) const = 0;
@ -57,6 +65,7 @@ public:
//Utilities //Utilities
QString archToString (const quint32 &index) const; QString archToString (const quint32 &index) const;
ArchBit archToType (const quint32 &index) const;
QString variantToString(const quint32 &index) const; QString variantToString(const quint32 &index) const;
QString rcModeToString (const quint32 &index) const; QString rcModeToString (const quint32 &index) const;
RCType rcModeToType (const quint32 &index) const; RCType rcModeToType (const quint32 &index) const;
@ -70,7 +79,7 @@ public:
virtual bool runEncodingPass(AbstractSource* pipedSource, const QString outputFile, const unsigned int &frames, const int &pass = 0, const QString &passLogFile = QString()); virtual bool runEncodingPass(AbstractSource* pipedSource, const QString outputFile, const unsigned int &frames, const int &pass = 0, const QString &passLogFile = QString());
static const AbstractEncoderInfo& getEncoderInfo(void); virtual const AbstractEncoderInfo& getEncoderInfo(void) const = 0;
protected: protected:
virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile) = 0; virtual void buildCommandLine(QStringList &cmdLine, const bool &usePipe, const unsigned int &frames, const QString &indexFile, const int &pass, const QString &passLogFile) = 0;

View File

@ -58,11 +58,11 @@ const AbstractEncoderInfo& EncoderFactory::getEncoderInfo(const OptionsModel::En
switch(encoderType) switch(encoderType)
{ {
case OptionsModel::EncType_X264: case OptionsModel::EncType_X264:
return X264Encoder::getEncoderInfo(); return X264Encoder::encoderInfo();
case OptionsModel::EncType_X265: case OptionsModel::EncType_X265:
return X265Encoder::getEncoderInfo(); return X265Encoder::encoderInfo();
case OptionsModel::EncType_NVEnc: case OptionsModel::EncType_NVEnc:
return NVEncEncoder::getEncoderInfo(); return NVEncEncoder::encoderInfo();
default: default:
MUTILS_THROW("Unknown encoder type encountered!"); MUTILS_THROW("Unknown encoder type encountered!");
} }

View File

@ -94,9 +94,11 @@ public:
return "NVEncC"; return "NVEncC";
} }
virtual QStringList getArchitectures(void) const virtual QList<ArchId> getArchitectures(void) const
{ {
return QStringList() << "32-Bit (x86)" << "64-Bit (x64)"; return QList<ArchId>()
<< qMakePair(QString("32-Bit (x86)"), ARCH_TYPE_X86)
<< qMakePair(QString("64-Bit (x64)"), ARCH_TYPE_X64);
} }
virtual QStringList getVariants(void) const virtual QStringList getVariants(void) const
@ -198,11 +200,16 @@ public:
static const NVEncEncoderInfo s_nvencEncoderInfo; static const NVEncEncoderInfo s_nvencEncoderInfo;
const AbstractEncoderInfo &NVEncEncoder::getEncoderInfo(void) const AbstractEncoderInfo& NVEncEncoder::encoderInfo(void)
{ {
return s_nvencEncoderInfo; return s_nvencEncoderInfo;
} }
const AbstractEncoderInfo &NVEncEncoder::getEncoderInfo(void) const
{
return encoderInfo();
}
// ------------------------------------------------------------ // ------------------------------------------------------------
// Constructor & Destructor // Constructor & Destructor
// ------------------------------------------------------------ // ------------------------------------------------------------

View File

@ -34,7 +34,8 @@ public:
virtual QString printVersion(const unsigned int &revision, const bool &modified); virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified); virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
static const AbstractEncoderInfo& getEncoderInfo(void); virtual const AbstractEncoderInfo& getEncoderInfo(void) const;
static const AbstractEncoderInfo& encoderInfo(void);
protected: protected:
virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); } virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); }

View File

@ -95,9 +95,11 @@ public:
return "x264 (AVC/H.264)"; return "x264 (AVC/H.264)";
} }
virtual QStringList getArchitectures(void) const virtual QList<ArchId> getArchitectures(void) const
{ {
return QStringList() << "32-Bit (x86)" << "64-Bit (x64)"; return QList<ArchId>()
<< qMakePair(QString("32-Bit (x86)"), ARCH_TYPE_X86)
<< qMakePair(QString("64-Bit (x64)"), ARCH_TYPE_X64);
} }
virtual QStringList getVariants(void) const virtual QStringList getVariants(void) const
@ -180,11 +182,16 @@ public:
static const X264EncoderInfo s_x264EncoderInfo; static const X264EncoderInfo s_x264EncoderInfo;
const AbstractEncoderInfo &X264Encoder::getEncoderInfo(void) const AbstractEncoderInfo& X264Encoder::encoderInfo(void)
{ {
return s_x264EncoderInfo; return s_x264EncoderInfo;
} }
const AbstractEncoderInfo &X264Encoder::getEncoderInfo(void) const
{
return encoderInfo();
}
// ------------------------------------------------------------ // ------------------------------------------------------------
// Constructor & Destructor // Constructor & Destructor
// ------------------------------------------------------------ // ------------------------------------------------------------

View File

@ -34,7 +34,8 @@ public:
virtual QString printVersion(const unsigned int &revision, const bool &modified); virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified); virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
static const AbstractEncoderInfo& getEncoderInfo(void); virtual const AbstractEncoderInfo& getEncoderInfo(void) const;
static const AbstractEncoderInfo& encoderInfo(void);
protected: protected:
virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); } virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); }

View File

@ -95,9 +95,11 @@ public:
return "x265 (HEVC/H.265)"; return "x265 (HEVC/H.265)";
} }
virtual QStringList getArchitectures(void) const virtual QList<ArchId> getArchitectures(void) const
{ {
return QStringList() << "32-Bit (x86)" << "64-Bit (x64)"; return QList<ArchId>()
<< qMakePair(QString("32-Bit (x86)"), ARCH_TYPE_X86)
<< qMakePair(QString("64-Bit (x64)"), ARCH_TYPE_X64);
} }
virtual QStringList getVariants(void) const virtual QStringList getVariants(void) const
@ -176,11 +178,16 @@ public:
static const X265EncoderInfo s_x265EncoderInfo; static const X265EncoderInfo s_x265EncoderInfo;
const AbstractEncoderInfo &X265Encoder::getEncoderInfo(void) const AbstractEncoderInfo& X265Encoder::encoderInfo(void)
{ {
return s_x265EncoderInfo; return s_x265EncoderInfo;
} }
const AbstractEncoderInfo &X265Encoder::getEncoderInfo(void) const
{
return encoderInfo();
}
// ------------------------------------------------------------ // ------------------------------------------------------------
// Constructor & Destructor // Constructor & Destructor
// ------------------------------------------------------------ // ------------------------------------------------------------

View File

@ -34,7 +34,8 @@ public:
virtual QString printVersion(const unsigned int &revision, const bool &modified); virtual QString printVersion(const unsigned int &revision, const bool &modified);
virtual bool isVersionSupported(const unsigned int &revision, const bool &modified); virtual bool isVersionSupported(const unsigned int &revision, const bool &modified);
static const AbstractEncoderInfo& getEncoderInfo(void); virtual const AbstractEncoderInfo& getEncoderInfo(void) const;
static const AbstractEncoderInfo& encoderInfo(void);
protected: protected:
virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); } virtual QString getBinaryPath() const { return getEncoderInfo().getBinaryPath(m_sysinfo, m_options->encArch(), m_options->encVariant()); }

View File

@ -151,10 +151,11 @@ void BinariesCheckThread::checkBinaries3(volatile bool &success, const SysinfoMo
for(OptionsModel::EncType encdr = OptionsModel::EncType_MIN; encdr <= OptionsModel::EncType_MAX; NEXT(encdr)) for(OptionsModel::EncType encdr = OptionsModel::EncType_MIN; encdr <= OptionsModel::EncType_MAX; NEXT(encdr))
{ {
const AbstractEncoderInfo &encInfo = EncoderFactory::getEncoderInfo(encdr); const AbstractEncoderInfo &encInfo = EncoderFactory::getEncoderInfo(encdr);
const QStringList archs = encInfo.getArchitectures(), variants = encInfo.getVariants(); const quint32 archCount = encInfo.getArchitectures().count();
QSet<QString> dependencySet; QSet<QString> dependencySet;
for (quint32 archIdx = 0; archIdx < quint32(archs.count()); ++archIdx) for (quint32 archIdx = 0; archIdx < archCount; ++archIdx)
{ {
const QStringList variants = encInfo.getVariants();
for (quint32 varntIdx = 0; varntIdx < quint32(variants.count()); ++varntIdx) for (quint32 varntIdx = 0; varntIdx < quint32(variants.count()); ++varntIdx)
{ {
const QStringList dependencies = encInfo.getDependencies(sysinfo, archIdx, varntIdx); const QStringList dependencies = encInfo.getDependencies(sysinfo, archIdx, varntIdx);

View File

@ -260,15 +260,15 @@ protected:
} }
}; };
class StringValidatorX264 : public StringValidator class StringValidatorEncoder : public StringValidator
{ {
public: public:
StringValidatorX264(QLabel *notifier, QLabel *icon) : StringValidator(notifier, icon) {} StringValidatorEncoder(QLabel *notifier, QLabel *icon) : StringValidator(notifier, icon) {}
virtual State validate(QString &input, int &pos) const virtual State validate(QString &input, int &pos) const
{ {
static const char *const params[] = {"B", "o", "h", "p", "q", /*"fps", "frames",*/ "preset", "tune", "profile", static const char *const params[] = {"B", "o", "h", "p", "q", /*"fps", "frames",*/ "preset", "tune", "profile",
"stdin", "crf", "bitrate", "qp", "pass", "stats", "output", "help", "quiet", NULL}; "stdin", "crf", "bitrate", "qp", "pass", "stats", "output", "help", "quiet", "codec", "y4m", NULL};
const QString commandLine = input.trimmed(); const QString commandLine = input.trimmed();
const QStringList tokens = commandLine.isEmpty() ? QStringList() : MUtils::OS::crack_command_line(commandLine); const QStringList tokens = commandLine.isEmpty() ? QStringList() : MUtils::OS::crack_command_line(commandLine);
@ -326,16 +326,6 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl
ui->cbxEncoderType->addItem(tr("x265 (HEVC)"), OptionsModel::EncType_X265); ui->cbxEncoderType->addItem(tr("x265 (HEVC)"), OptionsModel::EncType_X265);
ui->cbxEncoderType->addItem(tr("NVEncC"), OptionsModel::EncType_NVEnc); ui->cbxEncoderType->addItem(tr("NVEncC"), OptionsModel::EncType_NVEnc);
//Init arch combobox
ui->cbxEncoderArch->addItem(tr("32-Bit"), OptionsModel::EncArch_x86_32);
ui->cbxEncoderArch->addItem(tr("64-Bit"), OptionsModel::EncArch_x86_64);
//Init rc-mode combobox
ui->cbxRateControlMode->addItem(tr("CRF"), OptionsModel::RCMode_CRF);
ui->cbxRateControlMode->addItem(tr("CQ"), OptionsModel::RCMode_CQ);
ui->cbxRateControlMode->addItem(tr("2-Pass"), OptionsModel::RCMode_2Pass);
ui->cbxRateControlMode->addItem(tr("ABR"), OptionsModel::RCMode_ABR);
//Init combobox items //Init combobox items
ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED)); ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED));
ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED)); ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED));
@ -356,7 +346,7 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl
//Setup validator //Setup validator
ui->editCustomX264Params->installEventFilter(this); ui->editCustomX264Params->installEventFilter(this);
ui->editCustomX264Params->setValidator(new StringValidatorX264(ui->labelNotificationX264, ui->iconNotificationX264)); ui->editCustomX264Params->setValidator(new StringValidatorEncoder(ui->labelNotificationX264, ui->iconNotificationX264));
ui->editCustomX264Params->clear(); ui->editCustomX264Params->clear();
ui->editCustomAvs2YUVParams->installEventFilter(this); ui->editCustomAvs2YUVParams->installEventFilter(this);
ui->editCustomAvs2YUVParams->setValidator(new StringValidatorAvs2YUV(ui->labelNotificationAvs2YUV, ui->iconNotificationAvs2YUV)); ui->editCustomAvs2YUVParams->setValidator(new StringValidatorAvs2YUV(ui->labelNotificationAvs2YUV, ui->iconNotificationAvs2YUV));
@ -537,23 +527,28 @@ void AddJobDialog::encoderIndexChanged(int index)
const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt()); const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType); const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Update encoder variants //Update encoder architectures
const QFlags<OptionsModel::EncVariant> variants = encoderInfo.getVariants(); const QList<AbstractEncoderInfo::ArchId> archs = encoderInfo.getArchitectures();
ui->cbxEncoderVariant->clear(); ui->cbxEncoderArch->clear();
for(OptionsModel::EncVariant varnt = OptionsModel::EncVariant_MIN; varnt <= OptionsModel::EncVariant_MAX; SHFL(varnt)) for (quint32 archIdx = 0; archIdx < quint32(archs.count()); ++archIdx)
{ {
if(variants.testFlag(varnt)) ui->cbxEncoderArch->addItem(archs[archIdx].first, archIdx);
{ }
QString varntText;
switch(varnt) //Update encoder variants
{ const QStringList variants = encoderInfo.getVariants();
case OptionsModel::EncVariant_8Bit: varntText = tr("8-Bit"); break; ui->cbxEncoderVariant->clear();
case OptionsModel::EncVariant_10Bit: varntText = tr("10-Bit"); break; for(quint32 varntIdx = 0; varntIdx < quint32(variants.count()); ++varntIdx)
case OptionsModel::EncVariant_12Bit: varntText = tr("12-Bit"); break; {
default: MUTILS_THROW("Bad encoder variant!"); ui->cbxEncoderVariant->addItem(variants[varntIdx], varntIdx);
} }
ui->cbxEncoderVariant->addItem(varntText, QVariant(varnt));
} //Update encoder RC modes
const QList<AbstractEncoderInfo::RCMode> rcModes = encoderInfo.getRCModes();
ui->cbxRateControlMode->clear();
for (quint32 rcIndex = 0; rcIndex < quint32(rcModes.count()); ++rcIndex)
{
ui->cbxRateControlMode->addItem(rcModes[rcIndex].first, rcIndex);
} }
//Update presets //Update presets
@ -595,7 +590,7 @@ void AddJobDialog::variantIndexChanged(int index)
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType); const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Update encoder profiles //Update encoder profiles
const QStringList profiles = encoderInfo.getProfiles(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant->itemData(index).toInt())); const QStringList profiles = encoderInfo.getProfiles(ui->cbxEncoderVariant->itemData(index).toUInt());
if(profiles.empty()) if(profiles.empty())
{ {
ui->cbxProfile->setEnabled(false); ui->cbxProfile->setEnabled(false);
@ -614,18 +609,30 @@ void AddJobDialog::variantIndexChanged(int index)
void AddJobDialog::modeIndexChanged(int index) void AddJobDialog::modeIndexChanged(int index)
{ {
ui->spinQuantizer->setEnabled(index == OptionsModel::RCMode_CRF || index == OptionsModel::RCMode_CQ); const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
ui->spinBitrate ->setEnabled(index == OptionsModel::RCMode_ABR || index == OptionsModel::RCMode_2Pass); const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Update bitrate/quantizer boxes
const AbstractEncoderInfo::RCType rcType = encoderInfo.rcModeToType(ui->cbxRateControlMode->itemData(index).toUInt());
ui->spinQuantizer->setEnabled(rcType == AbstractEncoderInfo::RC_TYPE_QUANTIZER);
ui->spinBitrate ->setEnabled(rcType != AbstractEncoderInfo::RC_TYPE_QUANTIZER);
} }
void AddJobDialog::accept(void) void AddJobDialog::accept(void)
{ {
//Get encoder info
const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Check 64-Bit support //Check 64-Bit support
if((ui->cbxEncoderArch->currentIndex() == OptionsModel::EncArch_x86_64) && (!m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64))) if (encoderInfo.archToType(ui->cbxEncoderArch->itemData(ui->cbxEncoderArch->currentIndex()).toUInt()) == AbstractEncoderInfo::ARCH_TYPE_X64)
{ {
QMessageBox::warning(this, tr("64-Bit unsupported!"), tr("<nobr>Sorry, this computer does <b>not</b> support 64-Bit encoders!</nobr>")); if (!m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64))
ui->cbxEncoderArch->setCurrentIndex(OptionsModel::EncArch_x86_32); {
return; QMessageBox::warning(this, tr("64-Bit unsupported!"), tr("<nobr>Sorry, this computer does <b>not</b> support 64-Bit encoders!</nobr>"));
ui->cbxEncoderArch->setCurrentIndex(AbstractEncoderInfo::ARCH_TYPE_X86);
return;
}
} }
//Selection complete? //Selection complete?
@ -648,25 +655,6 @@ void AddJobDialog::accept(void)
return; return;
} }
//Get encoder info
const OptionsModel::EncType encType = static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt());
const AbstractEncoderInfo &encoderInfo = EncoderFactory::getEncoderInfo(encType);
//Is selected RC mode supported?
if(!encoderInfo.isRCModeSupported(static_cast<OptionsModel::RCMode>(ui->cbxRateControlMode->currentIndex())))
{
QMessageBox::warning(this, tr("Bad RC Mode!"), tr("<nobr>The selected RC mode is not supported by the selected encoder!</nobr>"));
for(int i = 0; i < ui->cbxRateControlMode->count(); i++)
{
if(encoderInfo.isRCModeSupported(static_cast<OptionsModel::RCMode>(i)))
{
ui->cbxRateControlMode->setCurrentIndex(i);
break;
}
}
return;
}
//Is the type of the source file supported? //Is the type of the source file supported?
const int sourceType = MediaInfo::analyze(sourceFile.canonicalFilePath()); const int sourceType = MediaInfo::analyze(sourceFile.canonicalFilePath());
if(sourceType == MediaInfo::FILETYPE_AVISYNTH) if(sourceType == MediaInfo::FILETYPE_AVISYNTH)
@ -1097,13 +1085,30 @@ void AddJobDialog::updateComboBox(QComboBox *const cbox, const QString &text)
} }
void AddJobDialog::updateComboBox(QComboBox *const cbox, const int &data) void AddJobDialog::updateComboBox(QComboBox *const cbox, const int &data)
{
int index = 0;
if (QAbstractItemModel *model = cbox->model())
{
for (int i = 0; i < cbox->model()->rowCount(); i++)
{
if (cbox->itemData(i).toInt() == data)
{
index = i;
break;
}
}
}
cbox->setCurrentIndex(index);
}
void AddJobDialog::updateComboBox(QComboBox *const cbox, const quint32 &data)
{ {
int index = 0; int index = 0;
if(QAbstractItemModel *model = cbox->model()) if(QAbstractItemModel *model = cbox->model())
{ {
for(int i = 0; i < cbox->model()->rowCount(); i++) for(int i = 0; i < cbox->model()->rowCount(); i++)
{ {
if(cbox->itemData(i).toInt() == data) if(cbox->itemData(i).toUInt() == data)
{ {
index = i; index = i;
break; break;
@ -1115,7 +1120,7 @@ void AddJobDialog::updateComboBox(QComboBox *const cbox, const int &data)
void AddJobDialog::restoreOptions(const OptionsModel *options) void AddJobDialog::restoreOptions(const OptionsModel *options)
{ {
DisableHelperRAII disbale(&m_monitorConfigChanges); DisableHelperRAII disable(&m_monitorConfigChanges);
updateComboBox(ui->cbxEncoderType, options->encType()); updateComboBox(ui->cbxEncoderType, options->encType());
updateComboBox(ui->cbxEncoderArch, options->encArch()); updateComboBox(ui->cbxEncoderArch, options->encArch());
@ -1135,19 +1140,20 @@ void AddJobDialog::restoreOptions(const OptionsModel *options)
void AddJobDialog::saveOptions(OptionsModel *options) void AddJobDialog::saveOptions(OptionsModel *options)
{ {
options->setEncType (static_cast<OptionsModel::EncType> (ui->cbxEncoderType ->itemData(ui->cbxEncoderType ->currentIndex()).toInt())); options->setEncType(static_cast<OptionsModel::EncType>(ui->cbxEncoderType->itemData(ui->cbxEncoderType->currentIndex()).toInt()));
options->setEncArch (static_cast<OptionsModel::EncArch> (ui->cbxEncoderArch ->itemData(ui->cbxEncoderArch ->currentIndex()).toInt()));
options->setEncVariant(static_cast<OptionsModel::EncVariant>(ui->cbxEncoderVariant ->itemData(ui->cbxEncoderVariant ->currentIndex()).toInt())); options->setEncArch (ui->cbxEncoderArch ->itemData(ui->cbxEncoderArch ->currentIndex()).toUInt());
options->setRCMode (static_cast<OptionsModel::RCMode> (ui->cbxRateControlMode->itemData(ui->cbxRateControlMode->currentIndex()).toInt())); options->setEncVariant(ui->cbxEncoderVariant ->itemData(ui->cbxEncoderVariant ->currentIndex()).toUInt());
options->setRCMode (ui->cbxRateControlMode->itemData(ui->cbxRateControlMode->currentIndex()).toUInt());
options->setQuantizer(ui->spinQuantizer->value()); options->setQuantizer(ui->spinQuantizer->value());
options->setBitrate(ui->spinBitrate->value()); options->setBitrate (ui->spinBitrate ->value());
options->setPreset (ui->cbxPreset ->model()->data(ui->cbxPreset ->model()->index(ui->cbxPreset ->currentIndex(), 0)).toString()); options->setPreset (ui->cbxPreset ->model()->data(ui->cbxPreset ->model()->index(ui->cbxPreset ->currentIndex(), 0)).toString());
options->setTune (ui->cbxTuning ->model()->data(ui->cbxTuning ->model()->index(ui->cbxTuning ->currentIndex(), 0)).toString()); options->setTune (ui->cbxTuning ->model()->data(ui->cbxTuning ->model()->index(ui->cbxTuning ->currentIndex(), 0)).toString());
options->setProfile(ui->cbxProfile->model()->data(ui->cbxProfile->model()->index(ui->cbxProfile->currentIndex(), 0)).toString()); options->setProfile(ui->cbxProfile->model()->data(ui->cbxProfile->model()->index(ui->cbxProfile->currentIndex(), 0)).toString());
options->setCustomEncParams(ui->editCustomX264Params->hasAcceptableInput() ? ui->editCustomX264Params->text().simplified() : QString()); options->setCustomEncParams(ui->editCustomX264Params->hasAcceptableInput() ? ui->editCustomX264Params->text().simplified() : QString());
options->setCustomAvs2YUV(ui->editCustomAvs2YUVParams->hasAcceptableInput() ? ui->editCustomAvs2YUVParams->text().simplified() : QString()); options->setCustomAvs2YUV(ui->editCustomAvs2YUVParams->hasAcceptableInput() ? ui->editCustomAvs2YUVParams->text().simplified() : QString());
} }

View File

@ -99,6 +99,7 @@ private:
void saveOptions(OptionsModel *options); void saveOptions(OptionsModel *options);
void updateComboBox(QComboBox *const cbox, const QString &text); void updateComboBox(QComboBox *const cbox, const QString &text);
void updateComboBox(QComboBox *const cbox, const int &data); void updateComboBox(QComboBox *const cbox, const int &data);
void updateComboBox(QComboBox *const cbox, const quint32 &data);
QString currentSourcePath(const bool bWithName = false); QString currentSourcePath(const bool bWithName = false);
QString currentOutputPath(const bool bWithName = false); QString currentOutputPath(const bool bWithName = false);