1 /* 2 * wpa_gui - Application startup 3 * Copyright (c) 2005-2006, Jouni Malinen <j (at) 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 #ifdef CONFIG_NATIVE_WINDOWS 16 #include <winsock.h> 17 #endif /* CONFIG_NATIVE_WINDOWS */ 18 #include <QApplication> 19 #include "wpagui.h" 20 21 22 class WpaGuiApp : public QApplication 23 { 24 public: 25 WpaGuiApp(int &argc, char **argv); 26 27 #ifndef QT_NO_SESSIONMANAGER 28 virtual void saveState(QSessionManager &manager); 29 #endif 30 31 WpaGui *w; 32 }; 33 34 WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv) 35 { 36 } 37 38 #ifndef QT_NO_SESSIONMANAGER 39 void WpaGuiApp::saveState(QSessionManager &manager) 40 { 41 QApplication::saveState(manager); 42 w->saveState(); 43 } 44 #endif 45 46 47 int main(int argc, char *argv[]) 48 { 49 WpaGuiApp app(argc, argv); 50 WpaGui w(&app); 51 int ret; 52 53 #ifdef CONFIG_NATIVE_WINDOWS 54 WSADATA wsaData; 55 if (WSAStartup(MAKEWORD(2, 0), &wsaData)) { 56 /* printf("Could not find a usable WinSock.dll\n"); */ 57 return -1; 58 } 59 #endif /* CONFIG_NATIVE_WINDOWS */ 60 61 app.w = &w; 62 63 ret = app.exec(); 64 65 #ifdef CONFIG_NATIVE_WINDOWS 66 WSACleanup(); 67 #endif /* CONFIG_NATIVE_WINDOWS */ 68 69 return ret; 70 } 71