00001 /* 00002 * wpa_gui - WpaGui class 00003 * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation. 00008 * 00009 * Alternatively, this software may be distributed under the terms of BSD 00010 * license. 00011 * 00012 * See README and COPYING for more details. 00013 */ 00014 00015 #ifndef WPAGUI_H 00016 #define WPAGUI_H 00017 00018 #include <QSystemTrayIcon> 00019 #include <QObject> 00020 #include "ui_wpagui.h" 00021 #include "addinterface.h" 00022 00023 class UserDataRequest; 00024 00025 00026 class WpaGui : public QMainWindow, public Ui::WpaGui 00027 { 00028 Q_OBJECT 00029 00030 public: 00031 WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0, 00032 Qt::WFlags fl = 0); 00033 ~WpaGui(); 00034 00035 virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen); 00036 virtual void triggerUpdate(); 00037 virtual void editNetwork(const QString &sel); 00038 virtual void removeNetwork(const QString &sel); 00039 virtual void enableNetwork(const QString &sel); 00040 virtual void disableNetwork(const QString &sel); 00041 virtual int getNetworkDisabled(const QString &sel); 00042 void setBssFromScan(const QString &bssid); 00043 #ifndef QT_NO_SESSIONMANAGER 00044 void saveState(); 00045 #endif 00046 00047 public slots: 00048 virtual void parse_argv(); 00049 virtual void updateStatus(); 00050 virtual void updateNetworks(); 00051 virtual void helpIndex(); 00052 virtual void helpContents(); 00053 virtual void helpAbout(); 00054 virtual void disconnect(); 00055 virtual void scan(); 00056 virtual void eventHistory(); 00057 virtual void ping(); 00058 virtual void processMsg(char *msg); 00059 virtual void processCtrlReq(const char *req); 00060 virtual void receiveMsgs(); 00061 virtual void connectB(); 00062 virtual void selectNetwork(const QString &sel); 00063 virtual void editSelectedNetwork(); 00064 virtual void editListedNetwork(); 00065 virtual void removeSelectedNetwork(); 00066 virtual void removeListedNetwork(); 00067 virtual void addNetwork(); 00068 virtual void enableAllNetworks(); 00069 virtual void disableAllNetworks(); 00070 virtual void removeAllNetworks(); 00071 virtual void saveConfig(); 00072 virtual void selectAdapter(const QString &sel); 00073 virtual void updateNetworkDisabledStatus(); 00074 virtual void enableListedNetwork(bool); 00075 virtual void disableListedNetwork(bool); 00076 virtual void showTrayMessage(QSystemTrayIcon::MessageIcon type, 00077 int sec, const QString &msg); 00078 virtual void showTrayStatus(); 00079 virtual void wpsDialog(); 00080 virtual void peersDialog(); 00081 virtual void tabChanged(int index); 00082 virtual void wpsPbc(); 00083 virtual void wpsGeneratePin(); 00084 virtual void wpsApPinChanged(const QString &text); 00085 virtual void wpsApPin(); 00086 #ifdef CONFIG_NATIVE_WINDOWS 00087 virtual void startService(); 00088 virtual void stopService(); 00089 #endif /* CONFIG_NATIVE_WINDOWS */ 00090 virtual void addInterface(); 00091 00092 protected slots: 00093 virtual void languageChange(); 00094 virtual void trayActivated(QSystemTrayIcon::ActivationReason how); 00095 virtual void closeEvent(QCloseEvent *event); 00096 00097 private: 00098 ScanResults *scanres; 00099 Peers *peers; 00100 bool networkMayHaveChanged; 00101 char *ctrl_iface; 00102 EventHistory *eh; 00103 struct wpa_ctrl *ctrl_conn; 00104 QSocketNotifier *msgNotifier; 00105 QTimer *timer; 00106 int pingsToStatusUpdate; 00107 WpaMsgList msgs; 00108 char *ctrl_iface_dir; 00109 struct wpa_ctrl *monitor_conn; 00110 UserDataRequest *udr; 00111 QAction *disconnectAction; 00112 QAction *reconnectAction; 00113 QAction *eventAction; 00114 QAction *scanAction; 00115 QAction *statAction; 00116 QAction *showAction; 00117 QAction *hideAction; 00118 QAction *quitAction; 00119 QMenu *tray_menu; 00120 QSystemTrayIcon *tray_icon; 00121 QString wpaStateTranslate(char *state); 00122 void createTrayIcon(bool); 00123 bool ackTrayIcon; 00124 bool startInTray; 00125 00126 int openCtrlConnection(const char *ifname); 00127 00128 bool wpsRunning; 00129 00130 QString bssFromScan; 00131 00132 void stopWpsRun(bool success); 00133 00134 #ifdef CONFIG_NATIVE_WINDOWS 00135 QAction *fileStartServiceAction; 00136 QAction *fileStopServiceAction; 00137 00138 bool serviceRunning(); 00139 #endif /* CONFIG_NATIVE_WINDOWS */ 00140 00141 QAction *addInterfaceAction; 00142 AddInterface *add_iface; 00143 00144 bool connectedToService; 00145 00146 QApplication *app; 00147 bool inTray; 00148 }; 00149 00150 #endif /* WPAGUI_H */