Diffstat (limited to 'noncore/multimedia/opieplayer2/mediawidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index da0706e..6b304ec 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -23,90 +23,90 @@ | |||
23 | 23 | ||
24 | #include "mediawidget.h" | 24 | #include "mediawidget.h" |
25 | #include "playlistwidget.h" | 25 | #include "playlistwidget.h" |
26 | #include "skin.h" | 26 | #include "skin.h" |
27 | 27 | ||
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | 30 | ||
31 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) | 31 | MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) |
32 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) | 32 | : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) |
33 | { | 33 | { |
34 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), | 34 | connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), |
35 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); | 35 | this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); |
36 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), | 36 | connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), |
37 | this, SLOT( setLength( long ) ) ); | 37 | this, SLOT( setLength( long ) ) ); |
38 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 38 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
39 | this, SLOT( setPlaying( bool ) ) ); | 39 | this, SLOT( setPlaying( bool ) ) ); |
40 | } | 40 | } |
41 | 41 | ||
42 | MediaWidget::~MediaWidget() | 42 | MediaWidget::~MediaWidget() |
43 | { | 43 | { |
44 | } | 44 | } |
45 | 45 | ||
46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, | 46 | void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, |
47 | const Skin &skin, const QSize &buttonAreaSize ) | 47 | const Skin &skin ) |
48 | { | 48 | { |
49 | buttonMask = skin.buttonMask( skinInfo, buttonCount, buttonAreaSize ); | 49 | buttonMask = skin.buttonMask( skinInfo, buttonCount ); |
50 | 50 | ||
51 | buttons.clear(); | 51 | buttons.clear(); |
52 | buttons.reserve( buttonCount ); | 52 | buttons.reserve( buttonCount ); |
53 | 53 | ||
54 | for ( uint i = 0; i < buttonCount; ++i ) { | 54 | for ( uint i = 0; i < buttonCount; ++i ) { |
55 | Button button = setupButton( skinInfo[ i ], skin ); | 55 | Button button = setupButton( skinInfo[ i ], skin ); |
56 | buttons.push_back( button ); | 56 | buttons.push_back( button ); |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) | 60 | MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) |
61 | { | 61 | { |
62 | Button button; | 62 | Button button; |
63 | button.command = buttonInfo.command; | 63 | button.command = buttonInfo.command; |
64 | button.type = buttonInfo.type; | 64 | button.type = buttonInfo.type; |
65 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); | 65 | button.mask = skin.buttonMaskImage( buttonInfo.fileName ); |
66 | 66 | ||
67 | return button; | 67 | return button; |
68 | } | 68 | } |
69 | 69 | ||
70 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) | 70 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) |
71 | { | 71 | { |
72 | Config cfg( "OpiePlayer" ); | 72 | Config cfg( "OpiePlayer" ); |
73 | cfg.setGroup( "Options" ); | 73 | cfg.setGroup( "Options" ); |
74 | QString skin = cfg.readEntry( "Skin","default" ); | 74 | QString skin = cfg.readEntry( "Skin","default" ); |
75 | 75 | ||
76 | loadSkin( skinInfo, buttonCount, skin, fileNameInfix ); | 76 | loadSkin( skinInfo, buttonCount, skin, fileNameInfix ); |
77 | } | 77 | } |
78 | 78 | ||
79 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ) | 79 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ) |
80 | { | 80 | { |
81 | Skin skin( name, fileNameInfix ); | 81 | Skin skin( name, fileNameInfix ); |
82 | 82 | ||
83 | QString skinPath = "opieplayer2/skins/" + name; | 83 | QString skinPath = "opieplayer2/skins/" + name; |
84 | backgroundPixmap = skin.backgroundImage(); | 84 | backgroundPixmap = skin.backgroundImage(); |
85 | buttonUpImage = skin.buttonUpImage(); | 85 | buttonUpImage = skin.buttonUpImage(); |
86 | buttonDownImage = skin.buttonDownImage(); | 86 | buttonDownImage = skin.buttonDownImage(); |
87 | 87 | ||
88 | setupButtons( skinInfo, buttonCount, skin, buttonUpImage.size() ); | 88 | setupButtons( skinInfo, buttonCount, skin ); |
89 | } | 89 | } |
90 | 90 | ||
91 | void MediaWidget::closeEvent( QCloseEvent * ) | 91 | void MediaWidget::closeEvent( QCloseEvent * ) |
92 | { | 92 | { |
93 | mediaPlayerState.setList(); | 93 | mediaPlayerState.setList(); |
94 | } | 94 | } |
95 | 95 | ||
96 | void MediaWidget::paintEvent( QPaintEvent *pe ) | 96 | void MediaWidget::paintEvent( QPaintEvent *pe ) |
97 | { | 97 | { |
98 | QPainter p( this ); | 98 | QPainter p( this ); |
99 | 99 | ||
100 | if ( mediaPlayerState.isFullscreen() ) { | 100 | if ( mediaPlayerState.isFullscreen() ) { |
101 | // Clear the background | 101 | // Clear the background |
102 | p.setBrush( QBrush( Qt::black ) ); | 102 | p.setBrush( QBrush( Qt::black ) ); |
103 | return; | 103 | return; |
104 | } | 104 | } |
105 | 105 | ||
106 | if ( !pe->erased() ) { | 106 | if ( !pe->erased() ) { |
107 | // Combine with background and double buffer | 107 | // Combine with background and double buffer |
108 | QPixmap pix( pe->rect().size() ); | 108 | QPixmap pix( pe->rect().size() ); |
109 | QPainter p( &pix ); | 109 | QPainter p( &pix ); |
110 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 110 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
111 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); | 111 | p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); |
112 | paintAllButtons( p ); | 112 | paintAllButtons( p ); |