#pragma once

#include <QCoreApplication>

#include "qt5singleapplib_global.h"

class QtLocalPeer;

class QT5SINGLEAPPLIB_EXPORT QtSingleCoreApplication : public QCoreApplication
{
	Q_OBJECT

public:
	QtSingleCoreApplication(int &argc, char **argv);
	QtSingleCoreApplication(const QString &id, int &argc, char **argv);

	bool isRunning();
	QString id() const;

public Q_SLOTS:
	bool sendMessage(const QString &message, int timeout = 5000);

Q_SIGNALS:
	void messageReceived(const QString &message);


private:
	QtLocalPeer* peer;
};
