#include <QtCore/QCoreApplication>
#include <QTimer>
#include "hellosignalslot.h"

int main(int argc, char *argv[])
{
    qDebug("Start!!!");

    // Main loop of console application
    QCoreApplication a(argc, argv);

    // Creates a timer and hello object with the QCoreApplication as parent
    QTimer *timer = new QTimer(&a);
    HelloSignalSlot *hello = new HelloSignalSlot(&a);

    // Connects signals to slots
    QObject::connect(timer, SIGNAL(timeout()), hello, SLOT(hello()));
    QObject::connect(hello, SIGNAL(helloSignal()), &a, SLOT(quit()));

    // Starts timer and runs main loop
    timer->start(10000);
    int result = a.exec();

    qDebug("Quit!!!");
    return result;
}
