Add system info option in Settings

W-I-P.
This commit is contained in:
Nicolas Mailloux 2021-06-08 08:03:46 -04:00
parent 9428483d02
commit 99d40c22ad
5 changed files with 175 additions and 128 deletions

View file

@ -50,6 +50,7 @@ namespace global {
inline bool textBrowserDialog; inline bool textBrowserDialog;
inline QString textBrowserContents; inline QString textBrowserContents;
} }
inline QString systemInfoText;
} }
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534 // https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
@ -261,5 +262,14 @@ namespace {
deviceUID = proc->readAllStandardOutput(); deviceUID = proc->readAllStandardOutput();
deviceUID = deviceUID.left(256); deviceUID = deviceUID.left(256);
} }
void getSystemInfo() {
getUID();
global::systemInfoText = "InkBox OS version ";
string_checkconfig_ro("/external_root/opt/isa/version");
global::systemInfoText.append(checkconfig_str_val);
global::systemInfoText.append("Device UID: ");
global::systemInfoText.append(deviceUID);
global::systemInfoText.append("\n");
}
} }
#endif // FUNCTIONS_H #endif // FUNCTIONS_H

View file

@ -765,9 +765,6 @@ void reader::on_aboutBtn_clicked()
string_checkconfig_ro("/external_root/opt/isa/version"); string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox "); aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val); aboutmsg.append(checkconfig_str_val);
getUID();
aboutmsg.append("\nDevice UID:\n");
aboutmsg.append(deviceUID);
QMessageBox::information(this, tr("Information"), aboutmsg); QMessageBox::information(this, tr("Information"), aboutmsg);
} }
else { else {

View file

@ -30,6 +30,7 @@ settings::settings(QWidget *parent) :
ui->usbmsBtn->setProperty("type", "borderless"); ui->usbmsBtn->setProperty("type", "borderless");
ui->updateBtn->setProperty("type", "borderless"); ui->updateBtn->setProperty("type", "borderless");
ui->resetBtn->setProperty("type", "borderless"); ui->resetBtn->setProperty("type", "borderless");
ui->showSystemInfoBtn->setProperty("type", "borderless");
ui->previousBtn->setProperty("type", "borderless"); ui->previousBtn->setProperty("type", "borderless");
ui->nextBtn->setProperty("type", "borderless"); ui->nextBtn->setProperty("type", "borderless");
ui->aboutBtn->setStyleSheet("font-size: 9pt"); ui->aboutBtn->setStyleSheet("font-size: 9pt");
@ -37,6 +38,7 @@ settings::settings(QWidget *parent) :
ui->usbmsBtn->setStyleSheet("font-size: 9pt"); ui->usbmsBtn->setStyleSheet("font-size: 9pt");
ui->updateBtn->setStyleSheet("font-size: 9pt"); ui->updateBtn->setStyleSheet("font-size: 9pt");
ui->resetBtn->setStyleSheet("font-size: 9pt"); ui->resetBtn->setStyleSheet("font-size: 9pt");
ui->showSystemInfoBtn->setStyleSheet("font-size: 9pt");
ui->comboBox->setStyleSheet("font-size: 9pt"); ui->comboBox->setStyleSheet("font-size: 9pt");
ui->setPasscodeBtn->setStyleSheet("font-size: 9pt"); ui->setPasscodeBtn->setStyleSheet("font-size: 9pt");
@ -266,9 +268,6 @@ void settings::on_aboutBtn_clicked()
string_checkconfig_ro("/external_root/opt/isa/version"); string_checkconfig_ro("/external_root/opt/isa/version");
aboutmsg.append("\n\nInkBox "); aboutmsg.append("\n\nInkBox ");
aboutmsg.append(checkconfig_str_val); aboutmsg.append(checkconfig_str_val);
getUID();
aboutmsg.append("\nDevice UID:\n");
aboutmsg.append(deviceUID);
QMessageBox::information(this, tr("Information"), aboutmsg); QMessageBox::information(this, tr("Information"), aboutmsg);
} }
else { else {
@ -649,3 +648,9 @@ void settings::on_enableUiScalingCheckBox_toggled(bool checked)
ui_enable_changed = true; ui_enable_changed = true;
} }
} }
void settings::on_showSystemInfoBtn_clicked()
{
getSystemInfo();
global::text::textBrowserContents = global::systemInfoText;
}

