Added an option to preferences that allows for saving the pending jobs *without* confirmation.

This commit is contained in:
LoRd_MuldeR 2017-01-07 20:29:25 +01:00
parent f823b485d7
commit 4d4da2273d
6 changed files with 74 additions and 44 deletions

View File

@ -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

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>359</height>
<width>369</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
@ -413,6 +413,37 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QCheckBox" name="checkSaveQueueNoConfirm">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelSaveQueueNoConfirm">
<property name="text">
<string>Save pending jobs on application exit *without* confirmation</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
@ -459,7 +490,7 @@ Please be aware that this option does NOT have any effect on 32-Bit systems.</st
</size>
</property>
<property name="text">
<string>Apply</string>
<string>Close</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">

View File

@ -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();
}

View File

@ -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);

View File

@ -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())
{
const int ret = QMessageBox::question(this, tr("Jobs Are Pending"), tr("<nobr>You still have some pending jobs in your queue. How do you want to proceed?</nobr>"), 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();
}
}

View File

@ -82,6 +82,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferen
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;
}
@ -169,6 +171,7 @@ void PreferencesDialog::done(int n)
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("<nobr>%1</nobr><br>").arg(tr("Please note that 10&minus;Bit H.264 streams are <b>not</b> currently supported by hardware (standalone) players!"));
// text += QString("<nobr>%1</nobr><br>").arg(tr("To play such streams, you will need an <i>up&minus;to&minus;date</i> ffdshow&minus;tryouts, CoreAVC 3.x or another supported s/w decoder."));
// text += QString("<nobr>%1</nobr><br>").arg(tr("Also be aware that hardware&minus;acceleration (CUDA, DXVA, etc) usually will <b>not</b> work with 10&minus;Bit H.264 streams."));
//
// if(QMessageBox::warning(this, tr("10-Bit Encoding"), text.replace("-", "&minus;"), tr("Continue"), tr("Revert"), QString(), 1) != 0)
// {
// UPDATE_CHECKBOX(ui->checkUse10BitEncoding, false, true);
// }
// }
//}
void PreferencesDialog::disableWarningsToggled(bool checked)
{
if(checked)