FrogPilot 0.9.7

This commit is contained in:
FrogAi
2024-06-27 10:22:08 -07:00
parent da00915ac8
commit b705b02e70
682 changed files with 181798 additions and 1348 deletions
+27 -5
View File
@@ -6,7 +6,6 @@
#include <QScrollBar>
#include <QStyle>
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/qt_window.h"
#include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/widgets/controls.h"
@@ -127,9 +126,21 @@ AdvancedNetworking::AdvancedNetworking(QWidget* parent, WifiManager* wifi): QWid
ListWidget *list = new ListWidget(this);
// Enable tethering layout
tetheringToggle = new ToggleControl(tr("Enable Tethering"), "", "", wifi->isTetheringEnabled());
std::vector<QString> tetheringSelection{tr("Off"), tr("Always"), tr("Only Onroad"), tr("Until Reboot")};
tetheringToggle = new ButtonParamControl("TetheringEnabled", tr("Enable Tethering"),
tr("Allow tethering with your data SIM and keep it active either while driving or continuously."),
"", tetheringSelection);
if (params.getInt("TetheringEnabled") == 3) {
params.remove("TetheringEnabled");
tetheringToggle->setCheckedButton(0);
}
QButtonGroup *buttonGroup = tetheringToggle->findChild<QButtonGroup *>();
if (buttonGroup) {
QObject::connect(buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked), [this](int id) {
toggleTethering(id);
});
}
list->addItem(tetheringToggle);
QObject::connect(tetheringToggle, &ToggleControl::toggleFlipped, this, &AdvancedNetworking::toggleTethering);
// Change tethering password
ButtonControl *editPasswordButton = new ButtonControl(tr("Tethering Password"), tr("EDIT"));
@@ -221,8 +232,8 @@ void AdvancedNetworking::refresh() {
update();
}
void AdvancedNetworking::toggleTethering(bool enabled) {
wifi->setTetheringEnabled(enabled);
void AdvancedNetworking::toggleTethering(int id) {
wifi->setTetheringEnabled(id == 1 || id == 3);
tetheringToggle->setEnabled(false);
}
@@ -290,6 +301,17 @@ WifiUI::WifiUI(QWidget *parent, WifiManager* wifi) : QWidget(parent), wifi(wifi)
color: #696969;
}
)");
// FrogPilot variables
QObject::connect(uiState(), &UIState::uiUpdate, this, &WifiUI::updateState);
}
void WifiUI::updateState(const UIState &s) {
if (!isVisible() || s.sm->frame % UI_FREQ != 0) {
return;
}
refresh();
}
void WifiUI::refresh() {
+6 -2
View File
@@ -6,6 +6,7 @@
#include "selfdrive/ui/qt/widgets/input.h"
#include "selfdrive/ui/qt/widgets/ssh_keys.h"
#include "selfdrive/ui/qt/widgets/toggle.h"
#include "selfdrive/ui/ui.h"
class WifiItem : public QWidget {
Q_OBJECT
@@ -45,6 +46,9 @@ private:
ListWidget *wifi_list_widget = nullptr;
std::vector<WifiItem*> wifi_items;
// FrogPilot widgets
void updateState(const UIState &s);
signals:
void connectToNetwork(const Network n);
@@ -59,7 +63,7 @@ public:
private:
LabelControl* ipLabel;
ToggleControl* tetheringToggle;
ButtonParamControl* tetheringToggle;
ToggleControl* roamingToggle;
ButtonControl* editApnButton;
ButtonControl* hiddenNetworkButton;
@@ -72,7 +76,7 @@ signals:
void requestWifiScreen();
public slots:
void toggleTethering(bool enabled);
void toggleTethering(int id);
void refresh();
};
+1 -1
View File
@@ -58,6 +58,7 @@ public:
void setTetheringEnabled(bool enabled);
bool isTetheringEnabled();
void changeTetheringPassword(const QString &newPassword);
QString getIp4Address();
QString getTetheringPassword();
private:
@@ -72,7 +73,6 @@ private:
QString getAdapter(const uint = NM_DEVICE_TYPE_WIFI);
uint getAdapterType(const QDBusObjectPath &path);
QString getIp4Address();
void deactivateConnectionBySsid(const QString &ssid);
void deactivateConnection(const QDBusObjectPath &path);
QVector<QDBusObjectPath> getActiveConnections();