1 /* 2 * wpa_gui - WpaGui class 3 * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef WPAGUI_H 10 #define WPAGUI_H 11 12 #include <QSystemTrayIcon> 13 #include <QObject> 14 #include "ui_wpagui.h" 15 #include "addinterface.h" 16 17 class UserDataRequest; 18 19 20 class WpaGui : public QMainWindow, public Ui::WpaGui 21 { 22 Q_OBJECT 23 24 public: 25 WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0, 26 Qt::WFlags fl = 0); 27 ~WpaGui(); 28 29 virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen); 30 virtual void triggerUpdate(); 31 virtual void editNetwork(const QString &sel); 32 virtual void removeNetwork(const QString &sel); 33 virtual void enableNetwork(const QString &sel); 34 virtual void disableNetwork(const QString &sel); 35 virtual int getNetworkDisabled(const QString &sel); 36 void setBssFromScan(const QString &bssid); 37 #ifndef QT_NO_SESSIONMANAGER 38 void saveState(); 39 #endif 40 41 public slots: 42 virtual void parse_argv(); 43 virtual void updateStatus(); 44 virtual void updateNetworks(); 45 virtual void helpIndex(); 46 virtual void helpContents(); 47 virtual void helpAbout(); 48 virtual void disconnect(); 49 virtual void scan(); 50 virtual void eventHistory(); 51 virtual void ping(); 52 virtual void processMsg(char *msg); 53 virtual void processCtrlReq(const char *req); 54 virtual void receiveMsgs(); 55 virtual void connectB(); 56 virtual void selectNetwork(const QString &sel); 57 virtual void editSelectedNetwork(); 58 virtual void editListedNetwork(); 59 virtual void removeSelectedNetwork(); 60 virtual void removeListedNetwork(); 61 virtual void addNetwork(); 62 virtual void enableAllNetworks(); 63 virtual void disableAllNetworks(); 64 virtual void removeAllNetworks(); 65 virtual void saveConfig(); 66 virtual void selectAdapter(const QString &sel); 67 virtual void updateNetworkDisabledStatus(); 68 virtual void enableListedNetwork(bool); 69 virtual void disableListedNetwork(bool); 70 virtual void showTrayMessage(QSystemTrayIcon::MessageIcon type, 71 int sec, const QString &msg); 72 virtual void showTrayStatus(); 73 virtual void wpsDialog(); 74 virtual void peersDialog(); 75 virtual void tabChanged(int index); 76 virtual void wpsPbc(); 77 virtual void wpsGeneratePin(); 78 virtual void wpsApPinChanged(const QString &text); 79 virtual void wpsApPin(); 80 #ifdef CONFIG_NATIVE_WINDOWS 81 virtual void startService(); 82 virtual void stopService(); 83 #endif /* CONFIG_NATIVE_WINDOWS */ 84 virtual void addInterface(); 85 86 protected slots: 87 virtual void languageChange(); 88 virtual void trayActivated(QSystemTrayIcon::ActivationReason how); 89 virtual void closeEvent(QCloseEvent *event); 90 91 private: 92 ScanResults *scanres; 93 Peers *peers; 94 bool networkMayHaveChanged; 95 char *ctrl_iface; 96 EventHistory *eh; 97 struct wpa_ctrl *ctrl_conn; 98 QSocketNotifier *msgNotifier; 99 QTimer *timer; 100 int pingsToStatusUpdate; 101 WpaMsgList msgs; 102 char *ctrl_iface_dir; 103 struct wpa_ctrl *monitor_conn; 104 UserDataRequest *udr; 105 QAction *disconnectAction; 106 QAction *reconnectAction; 107 QAction *eventAction; 108 QAction *scanAction; 109 QAction *statAction; 110 QAction *showAction; 111 QAction *hideAction; 112 QAction *quitAction; 113 QMenu *tray_menu; 114 QSystemTrayIcon *tray_icon; 115 QString wpaStateTranslate(char *state); 116 void createTrayIcon(bool); 117 bool ackTrayIcon; 118 bool startInTray; 119 120 int openCtrlConnection(const char *ifname); 121 122 bool wpsRunning; 123 124 QString bssFromScan; 125 126 void stopWpsRun(bool success); 127 128 #ifdef CONFIG_NATIVE_WINDOWS 129 QAction *fileStartServiceAction; 130 QAction *fileStopServiceAction; 131 132 bool serviceRunning(); 133 #endif /* CONFIG_NATIVE_WINDOWS */ 134 135 QAction *addInterfaceAction; 136 AddInterface *add_iface; 137 138 bool connectedToService; 139 140 QApplication *app; 141 bool inTray; 142 }; 143 144 #endif /* WPAGUI_H */ 145