#include <QCoreApplication>

#include <QDebug>
#include <QTime>
#include <QThread>

#include "libinputeventgather.h"
#include "localserver.h"
#include "socketserver.h"
#include "libinputdbusserver.h"

int main(int argc, char *argv[])
{
    qRegisterMetaType<Event>("Event");

    QCoreApplication a(argc, argv);

    LibinputEventGather libinputEventGather;

    SocketServer::self()->run();
    // LocalServer::self()->runServer();

    LibinputDBusServer dbusserver;

    QObject::connect(&libinputEventGather, &LibinputEventGather::sendEvent, &a, [=](Event event){
        // qDebug() << "connect thread: " << QThread::currentThread();
        // LocalServer::self()->send(event);
        SocketServer::self()->send(event);
    }, Qt::ConnectionType::QueuedConnection);

    libinputEventGather.start();
    return a.exec();
}
