mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-25 23:27:20 -08:00
Done with system info dialog
Works well, will have strange formatting is no InkBox version is known, probably due to checkconfig_str_val being null if no value is detected.
This commit is contained in:
parent
762489bb6b
commit
74937453ba
7 changed files with 72 additions and 37 deletions
22
functions.h
22
functions.h
|
@ -58,6 +58,7 @@ namespace {
|
|||
QString checkconfig_str_val;
|
||||
QString deviceUID;
|
||||
QString batt_level;
|
||||
QString kernelVersion;
|
||||
int batt_level_int;
|
||||
bool checked_box = false;
|
||||
bool checkconfig(QString file) {
|
||||
|
@ -145,6 +146,7 @@ namespace {
|
|||
fhandler.close();
|
||||
}
|
||||
void string_checkconfig(QString file) {
|
||||
checkconfig_str_val = "";
|
||||
QFile config(file);
|
||||
config.open(QIODevice::ReadWrite);
|
||||
QTextStream in (&config);
|
||||
|
@ -152,6 +154,7 @@ namespace {
|
|||
config.close();
|
||||
}
|
||||
void string_checkconfig_ro(QString file) {
|
||||
checkconfig_str_val = "";
|
||||
QFile config(file);
|
||||
config.open(QIODevice::ReadOnly);
|
||||
QTextStream in (&config);
|
||||
|
@ -262,14 +265,29 @@ namespace {
|
|||
deviceUID = proc->readAllStandardOutput();
|
||||
deviceUID = deviceUID.left(256);
|
||||
}
|
||||
void getKernelVersion() {
|
||||
QString prog ("uname");
|
||||
QStringList args;
|
||||
args << "-r";
|
||||
QProcess *proc = new QProcess();
|
||||
proc->start(prog, args);
|
||||
proc->waitForFinished();
|
||||
|
||||
kernelVersion = proc->readAllStandardOutput();
|
||||
}
|
||||
void getSystemInfo() {
|
||||
getUID();
|
||||
global::systemInfoText = "InkBox OS version ";
|
||||
getKernelVersion();
|
||||
global::systemInfoText = "<b>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("</b>");
|
||||
global::systemInfoText.append("\n<b>Device UID:</b> ");
|
||||
global::systemInfoText.append(deviceUID);
|
||||
global::systemInfoText.append("\n");
|
||||
global::systemInfoText.append("<b>Kernel version:</b> ");
|
||||
global::systemInfoText.append(kernelVersion);
|
||||
global::systemInfoText.append("\n");
|
||||
}
|
||||
}
|
||||
#endif // FUNCTIONS_H
|
||||
|
|
|
@ -97,6 +97,7 @@ generalDialog::generalDialog(QWidget *parent) :
|
|||
else if(global::text::textBrowserDialog == true) {
|
||||
textwidgetWindow = new textwidget();
|
||||
ui->headerLabel->setText("Information");
|
||||
ui->stackedWidget->setCurrentIndex(1);
|
||||
ui->mainStackedWidget->insertWidget(1, textwidgetWindow);
|
||||
ui->mainStackedWidget->setCurrentIndex(1);
|
||||
this->adjustSize();
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<item row="8" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -151,7 +151,7 @@
|
|||
<item row="6" column="0">
|
||||
<widget class="QStackedWidget" name="mainStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
|
|
|
@ -653,4 +653,10 @@ void settings::on_showSystemInfoBtn_clicked()
|
|||
{
|
||||
getSystemInfo();
|
||||
global::text::textBrowserContents = global::systemInfoText;
|
||||
global::text::textBrowserDialog = true;
|
||||
|
||||
// Show a system info dialog
|
||||
generalDialogWindow = new generalDialog();
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
generalDialogWindow->show();
|
||||
}
|
||||
|
|
64
settings.ui
64
settings.ui
|
@ -163,7 +163,7 @@ OK
|
|||
<item row="26" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -731,6 +731,26 @@ OK
|
|||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="1" 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="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>System info</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
|
@ -744,36 +764,6 @@ OK
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="updateLabel">
|
||||
<property name="text">
|
||||
<string>Update InkBox</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</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">
|
||||
|
@ -787,7 +777,17 @@ OK
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="updateLabel">
|
||||
<property name="text">
|
||||
<string>Update InkBox</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="showSystemInfoBtn">
|
||||
<property name="font">
|
||||
<font>
|
||||
|
|
|
@ -17,6 +17,9 @@ textwidget::textwidget(QWidget *parent) :
|
|||
this->setStyleSheet(stylesheetFile.readAll());
|
||||
stylesheetFile.close();
|
||||
|
||||
if(global::text::textBrowserDialog == true) {
|
||||
ui->textBrowser->setStyleSheet("font-size: 9pt");
|
||||
}
|
||||
ui->textBrowser->setText(global::text::textBrowserContents);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,14 @@
|
|||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
<widget class="QTextEdit" name="textBrowser">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>50</horstretch>
|
||||
<verstretch>50</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
Loading…
Reference in a new issue