You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.2 KiB
100 lines
2.2 KiB
4 years ago
|
#pragma once
|
||
4 years ago
|
|
||
2 years ago
|
#include <vector>
|
||
|
|
||
2 years ago
|
#include "selfdrive/ui/qt/network/wifi_manager.h"
|
||
4 years ago
|
#include "selfdrive/ui/qt/widgets/input.h"
|
||
|
#include "selfdrive/ui/qt/widgets/ssh_keys.h"
|
||
|
#include "selfdrive/ui/qt/widgets/toggle.h"
|
||
4 years ago
|
|
||
2 years ago
|
class WifiItem : public QWidget {
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit WifiItem(const QString &connecting_text, const QString &forget_text, QWidget* parent = nullptr);
|
||
|
void setItem(const Network& n, const QPixmap &icon, bool show_forget_btn, const QPixmap &strength);
|
||
|
|
||
|
signals:
|
||
2 years ago
|
// Cannot pass Network by reference. it may change after the signal is sent.
|
||
|
void connectToNetwork(const Network n);
|
||
|
void forgotNetwork(const Network n);
|
||
2 years ago
|
|
||
|
protected:
|
||
|
ElidedLabel* ssidLabel;
|
||
|
QPushButton* connecting;
|
||
|
QPushButton* forgetBtn;
|
||
|
QLabel* iconLabel;
|
||
|
QLabel* strengthLabel;
|
||
|
Network network;
|
||
|
};
|
||
|
|
||
4 years ago
|
class WifiUI : public QWidget {
|
||
|
Q_OBJECT
|
||
|
|
||
4 years ago
|
public:
|
||
4 years ago
|
explicit WifiUI(QWidget *parent = 0, WifiManager* wifi = 0);
|
||
4 years ago
|
|
||
4 years ago
|
private:
|
||
2 years ago
|
WifiItem *getItem(int n);
|
||
|
|
||
4 years ago
|
WifiManager *wifi = nullptr;
|
||
3 years ago
|
QLabel *scanningLabel = nullptr;
|
||
4 years ago
|
QPixmap lock;
|
||
|
QPixmap checkmark;
|
||
4 years ago
|
QPixmap circled_slash;
|
||
4 years ago
|
QVector<QPixmap> strengths;
|
||
2 years ago
|
ListWidget *wifi_list_widget = nullptr;
|
||
|
std::vector<WifiItem*> wifi_items;
|
||
4 years ago
|
|
||
4 years ago
|
signals:
|
||
2 years ago
|
void connectToNetwork(const Network n);
|
||
4 years ago
|
|
||
4 years ago
|
public slots:
|
||
4 years ago
|
void refresh();
|
||
4 years ago
|
};
|
||
|
|
||
|
class AdvancedNetworking : public QWidget {
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit AdvancedNetworking(QWidget* parent = 0, WifiManager* wifi = 0);
|
||
|
|
||
|
private:
|
||
4 years ago
|
LabelControl* ipLabel;
|
||
4 years ago
|
ToggleControl* tetheringToggle;
|
||
3 years ago
|
ToggleControl* roamingToggle;
|
||
|
ButtonControl* editApnButton;
|
||
|
ToggleControl* meteredToggle;
|
||
4 years ago
|
WifiManager* wifi = nullptr;
|
||
4 years ago
|
Params params;
|
||
4 years ago
|
|
||
|
signals:
|
||
|
void backPress();
|
||
|
|
||
4 years ago
|
public slots:
|
||
4 years ago
|
void toggleTethering(bool enabled);
|
||
4 years ago
|
void refresh();
|
||
|
};
|
||
|
|
||
4 years ago
|
class Networking : public QFrame {
|
||
4 years ago
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
4 years ago
|
explicit Networking(QWidget* parent = 0, bool show_advanced = true);
|
||
4 years ago
|
WifiManager* wifi = nullptr;
|
||
4 years ago
|
|
||
|
private:
|
||
4 years ago
|
QStackedLayout* main_layout = nullptr;
|
||
4 years ago
|
QWidget* wifiScreen = nullptr;
|
||
4 years ago
|
AdvancedNetworking* an = nullptr;
|
||
4 years ago
|
WifiUI* wifiWidget;
|
||
4 years ago
|
|
||
4 years ago
|
void showEvent(QShowEvent* event) override;
|
||
3 years ago
|
void hideEvent(QHideEvent* event) override;
|
||
4 years ago
|
|
||
4 years ago
|
public slots:
|
||
4 years ago
|
void refresh();
|
||
4 years ago
|
|
||
|
private slots:
|
||
2 years ago
|
void connectToNetwork(const Network n);
|
||
4 years ago
|
void wrongPassword(const QString &ssid);
|
||
4 years ago
|
};
|