[KLF Backend]
[KLF Tools]
[KLF Home]
KLatexFormula Project
src
klftools
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: klfdefs_win.cpp 978 2016-12-31 05:16:11Z phfaist $ */
23
29
#include <
klfdefs.h
>
30
#include <
klfsysinfo.h
>
31
32
#include <windows.h>
33
34
#if defined(_M_IX86)
35
static
const
char
* arch =
"x86"
;
36
#elif defined(_M_AMD64)
37
static
const
char
* arch =
"x86_64"
;
38
#elif defined(_WIN64)
39
static
const
char
* arch =
"win64"
;
40
#else
41
static
const
char
* arch =
"unknown"
;
42
#error "Unknown Processor Architecture."
43
#endif
44
45
KLF_EXPORT
QString
klf_defs_sysinfo_arch
()
46
{
47
return
QString::fromLatin1
(arch);
48
}
49
50
51
KLF_EXPORT
KLFSysInfo::BatteryInfo
_klf_win_battery_info
()
52
{
53
KLFSysInfo::BatteryInfo
info;
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
72
KLF_EXPORT
bool
_klf_win_is_laptop
()
73
{
74
KLFSysInfo::BatteryInfo
info;
75
info =
_klf_win_battery_info
();
76
return
info.
islaptop
;
77
}
78
79
KLF_EXPORT
bool
_klf_win_is_on_battery_power
()
80
{
81
KLFSysInfo::BatteryInfo
info;
82
info =
_klf_win_battery_info
();
83
return
info.
onbatterypower
;
84
}
85
KLFSysInfo::BatteryInfo
Definition:
klfsysinfo.h:65
KLFSysInfo::BatteryInfo::islaptop
bool islaptop
Definition:
klfsysinfo.h:68
klfsysinfo.h
_klf_win_is_laptop
KLF_EXPORT bool _klf_win_is_laptop()
Definition:
klfdefs_win.cpp:72
_klf_win_battery_info
KLF_EXPORT KLFSysInfo::BatteryInfo _klf_win_battery_info()
Definition:
klfdefs_win.cpp:51
QString
KLF_EXPORT
#define KLF_EXPORT
Definition:
klfdefs.h:41
_klf_win_is_on_battery_power
KLF_EXPORT bool _klf_win_is_on_battery_power()
Definition:
klfdefs_win.cpp:79
klfWarning
#define klfWarning(streamableItems)
KLFSysInfo::BatteryInfo::onbatterypower
bool onbatterypower
Definition:
klfsysinfo.h:69
QString::fromLatin1
QString fromLatin1(const char *str, int size)
klf_defs_sysinfo_arch
KLF_EXPORT QString klf_defs_sysinfo_arch()
Definition:
klfdefs_win.cpp:45
klfdefs.h
Base declarations for klatexformula and some utilities.
Generated by
doxygen
1.8.17