~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to noatun/noatun/modules/winskin/waStatus.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  standard Button for winamp Skin
 
3
  Copyright (C) 1999  Martin Vogt
 
4
 
 
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.
 
8
 
 
9
  For more information look at the file COPYRIGHT in this package
 
10
 
 
11
 */
 
12
 
 
13
 
 
14
#include <waStatus.h>
 
15
 
 
16
 
 
17
WaStatus::WaStatus(WaSkinModell* waSkinModell,QWidget* parent,char* name):
 
18
QWidget(parent,name){
 
19
  this->waSkinModell=waSkinModell;
 
20
  connect(waSkinModell,SIGNAL(event_WA_SKIN_PLAYPAUS_PLAY()),
 
21
          this,SLOT(pixmapChange()));
 
22
  playPixmap=new QPixmap();
 
23
  pausePixmap=new QPixmap();
 
24
  stopPixmap=new QPixmap();
 
25
 
 
26
  QSize size=sizeHint();
 
27
  nStatus=_STATUS_STOPPED;
 
28
 
 
29
  playPixmap->resize(size.width(),size.height());
 
30
  pausePixmap->resize(size.width(),size.height());
 
31
  stopPixmap->resize(size.width(),size.height());
 
32
 
 
33
  WaSkinDesc* waSkinDesc=waSkinModell->getWaSkinMapDesc(_WA_MAPPING_PLAYPAUS);
 
34
  setGeometry((*waSkinDesc->getGeometry()));
 
35
  pixmapChange();
 
36
}
 
37
 
 
38
WaStatus::~WaStatus() {
 
39
  delete playPixmap;
 
40
  delete pausePixmap;
 
41
  delete stopPixmap;
 
42
}
 
43
 
 
44
 
 
45
 
 
46
 
 
47
QSize WaStatus::sizeHint() const {
 
48
  WaSkinDesc* waSkinDesc=waSkinModell->getWaSkinMapDesc(_WA_MAPPING_PLAYPAUS);
 
49
  return QSize(waSkinDesc->getWidgetWidth(),waSkinDesc->getWidgetHeight());
 
50
}
 
51
 
 
52
void WaStatus::setStatus(int status) {
 
53
  this->nStatus=status;
 
54
  pixmapChange();
 
55
}
 
56
 
 
57
 
 
58
int WaStatus::getStatus() {
 
59
  return nStatus;
 
60
}
 
61
 
 
62
 
 
63
void WaStatus::paintEvent ( QPaintEvent * paintEvent ) {
 
64
 
 
65
  QPainter paint;
 
66
 
 
67
  int status=getStatus();
 
68
  if (status == _STATUS_PLAYING) {
 
69
    paint.begin( this );
 
70
    paint.drawPixmap(0,0,*playPixmap);
 
71
    paint.end();  
 
72
  }
 
73
  if (status == _STATUS_STOPPED) {
 
74
    paint.begin( this );
 
75
    paint.drawPixmap(0,0,*stopPixmap);
 
76
    paint.end();  
 
77
  }
 
78
  if (status == _STATUS_PAUSED) {
 
79
    paint.begin( this );
 
80
    paint.drawPixmap(0,0,*pausePixmap);
 
81
    paint.end();  
 
82
  }
 
83
 
 
84
}
 
85
 
 
86
 
 
87
 
 
88
 
 
89
void WaStatus::pixmapChange() {
 
90
 
 
91
  playPixmap=waSkinModell->get(_WA_SKIN_PLAYPAUS_PLAY);
 
92
  pausePixmap=waSkinModell->get(_WA_SKIN_PLAYPAUS_PAUSE);
 
93
  stopPixmap=waSkinModell->get(_WA_SKIN_PLAYPAUS_STOP);
 
94
  
 
95
 
 
96
  repaint(false);
 
97
}
 
98
     
 
99
#include "waStatus.moc"