#include <QKeyEvent>
#include <QNetworkAddressEntry>
#include <QNetworkInterface>
#include "information.h"
#include "image.h"
#include "text.h"


void shadowText(QWidget *parent, int x, int y, int size, const char *text)
{
	new Text(parent, x+2, y+2, text, size, QColor(0,0,0));
	new Text(parent, x, y, text, size, QColor(0xEf,0xEF,0xFC));
}


Information::Information(QWidget *parent) : Stage(parent)
{
	QLabel *icon = new QLabel(this);
	icon->setPixmap(Image::icon("info", 72));
	icon->move(10, 10);

	const char *title = QT_TRANSLATE_NOOP("DPF","Information");
    shadowText(this, 108, 18, 37, title);

	QNetworkInterface interface;
//	QNetworkAddressEntry addr = QNetworkInterface::allInterfaces()[0].addressEntries()[0];

/*
     foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces()) {
         foreach (QNetworkAddressEntry entry, interface.addressEntries()) {
         }
     }
*/

	shadowText(this, 50, 120, 20, QT_TRANSLATE_NOOP("DPF", "Model:"));
	shadowText(this, 50, 160, 20, QT_TRANSLATE_NOOP("DPF", "Software Version:"));
	shadowText(this, 50, 200, 20, QT_TRANSLATE_NOOP("DPF", "Copyright:"));
	shadowText(this, 50, 240, 20, QT_TRANSLATE_NOOP("DPF", "Contact:"));
	shadowText(this, 50, 280, 20, QT_TRANSLATE_NOOP("DPF", "Resolution:"));

	shadowText(this, 260, 120, 20, "PC Photoframe Simulation");
	shadowText(this, 260, 160, 20, "1.0 Demo, build 0000");
	shadowText(this, 260, 200, 20, "(C) InvertedLogic 2008-2009");
	shadowText(this, 260, 240, 20, "sales@invertedlogic.com");
	shadowText(this, 260, 280, 20, "800x480 16-bit");

/*
	shadowText(this, 450, 320, 20, QT_TRANSLATE_NOOP("DPF","IP Address:"));
	shadowText(this, 450, 360, 20, QT_TRANSLATE_NOOP("DPF","Netmask:"));
	shadowText(this, 450, 400, 20, QT_TRANSLATE_NOOP("DPF","Broadcast:"));

	shadowText(this, 650, 320, addr.ip().toString().toLatin1().data());
	shadowText(this, 650, 360, addr.netmask().toString().toLatin1().data());
	shadowText(this, 650, 400, addr.broadcast().toString().toLatin1().data());
*/
}


Information::~Information()

{
}


void Information::keyPressEvent(QKeyEvent *)
{
	hide();
	emit setStage(-1);
}

