HotplugWatcher_GUI::HotplugWatcher_GUI(QWidget *parent) :
	QWidget(parent)
{
	QVBoxLayout *vbl = new QVBoxLayout(this);
	setLayout(vbl);

	state = new QLabel(this);
	button = new QPushButton(tr("Start"), this);
	detail_button = new QToolButton(this);
	detail_button->setText(tr("Detail"));
	detail_button->setCheckable(true);
	detail_button->setChecked(true);
	msg_view = new QTextBrowser(this);
	msg_view->setLineWrapMode(QTextEdit::NoWrap);

	QHBoxLayout *hbl = new QHBoxLayout(this);
	hbl->addWidget(button);
	hbl->addWidget(detail_button);

	vbl->addWidget(state);
	vbl->addLayout(hbl);
	vbl->addWidget(msg_view);

	tray = new QSystemTrayIcon(this);
	tray->show();

	watcher = new QDeviceWatcher;
	watcher->appendEventReceiver(this);
	connect(watcher, SIGNAL(deviceAdded(QString)), this, SLOT(slotDeviceAdded(QString)), Qt::DirectConnection);
	connect(watcher, SIGNAL(deviceChanged(QString)), this, SLOT(slotDeviceChanged(QString)), Qt::DirectConnection);
	connect(watcher, SIGNAL(deviceRemoved(QString)), this, SLOT(slotDeviceRemoved(QString)), Qt::DirectConnection);

	connect(button, SIGNAL(clicked()), SLOT(toggleWatch()));
	connect(detail_button, SIGNAL(toggled(bool)), SLOT(showDetail(bool)));
}
int ConfigureMIDIInput::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slotDeviceAdded((*reinterpret_cast< MIDIDevice*(*)>(_a[1]))); break;
        case 1: slotDeviceRemoved((*reinterpret_cast< MIDIDevice*(*)>(_a[1]))); break;
        case 2: slotRefreshClicked(); break;
        case 3: slotEditClicked(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}