/* Copyright 2006-2025 The QElectroTech Team 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 . */ #include "machine_info.h" #include "qetapp.h" #include "qetversion.h" #include #include #include #include #include #include #include #include #include #include #ifdef Q_OS_WIN #include #endif MachineInfo *MachineInfo::m_instance = nullptr; /** @brief MachineInfo::MachineInfo @param parent */ MachineInfo::MachineInfo() { init_get_Screen_info(); init_get_cpu_info(); } /** @brief MachineInfo::send_info_to_debug */ void MachineInfo::send_info_to_debug() { qInfo()<<"debugging enabled:" << QLibraryInfo::isDebugBuild(); qInfo()<< "Qt library version:" << QLibraryInfo::version(); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove 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); #ifndef Q_OS_WIN qInfo()<< "Qt library location Qt settings:" << QLibraryInfo::location(QLibraryInfo::SettingsPath); #endif #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); #ifndef Q_OS_WIN qInfo()<< "Qt library path Qt settings:" << QLibraryInfo::path(QLibraryInfo::SettingsPath); #endif #endif if (strlen(GIT_COMMIT_SHA)) { qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA); } qInfo()<< "QElectroTech V " + QetVersion::displayedVersion(); qInfo()<< QObject::tr("Compilation : ") + pc.built.version; qInfo()<< "Built with Qt " + pc.built.QT + " - " + pc.built.arch + " - 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; qInfo()<< " System language:"<< QString(QETApp::langFromSetting().toLatin1()); 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()); qInfo()<< " App Config Location:"<< QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); qInfo()<< " App Data Location:"<< QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); qInfo()<< " App Local DataLocation:"<< QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); qInfo()<< " Home Location:"<< QStandardPaths::writableLocation(QStandardPaths::HomeLocation); qInfo()<< " Runtime Location:"<< QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); qInfo()<< " Cache Location:"<< QStandardPaths::writableLocation(QStandardPaths::CacheLocation); qInfo()<< "*** Qt screens ***"; for (int ii = 0; ii < pc.screen.count; ++ii) { qInfo()<<"( " + QString::number(ii + 1) + " : " + QString::number(pc.screen.width[ii]) + " x " + QString::number(pc.screen.height[ii]) + " )"; } foreach (const QStorageInfo &storage, QStorageInfo::mountedVolumes()) { if (storage.isReadOnly()) qDebug() << "isReadOnly:" << storage.isReadOnly(); qInfo() << "DISK :" << storage.rootPath().toLocal8Bit().constData() << " "; qInfo() << "FileSystemType:" << storage.fileSystemType(); qInfo() << "SizeTotal:" << storage.bytesTotal()/1000000000 << "GB"; qInfo() << "AvailableSize:" << storage.bytesAvailable()/1000000000 << "GB"; } QStorageInfo storage(qApp->applicationDirPath()); if (storage.isReadOnly()) qDebug() << "isReadOnly:" << storage.isReadOnly(); qInfo() << "DISK USED:" << storage.rootPath().toLocal8Bit().constData() << " "; qInfo() << "FileSystemType:" << storage.fileSystemType(); qInfo() << "SizeTotal:" << storage.bytesTotal()/1000000000 << "GB"; qInfo() << "AvailableSize:" << storage.bytesAvailable()/1000000000 << "GB"; } /** @brief MachineInfo::init_get_Screen_info Finds the largest screen and saves the values */ void MachineInfo::init_get_Screen_info() { const auto screens = qApp->screens(); pc.screen.count=screens.count(); for (int ii = 0; ii < pc.screen.count; ++ii) { pc.screen.width[ii]= screens[ii]->geometry().width() * screens[ii]->devicePixelRatio(); if(pc.screen.Max_widthgeometry().height() * screens[ii]->devicePixelRatio(); if(pc.screen.Max_height"; } return compilation_info; }