remove @EAP_LDFLAGS@, no longer exists
[mech_eap.orig] / libeap / wpa_supplicant / wpa_gui-qt4 / main.cpp
1 /*
2  * wpa_gui - Application startup
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 #ifdef CONFIG_NATIVE_WINDOWS
16 #include <winsock.h>
17 #endif /* CONFIG_NATIVE_WINDOWS */
18 #include <QApplication>
19 #include <QtCore/QLibraryInfo>
20 #include <QtCore/QTranslator>
21 #include "wpagui.h"
22
23
24 class WpaGuiApp : public QApplication
25 {
26 public:
27         WpaGuiApp(int &argc, char **argv);
28
29 #ifndef QT_NO_SESSIONMANAGER
30         virtual void saveState(QSessionManager &manager);
31 #endif
32
33         WpaGui *w;
34 };
35
36 WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv)
37 {
38 }
39
40 #ifndef QT_NO_SESSIONMANAGER
41 void WpaGuiApp::saveState(QSessionManager &manager)
42 {
43         QApplication::saveState(manager);
44         w->saveState();
45 }
46 #endif
47
48
49 int main(int argc, char *argv[])
50 {
51         WpaGuiApp app(argc, argv);
52         QTranslator translator;
53         QString locale;
54         QString resourceDir;
55         int ret;
56
57         locale = QLocale::system().name();
58         resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
59         if (!translator.load("wpa_gui_" + locale, resourceDir))
60                 translator.load("wpa_gui_" + locale, "lang");
61         app.installTranslator(&translator);
62
63         WpaGui w(&app);
64
65 #ifdef CONFIG_NATIVE_WINDOWS
66         WSADATA wsaData;
67         if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
68                 /* printf("Could not find a usable WinSock.dll\n"); */
69                 return -1;
70         }
71 #endif /* CONFIG_NATIVE_WINDOWS */
72
73         app.w = &w;
74
75         ret = app.exec();
76
77 #ifdef CONFIG_NATIVE_WINDOWS
78         WSACleanup();
79 #endif /* CONFIG_NATIVE_WINDOWS */
80
81         return ret;
82 }