Qt standalone wifi chooser (#20141)

* qt wifiManager remove qDebugs

* wifi widget

* 50% done

* Update SConscript

* backgrounds work

* backgrounds work

Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Comma Device <device@comma.ai>
albatross
grekiki 2021-02-26 14:21:06 +01:00 committed by GitHub
parent c60cc0310c
commit 069532eb18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 91 additions and 3 deletions

2
.gitignore vendored
View File

@ -70,7 +70,7 @@ pandaextra
flycheck_*
cppcheck_report.txt
comma.sh
comma*.sh
selfdrive/modeld/thneed/compile
models/*.thneed

View File

@ -5,4 +5,5 @@ qt/text
qt/spinner
qt/setup/setup
qt/setup/reset
qt/setup/wifi
qt/setup/installer*

View File

@ -45,6 +45,7 @@ else:
if "BUILD_SETUP" in os.environ:
qt_env.Program("qt/setup/reset", ["qt/setup/reset.cc"], LIBS=qt_libs)
qt_env.Program("qt/setup/setup", ["qt/setup/setup.cc"], LIBS=qt_libs + ['curl', 'common', 'json11'])
qt_env.Program("qt/setup/wifi", ["qt/setup/wifi.cc"], LIBS=qt_libs + ['common', 'json11'])
installers = [
("openpilot", "master"),

View File

@ -393,10 +393,8 @@ void WifiManager::disconnect() {
}
QVector<QDBusObjectPath> WifiManager::list_connections(){
qDebug() << "list connections";
QVector<QDBusObjectPath> connections;
QDBusInterface nm(nm_service, nm_settings_path, nm_settings_iface, bus);
qDebug() << "here";
nm.setTimeout(dbus_timeout);
QDBusMessage response = nm.call("ListConnections");

View File

@ -0,0 +1,74 @@
#include <stdio.h>
#include <stdlib.h>
#include <curl/curl.h>
#include <QLabel>
#include <QVBoxLayout>
#include <QApplication>
#include "wifi.hpp"
#include "offroad/networking.hpp"
#include "widgets/input_field.hpp"
#include "qt_window.hpp"
void WifiSetup::finish() {
qApp->exit();
}
WifiSetup::WifiSetup(QWidget *parent) {
QHBoxLayout *main_layout = new QHBoxLayout();
QPushButton *finish_btn = new QPushButton("Exit");
finish_btn->setFixedSize(400, 200);
main_layout->addWidget(finish_btn, 0, Qt::AlignTop | Qt::AlignLeft);
QObject::connect(finish_btn, SIGNAL(released()), this, SLOT(finish()));
QWidget* n = new Networking(this, true);
//Next 5 lines to keep the same stylesheet on the networking widget
QLayout* backgroundLayout = new QVBoxLayout();
backgroundLayout->addWidget(n);
QWidget* q = new QWidget();
q->setLayout(backgroundLayout);
q->setStyleSheet(R"(
* {
background-color: #292929;
}
)");
main_layout->addWidget(q, 1);
setLayout(main_layout);
QObject::connect(this, SIGNAL(downloadFailed()), this, SLOT(nextPage()));
setStyleSheet(R"(
* {
background-color: black;
color: white;
font-size: 50px;
}
QVBoxLayout {
padding: 20px;
}
QFrame {
border-radius: 30px;
background-color: #292929;
}
QPushButton {
margin: 40px;
padding: 5px;
border-width: 0;
border-radius: 30px;
color: #dddddd;
background-color: #444444;
}
)");
}
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
WifiSetup setup;
setMainWindow(&setup);
return a.exec();
}

View File

@ -0,0 +1,14 @@
#include <QString>
#include <QWidget>
#include <QLineEdit>
#include <QPushButton>
class WifiSetup : public QWidget {
Q_OBJECT
public:
explicit WifiSetup(QWidget *parent = 0);
public slots:
void finish();
};