[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
klfdefs_win.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * file klfdefs_win.cpp
3 * This file is part of the KLatexFormula Project.
4 * Copyright (C) 2011 by Philippe Faist
5 * philippe.faist at bluewin.ch
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
22/* $Id$ */
23
28
29#include <klfdefs.h>
30#include <klfsysinfo.h>
31
32#include <windows.h>
33
34#if defined(_M_IX86)
35static const char * arch = "x86";
36#elif defined(_M_AMD64)
37static const char * arch = "x86_64";
38#elif defined(_WIN64)
39static const char * arch = "win64";
40#else
41static const char * arch = "unknown";
42#error "Unknown Processor Architecture."
43#endif
44
49
50
52{
54
55 SYSTEM_POWER_STATUS batterystatus;
56
57 if (GetSystemPowerStatus(&batterystatus) == 0) {
58 klfWarning("Could not get battery status.") ;
59 info.islaptop = false;
60 info.onbatterypower = false;
61 return info;
62 }
63
64 info.islaptop = (batterystatus.ACLineStatus != 255);
65 info.onbatterypower = false;
66 if (batterystatus.ACLineStatus == 0)
67 info.onbatterypower = true;
68
69 return info;
70}
71
73{
75 info = _klf_win_battery_info();
76 return info.islaptop;
77}
78
85
#define klfWarning(streamableItems)
Definition klfdebug.h:171
Base declarations for klatexformula and some utilities.
#define KLF_EXPORT
Definition klfdefs.h:41
KLF_EXPORT QString klf_defs_sysinfo_arch()
KLF_EXPORT bool _klf_win_is_on_battery_power()
KLF_EXPORT KLFSysInfo::BatteryInfo _klf_win_battery_info()
KLF_EXPORT bool _klf_win_is_laptop()
QString fromLatin1(const char *str, int size)

Generated by doxygen 1.14.0