/* ============================================================
 * File  : frame_tooltip.cpp
 * Author: Stephane Gibault
 * Date  : Sun Feb 4 2007
 * Description :
 *
 * 
 *  (C) 2007 by Stephane Gibault
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General
 * Public License as published by the Free Software Foundation;
 * either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * ============================================================ */
#include <QtGui>
#include "frame_tooltip.h"

frame_tooltip::frame_tooltip ( QWidget * parent )
    : QFrame(parent)
{
	this->setAttribute(Qt::WA_DeleteOnClose);
	myfont.setFamily("Nimbus Sans L");
	myfont.setPixelSize ( 11 );
}

// ********************************
// *** DESSIN DU FOND DU WIDGET ***
// ********************************

void frame_tooltip::paintEvent(QPaintEvent *)
{
	QPainter p;
	p.begin(this);
	p.setPen(Qt::NoPen);
	p.setRenderHint(QPainter::Antialiasing,true);
	//p.setBrush(QColor(59,53,45,200));
	QLinearGradient Gradient1(0.0,20.0,0.0,this->height()-30.0);
	Gradient1.setColorAt(0.0, QColor(59,53,45,200));
	Gradient1.setColorAt(0.7, QColor(59,53,45,240));
	p.setBrush(Gradient1);
	p.drawRoundedRect(0, 20, this->width(), this->height()-20,5,5,Qt::AbsoluteSize);
	static const QPointF points[3] = {
		QPointF(25.0, 20),
		QPointF(45.0, 20),
		QPointF(35.0, 0),
	};
	p.setBrush(QColor(59,53,45,200));
	p.drawPolygon(points, 3);
	if ( wl_isdvd == 0 )
	{
		p.drawPixmap(this->width()-52,this->height()-52,QPixmap(":/Interface/Interface/reencode.png"),0,0,48,48);
	}
	else
	{
		p.drawPixmap(this->width()-52,this->height()-52,QPixmap(":/Interface/Interface/dvdformat.png"),0,0,48,48);
	}
	p.setPen(QColor(255,255,255));
	myfont.setBold(true);
	p.setFont(myfont);
	p.drawText(10,40,wl_pathname_media);
	myfont.setBold(false);
	p.setFont(myfont);
	p.drawText(10,65,tr("Resolution : ") + wl_width + "x" + wl_height + "   fps : " + wl_fps);
	p.drawText(10,80,tr("Duree : ") + wl_duree + " sec  " + tr("Format : ") + wl_format);
	p.drawText(10,95,tr("Canaux audio : ") + wl_audio_channel + "   " + tr("Chapitres : ") + wl_chapitres); 
	p.end();
}

