2
standard Button for winamp Skin
3
Copyright (C) 1999 Martin Vogt
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation.
9
For more information look at the file COPYRIGHT in this package
17
WaInfo::WaInfo(WaSkinModell* waSkinModell,QWidget* parent,char* name):
19
this->waSkinModell=waSkinModell;
20
connect(waSkinModell,SIGNAL(event_WA_SKIN_TEXT()),
21
this,SLOT(pixmapChange()));
22
completePixmap=new QPixmap();
23
buildPixmap=new QPixmap();
25
QSize size=sizeHint();
26
completePixmap->resize(size.width(),size.height());
27
WaSkinDesc* waSkinDesc=waSkinModell->getWaSkinMapDesc(_WA_MAPPING_INFO);
28
setGeometry((*waSkinDesc->getGeometry()));
31
timer=new QTimer(this);
32
connect(timer,SIGNAL(timeout()),this,SLOT(timeEvent()));
38
delete completePixmap;
43
void WaInfo::timeEvent() {
48
void WaInfo::scrollerSetup() {
52
QSize size=sizeHint();
53
if (completePixmap->width() > size.width()) {
62
QSize WaInfo::sizeHint() const {
63
WaSkinDesc* waSkinDesc=waSkinModell->getWaSkinMapDesc(_WA_MAPPING_INFO);
64
return QSize(waSkinDesc->getWidgetWidth(),waSkinDesc->getWidgetHeight());
68
void WaInfo::paintEvent ( QPaintEvent * paintEvent ) {
71
QSize size=sizeHint();
72
if (completePixmap->width() <= size.width()) {
74
paint.drawPixmap(0,0,*completePixmap);
79
// pixmap widther than window:
83
xDrawWidth=completePixmap->width()-xScrollPos;
84
if (xDrawWidth > size.width()) {
85
xDrawWidth=size.width();
88
paint.drawPixmap(0,0,*completePixmap,xScrollPos,0,xDrawWidth);
89
if (xDrawWidth < size.width()) {
90
xRestWidth=size.width()-xDrawWidth;
91
paint.drawPixmap(xDrawWidth,0,*completePixmap,0,0,xRestWidth);
95
xScrollPos+=xScrollDirection;
96
if (abs(xScrollPos) >completePixmap->width() ) {
102
void WaInfo::setSong(QString song) {
107
QString WaInfo::getSong() {
112
void WaInfo::pixmapChange() {
114
const char* infoString=getSong().latin1();
117
int n=strlen(infoString);
118
QSize size=sizeHint();
120
completePixmap->resize(0,0);
123
waSkinModell->getNumber(_WA_SKIN_TEXT,infoString[i],buildPixmap);
125
int w=buildPixmap->width();
126
int h=buildPixmap->height();
128
if (textWidth < size.width()) {
129
textWidth=size.width();
131
completePixmap->resize(textWidth,h);
134
bitBlt(completePixmap,x,0,buildPixmap);
135
x=x+buildPixmap->width();
137
// if the size is now smaller than the with of this widget, we
138
// fill the pixmap with spaces
139
if (x < size.width()) {
140
while (x < size.width()) {
141
waSkinModell->getNumber(_WA_SKIN_TEXT,' ',buildPixmap);
142
bitBlt(completePixmap,x,0,buildPixmap);
143
x=x+buildPixmap->width();
155
#include "waInfo.moc"