2008-02-28 02:34:43 +01:00
|
|
|
/*
|
|
|
|
* wpa_gui - WpaGui class
|
|
|
|
* Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
|
|
|
|
*
|
2012-02-11 15:46:35 +01:00
|
|
|
* This software may be distributed under the terms of the BSD license.
|
|
|
|
* See README for more details.
|
2008-02-28 02:34:43 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WPAGUI_H
|
|
|
|
#define WPAGUI_H
|
|
|
|
|
2008-09-24 11:26:57 +02:00
|
|
|
#include <QSystemTrayIcon>
|
2008-02-28 02:34:43 +01:00
|
|
|
#include <QObject>
|
|
|
|
#include "ui_wpagui.h"
|
2008-12-25 15:38:09 +01:00
|
|
|
#include "addinterface.h"
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
class UserDataRequest;
|
|
|
|
|
2015-05-08 23:01:01 +02:00
|
|
|
class WpaGuiApp : public QApplication
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
WpaGuiApp(int &argc, char **argv);
|
|
|
|
|
|
|
|
#if !defined(QT_NO_SESSIONMANAGER) && QT_VERSION < 0x050000
|
|
|
|
virtual void saveState(QSessionManager &manager);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
WpaGui *w;
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
};
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
class WpaGui : public QMainWindow, public Ui::WpaGui
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-03-15 23:27:46 +01:00
|
|
|
|
|
|
|
enum TrayIconType {
|
|
|
|
TrayIconOffline = 0,
|
|
|
|
TrayIconAcquiring,
|
|
|
|
TrayIconConnected,
|
|
|
|
TrayIconSignalNone,
|
|
|
|
TrayIconSignalWeak,
|
|
|
|
TrayIconSignalOk,
|
|
|
|
TrayIconSignalGood,
|
|
|
|
TrayIconSignalExcellent,
|
|
|
|
};
|
|
|
|
|
2009-01-17 12:45:05 +01:00
|
|
|
WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0,
|
2015-05-08 23:01:01 +02:00
|
|
|
Qt::WindowFlags fl = 0);
|
2008-02-28 02:34:43 +01:00
|
|
|
~WpaGui();
|
|
|
|
|
|
|
|
virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen);
|
|
|
|
virtual void triggerUpdate();
|
|
|
|
virtual void editNetwork(const QString &sel);
|
|
|
|
virtual void removeNetwork(const QString &sel);
|
|
|
|
virtual void enableNetwork(const QString &sel);
|
|
|
|
virtual void disableNetwork(const QString &sel);
|
|
|
|
virtual int getNetworkDisabled(const QString &sel);
|
2008-12-16 22:43:08 +01:00
|
|
|
void setBssFromScan(const QString &bssid);
|
2009-11-16 12:20:53 +01:00
|
|
|
#ifndef QT_NO_SESSIONMANAGER
|
2009-01-17 12:45:05 +01:00
|
|
|
void saveState();
|
2009-11-16 12:20:53 +01:00
|
|
|
#endif
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
virtual void parse_argv();
|
|
|
|
virtual void updateStatus();
|
|
|
|
virtual void updateNetworks();
|
|
|
|
virtual void helpIndex();
|
|
|
|
virtual void helpContents();
|
|
|
|
virtual void helpAbout();
|
|
|
|
virtual void disconnect();
|
|
|
|
virtual void scan();
|
|
|
|
virtual void eventHistory();
|
|
|
|
virtual void ping();
|
2015-03-15 23:27:46 +01:00
|
|
|
virtual void signalMeterUpdate();
|
2008-02-28 02:34:43 +01:00
|
|
|
virtual void processMsg(char *msg);
|
|
|
|
virtual void processCtrlReq(const char *req);
|
|
|
|
virtual void receiveMsgs();
|
|
|
|
virtual void connectB();
|
|
|
|
virtual void selectNetwork(const QString &sel);
|
|
|
|
virtual void editSelectedNetwork();
|
|
|
|
virtual void editListedNetwork();
|
|
|
|
virtual void removeSelectedNetwork();
|
|
|
|
virtual void removeListedNetwork();
|
|
|
|
virtual void addNetwork();
|
|
|
|
virtual void enableAllNetworks();
|
|
|
|
virtual void disableAllNetworks();
|
|
|
|
virtual void removeAllNetworks();
|
|
|
|
virtual void saveConfig();
|
|
|
|
virtual void selectAdapter(const QString &sel);
|
|
|
|
virtual void updateNetworkDisabledStatus();
|
|
|
|
virtual void enableListedNetwork(bool);
|
|
|
|
virtual void disableListedNetwork(bool);
|
2008-09-24 11:26:57 +02:00
|
|
|
virtual void showTrayMessage(QSystemTrayIcon::MessageIcon type,
|
|
|
|
int sec, const QString &msg);
|
|
|
|
virtual void showTrayStatus();
|
2015-03-15 23:27:46 +01:00
|
|
|
virtual void updateTrayIcon(TrayIconType type);
|
2014-12-06 17:02:18 +01:00
|
|
|
virtual void updateTrayToolTip(const QString &msg);
|
2015-04-20 23:36:43 +02:00
|
|
|
virtual QIcon loadThemedIcon(const QStringList &names,
|
|
|
|
const QIcon &fallback);
|
2008-12-15 21:36:42 +01:00
|
|
|
virtual void wpsDialog();
|
2009-09-08 15:28:41 +02:00
|
|
|
virtual void peersDialog();
|
2008-12-15 21:36:42 +01:00
|
|
|
virtual void tabChanged(int index);
|
|
|
|
virtual void wpsPbc();
|
|
|
|
virtual void wpsGeneratePin();
|
2008-12-16 22:43:08 +01:00
|
|
|
virtual void wpsApPinChanged(const QString &text);
|
|
|
|
virtual void wpsApPin();
|
2008-12-21 13:28:45 +01:00
|
|
|
#ifdef CONFIG_NATIVE_WINDOWS
|
|
|
|
virtual void startService();
|
|
|
|
virtual void stopService();
|
|
|
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
2008-12-25 15:38:09 +01:00
|
|
|
virtual void addInterface();
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
virtual void languageChange();
|
2008-09-24 11:26:57 +02:00
|
|
|
virtual void trayActivated(QSystemTrayIcon::ActivationReason how);
|
2008-02-28 02:34:43 +01:00
|
|
|
virtual void closeEvent(QCloseEvent *event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
ScanResults *scanres;
|
2009-09-08 15:28:41 +02:00
|
|
|
Peers *peers;
|
2008-02-28 02:34:43 +01:00
|
|
|
bool networkMayHaveChanged;
|
|
|
|
char *ctrl_iface;
|
|
|
|
EventHistory *eh;
|
|
|
|
struct wpa_ctrl *ctrl_conn;
|
|
|
|
QSocketNotifier *msgNotifier;
|
|
|
|
QTimer *timer;
|
|
|
|
int pingsToStatusUpdate;
|
|
|
|
WpaMsgList msgs;
|
|
|
|
char *ctrl_iface_dir;
|
|
|
|
struct wpa_ctrl *monitor_conn;
|
|
|
|
UserDataRequest *udr;
|
2008-09-24 11:26:57 +02:00
|
|
|
QAction *disconnectAction;
|
|
|
|
QAction *reconnectAction;
|
|
|
|
QAction *eventAction;
|
|
|
|
QAction *scanAction;
|
|
|
|
QAction *statAction;
|
|
|
|
QAction *showAction;
|
|
|
|
QAction *hideAction;
|
|
|
|
QAction *quitAction;
|
|
|
|
QMenu *tray_menu;
|
|
|
|
QSystemTrayIcon *tray_icon;
|
2015-03-15 23:27:46 +01:00
|
|
|
TrayIconType currentIconType;
|
2010-04-11 21:42:02 +02:00
|
|
|
QString wpaStateTranslate(char *state);
|
2008-10-01 08:48:11 +02:00
|
|
|
void createTrayIcon(bool);
|
2008-09-24 11:26:57 +02:00
|
|
|
bool ackTrayIcon;
|
2008-10-01 08:48:11 +02:00
|
|
|
bool startInTray;
|
2014-12-06 17:05:09 +01:00
|
|
|
bool quietMode;
|
2008-02-28 02:34:43 +01:00
|
|
|
|
|
|
|
int openCtrlConnection(const char *ifname);
|
2008-12-15 21:36:42 +01:00
|
|
|
|
|
|
|
bool wpsRunning;
|
2008-12-16 22:43:08 +01:00
|
|
|
|
|
|
|
QString bssFromScan;
|
|
|
|
|
|
|
|
void stopWpsRun(bool success);
|
2008-12-21 13:28:45 +01:00
|
|
|
|
2015-03-15 23:27:46 +01:00
|
|
|
QTimer *signalMeterTimer;
|
|
|
|
int signalMeterInterval;
|
|
|
|
|
2008-12-21 13:28:45 +01:00
|
|
|
#ifdef CONFIG_NATIVE_WINDOWS
|
|
|
|
QAction *fileStartServiceAction;
|
|
|
|
QAction *fileStopServiceAction;
|
|
|
|
|
|
|
|
bool serviceRunning();
|
|
|
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
2008-12-25 15:38:09 +01:00
|
|
|
|
|
|
|
QAction *addInterfaceAction;
|
|
|
|
AddInterface *add_iface;
|
2008-12-25 16:32:51 +01:00
|
|
|
|
|
|
|
bool connectedToService;
|
2009-01-17 12:45:05 +01:00
|
|
|
|
|
|
|
QApplication *app;
|
|
|
|
bool inTray;
|
2008-02-28 02:34:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* WPAGUI_H */
|