main.cpp
Go to the documentation of this file.
00001 /*
00002  * wpa_gui - Application startup
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 #ifdef CONFIG_NATIVE_WINDOWS
00016 #include <winsock.h>
00017 #endif /* CONFIG_NATIVE_WINDOWS */
00018 #include <QApplication>
00019 #include <QtCore/QLibraryInfo>
00020 #include <QtCore/QTranslator>
00021 #include "wpagui.h"
00022 
00023 
00024 class WpaGuiApp : public QApplication
00025 {
00026 public:
00027         WpaGuiApp(int &argc, char **argv);
00028 
00029 #ifndef QT_NO_SESSIONMANAGER
00030         virtual void saveState(QSessionManager &manager);
00031 #endif
00032 
00033         WpaGui *w;
00034 };
00035 
00036 WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv)
00037 {
00038 }
00039 
00040 #ifndef QT_NO_SESSIONMANAGER
00041 void WpaGuiApp::saveState(QSessionManager &manager)
00042 {
00043         QApplication::saveState(manager);
00044         w->saveState();
00045 }
00046 #endif
00047 
00048 
00049 int main(int argc, char *argv[])
00050 {
00051         WpaGuiApp app(argc, argv);
00052         QTranslator translator;
00053         QString locale;
00054         QString resourceDir;
00055         int ret;
00056 
00057         locale = QLocale::system().name();
00058         resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
00059         if (!translator.load("wpa_gui_" + locale, resourceDir))
00060                 translator.load("wpa_gui_" + locale, "lang");
00061         app.installTranslator(&translator);
00062 
00063         WpaGui w(&app);
00064 
00065 #ifdef CONFIG_NATIVE_WINDOWS
00066         WSADATA wsaData;
00067         if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
00068                 /* printf("Could not find a usable WinSock.dll\n"); */
00069                 return -1;
00070         }
00071 #endif /* CONFIG_NATIVE_WINDOWS */
00072 
00073         app.w = &w;
00074 
00075         ret = app.exec();
00076 
00077 #ifdef CONFIG_NATIVE_WINDOWS
00078         WSACleanup();
00079 #endif /* CONFIG_NATIVE_WINDOWS */
00080 
00081         return ret;
00082 }


wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:35