Adds initial intermediate qt6 porting state
This commit is contained in:
11247 files changed
+1891537
No files matched your search
@@ -0,0 +1,43 @@
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include "tcpserver.h"
|
||||
#include "cbi_help.h"
|
||||
#include "cbi_pingpong.h"
|
||||
#include "cbi_quit.h"
|
||||
#include "cbi_recvfile.h"
|
||||
#include "cbi_sendfile.h"
|
||||
#include "cbi_shutdown.h"
|
||||
#include "workerbase.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
NGL::NGLLoggerBootstrap::createNGLRootLogger("tcpserver_test.props", false);
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
QSettings settings(QLatin1String("./settings.ini"), QSettings::IniFormat);
|
||||
unsigned int port = settings.value(QLatin1String("port"), 4711).toInt();
|
||||
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_Help>);
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_PingPong>);
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_Quit>);
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_Recvfile>);
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_Sendfile>);
|
||||
TcpServer::registerCommand(port, CommandInterface::factory<CBI_Shutdown>);
|
||||
|
||||
TcpServer *tcpServer = TcpServer::instance(port);
|
||||
tcpServer->setUseWorkerThreads(true);
|
||||
|
||||
if (!tcpServer->listen(QHostAddress::LocalHost))
|
||||
{
|
||||
qFatal("Error listening on port %d, error: %d", port, tcpServer->serverError());
|
||||
delete tcpServer;
|
||||
return 1;
|
||||
}
|
||||
QObject::connect(tcpServer, &TcpServer::destroyed, &app, &QCoreApplication::quit);
|
||||
|
||||
int ret = app.exec();
|
||||
return ret;
|
||||
}
|
||||
Reference in new issue
Block a user