diff options
author | Ken Moore <ken@pcbsd.org> | 2015-04-16 22:49:58 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-04-16 22:49:58 -0400 |
commit | aeba6cb5554186478d15cbfc7a9ac580d3c52c72 (patch) | |
tree | 9baa36ce1136bba09ca0709a843060d2db686ec6 /libLumina | |
parent | Clean up a *lot* of the general XCB warnings that sometimes occur, and also t... (diff) | |
download | lumina-aeba6cb5554186478d15cbfc7a9ac580d3c52c72.tar.gz lumina-aeba6cb5554186478d15cbfc7a9ac580d3c52c72.tar.bz2 lumina-aeba6cb5554186478d15cbfc7a9ac580d3c52c72.zip |
Fix the session chimes (and possible stability issue) by removing the special audio thread and using the QMediaPlayer within the main thread (no stuttering/delays in my initial tests so far).
Add a PC-BSD specific routine for setting brightness so that hardware brightness controls are attempted (through pc-sysconfig) before the software brightness is modified (using xbrightness)
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaOS-FreeBSD.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index fc4135f0..73637048 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -72,12 +72,21 @@ void LOS::setScreenBrightness(int percent){ if(percent<0){percent=0;} else if(percent>100){ percent=100; } 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); + //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]"); + } + // - if hardware brightness does not work, use software brightness + if(!success){ + QString cmd = "xbrightness %1"; + cmd = cmd.arg( QString::number( int(65535*pf) ) ); + 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); } |