#ifndef PIINTROSPECTOR_H
#define PIINTROSPECTOR_H

#include "piintrospection_server_p.h"
#include "pipeer.h"
#include "piqt.h"
#include "ui_piintrospector.h"

#include <QDebug>
#include <QImage>
#include <QTime>
#include <emainwindow.h>

class QPIIntrospector
	: public EMainWindow
	, private Ui::QPIIntrospector
	, public PIObject {
	Q_OBJECT
	PIOBJECT(QPIIntrospector);

public:
	QPIIntrospector(QWidget * parent = 0);
	~QPIIntrospector();

protected:
	void changeEvent(QEvent * e);
	void timerEvent(QTimerEvent *);
	void savingSession(QPIConfig & conf);
	void loadingSession(QPIConfig & conf);

	void buildDumpSection(QTreeWidgetItem * pi, PIString & str);
	void showInfo();
	QString durationStr(PISystemTime t);
	void prepareContainers(PIVector<PIIntrospectionContainers::TypeInfo> & data);

	EVENT_HANDLER2(void, peerReceived, const PIString &, from, const PIByteArray &, data);
	EVENT_HANDLER1(void, peersChanged, const PIString &, name);

	PIString cur_server;
	PIIntrospection::ProcessInfo info;
	PIIntrospection::ProcessStat stat;
	PIPeer peer;
	int request_timer, pip_timer;

private slots:
	void buildTree(QByteArray d);
	void procRequestTimer();
	void on_listApp_currentRowChanged(int r);
	void on_buttonRequest_clicked();

public slots:
};

#endif // PIINTROSPECTOR_H
