mirror of
https://github.com/Quill-OS/quill.git
synced 2024-10-31 21:33:22 -07:00
Some fixes for Wi-Fi dialog; IP address in System Info
This commit is contained in:
parent
c509474ff3
commit
595da4b6be
8 changed files with 119 additions and 1 deletions
15
functions.h
15
functions.h
|
@ -374,6 +374,17 @@ namespace {
|
|||
kernelVersion.append(", build ");
|
||||
kernelVersion.append(kernelBuildID);
|
||||
}
|
||||
QString getConnectionInformation() {
|
||||
QString getIpProg ("sh");
|
||||
QStringList getIpArgs;
|
||||
getIpArgs << "-c" << "/sbin/ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'";
|
||||
QProcess *getIpProc = new QProcess();
|
||||
getIpProc->start(getIpProg, getIpArgs);
|
||||
getIpProc->waitForFinished();
|
||||
|
||||
QString ipAddress = getIpProc->readAllStandardOutput();
|
||||
return ipAddress;
|
||||
}
|
||||
void getSystemInfo() {
|
||||
getUID();
|
||||
getKernelVersion();
|
||||
|
@ -389,6 +400,10 @@ namespace {
|
|||
string_checkconfig_ro("/opt/inkbox_device");
|
||||
QString device = checkconfig_str_val.trimmed();
|
||||
global::systemInfoText.append(device);
|
||||
QString ipAddress = getConnectionInformation();
|
||||
global::systemInfoText.append("<br><b>IP address: </b>");
|
||||
global::systemInfoText.append(ipAddress);
|
||||
|
||||
}
|
||||
void resetKoboxUserData() {
|
||||
global::kobox::resetKoboxUserDataBool = true;
|
||||
|
|
|
@ -278,6 +278,8 @@ void generalDialog::on_okBtn_clicked()
|
|||
global::toast::modalToast = true;
|
||||
emit showToast("Connecting");
|
||||
QTimer::singleShot(100, this, SLOT(connectToNetworkSlot()));
|
||||
global::keyboard::wifiPassphraseDialog = false;
|
||||
global::keyboard::keyboardDialog = false;
|
||||
}
|
||||
else {
|
||||
QMessageBox::critical(this, tr("Invalid argument"), tr("Please type in the required argument."));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
QT += core gui
|
||||
QT += core gui network
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
|
@ -21,6 +21,7 @@ SOURCES += \
|
|||
koboxsettings.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
otamanager.cpp \
|
||||
quit.cpp \
|
||||
reader.cpp \
|
||||
savedwords.cpp \
|
||||
|
@ -44,6 +45,7 @@ HEADERS += \
|
|||
koboxappsdialog.h \
|
||||
koboxsettings.h \
|
||||
mainwindow.h \
|
||||
otamanager.h \
|
||||
quit.h \
|
||||
reader.h \
|
||||
savedwords.h \
|
||||
|
@ -66,6 +68,7 @@ FORMS += \
|
|||
koboxappsdialog.ui \
|
||||
koboxsettings.ui \
|
||||
mainwindow.ui \
|
||||
otamanager.ui \
|
||||
quit.ui \
|
||||
reader.ui \
|
||||
savedwords.ui \
|
||||
|
|
|
@ -601,6 +601,7 @@ void MainWindow::on_settingsBtn_clicked()
|
|||
else {
|
||||
;
|
||||
}
|
||||
showToast("Connection successful");
|
||||
}
|
||||
|
||||
void MainWindow::on_appsBtn_clicked()
|
||||
|
@ -950,6 +951,12 @@ void MainWindow::showToast(QString messageToDisplay) {
|
|||
connect(toastWindow, SIGNAL(showToast(QString)), SLOT(showToast(QString)));
|
||||
connect(toastWindow, SIGNAL(closeIndefiniteToast()), SLOT(closeIndefiniteToast()));
|
||||
toastWindow->show();
|
||||
|
||||
if(messageToDisplay == "Connection successful") {
|
||||
otaManagerWindow = new otaManager(this);
|
||||
connect(otaManagerWindow, SIGNAL(canInstallOtaUpdate(bool)), SLOT(openUpdateDialogOTA(bool)));
|
||||
otaManagerWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::hello(int testNumber) {
|
||||
|
@ -960,3 +967,12 @@ void MainWindow::closeIndefiniteToast() {
|
|||
// Warning: use with caution
|
||||
toastWindow->close();
|
||||
}
|
||||
|
||||
void MainWindow::openUpdateDialogOTA(bool open) {
|
||||
if(open == true) {
|
||||
openUpdateDialog();
|
||||
}
|
||||
else {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "textwidget.h"
|
||||
#include "virtualkeypad.h"
|
||||
#include "toast.h"
|
||||
#include "otamanager.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -82,6 +83,7 @@ private slots:
|
|||
void hello(int testNumber);
|
||||
void showToast(QString messageToDisplay);
|
||||
void closeIndefiniteToast();
|
||||
void openUpdateDialogOTA(bool open);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -98,6 +100,7 @@ private:
|
|||
textwidget *textwidgetWindow;
|
||||
virtualkeypad *keypadWidget;
|
||||
toast *toastWindow;
|
||||
otaManager *otaManagerWindow;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
32
otamanager.cpp
Normal file
32
otamanager.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include "otamanager.h"
|
||||
#include "ui_otamanager.h"
|
||||
#include "functions.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
otaManager::otaManager(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::otaManager)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
string_writeconfig("/opt/ibxd", "ota_update_check\n");
|
||||
QTimer *otaCheckTimer = new QTimer();
|
||||
otaCheckTimer->setInterval(100);
|
||||
connect(otaCheckTimer, &QTimer::timeout, [&]() {
|
||||
if(QFile::exists("/run/can_install_ota_update") == true) {
|
||||
if(checkconfig("/run/can_install_ota_update") == true) {
|
||||
emit canInstallOtaUpdate(true);
|
||||
otaManager::close();
|
||||
}
|
||||
else {
|
||||
emit canInstallOtaUpdate(false);
|
||||
otaManager::close();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
otaManager::~otaManager()
|
||||
{
|
||||
delete ui;
|
||||
}
|
26
otamanager.h
Normal file
26
otamanager.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
#ifndef OTAMANAGER_H
|
||||
#define OTAMANAGER_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class otaManager;
|
||||
}
|
||||
|
||||
class otaManager : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit otaManager(QWidget *parent = nullptr);
|
||||
~otaManager();
|
||||
|
||||
private:
|
||||
Ui::otaManager *ui;
|
||||
|
||||
signals:
|
||||
void canInstallOtaUpdate(bool yesno);
|
||||
|
||||
};
|
||||
|
||||
#endif // OTAMANAGER_H
|
21
otamanager.ui
Normal file
21
otamanager.ui
Normal file
|
@ -0,0 +1,21 @@
|
|||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>otamanager</class>
|
||||
<widget name="otamanager" class="QWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue