Check if hibernation is support on the computer. If not, disable the hibernate option.

This commit is contained in:
LoRd_MuldeR 2011-10-22 01:34:24 +02:00
parent a98206bd70
commit 6c67cb0012
5 changed files with 29 additions and 0 deletions

View File

@ -22,6 +22,7 @@ a:visited { color: #0000EE; }
<li>Added "built-in" WMA decoder (see <a href="http://forum.doom9.org/showthread.php?t=140273">this</a> thread for details) and removed all remnants of "old" decoder
<li>Added optional support for the FHG AAC Encoder included with Winamp 5.62 (see <a href="FAQ.html#71a113b0" target="_blank">FAQ doc</a> for details)
<li>Added a menu for bookmarking "favorite" output folders to the "output folder" tab
<li>Added an option to hibernate the computer (aka "Suspend-to-Disk") instead of shutting it down
<li>Added Polish translation, thanks to Sir Daniel K &lt;sir.daniel.k@gmail.com&gt;
<li>Added channel equalization options to the normalization filter (also fixes multi-channel processing)
<li>Updated Qt runtime libraries to v4.8.0 RC-1 (2011-10-13), compiled with MSVC 10.0

View File

@ -361,6 +361,7 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S
actionCheckForBetaUpdates->setChecked(m_settings->autoUpdateCheckBeta() || lamexp_version_demo());
actionCheckForBetaUpdates->setEnabled(!lamexp_version_demo());
actionHibernateComputer->setChecked(m_settings->hibernateComputer());
actionHibernateComputer->setEnabled(lamexp_is_hibernation_supported());
connect(actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
connect(actionDisableSounds, SIGNAL(triggered(bool)), this, SLOT(disableSoundsActionTriggered(bool)));
connect(actionDisableNeroAacNotifications, SIGNAL(triggered(bool)), this, SLOT(disableNeroAacNotificationsActionTriggered(bool)));

View File

@ -1499,6 +1499,24 @@ __int64 lamexp_free_diskspace(const QString &path)
}
}
/*
* Check if computer does support hibernation
*/
bool lamexp_is_hibernation_supported(void)
{
bool hibernationSupported = false;
SYSTEM_POWER_CAPABILITIES pwrCaps;
SecureZeroMemory(&pwrCaps, sizeof(SYSTEM_POWER_CAPABILITIES));
if(GetPwrCapabilities(&pwrCaps))
{
hibernationSupported = pwrCaps.SystemS4 && pwrCaps.HiberFilePresent;
}
return hibernationSupported;
}
/*
* Shutdown the computer
*/

View File

@ -104,6 +104,7 @@ void lamexp_ipc_send(unsigned int command, const char* message);
lamexp_cpu_t lamexp_detect_cpu_features(int argc = 0, char **argv = NULL);
bool lamexp_portable_mode(void);
bool lamexp_shutdown_computer(const QString &message, const unsigned long timeout = 30, const bool forceShutdown = true, const bool hibernate = false);
bool lamexp_is_hibernation_supported(void);
//Translation support
QStringList lamexp_query_translations(void);

View File

@ -247,6 +247,14 @@ void SettingsModel::validate(void)
qWarning("Current language \"%s\" is unknown, reverting to default language!", this->currentLanguage().toLatin1().constData());
this->currentLanguage(defaultLanguage());
}
if(this->hibernateComputer())
{
if(!lamexp_is_hibernation_supported())
{
this->hibernateComputer(false);
}
}
}
////////////////////////////////////////////////////////////