#ifndef CLIENT_DESKTOP_H
#define CLIENT_DESKTOP_H

#include <QFrame>
#include <QSettings>
#include <QToolButton>
#include <QLabel>
#include <QUrl>
#include <QSystemTrayIcon>
#include "SH_network_types.h"

#define DESKTOP_LAYER DesktopLayer::instance()


class NotificationWidget: public QFrame {
	Q_OBJECT
public:
	NotificationWidget();
	~NotificationWidget();

	void setText(const QString & t);

private:
	virtual QSize sizeHint() const;
	virtual void mousePressEvent(QMouseEvent * e);

	QLabel * lbl, * lim, * title;
	QToolButton * btn;

signals:
	void clicked();

};




class DesktopLayer: public QObject {
	Q_OBJECT
public:
	DesktopLayer();
	~DesktopLayer();

	void setPultWindow(QWidget * w) {pult_window = w;}
	void setPultTray(QSystemTrayIcon * t);

	static DesktopLayer * instance();

private:
	void showWidgets();
	void setTrayImage();
	void registerURI();

	QSettings settings;
	QWidget * pult_window;
	QSystemTrayIcon * pult_tray;
	QImage tray_im;
	QToolButton * btn_close;
	QVector<NotificationWidget*> widgets;

private slots:
	void closeAll();
	void clicked();
	void deleted(QObject * o);
	void URLTriggered(QUrl url);
	
public slots:
	void notify(QString s);
	
signals:
	
};


#endif // CLIENT_DESKTOP_H
