mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Rename class Machine_info to MachinInfo
Rename to follow the code style of QElectroTech
This commit is contained in:
@@ -35,7 +35,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
// liste des pages
|
// liste des pages
|
||||||
pages_list = new QListWidget();
|
pages_list = new QListWidget();
|
||||||
pages_list -> setViewMode(QListView::IconMode);
|
pages_list -> setViewMode(QListView::IconMode);
|
||||||
if(Machine_info::i_max_screen_height()<1000){
|
if(MachineInfo::i_max_screen_height()<1000){
|
||||||
pages_list -> setIconSize(QSize(64, 64));
|
pages_list -> setIconSize(QSize(64, 64));
|
||||||
} else {
|
} else {
|
||||||
pages_list -> setIconSize(QSize(128, 128));
|
pages_list -> setIconSize(QSize(128, 128));
|
||||||
@@ -79,7 +79,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) {
|
|||||||
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
connect(pages_list, SIGNAL(currentRowChanged(int)),
|
||||||
pages_widget, SLOT(setCurrentIndex(int)));
|
pages_widget, SLOT(setCurrentIndex(int)));
|
||||||
|
|
||||||
setMaximumSize(Machine_info::i_max_screen_width(), Machine_info::i_max_screen_height());
|
setMaximumSize(MachineInfo::i_max_screen_width(), MachineInfo::i_max_screen_height());
|
||||||
resize(1400,1000);
|
resize(1400,1000);
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
|||||||
@@ -30,19 +30,19 @@
|
|||||||
#include "qet.h"
|
#include "qet.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::Machine_info
|
@brief MachineInfo::MachineInfo
|
||||||
@param parent
|
@param parent
|
||||||
*/
|
*/
|
||||||
Machine_info::Machine_info(QObject *parent) : QObject(parent)
|
MachineInfo::MachineInfo()
|
||||||
{
|
{
|
||||||
init_get_Screen_info();
|
init_get_Screen_info();
|
||||||
init_get_cpu_info();
|
init_get_cpu_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::send_info_to_debug
|
@brief MachineInfo::send_info_to_debug
|
||||||
*/
|
*/
|
||||||
void Machine_info::send_info_to_debug()
|
void MachineInfo::send_info_to_debug()
|
||||||
{
|
{
|
||||||
qInfo()<<"debugging enabled:"
|
qInfo()<<"debugging enabled:"
|
||||||
<< QLibraryInfo::isDebugBuild();
|
<< QLibraryInfo::isDebugBuild();
|
||||||
@@ -120,7 +120,7 @@ void Machine_info::send_info_to_debug()
|
|||||||
#endif
|
#endif
|
||||||
qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA);
|
qInfo() << "GitRevision " + QString(GIT_COMMIT_SHA);
|
||||||
qInfo()<< "QElectroTech V " + QET::displayedVersion;
|
qInfo()<< "QElectroTech V " + QET::displayedVersion;
|
||||||
qInfo()<< tr("Compilation : ") + pc.built.version;
|
qInfo()<< QObject::tr("Compilation : ") + pc.built.version;
|
||||||
qInfo()<< "Built with Qt " + pc.built.QT
|
qInfo()<< "Built with Qt " + pc.built.QT
|
||||||
+ " - Date : " + pc.built.date
|
+ " - Date : " + pc.built.date
|
||||||
+ " : " + pc.built.time;
|
+ " : " + pc.built.time;
|
||||||
@@ -151,10 +151,10 @@ void Machine_info::send_info_to_debug()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_Screen_info
|
@brief MachineInfo::init_get_Screen_info
|
||||||
Finds the largest screen and saves the values
|
Finds the largest screen and saves the values
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_Screen_info()
|
void MachineInfo::init_get_Screen_info()
|
||||||
{
|
{
|
||||||
const auto screens = qApp->screens();
|
const auto screens = qApp->screens();
|
||||||
pc.screen.count=screens.count();
|
pc.screen.count=screens.count();
|
||||||
@@ -174,9 +174,9 @@ void Machine_info::init_get_Screen_info()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info
|
@brief MachineInfo::init_get_cpu_info
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info()
|
void MachineInfo::init_get_cpu_info()
|
||||||
{
|
{
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#ifdef __APPLE_CC__
|
#ifdef __APPLE_CC__
|
||||||
@@ -191,9 +191,9 @@ void Machine_info::init_get_cpu_info()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info_linux
|
@brief MachineInfo::init_get_cpu_info_linux
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info_linux()
|
void MachineInfo::init_get_cpu_info_linux()
|
||||||
{
|
{
|
||||||
QProcess linuxcpuinfo;
|
QProcess linuxcpuinfo;
|
||||||
linuxcpuinfo.start("bash", QStringList()
|
linuxcpuinfo.start("bash", QStringList()
|
||||||
@@ -237,9 +237,9 @@ void Machine_info::init_get_cpu_info_linux()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info_winnt
|
@brief MachineInfo::init_get_cpu_info_winnt
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info_winnt()
|
void MachineInfo::init_get_cpu_info_winnt()
|
||||||
{
|
{
|
||||||
QProcess wincpuinfo;
|
QProcess wincpuinfo;
|
||||||
wincpuinfo.start("wmic",
|
wincpuinfo.start("wmic",
|
||||||
@@ -291,9 +291,9 @@ void Machine_info::init_get_cpu_info_winnt()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::init_get_cpu_info_macos
|
@brief MachineInfo::init_get_cpu_info_macos
|
||||||
*/
|
*/
|
||||||
void Machine_info::init_get_cpu_info_macos()
|
void MachineInfo::init_get_cpu_info_macos()
|
||||||
{
|
{
|
||||||
QProcess macoscpuinfo;
|
QProcess macoscpuinfo;
|
||||||
macoscpuinfo.start("bash",
|
macoscpuinfo.start("bash",
|
||||||
@@ -317,10 +317,10 @@ void Machine_info::init_get_cpu_info_macos()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::i_max_screen_width
|
@brief MachineInfo::i_max_screen_width
|
||||||
@return max screen width
|
@return max screen width
|
||||||
*/
|
*/
|
||||||
int32_t Machine_info::i_max_screen_width()
|
int32_t MachineInfo::i_max_screen_width()
|
||||||
{
|
{
|
||||||
const auto screens = qApp->screens();
|
const auto screens = qApp->screens();
|
||||||
auto screen_count = screens.count();
|
auto screen_count = screens.count();
|
||||||
@@ -341,10 +341,10 @@ int32_t Machine_info::i_max_screen_width()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::i_max_screen_height
|
@brief MachineInfo::i_max_screen_height
|
||||||
@return max screen height
|
@return max screen height
|
||||||
*/
|
*/
|
||||||
int32_t Machine_info::i_max_screen_height()
|
int32_t MachineInfo::i_max_screen_height()
|
||||||
{
|
{
|
||||||
const auto screens = qApp->screens();
|
const auto screens = qApp->screens();
|
||||||
auto screen_count = screens.count();
|
auto screen_count = screens.count();
|
||||||
@@ -365,12 +365,12 @@ int32_t Machine_info::i_max_screen_height()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Machine_info::compilation_info
|
@brief MachineInfo::compilation_info
|
||||||
@return compilation_info
|
@return compilation_info
|
||||||
*/
|
*/
|
||||||
QString Machine_info::compilation_info()
|
QString MachineInfo::compilation_info()
|
||||||
{
|
{
|
||||||
QString compilation_info = "<br />" + tr("Compilation : ");
|
QString compilation_info = "<br />" + QObject::tr("Compilation : ");
|
||||||
compilation_info +=pc.built.version;
|
compilation_info +=pc.built.version;
|
||||||
compilation_info += "<br>Built with Qt " + pc.built.QT;
|
compilation_info += "<br>Built with Qt " + pc.built.QT;
|
||||||
compilation_info += " - Date : " + pc.built.date;
|
compilation_info += " - Date : " + pc.built.date;
|
||||||
|
|||||||
@@ -18,31 +18,27 @@
|
|||||||
#ifndef MACHINE_INFO_H
|
#ifndef MACHINE_INFO_H
|
||||||
#define MACHINE_INFO_H
|
#define MACHINE_INFO_H
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief The Machine_info class
|
@brief The MachineInfo class
|
||||||
This class hold information from your PC.
|
This class hold information from your PC.
|
||||||
*/
|
*/
|
||||||
class Machine_info : public QObject
|
class MachineInfo
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
public:
|
||||||
public:
|
explicit MachineInfo();
|
||||||
explicit Machine_info(QObject *parent = nullptr);
|
static int32_t i_max_screen_width();
|
||||||
static int32_t i_max_screen_width();
|
static int32_t i_max_screen_height();
|
||||||
static int32_t i_max_screen_height();
|
QString compilation_info();
|
||||||
QString compilation_info();
|
void send_info_to_debug();
|
||||||
void send_info_to_debug();
|
|
||||||
|
|
||||||
signals:
|
private:
|
||||||
|
void init_get_Screen_info();
|
||||||
private:
|
void init_get_cpu_info();
|
||||||
void init_get_Screen_info();
|
void init_get_cpu_info_linux();
|
||||||
void init_get_cpu_info();
|
void init_get_cpu_info_winnt();
|
||||||
void init_get_cpu_info_linux();
|
void init_get_cpu_info_macos();
|
||||||
void init_get_cpu_info_winnt();
|
|
||||||
void init_get_cpu_info_macos();
|
|
||||||
struct Pc
|
struct Pc
|
||||||
{
|
{
|
||||||
struct Screen
|
struct Screen
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ int main(int argc, char **argv)
|
|||||||
qInfo("Start-up");
|
qInfo("Start-up");
|
||||||
// delete old log files of max 7 days old.
|
// delete old log files of max 7 days old.
|
||||||
delete_old_log_files(7);
|
delete_old_log_files(7);
|
||||||
Machine_info ma;
|
MachineInfo ma;
|
||||||
ma.send_info_to_debug();
|
ma.send_info_to_debug();
|
||||||
});
|
});
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|||||||
@@ -152,8 +152,8 @@ void AboutQETDialog::setVersion()
|
|||||||
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V "
|
QString str = "<span style=\"font-weight:bold;font-size:16pt;\">QElectroTech V "
|
||||||
+ QET::displayedVersion
|
+ QET::displayedVersion
|
||||||
+ "</span>";
|
+ "</span>";
|
||||||
Machine_info *my_ma =new Machine_info(this);
|
MachineInfo mi_;
|
||||||
ui->m_version_label->setText(str + my_ma->compilation_info());
|
ui->m_version_label->setText(str + mi_.compilation_info());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user