From 4d4da2273dcd29509e921ac105fc768ab68a5359 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sat, 7 Jan 2017 20:29:25 +0100 Subject: [PATCH] Added an option to preferences that allows for saving the pending jobs *without* confirmation. --- HISTORY.txt | 4 +++ gui/win_preferences.ui | 37 ++++++++++++++++++++++++--- src/model_preferences.cpp | 3 +++ src/model_preferences.h | 1 + src/win_main.cpp | 20 +++++++++------ src/win_preferences.cpp | 53 +++++++++++++++------------------------ 6 files changed, 74 insertions(+), 44 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index d92cc59..4915bae 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -2,6 +2,10 @@ Simple x264/x265 Launcher version history ----------------------------------------- +Version 2.78 [2017-01-07] +* Updated x265 to version 2.2+22 +* Some fixes to parameter validation code + Version 2.77 [2016-12-13] * Updated x265 to version 2.1+69 * Updated x264 to revision 2744 diff --git a/gui/win_preferences.ui b/gui/win_preferences.ui index badc183..f566eea 100644 --- a/gui/win_preferences.ui +++ b/gui/win_preferences.ui @@ -9,8 +9,8 @@ 0 0 - 372 - 359 + 369 + 387 @@ -413,6 +413,37 @@ Please be aware that this option does NOT have any effect on 32-Bit systems. + + + + + + + + + + + + + Save pending jobs on application exit *without* confirmation + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -459,7 +490,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems. - Apply + Close diff --git a/src/model_preferences.cpp b/src/model_preferences.cpp index 3bda33c..5a9b433 100644 --- a/src/model_preferences.cpp +++ b/src/model_preferences.cpp @@ -82,6 +82,7 @@ void PreferencesModel::initPreferences(PreferencesModel *preferences) INIT_VALUE(AbortOnTimeout, true ); INIT_VALUE(SkipVersionTest, false); INIT_VALUE(NoSystrayWarning, false); + INIT_VALUE(SaveQueueNoConfirm, false); } void PreferencesModel::loadPreferences(PreferencesModel *preferences) @@ -102,6 +103,7 @@ void PreferencesModel::loadPreferences(PreferencesModel *preferences) LOAD_VALUE_B(DisableWarnings ); LOAD_VALUE_B(NoUpdateReminder ); LOAD_VALUE_B(NoSystrayWarning ); + LOAD_VALUE_B(SaveQueueNoConfirm); //Validation preferences->setProcessPriority(qBound(-2, preferences->getProcessPriority(), 2)); @@ -125,6 +127,7 @@ void PreferencesModel::savePreferences(PreferencesModel *preferences) STORE_VALUE(DisableWarnings ); STORE_VALUE(NoUpdateReminder ); STORE_VALUE(NoSystrayWarning ); + STORE_VALUE(SaveQueueNoConfirm); settings.sync(); } diff --git a/src/model_preferences.h b/src/model_preferences.h index e3750b9..a869e98 100644 --- a/src/model_preferences.h +++ b/src/model_preferences.h @@ -66,6 +66,7 @@ public: PREFERENCES_MAKE_B(AbortOnTimeout) PREFERENCES_MAKE_B(SkipVersionTest) PREFERENCES_MAKE_B(NoSystrayWarning) + PREFERENCES_MAKE_B(SaveQueueNoConfirm) public: static void initPreferences(PreferencesModel *preferences); diff --git a/src/win_main.cpp b/src/win_main.cpp index eaee34b..ed48c34 100644 --- a/src/win_main.cpp +++ b/src/win_main.cpp @@ -1342,18 +1342,22 @@ void MainWindow::closeEvent(QCloseEvent *e) //Save pending jobs for next time, if desired by user if(countPendingJobs() > 0) { - int ret = QMessageBox::question(this, tr("Jobs Are Pending"), tr("You still have pending jobs. How do you want to proceed?"), tr("Save Pending Jobs"), tr("Discard")); - if(ret == 0) + if (!m_preferences->getSaveQueueNoConfirm()) { - m_jobList->saveQueuedJobs(); + const int ret = QMessageBox::question(this, tr("Jobs Are Pending"), tr("You still have some pending jobs in your queue. How do you want to proceed?"), tr("Save Jobs"), tr("Always Save Jobs"), tr("Discard Jobs")); + if ((ret >= 0) && (ret <= 1)) + { + if (ret > 0) + { + m_preferences->setSaveQueueNoConfirm(true); + PreferencesModel::savePreferences(m_preferences.data()); + } + m_jobList->saveQueuedJobs(); + } } else { - if(QMessageBox::warning(this, tr("Jobs Are Pending"), tr("Do you really want to discard all pending jobs?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) - { - e->ignore(); - return; - } + m_jobList->saveQueuedJobs(); } } diff --git a/src/win_preferences.cpp b/src/win_preferences.cpp index 665a9c8..19303f2 100644 --- a/src/win_preferences.cpp +++ b/src/win_preferences.cpp @@ -74,14 +74,15 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferen ui->comboBoxPriority->setItemData(2, QVariant::fromValue(-1)); //Below Normal ui->comboBoxPriority->setItemData(3, QVariant::fromValue(-2)); //Idle - ui->labelRunNextJob->installEventFilter(this); - ui->labelUse64BitAvs2YUV->installEventFilter(this); - ui->labelShutdownComputer->installEventFilter(this); - ui->labelSaveLogFiles->installEventFilter(this); + ui->labelRunNextJob ->installEventFilter(this); + ui->labelUse64BitAvs2YUV ->installEventFilter(this); + ui->labelShutdownComputer ->installEventFilter(this); + ui->labelSaveLogFiles ->installEventFilter(this); ui->labelSaveToSourceFolder->installEventFilter(this); - ui->labelEnableSounds->installEventFilter(this); - ui->labelDisableWarnings->installEventFilter(this); - ui->labelNoUpdateReminder->installEventFilter(this); + ui->labelEnableSounds ->installEventFilter(this); + ui->labelDisableWarnings ->installEventFilter(this); + ui->labelNoUpdateReminder ->installEventFilter(this); + ui->labelSaveQueueNoConfirm->installEventFilter(this); ui->checkBoxDummy1->installEventFilter(this); ui->checkBoxDummy2->installEventFilter(this); @@ -109,9 +110,9 @@ void PreferencesDialog::showEvent(QShowEvent *event) UPDATE_CHECKBOX(ui->checkEnableSounds, m_preferences->getEnableSounds()); UPDATE_CHECKBOX(ui->checkNoUpdateReminder, m_preferences->getNoUpdateReminder()); UPDATE_CHECKBOX(ui->checkDisableWarnings, m_preferences->getDisableWarnings(), true); + UPDATE_CHECKBOX(ui->checkSaveQueueNoConfirm, m_preferences->getSaveQueueNoConfirm()); ui->spinBoxJobCount->setValue(m_preferences->getMaxRunningJobCount()); - UPDATE_COMBOBOX(ui->comboBoxPriority, qBound(-2, m_preferences->getProcessPriority(), 1), 0); const bool hasX64 = m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64); @@ -136,6 +137,7 @@ bool PreferencesDialog::eventFilter(QObject *o, QEvent *e) emulateMouseEvent(o, e, ui->labelEnableSounds, ui->checkEnableSounds); emulateMouseEvent(o, e, ui->labelDisableWarnings, ui->checkDisableWarnings); emulateMouseEvent(o, e, ui->labelNoUpdateReminder, ui->checkNoUpdateReminder); + emulateMouseEvent(o, e, ui->labelSaveQueueNoConfirm, ui->checkSaveQueueNoConfirm); } return false; } @@ -159,16 +161,17 @@ void PreferencesDialog::emulateMouseEvent(QObject *object, QEvent *event, QWidge void PreferencesDialog::done(int n) { - m_preferences->setAutoRunNextJob(ui->checkRunNextJob->isChecked()); - m_preferences->setShutdownComputer(ui->checkShutdownComputer->isChecked()); - m_preferences->setPrefer64BitSource(ui->checkUse64BitAvs2YUV->isChecked()); - m_preferences->setSaveLogFiles(ui->checkSaveLogFiles->isChecked()); - m_preferences->setSaveToSourcePath(ui->checkSaveToSourceFolder->isChecked()); + m_preferences->setAutoRunNextJob (ui->checkRunNextJob->isChecked()); + m_preferences->setShutdownComputer (ui->checkShutdownComputer->isChecked()); + m_preferences->setPrefer64BitSource (ui->checkUse64BitAvs2YUV->isChecked()); + m_preferences->setSaveLogFiles (ui->checkSaveLogFiles->isChecked()); + m_preferences->setSaveToSourcePath (ui->checkSaveToSourceFolder->isChecked()); m_preferences->setMaxRunningJobCount(ui->spinBoxJobCount->value()); - m_preferences->setProcessPriority(ui->comboBoxPriority->itemData(ui->comboBoxPriority->currentIndex()).toInt()); - m_preferences->setEnableSounds(ui->checkEnableSounds->isChecked()); - m_preferences->setDisableWarnings(ui->checkDisableWarnings->isChecked()); - m_preferences->setNoUpdateReminder(ui->checkNoUpdateReminder->isChecked()); + m_preferences->setProcessPriority (ui->comboBoxPriority->itemData(ui->comboBoxPriority->currentIndex()).toInt()); + m_preferences->setEnableSounds (ui->checkEnableSounds->isChecked()); + m_preferences->setDisableWarnings (ui->checkDisableWarnings->isChecked()); + m_preferences->setNoUpdateReminder (ui->checkNoUpdateReminder->isChecked()); + m_preferences->setSaveQueueNoConfirm(ui->checkSaveQueueNoConfirm->isChecked()); PreferencesModel::savePreferences(m_preferences); QDialog::done(n); @@ -180,22 +183,6 @@ void PreferencesDialog::resetButtonPressed(void) showEvent(NULL); } -//void PreferencesDialog::use10BitEncodingToggled(bool checked) -//{ -// if(checked) -// { -// QString text; -// text += QString("%1
").arg(tr("Please note that 10−Bit H.264 streams are not currently supported by hardware (standalone) players!")); -// text += QString("%1
").arg(tr("To play such streams, you will need an up−to−date ffdshow−tryouts, CoreAVC 3.x or another supported s/w decoder.")); -// text += QString("%1
").arg(tr("Also be aware that hardware−acceleration (CUDA, DXVA, etc) usually will not work with 10−Bit H.264 streams.")); -// -// if(QMessageBox::warning(this, tr("10-Bit Encoding"), text.replace("-", "−"), tr("Continue"), tr("Revert"), QString(), 1) != 0) -// { -// UPDATE_CHECKBOX(ui->checkUse10BitEncoding, false, true); -// } -// } -//} - void PreferencesDialog::disableWarningsToggled(bool checked) { if(checked)