2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
|
2016-04-24 18:33:04 +12:00
|
|
|
#if (!(defined(x64) || defined(__LP64__) || defined(LINUX)))
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Toonz includes
|
2016-03-19 06:57:51 +13:00
|
|
|
#include "tiio_std.h"
|
|
|
|
#include "tnzimage.h"
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Qt includes
|
2016-03-19 06:57:51 +13:00
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QThread>
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// tipc includes
|
2016-03-19 06:57:51 +13:00
|
|
|
#include "tipcmsg.h"
|
|
|
|
#include "tipcsrv.h"
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Specific Parsers includes
|
2016-03-19 06:57:51 +13:00
|
|
|
#include "t32movmsg.h"
|
|
|
|
#include "t323gpmsg.h"
|
|
|
|
#include "t32fontmsg.h"
|
|
|
|
|
|
|
|
//************************************************************************
|
|
|
|
// Server Thread
|
|
|
|
//************************************************************************
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class ServerThread : public QThread {
|
|
|
|
QString m_srvName;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
ServerThread(const QString &srvName) : m_srvName(srvName) {}
|
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
void run() override {
|
2016-06-15 18:43:10 +12:00
|
|
|
// Start a local server receiving connections on the specified key
|
|
|
|
tipc::Server server;
|
|
|
|
mov_io::addParsers(&server);
|
|
|
|
_3gp_io::addParsers(&server);
|
2016-03-19 06:57:51 +13:00
|
|
|
#ifdef MACOSX
|
2016-06-15 18:43:10 +12:00
|
|
|
font_io::addParsers(&server);
|
2016-03-19 06:57:51 +13:00
|
|
|
#endif
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Start listening on supplied key
|
|
|
|
bool ok = server.listen(m_srvName);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
exec();
|
|
|
|
}
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//************************************************************************
|
|
|
|
// Main server implementation
|
|
|
|
//************************************************************************
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
if (argc < 2) // The server key name must be passed
|
|
|
|
return -1;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QCoreApplication a(argc, argv);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
Tiio::defineStd();
|
|
|
|
initImageIo();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QString srvName(QString::fromUtf8(argv[1]));
|
|
|
|
QString mainSrvName(srvName + "_main");
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
QLocalServer::removeServer(srvName);
|
|
|
|
QLocalServer::removeServer(mainSrvName);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Start a separate thread to host most of the event processing
|
|
|
|
ServerThread *srvThread = new ServerThread(srvName);
|
|
|
|
srvThread->start();
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Start a server on the main thread too - this one to host
|
|
|
|
// commands that need to be explicitly performed on the main thread
|
|
|
|
tipc::Server server;
|
|
|
|
mov_io::addParsers(&server);
|
|
|
|
_3gp_io::addParsers(&server);
|
2016-03-19 06:57:51 +13:00
|
|
|
#ifdef MACOSX
|
2016-06-15 18:43:10 +12:00
|
|
|
font_io::addParsers(&server);
|
2016-03-19 06:57:51 +13:00
|
|
|
#endif
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// Start listening on supplied key
|
|
|
|
bool ok = server.listen(srvName + "_main");
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
a.exec();
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int main(int argc, char *argv[]) { return 0; }
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
#endif // !x64 && !__LP64__
|