hostap/wpa_supplicant/wpa_gui-qt4/main.cpp
Christian Rüb 1545457e04 wpa_gui-qt4: Fix build with Session Manager disabled in Qt4
When trying to build wpa_gui (Qt4 version) from openembedded it fails
because Qt4 is compiled without session manager and thus wpa_gui fails
to compile.

I attached a patch, that enables compiling without Session Manager (via
preprocessor) if it is not compiled into Qt4; otherwise, it behaves as
it does right now.

I checked to build on my host (Debian unstable, Session Manager
enabled) and openembedded (Session Manager disabled).
2009-11-16 13:20:53 +02:00

70 lines
1.4 KiB
C++

/*
* wpa_gui - Application startup
* Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/
#ifdef CONFIG_NATIVE_WINDOWS
#include <winsock.h>
#endif /* CONFIG_NATIVE_WINDOWS */
#include <QApplication>
#include "wpagui.h"
class WpaGuiApp : public QApplication
{
public:
WpaGuiApp(int &argc, char **argv);
#ifndef QT_NO_SESSIONMANAGER
virtual void saveState(QSessionManager &manager);
#endif
WpaGui *w;
};
WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv)
{
}
#ifndef QT_NO_SESSIONMANAGER
void WpaGuiApp::saveState(QSessionManager &manager)
{
QApplication::saveState(manager);
w->saveState();
}
#endif
int main(int argc, char *argv[])
{
WpaGuiApp app(argc, argv);
WpaGui w(&app);
int ret;
#ifdef CONFIG_NATIVE_WINDOWS
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
/* printf("Could not find a usable WinSock.dll\n"); */
return -1;
}
#endif /* CONFIG_NATIVE_WINDOWS */
app.w = &w;
ret = app.exec();
#ifdef CONFIG_NATIVE_WINDOWS
WSACleanup();
#endif /* CONFIG_NATIVE_WINDOWS */
return ret;
}