#ifndef QSINGLEAPPLICATION_H
#define QSINGLEAPPLICATION_H

#include <QThread>
#include <QSharedMemory>

class QSingleApplication: public QThread
{
	Q_OBJECT
public:
	QSingleApplication(const QString & app_name = QString("qapp"));
	~QSingleApplication();
	
	bool isFirst() const {return first;}
	
private:
	void run();
	
	QSharedMemory shm;
	bool first, exiting;
	
public slots:
	void sendMessage(const QByteArray & m);
	
signals:
	void messageReceived(QByteArray);
	
};

#endif // QSINGLEAPPLICATION_H
