#ifndef PIQT_IODEVICE_EDIT_H
#define PIQT_IODEVICE_EDIT_H

#include <QWidget>
#include "qad_types.h"

class QLineEdit;
class QToolButton;
class IODeviceEditDialog;


class IODeviceEdit: public QWidget {
	Q_OBJECT
	Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
	Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
public:
	explicit IODeviceEdit(QWidget * parent = 0);
	~IODeviceEdit();
	
	QVariant value() const;
	bool isReadOnly() const;
	
private:
	void setDevice(const QAD::IODevice & d);

	QLineEdit * line;
	QToolButton * btn;
	IODeviceEditDialog * dlg;
	QAD::IODevice dev;
	
public slots:
	void setValue(const QVariant & v);
	void setReadOnly(bool yes);

private slots:
	void buttonDlg_clicked();

signals:
	void valueChanged();
	
};


class __IODeviceEditRegistrator__ {
public:
	__IODeviceEditRegistrator__();
};

static __IODeviceEditRegistrator__ __iodeviceeditregistrator__;

void QAD_IODevice_toString(const QVariant & v, QString & r);
#endif // PIQT_IODEVICE_EDIT_H
