#ifndef CDPULTWINDOW_H
#define CDPULTWINDOW_H

#include "emainwindow.h"
#include "ui_cdpultwindow.h"
#include "cdviewwidget.h"
#include "ribbon.h"
#include "piobject.h"


class CDPultWindow : public EMainWindow, public Ui::CDPultWindow
{
	Q_OBJECT
	Q_ENUMS(LogIcon)
public:

	explicit CDPultWindow(QWidget *parent = 0);
	~CDPultWindow();
	void loadFile(const QString & fp);
	void apply(bool sessions);

private:

	void closeEvent(QCloseEvent *);
	void reset(bool full = false);
	bool load(const QString & path);
	bool save(const QString & path);
	QString loadFilter() {return "Pult session(*.conf)";}
	QString saveFilter() {return loadFilter();}
	void loadingSession(QPIConfig & conf);
	void savingSession(QPIConfig & conf);

	QByteArray appIcon() const;
	void setAppIcon(QByteArray ba);

	Ribbon * ribbon;
	QMap<CDViewWidget::LogIcon, QIcon> log_icons;
	QByteArray session_gr, session_dk, session_mw;
	QString def_config, last_icon;
	QImage icon;

private slots:
	void addToLog(CDViewWidget::LogIcon icon, const QString & msg);
	void messageReceived(QString path, int type, QString msg);

	void on_editFileK_valueChanged(const QVariant & p);
	void on_buttonSessionApply_clicked();

	void on_lineSessionName_textChanged(const QString & t);
	void on_buttonIcon_clicked();
};

#endif // CDPULTWINDOW_H
