Browse Source

DaemonQT

pull/520/head
orignal 9 years ago
parent
commit
b0e3339370
  1. 13
      Daemon.h
  2. 39
      qt/i2pd_qt/DaemonQT.cpp
  3. 3
      qt/i2pd_qt/i2pd_qt.pro
  4. 23
      qt/i2pd_qt/main.cpp

13
Daemon.h

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

39
qt/i2pd_qt/DaemonQT.cpp

@ -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);
}
}
}
}

3
qt/i2pd_qt/i2pd_qt.pro

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

23
qt/i2pd_qt/main.cpp

@ -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;
}
Loading…
Cancel
Save