This commit is contained in:
orignal 2016-06-15 12:20:31 -04:00
parent 70e502e55d
commit b0e3339370
4 changed files with 46 additions and 32 deletions

View File

@ -3,14 +3,6 @@
#include <string>
#if defined(QT_GUI)
#elif defined(_WIN32)
#else
#endif
namespace i2p
{
namespace util
@ -49,6 +41,11 @@ namespace i2p
static DaemonQT instance;
return instance;
}
bool init(int argc, char* argv[]);
bool start();
bool stop();
void run ();
};
#elif defined(_WIN32)

39
qt/i2pd_qt/DaemonQT.cpp Normal file
View File

@ -0,0 +1,39 @@
#include <memory>
#include "mainwindow.h"
#include <QApplication>
#include <stdlib.h>
#include "../../Daemon.h"
namespace i2p
{
namespace util
{
std::unique_ptr<QApplication> app;
bool DaemonQT::init(int argc, char* argv[])
{
app.reset (new QApplication (argc, argv));
return Daemon_Singleton::init(argc, argv);
}
bool DaemonQT::start()
{
return Daemon_Singleton::start();
}
bool DaemonQT::stop()
{
return Daemon_Singleton::stop();
}
void DaemonQT::run ()
{
MainWindow w;
w.show ();
if (app)
{
app->exec();
app.reset (nullptr);
}
}
}
}

View File

@ -13,7 +13,7 @@ TEMPLATE = app
QMAKE_CXXFLAGS *= -std=c++11
SOURCES += main.cpp\
SOURCES += DaemonQT.cpp\
mainwindow.cpp \
../../HTTPServer.cpp ../../I2PControl.cpp ../../UPnP.cpp ../../Daemon.cpp ../../Config.cpp \
../../AddressBook.cpp \
@ -59,6 +59,7 @@ SOURCES += main.cpp\
../../TunnelGateway.cpp \
../../TunnelPool.cpp \
../../util.cpp \
../../i2pd.cpp \
/mnt/media/android/android-ifaddrs/ifaddrs.c
HEADERS += mainwindow.h \

View File

@ -1,23 +0,0 @@
#include "mainwindow.h"
#include <QApplication>
#include <stdlib.h>
#include "../../Daemon.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
int ret = -1;
if (Daemon.init(argc, argv))
{
if (Daemon.start())
{
w.show();
ret = a.exec();
}
Daemon.stop();
}
return ret;
}