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