summaryrefslogblamecommitdiffstats
path: root/src/client/vnc/vncserver.h
blob: 61e6d21e9b81f010fe4034fa5fb081e0001c7af3 (plain) (tree)
































                                     
                                                              


















                                                                                                 
/*
 * vncserver.h
 *
 *  Created on: 24.01.2013
 *      Author: sr
 */

#ifndef VNCSERVER_H_
#define VNCSERVER_H_

#include <QtCore>

class VncServer;

class VncServer : public QObject
{
	Q_OBJECT

private:
	QProcess *_process;
	QString _ropass;
	QString _rwpass;
	int _port;
	int _timerId;

	VncServer();
	virtual ~VncServer();

	static VncServer *me;

public:
	static VncServer *instance();

	inline bool isVncServerRunning() { return _port > 0; }
	void start();
	void stop();

protected:
	void timerEvent(QTimerEvent *event);

signals:
	// Emited when started succesfully, or if startup failed. port will be <= 0 if it failed.
	void started(int port, QString& ropass, QString& rwpass);

private slots:
	void onStdOut();
	void onStdErr();
	void onFinished(int exitCode);
	void onError(QProcess::ProcessError error);

};

#endif /* VNCSERVER_H_ */