diff --git a/src/encoder_x264.cpp b/src/encoder_x264.cpp index f0a6d8b..bc64ff8 100644 --- a/src/encoder_x264.cpp +++ b/src/encoder_x264.cpp @@ -338,21 +338,30 @@ void X264Encoder::buildCommandLine(QStringList &cmdLine, const bool &usePipe, co cmdLine << "--stats" << QDir::toNativeSeparators(passLogFile); } - cmdLine << "--preset" << m_options->preset().toLower(); - - if(!m_options->tune().simplified().isEmpty()) + const QString preset = m_options->preset().simplified().toLower(); + if(!preset.isEmpty()) { - if(m_options->tune().simplified().compare(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED), Qt::CaseInsensitive) != 0) + if(preset.compare(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED), Qt::CaseInsensitive) != 0) { - cmdLine << "--tune" << m_options->tune().simplified().toLower(); + cmdLine << "--preset" << preset; } } - if(!m_options->profile().simplified().isEmpty()) + const QString tune = m_options->tune().simplified().toLower(); + if(!tune.isEmpty()) { - if(m_options->profile().simplified().compare(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED), Qt::CaseInsensitive) != 0) + if(tune.compare(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED), Qt::CaseInsensitive) != 0) { - cmdLine << "--profile" << m_options->profile().simplified().toLower(); + cmdLine << "--tune" << tune; + } + } + + const QString profile = m_options->profile().simplified().toLower(); + if(!profile.isEmpty()) + { + if(profile.compare(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED), Qt::CaseInsensitive) != 0) + { + cmdLine << "--profile" << profile; } } diff --git a/src/encoder_x265.cpp b/src/encoder_x265.cpp index 3f9842d..ac99598 100644 --- a/src/encoder_x265.cpp +++ b/src/encoder_x265.cpp @@ -334,21 +334,30 @@ void X265Encoder::buildCommandLine(QStringList &cmdLine, const bool &usePipe, co cmdLine << "--stats" << QDir::toNativeSeparators(passLogFile); } - cmdLine << "--preset" << m_options->preset().toLower(); - - if(!m_options->tune().simplified().isEmpty()) + const QString preset = m_options->preset().simplified().toLower(); + if(!preset.isEmpty()) { - if(m_options->tune().simplified().compare(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED), Qt::CaseInsensitive) != 0) + if(preset.compare(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED), Qt::CaseInsensitive) != 0) { - cmdLine << "--tune" << m_options->tune().simplified().toLower(); + cmdLine << "--preset" << preset; } } - if(!m_options->profile().simplified().isEmpty()) + const QString tune = m_options->tune().simplified().toLower(); + if(!tune.isEmpty()) { - if(m_options->profile().simplified().compare(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED), Qt::CaseInsensitive) != 0) + if(tune.compare(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED), Qt::CaseInsensitive) != 0) { - cmdLine << "--profile" << m_options->profile().simplified().toLower(); + cmdLine << "--tune" << tune; + } + } + + const QString profile = m_options->profile().simplified().toLower(); + if(!profile.isEmpty()) + { + if(profile.compare(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED), Qt::CaseInsensitive) != 0) + { + cmdLine << "--profile" << profile; } } diff --git a/src/model_options.cpp b/src/model_options.cpp index 370487f..fab695d 100644 --- a/src/model_options.cpp +++ b/src/model_options.cpp @@ -51,7 +51,7 @@ static const char *KEY_PROFILE_NAME = "profile_name"; static const char *KEY_CUSTOM_ENCODER = "custom_params_encoder"; static const char *KEY_CUSTOM_AVS2YUV = "custom_params_avs2yuv"; -const char *const OptionsModel::TUNING_UNSPECIFIED = ""; +const char *const OptionsModel::SETTING_UNSPECIFIED = ""; const char *const OptionsModel::PROFILE_UNRESTRICTED = ""; OptionsModel::OptionsModel(const SysinfoModel *sysinfo) @@ -63,7 +63,7 @@ OptionsModel::OptionsModel(const SysinfoModel *sysinfo) m_bitrate = 1200; m_quantizer = 22; m_preset = "Medium"; - m_tune = QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED); + m_tune = QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED); m_profile = QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED); m_custom_encoder = QString(); m_custom_avs2yuv = QString(); @@ -292,6 +292,6 @@ void OptionsModel::fixTemplate(QSettings &settingsFile) } if(settingsFile.value(KEY_TUNING_NAME).toString().compare("none", Qt::CaseInsensitive) == 0) { - settingsFile.setValue(KEY_TUNING_NAME, QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED)); + settingsFile.setValue(KEY_TUNING_NAME, QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED)); } } diff --git a/src/model_options.h b/src/model_options.h index 011eeff..1fe30bd 100644 --- a/src/model_options.h +++ b/src/model_options.h @@ -74,7 +74,7 @@ public: RCMode_MAX = RCMode_ABR, }; - static const char *const TUNING_UNSPECIFIED; + static const char *const SETTING_UNSPECIFIED; static const char *const PROFILE_UNRESTRICTED; //Getter diff --git a/src/win_addJob.cpp b/src/win_addJob.cpp index 01649b7..6460913 100644 --- a/src/win_addJob.cpp +++ b/src/win_addJob.cpp @@ -294,7 +294,7 @@ AddJobDialog::AddJobDialog(QWidget *parent, OptionsModel *const options, Recentl ui->cbxRateControlMode->addItem(tr("ABR"), OptionsModel::RCMode_ABR); //Init combobox items - ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED)); + ui->cbxTuning ->addItem(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED)); ui->cbxProfile->addItem(QString::fromLatin1(OptionsModel::PROFILE_UNRESTRICTED)); //Hide optional controls @@ -524,7 +524,7 @@ void AddJobDialog::encoderIndexChanged(int index) { ui->cbxPreset->setEnabled(true); ui->cbxPreset->clear(); - ui->cbxPreset->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED)); + ui->cbxPreset->addItem(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED)); ui->cbxPreset->addItems(presets); } @@ -539,7 +539,7 @@ void AddJobDialog::encoderIndexChanged(int index) { ui->cbxTuning->setEnabled(true); ui->cbxTuning->clear(); - ui->cbxTuning->addItem(QString::fromLatin1(OptionsModel::TUNING_UNSPECIFIED)); + ui->cbxTuning->addItem(QString::fromLatin1(OptionsModel::SETTING_UNSPECIFIED)); ui->cbxTuning->addItems(tunings); }