/* -*- mode: c++; tab-width: 4; c-basic-offset: 4 -*- */
/*
 * Copyright (C) 2005 Atmark <atmarkat _AT_ msn _DOT_ com>
 *                    AGAWA Koji <i _AT_ atty _DOT_ jp>
 *
 * 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 of the License, 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef PLAYINFO_H_INCLUDED
#define PLAYINFO_H_INCLUDED

#include <qwidget.h>
#include <qcolor.h>
#include <qfont.h>
#include "configuration.h"
#include "coverartprovider.h"
#include "coverart.h"
#include "media.h"

class QLabel;
class QLCDNumber;
class QBoxLayout;
class QVBoxLayout;
class QHBoxLayout;

class PlayInfo : public QWidget
{
	Q_OBJECT

public:
	PlayInfo(const Configuration&, QWidget *parent = 0, const char *name = 0);
	virtual ~PlayInfo() {}
	
	void setCoverArtDirectory(const QString &directory) { coverArtProvider->setCoverArtDirectory(directory); }
	void precacheCoverArt(const Media &info)
	{
		coverArtProvider->loadCover(info.artist(), info.album(), info.location().toString());
	}

public slots:
	void rescanCoverArtDirectory() { coverArtProvider->rescan(); }
	
	void setMediaInfo(const Media&);
	void setTotalNumber(unsigned int);
	void setCurrentNumber(unsigned int);
	
// private slots:
	void setFont(const QFont &font);
	void setColor(const QColor &fontColor, const QColor &bgColor);

protected:
	virtual void resizeEvent(QResizeEvent *e);
	void setTitle(const QString&);
	void setArtist(const QString&);
	void setAlbum(const QString&);
	
private:
	QLabel *titleLabel, *artistLabel, *albumLabel;
	QLabel *title, *artist, *album;
	QLabel *timeSeparator, *numberSeparator;
	QLCDNumber *elapsedTime, *totalTime;
	QLCDNumber *currentNumber, *totalNumber;

	QHBoxLayout *numberLayout;
	QVBoxLayout *infoLayout; 
	
	CoverArt *coverArt;
	CoverArtProvider *coverArtProvider;
	QBoxLayout *screenLayout;
	
	const Configuration &config;
	
	void CheckOrientation();	
};

#endif // PLAYINFO_H_INCLUDED
