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.
		
		
		
		
			
				
					102 lines
				
				1.9 KiB
			
		
		
			
		
	
	
					102 lines
				
				1.9 KiB
			| 
								 
											5 years ago
										 
									 | 
							
								#pragma once
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QWidget>
							 | 
						||
| 
								 | 
							
								#include <QButtonGroup>
							 | 
						||
| 
								 | 
							
								#include <QVBoxLayout>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QStackedWidget>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QPushButton>
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include <QTimer>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include "wifiManager.hpp"
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include "widgets/input_field.hpp"
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								#include "widgets/ssh_keys.hpp"
							 | 
						||
| 
								 | 
							
								#include "widgets/toggle.hpp"
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								class WifiUI : public QWidget {
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  int page;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  explicit WifiUI(QWidget *parent = 0, int page_length = 5, WifiManager* wifi = 0);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								private:
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  WifiManager *wifi = nullptr;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  int networks_per_page;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  QVBoxLayout *vlayout;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  QButtonGroup *connectButtons;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  bool tetheringEnabled;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								signals:
							 | 
						||
| 
								 | 
							
								  void openKeyboard();
							 | 
						||
| 
								 | 
							
								  void closeKeyboard();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void connectToNetwork(Network n);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								public slots:
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void handleButton(QAbstractButton* m_button);
							 | 
						||
| 
								 | 
							
								  void refresh();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void prevPage();
							 | 
						||
| 
								 | 
							
								  void nextPage();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class AdvancedNetworking : public QWidget {
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  explicit AdvancedNetworking(QWidget* parent = 0, WifiManager* wifi = 0);
							 | 
						||
| 
								 | 
							
								  QStackedLayout* s;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								private:
							 | 
						||
| 
								 | 
							
								  InputField* inputField;
							 | 
						||
| 
								 | 
							
								  QLabel* ipLabel;
							 | 
						||
| 
								 | 
							
								  QPushButton* editPasswordButton;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  SSH* ssh;
							 | 
						||
| 
								 | 
							
								  Toggle* toggle_switch_SSH;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								  WifiManager* wifi = nullptr;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  bool isSSHEnabled();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								signals:
							 | 
						||
| 
								 | 
							
								  void openKeyboard();
							 | 
						||
| 
								 | 
							
								  void closeKeyboard();
							 | 
						||
| 
								 | 
							
								  void backPress();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								public slots:
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void receiveText(QString text);
							 | 
						||
| 
								 | 
							
								  void abortTextInput();
							 | 
						||
| 
								 | 
							
								  void toggleTethering(int enable);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void toggleSSH(int enable);
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  void refresh();
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class Networking : public QWidget {
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  explicit Networking(QWidget* parent = 0);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								private:
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  QStackedLayout* s = nullptr;// keyboard, wifiScreen, advanced
							 | 
						||
| 
								 | 
							
								  AdvancedNetworking* an = nullptr;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								  Network selectedNetwork;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  WifiUI* wifiWidget;
							 | 
						||
| 
								 | 
							
								  WifiManager* wifi = nullptr;
							 | 
						||
| 
								 | 
							
								  InputField* inputField;
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								signals:
							 | 
						||
| 
								 | 
							
								  void openKeyboard();
							 | 
						||
| 
								 | 
							
								  void closeKeyboard();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 | 
						||
| 
								 | 
							
								private slots:
							 | 
						||
| 
								 | 
							
								  void connectToNetwork(Network n);
							 | 
						||
| 
								 | 
							
								  void refresh();
							 | 
						||
| 
								 | 
							
								  void receiveText(QString text);
							 | 
						||
| 
								 | 
							
								  void abortTextInput();
							 | 
						||
| 
								 | 
							
								  void wrongPassword(QString ssid);
							 | 
						||
| 
								 | 
							
								  void successfulConnection(QString ssid);
							 | 
						||
| 
								 | 
							
								  void sidebarChange();
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								};
							 | 
						||
| 
								 
											5 years ago
										 
									 | 
							
								
							 |