1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-26 08:26:15 +02:00

Create the powersaver instance on demand and destroy it when not needed.

This commit is contained in:
Ayla 2011-08-17 00:46:11 +02:00
parent f31828667f
commit fca8c8e8a1

View File

@ -391,7 +391,10 @@ GMenu2X::GMenu2X()
} }
input.init(input_file); input.init(input_file);
PowerSaver::getInstance()->setScreenTimeout( confInt["backlightTimeout"] );
if (confInt["backlightTimeout"] > 0)
PowerSaver::getInstance()->setScreenTimeout( confInt["backlightTimeout"] );
setInputSpeed(); setInputSpeed();
initServices(); initServices();
setBacklight(confInt["backlight"]); setBacklight(confInt["backlight"]);
@ -412,6 +415,8 @@ GMenu2X::~GMenu2X() {
if (fwType=="open2x") writeConfigOpen2x(); if (fwType=="open2x") writeConfigOpen2x();
#endif #endif
if (PowerSaver::isRunning())
delete PowerSaver::getInstance();
quit(); quit();
delete menu; delete menu;
@ -1261,7 +1266,14 @@ void GMenu2X::options() {
if (prevbacklight != confInt["backlight"]) setBacklight(confInt["backlight"]); if (prevbacklight != confInt["backlight"]) setBacklight(confInt["backlight"]);
if (curMenuClock!=confInt["menuClock"]) setClock(confInt["menuClock"]); if (curMenuClock!=confInt["menuClock"]) setClock(confInt["menuClock"]);
if (curGlobalVolume!=confInt["globalVolume"]) setVolume(confInt["globalVolume"]); if (curGlobalVolume!=confInt["globalVolume"]) setVolume(confInt["globalVolume"]);
PowerSaver::getInstance()->setScreenTimeout( confInt["backlightTimeout"] );
if (confInt["backlightTimeout"] == 0) {
if (PowerSaver::isRunning())
delete PowerSaver::getInstance();
} else {
PowerSaver::getInstance()->setScreenTimeout( confInt["backlightTimeout"] );
}
if (lang == "English") lang = ""; if (lang == "English") lang = "";
if (lang != tr.lang()) { if (lang != tr.lang()) {
tr.setLang(lang); tr.setLang(lang);