X-Git-Url: https://roy.marples.name/git?ds=sidebyside diff --git a/src/dhcpcd-qt/dhcpcd-qt.h b/src/dhcpcd-qt/dhcpcd-qt.h index 019d6a8..1a96c36 100644 --- a/src/dhcpcd-qt/dhcpcd-qt.h +++ b/src/dhcpcd-qt/dhcpcd-qt.h @@ -1,3 +1,29 @@ +/* + * dhcpcd-qt + * Copyright 2014 Roy Marples + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef DHCPCD_QT_H #define DHCPCD_QT_H @@ -17,6 +43,7 @@ class QAction; class QDialog; class QLabel; class QMenu; +class QPoint; class QPushButton; class QSocketNotifier; class QTimer; @@ -29,8 +56,7 @@ public: DhcpcdQt(); ~DhcpcdQt(); - void closeAbout(); - + DHCPCD_CONNECTION *getConnection(); static void dhcpcd_status_cb(DHCPCD_CONNECTION *con, const char *status, void *d); void statusCallback(const char *status); @@ -39,26 +65,29 @@ public: static void dhcpcd_wpa_scan_cb(DHCPCD_WPA *wpa, void *d); void scanCallback(DHCPCD_WPA *wpa); + static void dhcpcd_wpa_status_cb(DHCPCD_WPA *wpa, const char *status, + void *d); + void wpaStatusCallback(DHCPCD_WPA *wpa, const char *status); static QIcon getIcon(QString category, QString name); + QList *getWis(); + void closeAbout(); void dialogClosed(QDialog *dialog); protected: void closeEvent(QCloseEvent *event); private slots: + void tryOpen(); void animate(); void dispatch(); void showAbout(); void showPreferences(); void iconActivated(QSystemTrayIcon::ActivationReason reason); - void connectSsid(DHCPCD_IF *ifp, DHCPCD_WI_SCAN *scan); - private: DHCPCD_CONNECTION *con; - bool tryOpen(); QSocketNotifier *notifier; QTimer *retryOpenTimer; QList *wis; @@ -74,6 +103,7 @@ private: QDialog *about; QDialog *preferences; + void processScans(DhcpcdWi *wi, DHCPCD_WI_SCAN *scans); void addSsidMenu(QMenu *&menu, DHCPCD_IF *ifp, DhcpcdWi *&wi); void createSsidMenu(); @@ -90,6 +120,7 @@ private: QAction *aboutAction; QMenu *trayIconMenu; QMenu *ssidMenu; + QPoint ssidMenuPos; void notify(QString &title, QString &msg, QSystemTrayIcon::MessageIcon icon = QSystemTrayIcon::Information);