Moved option to shut-down computer from the preferences dialog to the menubar.
This commit is contained in:
parent
585fdf009a
commit
5b91737789
@ -6,6 +6,7 @@ Version 2.86 [2018-02-26]
|
||||
* Updated x264 to revision 2901 (API v155)
|
||||
* Updated x265 to version 2.7+1
|
||||
* Updated NVEncC to version 3.30
|
||||
* Moved "shut-down computer" from preferences to main menu
|
||||
* x264 now uses combined 8-Bit/10-Bit binaries
|
||||
|
||||
Version 2.85 [2017-10-04]
|
||||
|
@ -332,10 +332,23 @@
|
||||
<addaction name="actionCleanup_Finished"/>
|
||||
<addaction name="actionCleanup_Enqueued"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRemove_PostOperation">
|
||||
<property name="title">
|
||||
<string>On Completion</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res/resources.qrc">
|
||||
<normaloff>:/buttons/flag.png</normaloff>:/buttons/flag.png</iconset>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPostOp_PowerDown"/>
|
||||
<addaction name="actionPostOp_Hibernate"/>
|
||||
</widget>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionCreateJob"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuRemove_Jobs"/>
|
||||
<addaction name="menuRemove_PostOperation"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
<addaction name="separator"/>
|
||||
@ -805,6 +818,39 @@
|
||||
<string>Remove Enqued Jobs</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDo_Nothing">
|
||||
<property name="icon">
|
||||
<iconset resource="../res/resources.qrc">
|
||||
<normaloff>:/buttons/cup.png</normaloff>:/buttons/cup.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do Nothing</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPostOp_PowerDown">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res/resources.qrc">
|
||||
<normaloff>:/buttons/power_off.png</normaloff>:/buttons/power_off.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Shutdown Computer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPostOp_Hibernate">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res/resources.qrc">
|
||||
<normaloff>:/buttons/power_save.png</normaloff>:/buttons/power_save.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hibernate Computer</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>buttonAddJob</tabstop>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>369</width>
|
||||
<height>387</height>
|
||||
<height>359</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -222,37 +222,6 @@ 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_10">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkShutdownComputer">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelShutdownComputer">
|
||||
<property name="text">
|
||||
<string>Shutdown computer as soon as the last job has completed</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
|
@ -17,12 +17,14 @@
|
||||
<file>buttons/computer.png</file>
|
||||
<file>buttons/control_pause.png</file>
|
||||
<file>buttons/cross.png</file>
|
||||
<file>buttons/cup.png</file>
|
||||
<file>buttons/disk.png</file>
|
||||
<file>buttons/door_in.png</file>
|
||||
<file>buttons/error.png</file>
|
||||
<file>buttons/exclamation.png</file>
|
||||
<file>buttons/exclamation_small.png</file>
|
||||
<file>buttons/find.png</file>
|
||||
<file>buttons/flag.png</file>
|
||||
<file>buttons/folder_add.png</file>
|
||||
<file>buttons/folder_magnify.png</file>
|
||||
<file>buttons/group.png</file>
|
||||
@ -37,6 +39,7 @@
|
||||
<file>buttons/play_big.png</file>
|
||||
<file>buttons/power_off.png</file>
|
||||
<file>buttons/power_on.png</file>
|
||||
<file>buttons/power_save.png</file>
|
||||
<file>buttons/qt.png</file>
|
||||
<file>buttons/restart.png</file>
|
||||
<file>buttons/setup.png</file>
|
||||
|
@ -71,7 +71,6 @@ void PreferencesModel::initPreferences(PreferencesModel *preferences)
|
||||
{
|
||||
INIT_VALUE(AutoRunNextJob, true );
|
||||
INIT_VALUE(MaxRunningJobCount, 1 );
|
||||
INIT_VALUE(ShutdownComputer, false);
|
||||
INIT_VALUE(Prefer64BitSource, false);
|
||||
INIT_VALUE(SaveLogFiles, false);
|
||||
INIT_VALUE(SaveToSourcePath, false);
|
||||
@ -94,7 +93,6 @@ void PreferencesModel::loadPreferences(PreferencesModel *preferences)
|
||||
|
||||
LOAD_VALUE_B(AutoRunNextJob );
|
||||
LOAD_VALUE_U(MaxRunningJobCount);
|
||||
LOAD_VALUE_B(ShutdownComputer );
|
||||
LOAD_VALUE_B(Prefer64BitSource );
|
||||
LOAD_VALUE_B(SaveLogFiles );
|
||||
LOAD_VALUE_B(SaveToSourcePath );
|
||||
@ -118,7 +116,6 @@ void PreferencesModel::savePreferences(PreferencesModel *preferences)
|
||||
|
||||
STORE_VALUE(AutoRunNextJob );
|
||||
STORE_VALUE(MaxRunningJobCount);
|
||||
STORE_VALUE(ShutdownComputer );
|
||||
STORE_VALUE(Prefer64BitSource );
|
||||
STORE_VALUE(SaveLogFiles );
|
||||
STORE_VALUE(SaveToSourcePath );
|
||||
|
@ -55,7 +55,6 @@ public:
|
||||
|
||||
PREFERENCES_MAKE_B(AutoRunNextJob)
|
||||
PREFERENCES_MAKE_U(MaxRunningJobCount)
|
||||
PREFERENCES_MAKE_B(ShutdownComputer)
|
||||
PREFERENCES_MAKE_B(Prefer64BitSource)
|
||||
PREFERENCES_MAKE_B(SaveLogFiles)
|
||||
PREFERENCES_MAKE_B(SaveToSourcePath)
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define VER_X264_MAJOR 2
|
||||
#define VER_X264_MINOR 8
|
||||
#define VER_X264_PATCH 6
|
||||
#define VER_X264_BUILD 1120
|
||||
#define VER_X264_BUILD 1122
|
||||
|
||||
#define VER_X264_PORTABLE_EDITION (0)
|
||||
|
||||
|
@ -109,6 +109,7 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtil
|
||||
m_pendingFiles(new QStringList()),
|
||||
m_preferences(NULL),
|
||||
m_recentlyUsed(NULL),
|
||||
m_postOperation(POST_OP_DONOTHING),
|
||||
m_initialized(false),
|
||||
ui(new Ui::MainWindow())
|
||||
{
|
||||
@ -217,11 +218,16 @@ MainWindow::MainWindow(const MUtils::CPUFetaures::cpu_info_t &cpuFeatures, MUtil
|
||||
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openActionTriggered()));
|
||||
connect(ui->actionCleanup_Finished, SIGNAL(triggered()), this, SLOT(cleanupActionTriggered()));
|
||||
connect(ui->actionCleanup_Enqueued, SIGNAL(triggered()), this, SLOT(cleanupActionTriggered()));
|
||||
connect(ui->actionPostOp_PowerDown, SIGNAL(triggered()), this, SLOT(postOpActionTriggered()));
|
||||
connect(ui->actionPostOp_Hibernate, SIGNAL(triggered()), this, SLOT(postOpActionTriggered()));
|
||||
connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
|
||||
connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferences()));
|
||||
connect(ui->actionCheckForUpdates, SIGNAL(triggered()), this, SLOT(checkUpdates()));
|
||||
ui->actionCleanup_Finished->setData(QVariant(bool(0)));
|
||||
ui->actionCleanup_Enqueued->setData(QVariant(bool(1)));
|
||||
ui->actionPostOp_PowerDown->setData(QVariant(POST_OP_POWERDOWN));
|
||||
ui->actionPostOp_Hibernate->setData(QVariant(POST_OP_HIBERNATE));
|
||||
ui->actionPostOp_Hibernate->setEnabled(MUtils::OS::is_hibernation_supported());
|
||||
|
||||
//Setup web-links
|
||||
SETUP_WEBLINK(ui->actionWebMulder, home_url);
|
||||
@ -412,6 +418,42 @@ void MainWindow::cleanupActionTriggered(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The "clean-up" action was invoked
|
||||
*/
|
||||
void MainWindow::postOpActionTriggered(void)
|
||||
{
|
||||
ENSURE_APP_IS_READY();
|
||||
|
||||
QAction *const sender = dynamic_cast<QAction*>(QObject::sender());
|
||||
if (sender)
|
||||
{
|
||||
const QVariant data = sender->data();
|
||||
if (data.isValid() && (data.type() == QVariant::Int))
|
||||
{
|
||||
const postOp_t mode = (postOp_t)data.toInt();
|
||||
if (sender->isChecked())
|
||||
{
|
||||
m_postOperation = mode;
|
||||
if (mode != POST_OP_POWERDOWN)
|
||||
{
|
||||
ui->actionPostOp_PowerDown->setChecked(false);
|
||||
}
|
||||
if (mode != POST_OP_HIBERNATE)
|
||||
{
|
||||
ui->actionPostOp_Hibernate->setChecked(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_postOperation = POST_OP_DONOTHING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qWarning("Post-operation: %d", m_postOperation);
|
||||
}
|
||||
|
||||
/*
|
||||
* The "start" button was clicked
|
||||
*/
|
||||
@ -720,8 +762,9 @@ void MainWindow::launchNextJob(void)
|
||||
|
||||
qWarning("No enqueued jobs left to be started!");
|
||||
|
||||
if(m_preferences->getShutdownComputer())
|
||||
if(m_postOperation)
|
||||
{
|
||||
qDebug("Post operation has been scheduled! (m_postOperation: %d)", m_postOperation);
|
||||
QTimer::singleShot(0, this, SLOT(shutdownComputer()));
|
||||
}
|
||||
}
|
||||
@ -769,16 +812,23 @@ void MainWindow::saveLogFile(const QModelIndex &index)
|
||||
void MainWindow::shutdownComputer(void)
|
||||
{
|
||||
ENSURE_APP_IS_READY();
|
||||
qDebug("shutdownComputer (m_postOperation: %d)", m_postOperation);
|
||||
|
||||
if(countPendingJobs() > 0)
|
||||
{
|
||||
qDebug("Still have pending jobs, won't shutdown yet!");
|
||||
qWarning("Still have pending jobs, won't shutdown yet!");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((m_postOperation != POST_OP_POWERDOWN) && (m_postOperation != POST_OP_HIBERNATE))
|
||||
{
|
||||
qWarning("No post-operation has been schedule!");
|
||||
}
|
||||
|
||||
const int iTimeout = 30;
|
||||
const Qt::WindowFlags flags = Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowSystemMenuHint;
|
||||
const QString text = QString("%1%2%1").arg(QString().fill(' ', 18), tr("Warning: Computer will shutdown in %1 seconds..."));
|
||||
const bool hibernate = (m_postOperation == POST_OP_HIBERNATE);
|
||||
const QString text = QString("%1%2%1").arg(QString().fill(' ', 18), hibernate ? tr("Warning: Computer will hibernate in %1 seconds...") : tr("Warning: Computer will shutdown in %1 seconds..."));
|
||||
|
||||
qWarning("Initiating shutdown sequence!");
|
||||
|
||||
@ -823,7 +873,7 @@ void MainWindow::shutdownComputer(void)
|
||||
|
||||
qWarning("Shutting down !!!");
|
||||
|
||||
if(MUtils::OS::shutdown_computer("Simple x264 Launcher: All jobs completed, shutting down!", 10, true, false))
|
||||
if(MUtils::OS::shutdown_computer("Simple x264 Launcher: All jobs completed, shutting down!", 10, true, hibernate))
|
||||
{
|
||||
qApp->closeAllWindows();
|
||||
}
|
||||
|
@ -73,10 +73,20 @@ protected:
|
||||
virtual void dropEvent(QDropEvent *event);
|
||||
|
||||
private:
|
||||
typedef enum
|
||||
{
|
||||
POST_OP_DONOTHING = 0,
|
||||
POST_OP_POWERDOWN = 1,
|
||||
POST_OP_HIBERNATE = 2
|
||||
}
|
||||
postOp_t;
|
||||
|
||||
Ui::MainWindow *const ui;
|
||||
MUtils::IPCChannel *const m_ipcChannel;
|
||||
|
||||
postOp_t m_postOperation;
|
||||
bool m_initialized;
|
||||
|
||||
QScopedPointer<QLabel> m_label[2];
|
||||
QScopedPointer<QMovie> m_animation;
|
||||
QScopedPointer<QTimer> m_fileTimer;
|
||||
@ -112,6 +122,7 @@ private slots:
|
||||
void addButtonPressed();
|
||||
void openActionTriggered();
|
||||
void cleanupActionTriggered(void);
|
||||
void postOpActionTriggered(void);
|
||||
void abortButtonPressed(void);
|
||||
void browseButtonPressed(void);
|
||||
void deleteButtonPressed(void);
|
||||
|
@ -76,7 +76,6 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, PreferencesModel *preferen
|
||||
|
||||
ui->labelRunNextJob ->installEventFilter(this);
|
||||
ui->labelUse64BitAvs2YUV ->installEventFilter(this);
|
||||
ui->labelShutdownComputer ->installEventFilter(this);
|
||||
ui->labelSaveLogFiles ->installEventFilter(this);
|
||||
ui->labelSaveToSourceFolder->installEventFilter(this);
|
||||
ui->labelEnableSounds ->installEventFilter(this);
|
||||
@ -103,7 +102,6 @@ void PreferencesDialog::showEvent(QShowEvent *event)
|
||||
if(event) QDialog::showEvent(event);
|
||||
|
||||
UPDATE_CHECKBOX(ui->checkRunNextJob, m_preferences->getAutoRunNextJob());
|
||||
UPDATE_CHECKBOX(ui->checkShutdownComputer, m_preferences->getShutdownComputer());
|
||||
UPDATE_CHECKBOX(ui->checkUse64BitAvs2YUV, m_preferences->getPrefer64BitSource() && m_sysinfo->getCPUFeatures(SysinfoModel::CPUFeatures_X64));
|
||||
UPDATE_CHECKBOX(ui->checkSaveLogFiles, m_preferences->getSaveLogFiles());
|
||||
UPDATE_CHECKBOX(ui->checkSaveToSourceFolder, m_preferences->getSaveToSourcePath());
|
||||
@ -130,7 +128,6 @@ bool PreferencesDialog::eventFilter(QObject *o, QEvent *e)
|
||||
else if((e->type() == QEvent::MouseButtonPress) || (e->type() == QEvent::MouseButtonRelease))
|
||||
{
|
||||
emulateMouseEvent(o, e, ui->labelRunNextJob, ui->checkRunNextJob);
|
||||
emulateMouseEvent(o, e, ui->labelShutdownComputer, ui->checkShutdownComputer);
|
||||
emulateMouseEvent(o, e, ui->labelUse64BitAvs2YUV, ui->checkUse64BitAvs2YUV);
|
||||
emulateMouseEvent(o, e, ui->labelSaveLogFiles, ui->checkSaveLogFiles);
|
||||
emulateMouseEvent(o, e, ui->labelSaveToSourceFolder, ui->checkSaveToSourceFolder);
|
||||
@ -162,7 +159,6 @@ 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());
|
||||
|
Loading…
Reference in New Issue
Block a user