Init CS-NG Tab
This commit is contained in:
parent
7be4d7db35
commit
9816a04557
@ -44,12 +44,14 @@ class SettingsWindow : public QWidget
|
||||
public:
|
||||
explicit SettingsWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent = nullptr);
|
||||
~SettingsWindow() override;
|
||||
void loadSystemValues();
|
||||
|
||||
private slots:
|
||||
void onSave();
|
||||
void onResetToDefaults();
|
||||
void onUpdateScreenDPI(int value);
|
||||
void onShowBindings();
|
||||
void onUpdateSystemVolume(int value);
|
||||
|
||||
private:
|
||||
void showEvent(QShowEvent* event);
|
||||
|
@ -19,6 +19,10 @@
|
||||
#include <QMessageBox>
|
||||
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
|
||||
#include "ui_settingswindow.h"
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QTextStream>
|
||||
#include <string>
|
||||
|
||||
namespace f1x
|
||||
{
|
||||
@ -45,6 +49,7 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
|
||||
connect(ui_->pushButtonSelectAll, &QPushButton::clicked, std::bind(&SettingsWindow::setButtonCheckBoxes, this, true));
|
||||
connect(ui_->pushButtonResetToDefaults, &QPushButton::clicked, this, &SettingsWindow::onResetToDefaults);
|
||||
connect(ui_->pushButtonShowBindings, &QPushButton::clicked, this, &SettingsWindow::onShowBindings);
|
||||
connect(ui_->horizontalSliderSystemVolume, &QSlider::valueChanged, this, &SettingsWindow::onUpdateSystemVolume);
|
||||
}
|
||||
|
||||
SettingsWindow::~SettingsWindow()
|
||||
@ -101,6 +106,8 @@ void SettingsWindow::onSave()
|
||||
|
||||
configuration_->save();
|
||||
|
||||
system((std::string("/usr/local/bin/oasysif setvolume ") + std::to_string(ui_->horizontalSliderSystemVolume->value())).c_str());
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
@ -233,6 +240,103 @@ void SettingsWindow::onUpdateScreenDPI(int value)
|
||||
ui_->labelScreenDPIValue->setText(QString::number(value));
|
||||
}
|
||||
|
||||
void SettingsWindow::onUpdateSystemVolume(int value)
|
||||
{
|
||||
ui_->labelSystemVolumeValue->setText(QString::number(value));
|
||||
//system((std::string("/usr/local/bin/oasysif setvolume ") + std::to_string(value)).c_str());
|
||||
}
|
||||
|
||||
void SettingsWindow::loadSystemValues()
|
||||
{
|
||||
// Get version string
|
||||
QFileInfo vFile("/etc/crankshaft.build");
|
||||
if (vFile.exists()) {
|
||||
QFile versionFile(QString("/etc/crankshaft.build"));
|
||||
versionFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_version(&versionFile);
|
||||
QString valueversion = data_version.readAll();
|
||||
versionFile.close();
|
||||
ui_->valueSystemVersion->setText(valueversion);
|
||||
} else {
|
||||
ui_->valueSystemVersion->setText("");
|
||||
}
|
||||
|
||||
// Get date string
|
||||
QFileInfo dFile("/etc/crankshaft.date");
|
||||
if (dFile.exists()) {
|
||||
QFile dateFile(QString("/etc/crankshaft.date"));
|
||||
dateFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_date(&dateFile);
|
||||
QString valuedate = data_date.readAll();
|
||||
dateFile.close();
|
||||
ui_->valueSystemBuildDate->setText(valuedate);
|
||||
} else {
|
||||
ui_->valueSystemBuildDate->setText("");
|
||||
}
|
||||
|
||||
system("/usr/local/bin/oasysif getvolume");
|
||||
QFileInfo rFile("/tmp/return_value");
|
||||
if (rFile.exists()) {
|
||||
QFile returnFile(QString("/tmp/return_value"));
|
||||
returnFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_return(&returnFile);
|
||||
QString currentvol = data_return.readAll();
|
||||
returnFile.close();
|
||||
ui_->labelSystemVolumeValue->setText(currentvol);
|
||||
ui_->horizontalSliderSystemVolume->setValue(currentvol.toInt());
|
||||
}
|
||||
|
||||
system("/usr/local/bin/oasysif getfreemem");
|
||||
if (rFile.exists()) {
|
||||
QFile returnFile(QString("/tmp/return_value"));
|
||||
returnFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_return(&returnFile);
|
||||
QString currentmem = data_return.readAll();
|
||||
returnFile.close();
|
||||
ui_->valueSystemFreeMem->setText(currentmem);
|
||||
}
|
||||
|
||||
system("/usr/local/bin/oasysif getcpufreq");
|
||||
if (rFile.exists()) {
|
||||
QFile returnFile(QString("/tmp/return_value"));
|
||||
returnFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_return(&returnFile);
|
||||
QString currentfreq = data_return.readAll();
|
||||
returnFile.close();
|
||||
ui_->valueSystemCPUFreq->setText(currentfreq);
|
||||
}
|
||||
|
||||
system("/usr/local/bin/oasysif getcputemp");
|
||||
if (rFile.exists()) {
|
||||
QFile returnFile(QString("/tmp/return_value"));
|
||||
returnFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_return(&returnFile);
|
||||
QString cputemp = data_return.readAll();
|
||||
returnFile.close();
|
||||
ui_->valueSystemCPUTemp->setText(cputemp);
|
||||
}
|
||||
|
||||
system("/usr/local/bin/oasysif getshutdown");
|
||||
if (rFile.exists()) {
|
||||
QFile returnFile(QString("/tmp/return_value"));
|
||||
returnFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_return(&returnFile);
|
||||
QString shutdowntimer = data_return.readAll();
|
||||
returnFile.close();
|
||||
ui_->valueShutdownTimer->setText(shutdowntimer);
|
||||
}
|
||||
|
||||
system("/usr/local/bin/oasysif getdisconnect");
|
||||
if (rFile.exists()) {
|
||||
QFile returnFile(QString("/tmp/return_value"));
|
||||
returnFile.open(QIODevice::ReadOnly);
|
||||
QTextStream data_return(&returnFile);
|
||||
QString disconnecttimer = data_return.readAll();
|
||||
returnFile.close();
|
||||
ui_->valueDisconnectTimer->setText(disconnecttimer);
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsWindow::onShowBindings()
|
||||
{
|
||||
const QString message = QString("Enter -> [Enter] \n")
|
||||
|
@ -27,7 +27,8 @@
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(46, 52, 54);
|
||||
color: rgb(238, 238, 236);</string>
|
||||
color: rgb(238, 238, 236);
|
||||
</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButtonSave">
|
||||
<property name="geometry">
|
||||
@ -74,7 +75,7 @@ color: rgb(238, 238, 236);</string>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabGeneral">
|
||||
<attribute name="title">
|
||||
@ -290,7 +291,7 @@ color: rgb(238, 238, 236);</string>
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>80</y>
|
||||
<width>311</width>
|
||||
<width>360</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -405,9 +406,13 @@ color: rgb(238, 238, 236);</string>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>531</width>
|
||||
<height>31</height>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QSlider::handle:horizontal { background: white; height: 32px; width: 52px; margin: 0 0;}
|
||||
QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>400</number>
|
||||
</property>
|
||||
@ -896,7 +901,7 @@ color: rgb(238, 238, 236);</string>
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>160</y>
|
||||
<width>271</width>
|
||||
<width>320</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -958,6 +963,265 @@ color: rgb(238, 238, 236);</string>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabCrankshaftNG">
|
||||
<attribute name="title">
|
||||
<string>Crankshaft NG</string>
|
||||
</attribute>
|
||||
<widget class="QGroupBox" name="groupBoxSystemInfo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>621</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>System Information</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="labelSystemVersion">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valueSystemVersion">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>34</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelSystemBuildDate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Build Date:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valueSystemBuildDate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>64</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelSystemFreeMem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>30</y>
|
||||
<width>110</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Free Memory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valueSystemFreeMem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>34</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelSystemCPUFreq">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>60</y>
|
||||
<width>110</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CPU Frequency:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valueSystemCPUFreq">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>64</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelSystemCPUTemp">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>30</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>CPU Temp:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valueSystemCPUTemp">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>500</x>
|
||||
<y>34</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBoxSystemVolume">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>110</y>
|
||||
<width>621</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Master System Volume</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="labelSystemVolumeValue">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>570</x>
|
||||
<y>40</y>
|
||||
<width>41</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>100</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="horizontalSliderSystemVolume">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>531</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QSlider::handle:horizontal { background: white; height: 32px; width: 52px; margin: 0 0;}
|
||||
QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="Timers">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>200</y>
|
||||
<width>621</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Timer</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="labelShutdownTimer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>150</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Shutdown Timeout:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valueShutdownTimer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>34</y>
|
||||
<width>240</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelDisconnectTimer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>150</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disconnect Timeout:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="valueDisconnectTimer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>64</y>
|
||||
<width>240</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelSettingsIcon">
|
||||
<property name="geometry">
|
||||
|
@ -103,6 +103,7 @@ int main(int argc, char* argv[])
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::exit, []() { std::exit(0); });
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::reboot, []() { system("touch /tmp/reboot"); std::exit(0); });
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::showFullScreen);
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::loadSystemValues);
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec);
|
||||
|
||||
qApplication.setOverrideCursor(Qt::BlankCursor);
|
||||
|
Loading…
x
Reference in New Issue
Block a user