mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Moved compilation_info to class Machine_info
This is preparation for making a dev log file
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
#include "machine_info.h"
|
||||
#include <QScreen>
|
||||
#include <QProcess>
|
||||
#include <QThread>
|
||||
#include <QApplication>
|
||||
|
||||
/**
|
||||
@@ -67,7 +69,7 @@ void Machine_info::init_get_Screen_info()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Machine_info::get_max_screen_width
|
||||
@brief Machine_info::i_max_screen_width
|
||||
@return max screen width
|
||||
*/
|
||||
int32_t Machine_info::i_max_screen_width()
|
||||
@@ -76,10 +78,122 @@ int32_t Machine_info::i_max_screen_width()
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Machine_info::get_max_screen_height
|
||||
@brief Machine_info::i_max_screen_height
|
||||
@return max screen height
|
||||
*/
|
||||
int32_t Machine_info::i_max_screen_height()
|
||||
{
|
||||
return Max_screen_height;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Machine_info::compilation_info
|
||||
@return compilation_info
|
||||
*/
|
||||
QString Machine_info::compilation_info()
|
||||
{
|
||||
QString compilation_info = "<br />" + tr("Compilation : ");
|
||||
#ifdef __GNUC__
|
||||
#ifdef __APPLE_CC__
|
||||
compilation_info += " CLANG " + QString(__clang_version__ );
|
||||
compilation_info += " <br>Built with Qt " + QString(QT_VERSION_STR);
|
||||
compilation_info += " - Date : " + QString(__DATE__);
|
||||
compilation_info += " : " + QString(__TIME__);
|
||||
compilation_info += " <br>Run with Qt "+ QString(qVersion());
|
||||
compilation_info += " using" + QString(" %1 thread(s)").arg(
|
||||
QThread::idealThreadCount());
|
||||
QProcess macoscpuinfo;
|
||||
macoscpuinfo.start("bash",
|
||||
QStringList()
|
||||
<< "-c"
|
||||
<< "sysctl -n machdep.cpu.brand_string");
|
||||
macoscpuinfo.waitForFinished();
|
||||
QString macosOutput = macoscpuinfo.readAllStandardOutput();
|
||||
compilation_info += "<br>"" CPU : "
|
||||
+ QString(macosOutput.toLocal8Bit().constData());
|
||||
|
||||
#else
|
||||
compilation_info += " GCC " + QString(__VERSION__);
|
||||
compilation_info += "<br>Built with Qt " + QString(QT_VERSION_STR);
|
||||
compilation_info += " - Date : " + QString(__DATE__);
|
||||
compilation_info += " : " + QString(__TIME__);
|
||||
compilation_info += " <br>Run with Qt "+ QString(qVersion());
|
||||
compilation_info += " using"
|
||||
+ QString(" %1 thread(s)").arg(
|
||||
QThread::idealThreadCount());
|
||||
|
||||
QString OSName = QSysInfo::kernelType();
|
||||
if (OSName == "linux")
|
||||
{
|
||||
QProcess linuxcpuinfo;
|
||||
linuxcpuinfo.start("bash", QStringList()
|
||||
<< "-c"
|
||||
<< "cat /proc/cpuinfo |grep 'model name' | uniq");
|
||||
linuxcpuinfo.waitForFinished();
|
||||
QString linuxOutput = linuxcpuinfo.readAllStandardOutput();
|
||||
compilation_info += "<br>"" CPU : "
|
||||
+ QString(linuxOutput.toLocal8Bit().constData());
|
||||
|
||||
QProcess p;
|
||||
p.start("awk", QStringList()
|
||||
<< "/MemTotal/ { print $2 }"
|
||||
<< "/proc/meminfo");
|
||||
p.waitForFinished();
|
||||
QString memory = p.readAllStandardOutput();
|
||||
compilation_info += "<br>"
|
||||
+ QString("RAM Total : %1 MB").arg(
|
||||
memory.toLong() / 1024);
|
||||
p.close();
|
||||
|
||||
QProcess qp;
|
||||
qp.start("awk",
|
||||
QStringList()
|
||||
<< "/MemAvailable/ {print $2}"
|
||||
<< "/proc/meminfo");
|
||||
qp.waitForFinished();
|
||||
QString AvailableMemory = qp.readAllStandardOutput();
|
||||
compilation_info += "<br>"
|
||||
+ QString("RAM Available : %1 MB").arg(
|
||||
AvailableMemory.toLong() / 1024);
|
||||
qp.close();
|
||||
|
||||
QProcess linuxgpuinfo;
|
||||
linuxgpuinfo.start("bash",
|
||||
QStringList()
|
||||
<< "-c"
|
||||
<< "lspci | grep VGA | cut -d : -f 3");
|
||||
linuxgpuinfo.waitForFinished();
|
||||
QString linuxGPUOutput = linuxgpuinfo.readAllStandardOutput();
|
||||
compilation_info += "<br>"" GPU : "
|
||||
+ QString(linuxGPUOutput.toLocal8Bit().constData());
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
compilation_info += "<br>" " OS : "
|
||||
+ QString(QSysInfo::kernelType());
|
||||
compilation_info += " - "
|
||||
+ QString(QSysInfo::currentCpuArchitecture());
|
||||
compilation_info += " - Version : "
|
||||
+ QString(QSysInfo::prettyProductName());
|
||||
compilation_info += "</br>" " - Kernel : "
|
||||
+ QString(QSysInfo::kernelVersion());
|
||||
compilation_info += "<br> *** Qt screens *** </br>";
|
||||
const auto screens = qApp->screens();
|
||||
for (int ii = 0; ii < screens.count(); ++ii) {
|
||||
compilation_info += "<br> ( "
|
||||
+ QString::number(ii + 1)
|
||||
+ " : "
|
||||
+ QString::number(
|
||||
screens[ii]->geometry().width()
|
||||
* screens[ii]->devicePixelRatio())
|
||||
+ " x "
|
||||
+ QString::number(
|
||||
screens[ii]->geometry().height()
|
||||
* screens[ii]->devicePixelRatio())
|
||||
+ " ) </br>";
|
||||
}
|
||||
return compilation_info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user