#include "wifimidiwindow.h"

#include <QPixmap>
#include <QIcon>
#include <QLabel>
#include <QMessageBox>

WifiMidiWindow::WifiMidiWindow(QWidget *parent)
	:QWidget(parent)
{
	midi2udpthread = 0;
	udp2midithread = 0;
	
	setFixedSize(163, 80);
	setWindowTitle("DSMIDIWifi");
	
	setWindowIcon(QIcon(":/images/midiwifiico32.png"));
	
	QLabel *label_logo = new QLabel(this);
	label_logo->setGeometry(10, 10, 143, 61);
	label_logo->setPixmap(QPixmap(":/images/logo.png"));
	label_logo->show();
	
	
	midi2udpthread = new Midi2UdpThread();
	bool res = midi2udpthread->go();
	if(res == true) {
		printf("midi2udp initialized\n");
	} else {
		QMessageBox::critical(0, "Error!", "Error initializing midi2udp!");
		delete midi2udpthread;
		midi2udpthread = 0;
	}
	
	udp2midithread = new Udp2MidiThread();
	res = udp2midithread->go(midi2udpthread);
	if(res == true) {
		printf("udp2midi initialized\n");
	} else {
		QMessageBox::critical(0, "Error!", "Error initializing udp2midi!");
		delete udp2midithread;
		udp2midithread = 0;
	}
}

