Ignore:
Timestamp:
07/24/14 06:10:32 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.3, releng/10.1, releng/10.1.1
Children:
9d0ec76
Parents:
3f98638
Message:

Move all the OS-specific functions into the LuminaOS class (LOS), and create the shell for the Linux version with all the previous submissions to make it work on Linux.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lumina/libLumina/LuminaOS-FreeBSD.cpp

    rd0a927f r733da14  
    11//=========================================== 
    22//  Lumina-DE source code 
    3 //  Copyright (c) 2013, Ken Moore 
     3//  Copyright (c) 2014, Ken Moore 
    44//  Available under the 3-clause BSD license 
    55//  See the LICENSE file for full details 
    66//=========================================== 
    77#include "LuminaOS.h" 
     8#include <unistd.h> 
     9 
    810static int screenbrightness = -1; 
    911 
     
    101103  }      
    102104} 
     105 
     106//System Shutdown 
     107void LOS::systemShutdown(){ //start poweroff sequence 
     108  QProcess::startDetached("shutdown -p now"); 
     109} 
     110 
     111//System Restart 
     112void LOS::systemRestart(){ //start reboot sequence 
     113  QProcess::startDetached("shutdown -r now"); 
     114} 
     115 
     116//Battery Availability 
     117bool LOS::hasBattery(){ 
     118  int val = LUtils::getCmdOutput("apm -l").join("").toInt(); 
     119  return (val >= 0 && val <= 100); 
     120} 
     121 
     122//Battery Charge Level 
     123int LOS::batteryCharge(){ //Returns: percent charge (0-100), anything outside that range is counted as an error 
     124  int charge = LUtils::getCmdOutput("apm -l").join("").toInt(); 
     125  if(charge > 100){ charge = -1; } //invalid charge  
     126  return charge;         
     127} 
     128 
     129//Battery Charging State 
     130bool LOS::batteryIsCharging(){ 
     131  return (LUtils::getCmdOutput("apm -a").join("").simplified() == "1"); 
     132} 
     133 
     134//Battery Time Remaining 
     135int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining 
     136  return LUtils::getCmdOutput("apm -t").join("").toInt(); 
     137} 
Note: See TracChangeset for help on using the changeset viewer.