2020-07-22 21:16:38 +02:00
/*
2025-01-04 13:37:40 +01:00
Copyright 2006 - 2025 The QElectroTech Team
2020-07-22 21:16:38 +02:00
This file is part of QElectroTech .
QElectroTech is free software : you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation , either version 2 of the License , or
( at your option ) any later version .
QElectroTech is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with QElectroTech . If not , see < http : //www.gnu.org/licenses/>.
*/
2020-07-21 20:29:05 +02:00
# include "machine_info.h"
2025-01-23 16:34:48 +01:00
# include "qetapp.h"
2023-01-19 20:18:21 +01:00
# include "qetversion.h"
2025-01-23 16:34:48 +01:00
# include <QSettings>
2025-01-26 12:16:46 +01:00
# include <QDirIterator>
2023-01-19 20:18:21 +01:00
2020-07-21 20:29:05 +02:00
# include <QScreen>
2020-07-23 21:57:30 +02:00
# include <QProcess>
2020-07-21 20:29:05 +02:00
# include <QApplication>
2020-08-12 23:54:09 +02:00
# include <QDebug>
2020-08-13 17:05:46 +02:00
# include <QSysInfo>
# include <QStorageInfo>
2020-08-14 00:36:59 +02:00
# include <QLibraryInfo>
2022-04-07 16:33:20 +02:00
# include <QStorageInfo>
2025-01-23 12:35:03 +01:00
# include <QStandardPaths>
2020-07-21 20:29:05 +02:00
2020-08-20 06:05:55 +02:00
# ifdef Q_OS_WIN
# include <windows.h>
# endif
2020-08-18 21:24:22 +02:00
2021-03-22 19:20:07 +01:00
MachineInfo * MachineInfo : : m_instance = nullptr ;
2020-07-21 20:29:05 +02:00
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : MachineInfo
2020-07-21 20:29:05 +02:00
@ param parent
*/
2021-03-22 19:01:46 +01:00
MachineInfo : : MachineInfo ( )
2020-07-21 20:29:05 +02:00
{
init_get_Screen_info ( ) ;
2020-08-13 22:50:58 +02:00
init_get_cpu_info ( ) ;
}
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : send_info_to_debug
2020-08-13 22:50:58 +02:00
*/
2021-03-22 19:01:46 +01:00
void MachineInfo : : send_info_to_debug ( )
2020-08-13 22:50:58 +02:00
{
2020-08-14 00:36:59 +02:00
qInfo ( ) < < " debugging enabled: "
< < QLibraryInfo : : isDebugBuild ( ) ;
qInfo ( ) < < " Qt library version: "
< < QLibraryInfo : : version ( ) ;
2020-10-03 09:25:29 +02:00
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
2020-08-14 00:36:59 +02:00
qInfo ( ) < < " Qt library location default prefix: "
< < QLibraryInfo : : location ( QLibraryInfo : : PrefixPath ) ;
qInfo ( ) < < " Qt library location documentation: "
< < QLibraryInfo : : location ( QLibraryInfo : : DocumentationPath ) ;
qInfo ( ) < < " Qt library location headers: "
< < QLibraryInfo : : location ( QLibraryInfo : : HeadersPath ) ;
qInfo ( ) < < " Qt library location libraries: "
< < QLibraryInfo : : location ( QLibraryInfo : : LibrariesPath ) ;
qInfo ( ) < < " Qt library location executables: "
< < QLibraryInfo : : location ( QLibraryInfo : : LibraryExecutablesPath ) ;
qInfo ( ) < < " Qt library location Qt binaries: "
< < QLibraryInfo : : location ( QLibraryInfo : : BinariesPath ) ;
qInfo ( ) < < " Qt library location Qt plugins: "
< < QLibraryInfo : : location ( QLibraryInfo : : PluginsPath ) ;
qInfo ( ) < < " Qt library location installed QML extensions: "
< < QLibraryInfo : : location ( QLibraryInfo : : ImportsPath ) ;
qInfo ( ) < < " Qt library location installed QML extensions: "
< < QLibraryInfo : : location ( QLibraryInfo : : Qml2ImportsPath ) ;
qInfo ( ) < < " Qt library location dependent Qt data: "
< < QLibraryInfo : : location ( QLibraryInfo : : ArchDataPath ) ;
qInfo ( ) < < " Qt library location independent Qt data: "
< < QLibraryInfo : : location ( QLibraryInfo : : DataPath ) ;
qInfo ( ) < < " Qt library location translation: "
< < QLibraryInfo : : location ( QLibraryInfo : : TranslationsPath ) ;
qInfo ( ) < < " Qt library location examples: "
< < QLibraryInfo : : location ( QLibraryInfo : : ExamplesPath ) ;
qInfo ( ) < < " Qt library location Qt testcases: "
< < QLibraryInfo : : location ( QLibraryInfo : : TestsPath ) ;
2020-10-03 15:51:53 +02:00
# ifndef Q_OS_WIN
qInfo ( ) < < " Qt library location Qt settings: "
< < QLibraryInfo : : location ( QLibraryInfo : : SettingsPath ) ;
# endif
2020-10-03 09:25:29 +02:00
# else
# if TODO_LIST
# pragma message("@TODO remove code for QT 6 or later")
# endif
qInfo ( ) < < " Qt library path default prefix: "
< < QLibraryInfo : : path ( QLibraryInfo : : PrefixPath ) ;
qInfo ( ) < < " Qt library path documentation: "
< < QLibraryInfo : : path ( QLibraryInfo : : DocumentationPath ) ;
qInfo ( ) < < " Qt library path headers: "
< < QLibraryInfo : : path ( QLibraryInfo : : HeadersPath ) ;
qInfo ( ) < < " Qt library path libraries: "
< < QLibraryInfo : : path ( QLibraryInfo : : LibrariesPath ) ;
qInfo ( ) < < " Qt library path executables: "
< < QLibraryInfo : : path ( QLibraryInfo : : LibraryExecutablesPath ) ;
qInfo ( ) < < " Qt library path Qt binaries: "
< < QLibraryInfo : : path ( QLibraryInfo : : BinariesPath ) ;
qInfo ( ) < < " Qt library path Qt plugins: "
< < QLibraryInfo : : path ( QLibraryInfo : : PluginsPath ) ;
// qInfo()<< "Qt library path installed QML extensions:"
// << QLibraryInfo::path(QLibraryInfo::ImportsPath);
qInfo ( ) < < " Qt library path installed QML extensions: "
< < QLibraryInfo : : path ( QLibraryInfo : : Qml2ImportsPath ) ;
qInfo ( ) < < " Qt library path dependent Qt data: "
< < QLibraryInfo : : path ( QLibraryInfo : : ArchDataPath ) ;
qInfo ( ) < < " Qt library path independent Qt data: "
< < QLibraryInfo : : path ( QLibraryInfo : : DataPath ) ;
qInfo ( ) < < " Qt library path translation: "
< < QLibraryInfo : : path ( QLibraryInfo : : TranslationsPath ) ;
qInfo ( ) < < " Qt library path examples: "
< < QLibraryInfo : : path ( QLibraryInfo : : ExamplesPath ) ;
qInfo ( ) < < " Qt library path Qt testcases: "
< < QLibraryInfo : : path ( QLibraryInfo : : TestsPath ) ;
2020-08-14 00:36:59 +02:00
# ifndef Q_OS_WIN
2020-10-03 15:51:53 +02:00
qInfo ( ) < < " Qt library path Qt settings: "
< < QLibraryInfo : : path ( QLibraryInfo : : SettingsPath ) ;
# endif
2020-08-14 00:36:59 +02:00
# endif
2023-01-23 16:32:43 +01:00
if ( strlen ( GIT_COMMIT_SHA ) ) {
qInfo ( ) < < " GitRevision " + QString ( GIT_COMMIT_SHA ) ;
}
2024-04-10 10:28:58 +02:00
qInfo ( ) < < " QElectroTech V " + QetVersion : : displayedVersion ( ) ;
2021-03-22 19:01:46 +01:00
qInfo ( ) < < QObject : : tr ( " Compilation : " ) + pc . built . version ;
2020-08-13 22:50:58 +02:00
qInfo ( ) < < " Built with Qt " + pc . built . QT
2024-04-10 10:28:58 +02:00
+ " - " + pc . built . arch
2020-08-13 22:50:58 +02:00
+ " - Date : " + pc . built . date
+ " : " + pc . built . time ;
qInfo ( ) < < " Run with Qt " + QString ( qVersion ( ) )
+ " using "
+ QString ( " %1 thread(s) " ) . arg ( pc . cpu . ThreadCount ) ;
qInfo ( ) < < " CPU : " + pc . cpu . info ;
qInfo ( ) < < pc . ram . Total ;
qInfo ( ) < < pc . ram . Available ;
qInfo ( ) < < " GPU : " + pc . gpu . info ;
qInfo ( ) < < " GPU RAM : " + pc . gpu . RAM ;
qInfo ( ) < < " OS : " + pc . os . type
+ " - " + pc . cpu . Architecture
+ " - Version : " + pc . os . name
+ " - Kernel : " + pc . os . kernel ;
2025-01-25 14:00:57 +01:00
qInfo ( ) < < " " ;
qInfo ( ) < < " OS System language: " < < QLocale : : system ( ) . name ( ) ;
2025-01-25 14:23:51 +01:00
qInfo ( ) < < " OS System Native Country Name: " < < QLocale : : system ( ) . nativeCountryName ( ) ;
qInfo ( ) < < " OS System Native Language Name: " < < QLocale : : system ( ) . nativeLanguageName ( ) ;
2025-01-25 14:00:57 +01:00
qInfo ( ) < < " " ;
2025-01-25 14:15:30 +01:00
qInfo ( ) < < " System language defined in QET configuration: " < < QString ( QETApp : : langFromSetting ( ) . toLatin1 ( ) ) ;
2025-01-23 16:34:48 +01:00
qInfo ( ) < < " language Path: " < < QString ( QETApp : : languagesPath ( ) . toLatin1 ( ) ) ;
qInfo ( ) < < " Common Elements Dir: " < < QString ( QETApp : : commonElementsDir ( ) . toLatin1 ( ) ) ;
qInfo ( ) < < " Common TitleBlock Templates Dir: " < < QString ( QETApp : : commonTitleBlockTemplatesDir ( ) . toLatin1 ( ) ) ;
qInfo ( ) < < " Custom Elements Dir: " < < QString ( QETApp : : customElementsDir ( ) . toLatin1 ( ) ) ;
qInfo ( ) < < " Custom TitleBlock Templates Dir: " < < QString ( QETApp : : customTitleBlockTemplatesDir ( ) . toLatin1 ( ) ) ;
qInfo ( ) < < " Company Elements Dir: " < < QString ( QETApp : : companyElementsDir ( ) . toLatin1 ( ) ) ;
qInfo ( ) < < " Company TitleBlock Templates Dir: " < < QString ( QETApp : : companyTitleBlockTemplatesDir ( ) . toLatin1 ( ) ) ;
2025-01-25 14:00:57 +01:00
qInfo ( ) < < " " ;
qInfo ( ) < < " For QET configuration-files: " ;
2025-01-25 20:09:31 +01:00
# if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
2025-01-25 20:29:11 +01:00
qInfo ( ) < < " App Config Location: see Regedit: HKEY_CURRENT_USER/Software/QElectroTech/ " ;
2025-01-25 20:09:31 +01:00
# else
qInfo ( ) < < " App Config Location: " < < QStandardPaths : : writableLocation ( QStandardPaths : : AppConfigLocation ) + " .conf/ " ;
2025-01-25 19:03:33 +01:00
# endif
2025-01-25 20:09:31 +01:00
2025-01-25 14:00:57 +01:00
qInfo ( ) < < " For data-files (user-/company-collections, titleblocks, etc.): " ;
2025-01-24 21:19:45 +01:00
qInfo ( ) < < " App Data Location: " < < QStandardPaths : : writableLocation ( QStandardPaths : : AppDataLocation ) ;
2025-01-25 14:00:57 +01:00
qInfo ( ) < < " Directory for project stalefiles: " ;
2025-01-25 19:03:33 +01:00
qInfo ( ) < < " Generic Data Location: " < < QStandardPaths : : writableLocation ( QStandardPaths : : GenericDataLocation ) + " /stalefiles/QElectroTech/ " ;
2025-01-24 21:19:45 +01:00
// qInfo()<< " App Local DataLocation:"<< QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation);
2025-01-24 11:12:36 +01:00
// qInfo()<< " Home Location:"<< QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
// qInfo()<< " Runtime Location:"<< QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
// qInfo()<< " Cache Location:"<< QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
2025-01-26 12:31:10 +01:00
qInfo ( ) < < " " ;
2025-01-26 12:16:46 +01:00
2025-01-26 14:27:02 +01:00
qInfo ( ) < < " Count the *.elmt files you have in your collections (Official-common-collection, user-/company-collections, user-/custom-collections, etc.): " ;
2025-01-26 12:16:46 +01:00
QStringList nameFilters ;
nameFilters < < " *.elmt " ;
int commomElementsDir = 0 ;
QDirIterator it1 ( QETApp : : commonElementsDir ( ) . toLatin1 ( ) , nameFilters , QDir : : Files , QDirIterator : : Subdirectories ) ;
while ( it1 . hasNext ( ) )
{
if ( it1 . next ( ) > 0 )
{
commomElementsDir + + ;
}
}
2025-01-26 14:44:47 +01:00
qInfo ( ) < < " Common Elements count: " < < commomElementsDir < < " Elements " ;
2025-01-26 12:16:46 +01:00
2025-01-23 12:35:03 +01:00
2025-01-26 12:16:46 +01:00
int customElementsDir = 0 ;
QDirIterator it2 ( QETApp : : customElementsDir ( ) . toLatin1 ( ) , nameFilters , QDir : : Files , QDirIterator : : Subdirectories ) ;
while ( it2 . hasNext ( ) )
{
if ( it2 . next ( ) > 0 )
{
customElementsDir + + ;
}
}
2025-01-26 14:44:47 +01:00
qInfo ( ) < < " Custom Elements count: " < < customElementsDir < < " Elements " ;
2025-01-23 16:34:48 +01:00
2025-01-26 12:16:46 +01:00
int companyElementsDir = 0 ;
QDirIterator it3 ( QETApp : : companyElementsDir ( ) . toLatin1 ( ) , nameFilters , QDir : : Files , QDirIterator : : Subdirectories ) ;
while ( it3 . hasNext ( ) )
{
if ( it3 . next ( ) > 0 )
{
companyElementsDir + + ;
}
}
2025-01-26 14:44:47 +01:00
qInfo ( ) < < " Company Elements count: " < < companyElementsDir < < " Elements " ;
2025-01-26 12:31:10 +01:00
qInfo ( ) < < " " ;
2025-01-26 12:16:46 +01:00
2020-08-13 22:50:58 +02:00
qInfo ( ) < < " *** Qt screens *** " ;
2025-01-26 12:16:46 +01:00
for ( int ii = 0 ; ii < pc . screen . count ; + + ii ) {
2020-08-13 22:50:58 +02:00
qInfo ( ) < < " ( "
+ QString : : number ( ii + 1 )
+ " : "
+ QString : : number ( pc . screen . width [ ii ] )
+ " x "
+ QString : : number ( pc . screen . height [ ii ] )
+ " ) " ;
2021-03-11 19:52:50 +01:00
}
2025-01-25 14:00:57 +01:00
qInfo ( ) < < " " ;
2025-01-26 12:31:10 +01:00
2022-04-07 16:33:20 +02:00
foreach ( const QStorageInfo & storage , QStorageInfo : : mountedVolumes ( ) ) {
if ( storage . isReadOnly ( ) )
2022-04-07 17:01:23 +02:00
qDebug ( ) < < " isReadOnly: " < < storage . isReadOnly ( ) ;
2022-04-07 16:33:20 +02:00
qInfo ( ) < < " DISK : " < < storage . rootPath ( ) . toLocal8Bit ( ) . constData ( ) < < " " ;
qInfo ( ) < < " FileSystemType: " < < storage . fileSystemType ( ) ;
2022-04-07 17:01:23 +02:00
qInfo ( ) < < " SizeTotal: " < < storage . bytesTotal ( ) / 1000000000 < < " GB " ;
qInfo ( ) < < " AvailableSize: " < < storage . bytesAvailable ( ) / 1000000000 < < " GB " ;
2022-04-07 16:33:20 +02:00
}
QStorageInfo storage ( qApp - > applicationDirPath ( ) ) ;
2025-01-26 12:31:10 +01:00
2022-04-07 16:33:20 +02:00
if ( storage . isReadOnly ( ) )
2022-04-07 17:01:23 +02:00
qDebug ( ) < < " isReadOnly: " < < storage . isReadOnly ( ) ;
2022-04-07 16:33:20 +02:00
qInfo ( ) < < " DISK USED: " < < storage . rootPath ( ) . toLocal8Bit ( ) . constData ( ) < < " " ;
qInfo ( ) < < " FileSystemType: " < < storage . fileSystemType ( ) ;
2022-04-07 17:01:23 +02:00
qInfo ( ) < < " SizeTotal: " < < storage . bytesTotal ( ) / 1000000000 < < " GB " ;
qInfo ( ) < < " AvailableSize: " < < storage . bytesAvailable ( ) / 1000000000 < < " GB " ;
2025-01-26 14:44:47 +01:00
qInfo ( ) < < " Count All Elements in collections = " < < commomElementsDir + customElementsDir + customElementsDir < < " Elements " ;
2022-04-07 16:33:20 +02:00
2020-07-21 20:29:05 +02:00
}
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : init_get_Screen_info
2020-07-21 20:29:05 +02:00
Finds the largest screen and saves the values
*/
2021-03-22 19:01:46 +01:00
void MachineInfo : : init_get_Screen_info ( )
2020-07-21 20:29:05 +02:00
{
const auto screens = qApp - > screens ( ) ;
2020-08-14 17:03:08 +02:00
pc . screen . count = screens . count ( ) ;
for ( int ii = 0 ; ii < pc . screen . count ; + + ii ) {
pc . screen . width [ ii ] =
2020-07-21 20:29:05 +02:00
screens [ ii ] - > geometry ( ) . width ( )
2020-08-14 17:03:08 +02:00
* screens [ ii ] - > devicePixelRatio ( ) ;
if ( pc . screen . Max_width < pc . screen . width [ ii ] )
pc . screen . Max_width = pc . screen . width [ ii ] ;
pc . screen . height [ ii ] =
2020-07-21 20:29:05 +02:00
screens [ ii ] - > geometry ( ) . height ( )
2020-08-14 17:03:08 +02:00
* screens [ ii ] - > devicePixelRatio ( ) ;
if ( pc . screen . Max_height < pc . screen . height [ ii ] )
pc . screen . Max_height = pc . screen . height [ ii ] ;
2020-07-21 20:29:05 +02:00
}
}
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : init_get_cpu_info
2020-07-21 20:29:05 +02:00
*/
2021-03-22 19:01:46 +01:00
void MachineInfo : : init_get_cpu_info ( )
2020-07-21 20:29:05 +02:00
{
2020-08-13 22:50:58 +02:00
# ifdef __APPLE_CC__
init_get_cpu_info_macos ( ) ;
# else
if ( pc . os . type = = " linux " )
init_get_cpu_info_linux ( ) ;
if ( pc . os . type = = " winnt " )
init_get_cpu_info_winnt ( ) ;
# endif
2020-07-21 20:29:05 +02:00
}
2020-07-23 21:57:30 +02:00
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : init_get_cpu_info_linux
2020-07-23 21:57:30 +02:00
*/
2021-03-22 19:01:46 +01:00
void MachineInfo : : init_get_cpu_info_linux ( )
2020-07-23 21:57:30 +02:00
{
QProcess linuxcpuinfo ;
linuxcpuinfo . start ( " bash " , QStringList ( )
< < " -c "
< < " cat /proc/cpuinfo |grep 'model name' | uniq " ) ;
linuxcpuinfo . waitForFinished ( ) ;
QString linuxOutput = linuxcpuinfo . readAllStandardOutput ( ) ;
2020-08-13 22:50:58 +02:00
pc . cpu . info = QString ( linuxOutput . toLocal8Bit ( ) . constData ( ) ) ;
2020-07-23 21:57:30 +02:00
QProcess p ;
p . start ( " awk " , QStringList ( )
< < " /MemTotal/ { print $2 } "
< < " /proc/meminfo " ) ;
p . waitForFinished ( ) ;
QString memory = p . readAllStandardOutput ( ) ;
2020-08-13 22:50:58 +02:00
//compilation_info += "<br>"
2022-04-26 07:54:41 +02:00
pc . ram . Total = QString ( " RAM Total : %1 GB " ) . arg (
memory . toLong ( ) / ( 1024 * 1000 ) ) ;
2020-07-23 21:57:30 +02:00
p . close ( ) ;
QProcess qp ;
qp . start ( " awk " ,
QStringList ( )
< < " /MemAvailable/ {print $2} "
< < " /proc/meminfo " ) ;
qp . waitForFinished ( ) ;
QString AvailableMemory = qp . readAllStandardOutput ( ) ;
2022-04-26 07:54:41 +02:00
pc . ram . Available = QString ( " RAM Available : %1 GB " ) . arg (
AvailableMemory . toLong ( ) / ( 1024 * 1000 ) ) ;
2020-07-23 21:57:30 +02:00
qp . close ( ) ;
QProcess linuxgpuinfo ;
linuxgpuinfo . start ( " bash " ,
QStringList ( )
< < " -c "
< < " lspci | grep VGA | cut -d : -f 3 " ) ;
linuxgpuinfo . waitForFinished ( ) ;
QString linuxGPUOutput = linuxgpuinfo . readAllStandardOutput ( ) ;
2020-08-13 22:50:58 +02:00
pc . gpu . info = QString ( linuxGPUOutput . toLocal8Bit ( ) . constData ( ) ) ;
2022-02-17 19:01:56 +01:00
linuxgpuinfo . close ( ) ;
2024-04-10 10:28:58 +02:00
2022-02-17 19:01:56 +01:00
QProcess linuxgpuRAM ;
linuxgpuRAM . start ( " bash " ,
QStringList ( )
< < " -c "
< < " glxinfo | egrep -i 'video memory' | cut -b 1- " ) ;
linuxgpuRAM . waitForFinished ( ) ;
QString linuxGPURAMOutput = linuxgpuRAM . readAllStandardOutput ( ) ;
pc . gpu . RAM = QString ( linuxGPURAMOutput . toLocal8Bit ( ) . constData ( ) ) ;
linuxgpuRAM . close ( ) ;
2020-08-13 22:50:58 +02:00
}
2020-08-14 17:03:08 +02:00
2020-08-13 22:50:58 +02:00
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : init_get_cpu_info_winnt
2020-08-13 22:50:58 +02:00
*/
2021-03-22 19:01:46 +01:00
void MachineInfo : : init_get_cpu_info_winnt ( )
2020-08-13 22:50:58 +02:00
{
QProcess wincpuinfo ;
wincpuinfo . start ( " wmic " ,
QStringList ( ) < < " cpu " < < " get " < < " name " ) ;
wincpuinfo . waitForFinished ( ) ;
QString windows_output = wincpuinfo . readAllStandardOutput ( ) . toUpper ( ) ;
pc . cpu . info = QString ( windows_output . toLocal8Bit ( ) . constData ( ) ) ;
2020-07-23 21:57:30 +02:00
2020-08-13 22:50:58 +02:00
QProcess wingpuinfo ;
wingpuinfo . start ( " wmic " ,
QStringList ( )
< < " PATH "
< < " Win32_videocontroller "
< < " get "
< < " VideoProcessor " ) ;
wingpuinfo . waitForFinished ( ) ;
QString WinGPUOutput = wingpuinfo . readAllStandardOutput ( ) ;
pc . gpu . info = QString ( WinGPUOutput . toLocal8Bit ( ) . constData ( ) ) ;
2020-07-23 21:57:30 +02:00
2020-08-13 22:50:58 +02:00
QProcess wingpuraminfo ;
wingpuraminfo . start ( " wmic " ,
2020-10-03 09:25:29 +02:00
QStringList ( )
< < " PATH "
< < " Win32_videocontroller "
< < " get "
< < " AdapterRAM " ) ;
2020-08-13 22:50:58 +02:00
wingpuraminfo . waitForFinished ( ) ;
QString WinGPURAMOutput = wingpuraminfo . readAllStandardOutput ( ) ;
2020-08-20 19:45:20 +02:00
pc . gpu . RAM = QString ( " RAM Total : %1 B " ) . arg (
2020-08-20 18:09:37 +02:00
WinGPURAMOutput . toLocal8Bit ( ) . constData ( ) ) ;
2020-08-14 12:57:15 +02:00
wingpuraminfo . close ( ) ;
2020-10-03 09:25:29 +02:00
2020-08-20 06:05:55 +02:00
# ifdef Q_OS_WIN
MEMORYSTATUSEX memory_status ;
ZeroMemory ( & memory_status , sizeof ( MEMORYSTATUSEX ) ) ;
memory_status . dwLength = sizeof ( MEMORYSTATUSEX ) ;
if ( GlobalMemoryStatusEx ( & memory_status ) ) {
pc . ram . Total . append (
2022-04-26 07:54:41 +02:00
QString ( " RAM Total : %1 GB " )
. arg ( memory_status . ullTotalPhys / ( ( 1024 * 1024 ) * 1000 ) ) ) ;
2020-08-20 18:09:37 +02:00
pc . ram . Available . append (
2022-04-26 07:54:41 +02:00
QString ( " RAM Available : %1 GB " )
. arg ( memory_status . ullAvailPhys / ( ( 1024 * 1024 ) * 1000 ) ) ) ;
2020-08-20 18:09:37 +02:00
} else {
2020-08-20 19:34:07 +02:00
pc . ram . Total . append ( " Unknown RAM " ) ;
2020-08-20 18:09:37 +02:00
pc . ram . Available . append ( " Unknown RAM " ) ;
}
2020-08-20 06:05:55 +02:00
# endif
2020-08-13 22:50:58 +02:00
}
2020-08-14 00:36:59 +02:00
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : init_get_cpu_info_macos
2020-08-14 00:36:59 +02:00
*/
2021-03-22 19:01:46 +01:00
void MachineInfo : : init_get_cpu_info_macos ( )
2020-08-13 22:50:58 +02:00
{
QProcess macoscpuinfo ;
macoscpuinfo . start ( " bash " ,
QStringList ( )
< < " -c "
< < " sysctl -n machdep.cpu.brand_string " ) ;
macoscpuinfo . waitForFinished ( ) ;
QString macosOutput = macoscpuinfo . readAllStandardOutput ( ) ;
pc . cpu . info = QString ( macosOutput . toLocal8Bit ( ) . constData ( ) ) ;
2020-10-03 09:25:29 +02:00
2020-08-14 12:51:50 +02:00
QProcess macosraminfo ;
macosraminfo . start ( " bash " ,
QStringList ( )
< < " -c "
< < " sysctl -n hw.memsize " ) ;
macosraminfo . waitForFinished ( ) ;
QString macosRAMOutput = macosraminfo . readAllStandardOutput ( ) ;
2022-04-26 07:54:41 +02:00
pc . ram . Total = QString ( " RAM Total : %1 GB " ) . arg (
2022-04-26 08:15:20 +02:00
macosRAMOutput . toLongLong ( ) / ( ( 1024 * 1024 ) * 1000 ) ) ;
2020-08-14 12:51:50 +02:00
macosraminfo . close ( ) ;
2020-08-13 22:50:58 +02:00
}
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : i_max_screen_width
2020-08-13 22:50:58 +02:00
@ return max screen width
2020-08-16 11:19:36 +02:00
*/
2021-03-22 19:20:07 +01:00
int32_t MachineInfo : : i_max_screen_width ( ) {
return pc . screen . Max_width ;
2020-08-13 22:50:58 +02:00
}
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : i_max_screen_height
2020-08-13 22:50:58 +02:00
@ return max screen height
*/
2021-03-22 19:20:07 +01:00
int32_t MachineInfo : : i_max_screen_height ( ) {
return pc . screen . Max_height ;
2020-08-13 22:50:58 +02:00
}
2020-07-23 21:57:30 +02:00
2020-08-13 22:50:58 +02:00
/**
2021-03-22 19:01:46 +01:00
@ brief MachineInfo : : compilation_info
2020-08-13 22:50:58 +02:00
@ return compilation_info
*/
2021-03-22 19:01:46 +01:00
QString MachineInfo : : compilation_info ( )
2020-08-13 22:50:58 +02:00
{
2021-03-22 19:01:46 +01:00
QString compilation_info = " <br /> " + QObject : : tr ( " Compilation : " ) ;
2020-08-13 22:50:58 +02:00
compilation_info + = pc . built . version ;
2022-07-08 20:50:45 +02:00
2020-08-13 22:50:58 +02:00
compilation_info + = " <br>Built with Qt " + pc . built . QT ;
2022-07-08 21:34:10 +02:00
compilation_info + = " - " + pc . built . arch ;
2020-08-13 22:50:58 +02:00
compilation_info + = " - Date : " + pc . built . date ;
compilation_info + = " : " + pc . built . time ;
2023-01-23 16:32:43 +01:00
if ( strlen ( GIT_COMMIT_SHA ) ) {
compilation_info + = " <br> Git Revision : " + QString ( GIT_COMMIT_SHA ) ;
}
2023-01-21 14:46:34 +01:00
compilation_info + = " <br>Run with Qt " + QString ( qVersion ( ) ) ;
2020-08-13 22:50:58 +02:00
compilation_info + = " using "
+ QString ( " %1 thread(s) " ) . arg ( pc . cpu . ThreadCount ) ;
compilation_info + = " <br> CPU : " + pc . cpu . info ;
compilation_info + = " <br> " + pc . ram . Total ;
compilation_info + = " <br> " + pc . ram . Available ;
compilation_info + = " <br>GPU : " + pc . gpu . info ;
compilation_info + = " <br>GPU RAM : " + pc . gpu . RAM ;
compilation_info + = " <br> OS : " + pc . os . type ;
compilation_info + = " - " + pc . cpu . Architecture ;
compilation_info + = " - Version : " + pc . os . name ;
compilation_info + = " </br> - Kernel : " + pc . os . kernel ;
2020-07-23 21:57:30 +02:00
compilation_info + = " <br> *** Qt screens *** </br> " ;
2020-08-13 22:50:58 +02:00
for ( int ii = 0 ; ii < pc . screen . count ; + + ii ) {
2020-07-23 21:57:30 +02:00
compilation_info + = " <br> ( "
+ QString : : number ( ii + 1 )
+ " : "
2020-08-13 22:50:58 +02:00
+ QString : : number ( pc . screen . width [ ii ] )
2020-07-23 21:57:30 +02:00
+ " x "
2020-08-13 22:50:58 +02:00
+ QString : : number ( pc . screen . height [ ii ] )
2020-07-23 21:57:30 +02:00
+ " ) </br> " ;
}
return compilation_info ;
}
2025-01-23 12:35:03 +01:00