[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
src/klftools/klfdefs_win.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   file klfdefs_win.cpp
00003  *   This file is part of the KLatexFormula Project.
00004  *   Copyright (C) 2011 by Philippe Faist
00005  *   philippe.faist at bluewin.ch
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 /* $Id$ */
00023 
00029 #include <klfdefs.h>
00030 #include <klfsysinfo.h>
00031 
00032 #include <windows.h>
00033 
00034 #if defined(_M_IX86)
00035 static const char * arch = "x86";
00036 #elif defined(_M_AMD64)
00037 static const char * arch = "x86_64";
00038 #elif defined(_WIN64)
00039 static const char * arch = "win64";
00040 #else
00041 static const char * arch = "unknown";
00042 #error "Unknown Processor Architecture."
00043 #endif
00044 
00045 KLF_EXPORT QString klf_defs_sysinfo_arch()
00046 {
00047   return QString::fromLatin1(arch);
00048 }
00049 
00050 
00051 KLF_EXPORT KLFSysInfo::BatteryInfo _klf_win_battery_info()
00052 {
00053   KLFSysInfo::BatteryInfo info;
00054 
00055   SYSTEM_POWER_STATUS batterystatus;
00056 
00057   if (GetSystemPowerStatus(&batterystatus) == 0) {
00058     klfWarning("Could not get battery status.") ;
00059     info.islaptop = false;
00060     info.onbatterypower = false;
00061     return info;
00062   }
00063 
00064   info.islaptop = (batterystatus.ACLineStatus != 255);
00065   info.onbatterypower = false;
00066   if (batterystatus.ACLineStatus == 0)
00067     info.onbatterypower = true;
00068 
00069   return info;
00070 }
00071 
00072 KLF_EXPORT bool _klf_win_is_laptop()
00073 {
00074   KLFSysInfo::BatteryInfo info;
00075   info = _klf_win_battery_info();
00076   return info.islaptop;
00077 }
00078 
00079 KLF_EXPORT bool _klf_win_is_on_battery_power()
00080 {
00081   KLFSysInfo::BatteryInfo info;
00082   info = _klf_win_battery_info();
00083   return info.onbatterypower;
00084 }
00085 

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net