mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
DaemonQT
This commit is contained in:
parent
70e502e55d
commit
b0e3339370
13
Daemon.h
13
Daemon.h
@ -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
39
qt/i2pd_qt/DaemonQT.cpp
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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 \
|
||||
|
@ -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…
Reference in New Issue
Block a user