QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
machine_info.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef MACHINE_INFO_H
19#define MACHINE_INFO_H
20
21#include <QThread>
22#include <QMutex>
23
29{
31 public:
33 {
34 static QMutex mutex;
35 if (!m_instance)
36 {
37 mutex.lock();
38 if (!m_instance) {
39 m_instance = new MachineInfo();
40 }
41 mutex.unlock();
42 }
43
44 return m_instance;
45 }
46
47 static void dropInstance()
48 {
49 static QMutex mutex;
50 if (m_instance) {
51 mutex.lock();
52 delete m_instance;
53 m_instance = nullptr;
54 mutex.unlock();
55 }
56 }
57
58 int32_t i_max_screen_width();
59 int32_t i_max_screen_height();
60 QString compilation_info();
61 void send_info_to_debug();
62
63
64 private:
67 void init_get_cpu_info();
71
72 struct Pc
73 {
74 struct Screen
75 {
76 int32_t count;
77 int32_t width[10];
78 int32_t height[10];
79 int32_t Max_width;
80 int32_t Max_height;
82 struct Built
83 {
84 QString version=
85#ifdef __GNUC__
86#ifdef __APPLE_CC__
87 "CLANG " + QString(__clang_version__);
88#else
89 "GCC " + QString(__VERSION__);
90#endif
91#elif defined(Q_CC_MSVC)
92 "MSVC " + QString(QT_STRINGIFY(_MSC_FULL_VER));
93#endif
94 QString QT=QString(QT_VERSION_STR);
95 QString date=QString(__DATE__);
96 QString time=QString(__TIME__);
97 QString arch=QString(QSysInfo::buildCpuArchitecture());
99 struct CPU
100 {
101 QString info;
102 QString Architecture=QString(
103 QSysInfo::currentCpuArchitecture());
104 int32_t ThreadCount=QThread::idealThreadCount();
106 struct RAM
107 {
108 QString Total;
109 QString Available;
111 struct GPU
112 {
113 QString info;
114 QString RAM;
115
117 struct OS
118 {
119 QString type=QString(QSysInfo::kernelType());
120 QString name=QString(QSysInfo::prettyProductName());
121 QString kernel=QString(QSysInfo::kernelVersion());
124
125
126};
127
128#endif // MACHINE_INFO_H
The MachineInfo class This class hold information from your PC.
Definition machine_info.h:29
QString compilation_info()
MachineInfo::compilation_info.
Definition machine_info.cpp:376
static void dropInstance()
Definition machine_info.h:47
struct MachineInfo::Pc pc
int32_t i_max_screen_height()
MachineInfo::i_max_screen_height.
Definition machine_info.cpp:368
void init_get_cpu_info_macos()
MachineInfo::init_get_cpu_info_macos.
Definition machine_info.cpp:333
void init_get_cpu_info_winnt()
MachineInfo::init_get_cpu_info_winnt.
Definition machine_info.cpp:279
void init_get_Screen_info()
MachineInfo::init_get_Screen_info Finds the largest screen and saves the values.
Definition machine_info.cpp:186
int32_t i_max_screen_width()
MachineInfo::i_max_screen_width.
Definition machine_info.cpp:360
static MachineInfo * instance()
Definition machine_info.h:32
static MachineInfo * m_instance
Definition machine_info.h:30
void send_info_to_debug()
MachineInfo::send_info_to_debug.
Definition machine_info.cpp:49
void init_get_cpu_info()
MachineInfo::init_get_cpu_info.
Definition machine_info.cpp:208
MachineInfo()
MachineInfo::MachineInfo.
Definition machine_info.cpp:40
void init_get_cpu_info_linux()
MachineInfo::init_get_cpu_info_linux.
Definition machine_info.cpp:223
Definition machine_info.h:83
QString date
Definition machine_info.h:95
QString arch
Definition machine_info.h:97
QString version
Definition machine_info.h:84
QString time
Definition machine_info.h:96
Definition machine_info.h:100
int32_t ThreadCount
Definition machine_info.h:104
QString info
Definition machine_info.h:101
QString Architecture
Definition machine_info.h:102
Definition machine_info.h:112
QString RAM
Definition machine_info.h:114
QString info
Definition machine_info.h:113
Definition machine_info.h:118
QString type
Definition machine_info.h:119
QString kernel
Definition machine_info.h:121
QString name
Definition machine_info.h:120
Definition machine_info.h:107
QString Total
Definition machine_info.h:108
QString Available
Definition machine_info.h:109
Definition machine_info.h:75
int32_t height[10]
Definition machine_info.h:78
int32_t count
Definition machine_info.h:76
int32_t width[10]
Definition machine_info.h:77
int32_t Max_height
Definition machine_info.h:80
int32_t Max_width
Definition machine_info.h:79
Definition machine_info.h:73
struct MachineInfo::Pc::Screen screen
struct MachineInfo::Pc::CPU cpu
struct MachineInfo::Pc::GPU gpu
struct MachineInfo::Pc::RAM ram
struct MachineInfo::Pc::OS os
struct MachineInfo::Pc::Built built