aboutsummaryrefslogtreecommitdiff
path: root/libLumina/LuminaOS-FreeBSD.cpp
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2015-04-17 08:45:54 -0400
committerKen Moore <ken@pcbsd.org>2015-04-17 08:45:54 -0400
commit604e48172be8fd6674f6d46f4bccd6a0c2b0bb0d (patch)
tree64af7f0f831b802287517fd5e204159c3a870c85 /libLumina/LuminaOS-FreeBSD.cpp
parentUpdate the system dashboard behavior a bit: (diff)
downloadlumina-604e48172be8fd6674f6d46f4bccd6a0c2b0bb0d.tar.gz
lumina-604e48172be8fd6674f6d46f4bccd6a0c2b0bb0d.tar.bz2
lumina-604e48172be8fd6674f6d46f4bccd6a0c2b0bb0d.zip
Fix the implementation of the hardware brightness control on PC-BSD. Now it works consistently.
Diffstat (limited to 'libLumina/LuminaOS-FreeBSD.cpp')
-rw-r--r--libLumina/LuminaOS-FreeBSD.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp
index 73637048..430a31fc 100644
--- a/libLumina/LuminaOS-FreeBSD.cpp
+++ b/libLumina/LuminaOS-FreeBSD.cpp
@@ -8,6 +8,7 @@
#include "LuminaOS.h"
#include <unistd.h>
+#include <QDebug>
//can't read xbrightness settings - assume invalid until set
static int screenbrightness = -1;
@@ -71,17 +72,18 @@ void LOS::setScreenBrightness(int percent){
//ensure bounds
if(percent<0){percent=0;}
else if(percent>100){ percent=100; }
- float pf = percent/100.0; //convert to a decimel
//Run the command(s)
bool success = false;
// - try hardware setting first (PC-BSD only)
if(QFile::exists("/usr/local/bin/pc-sysconfig")){
- QString ret = LUtils::getCmdOutput("pc-sysconfig \"setscreenbrightness "+QString::number(percent)+"\"").join("");
- success = (ret.simplified() == "[SUCCESS]");
+ QString ret = LUtils::getCmdOutput("pc-sysconfig", QStringList() <<"setscreenbrightness "+QString::number(percent)).join("");
+ success = ret.toLower().contains("success");
+ qDebug() << "Set hardware brightness:" << percent << success;
}
// - if hardware brightness does not work, use software brightness
if(!success){
QString cmd = "xbrightness %1";
+ float pf = percent/100.0; //convert to a decimel
cmd = cmd.arg( QString::number( int(65535*pf) ) );
success = (0 == LUtils::runCmd(cmd) );
}
bgstack15