View file

@ -47,6 +47,8 @@ private slots:
void on_enableLockscreenCheckBox_toggled(bool checked); void on_enableLockscreenCheckBox_toggled(bool checked);
void on_enableUiScalingCheckBox_toggled(bool checked); void on_enableUiScalingCheckBox_toggled(bool checked);
void on_showSystemInfoBtn_clicked();
private: private:
Ui::settings *ui; Ui::settings *ui;
usbms_splash *usbmsWindow; usbms_splash *usbmsWindow;

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>477</width> <width>477</width>
<height>603</height> <height>607</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -163,7 +163,7 @@ OK
<item row="26" column="0"> <item row="26" column="0">
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="page"> <widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@ -524,6 +524,23 @@ OK
</property> </property>
<item> <item>
<layout class="QGridLayout" name="gridLayout_10"> <layout class="QGridLayout" name="gridLayout_10">
<item row="8" column="0">
<widget class="QCheckBox" name="enableUiScalingCheckBox">
<property name="text">
<string>Enable UI scaling</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="Line" name="line_9">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="11" column="0"> <item row="11" column="0">
<layout class="QGridLayout" name="gridLayout_12"> <layout class="QGridLayout" name="gridLayout_12">
<property name="bottomMargin"> <property name="bottomMargin">
@ -536,6 +553,19 @@ OK
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="2">
<widget class="QPushButton" name="resetBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<spacer name="horizontalSpacer_8"> <spacer name="horizontalSpacer_8">
<property name="orientation"> <property name="orientation">
@ -549,19 +579,6 @@ OK
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="2">
<widget class="QPushButton" name="resetBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="6" column="0"> <item row="6" column="0">
@ -577,93 +594,6 @@ OK
</property> </property>
</widget> </widget>
</item> </item>
<item row="17" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="16" column="0">
<layout class="QGridLayout" name="gridLayout_13">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="setPasscodeBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="setPasscodeLabel">
<property name="text">
<string>Set a passcode</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="darkModeCheckBox">
<property name="text">
<string>Enable night mode</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="Line" name="line_9">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QCheckBox" name="enableLockscreenCheckBox">
<property name="text">
<string>Enable lock screen and passcode</string>
</property>
</widget>
</item>
<item row="9" column="0"> <item row="9" column="0">
<layout class="QGridLayout" name="gridLayout_8"> <layout class="QGridLayout" name="gridLayout_8">
<property name="bottomMargin"> <property name="bottomMargin">
@ -716,6 +646,83 @@ OK
</item> </item>
</layout> </layout>
</item> </item>
<item row="16" column="0">
<layout class="QGridLayout" name="gridLayout_13">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="setPasscodeBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Set</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="setPasscodeLabel">
<property name="text">
<string>Set a passcode</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="darkModeCheckBox">
<property name="text">
<string>Enable night mode</string>
</property>
</widget>
</item>
<item row="17" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="14" column="0">
<widget class="Line" name="line_2">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QCheckBox" name="enableLockscreenCheckBox">
<property name="text">
<string>Enable lock screen and passcode</string>
</property>
</widget>
</item>
<item row="12" column="0"> <item row="12" column="0">
<layout class="QGridLayout" name="gridLayout_7"> <layout class="QGridLayout" name="gridLayout_7">
<property name="bottomMargin"> <property name="bottomMargin">
@ -724,19 +731,6 @@ OK
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="2">
<widget class="QPushButton" name="updateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
<item row="0" column="1"> <item row="0" column="1">
<spacer name="horizontalSpacer_6"> <spacer name="horizontalSpacer_6">
<property name="orientation"> <property name="orientation">
@ -760,6 +754,52 @@ OK
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>System info</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="updateBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="showSystemInfoBtn">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Show</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="13" column="0"> <item row="13" column="0">
@ -775,13 +815,6 @@ OK
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="0">
<widget class="QCheckBox" name="enableUiScalingCheckBox">
<property name="text">
<string>Enable UI scaling</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>