diff options
author | Michael Neumann <mneumann@ntecs.de> | 2015-08-16 15:58:24 +0200 |
---|---|---|
committer | Michael Neumann <mneumann@ntecs.de> | 2015-08-16 15:58:24 +0200 |
commit | 522b3712cc75e1576a8b0c4b7281671d08666595 (patch) | |
tree | 426ee96c0e96e2373f42b114ea7bdc00b02ea526 /libLumina/LuminaOS-DragonFly.cpp | |
parent | Touch up the new Grey-Dark color scheme a bit - now the highlight/accent colo... (diff) | |
download | lumina-522b3712cc75e1576a8b0c4b7281671d08666595.tar.gz lumina-522b3712cc75e1576a8b0c4b7281671d08666595.tar.bz2 lumina-522b3712cc75e1576a8b0c4b7281671d08666595.zip |
DragonFly: Sync get/set ScreenBrightness a bit with FreeBSD
Diffstat (limited to 'libLumina/LuminaOS-DragonFly.cpp')
-rw-r--r-- | libLumina/LuminaOS-DragonFly.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index 79f84e65..2f9beb4b 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -58,21 +58,27 @@ int LOS::ScreenBrightness(){ screenbrightness = val; } } + //If it gets to this point, then we have a valid (but new) installation + if(screenbrightness<0){ screenbrightness = 100; } //default value for systems + return screenbrightness; } //Set screen brightness void LOS::setScreenBrightness(int percent){ + if(percent == -1){ return; } //This is usually an invalid value passed directly to the setter //ensure bounds if(percent<0){percent=0;} else if(percent>100){ percent=100; } + //Run the command(s) + bool success = false; float pf = percent/100.0; //convert to a decimel //Run the command QString cmd = "xbrightness %1"; cmd = cmd.arg( QString::number( int(65535*pf) ) ); - int ret = LUtils::runCmd(cmd); + success = (0 == LUtils::runCmd(cmd) ); //Save the result for later - if(ret!=0){ screenbrightness = -1; } + if(!success){ screenbrightness = -1; } else{ screenbrightness = percent; } LUtils::writeFile(QDir::homePath()+"/.lumina/.currentxbrightness", QStringList() << QString::number(screenbrightness), true); } |