summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 6b304ec..0d1c8b6 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -42,74 +42,72 @@ MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPla
42MediaWidget::~MediaWidget() 42MediaWidget::~MediaWidget()
43{ 43{
44} 44}
45 45
46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
47 const Skin &skin ) 47 const Skin &skin )
48{ 48{
49 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 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
60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 60MediaWidget::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
70void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) 70void 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 name = cfg.readEntry( "Skin","default" );
75 75
76 loadSkin( skinInfo, buttonCount, skin, fileNameInfix ); 76 Skin skin( name, fileNameInfix );
77 loadSkin( skinInfo, buttonCount, skin );
77} 78}
78 79
79void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ) 80void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
80{ 81{
81 Skin skin( name, fileNameInfix );
82
83 QString skinPath = "opieplayer2/skins/" + name;
84 backgroundPixmap = skin.backgroundImage(); 82 backgroundPixmap = skin.backgroundImage();
85 buttonUpImage = skin.buttonUpImage(); 83 buttonUpImage = skin.buttonUpImage();
86 buttonDownImage = skin.buttonDownImage(); 84 buttonDownImage = skin.buttonDownImage();
87 85
88 setupButtons( skinInfo, buttonCount, skin ); 86 setupButtons( skinInfo, buttonCount, skin );
89} 87}
90 88
91void MediaWidget::closeEvent( QCloseEvent * ) 89void MediaWidget::closeEvent( QCloseEvent * )
92{ 90{
93 mediaPlayerState.setList(); 91 mediaPlayerState.setList();
94} 92}
95 93
96void MediaWidget::paintEvent( QPaintEvent *pe ) 94void MediaWidget::paintEvent( QPaintEvent *pe )
97{ 95{
98 QPainter p( this ); 96 QPainter p( this );
99 97
100 if ( mediaPlayerState.isFullscreen() ) { 98 if ( mediaPlayerState.isFullscreen() ) {
101 // Clear the background 99 // Clear the background
102 p.setBrush( QBrush( Qt::black ) ); 100 p.setBrush( QBrush( Qt::black ) );
103 return; 101 return;
104 } 102 }
105 103
106 if ( !pe->erased() ) { 104 if ( !pe->erased() ) {
107 // Combine with background and double buffer 105 // Combine with background and double buffer
108 QPixmap pix( pe->rect().size() ); 106 QPixmap pix( pe->rect().size() );
109 QPainter p( &pix ); 107 QPainter p( &pix );
110 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 108 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
111 p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() ); 109 p.drawTiledPixmap( pe->rect(), backgroundPixmap, pe->rect().topLeft() );
112 paintAllButtons( p ); 110 paintAllButtons( p );
113 QPainter p2( this ); 111 QPainter p2( this );
114 p2.drawPixmap( pe->rect().topLeft(), pix ); 112 p2.drawPixmap( pe->rect().topLeft(), pix );
115 } else { 113 } else {
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 0fe4772..9f13677 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -77,65 +77,65 @@ public:
77 { 77 {
78 Command command; 78 Command command;
79 const char *fileName; 79 const char *fileName;
80 ButtonType type; 80 ButtonType type;
81 }; 81 };
82 82
83 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 83 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
84 virtual ~MediaWidget(); 84 virtual ~MediaWidget();
85 85
86public slots: 86public slots:
87 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 87 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
88 virtual void setLength( long length ) = 0; 88 virtual void setLength( long length ) = 0;
89 virtual void setPlaying( bool playing ) = 0; 89 virtual void setPlaying( bool playing ) = 0;
90 90
91 virtual void loadSkin() = 0; 91 virtual void loadSkin() = 0;
92 92
93signals: 93signals:
94 void moreReleased(); 94 void moreReleased();
95 void lessReleased(); 95 void lessReleased();
96 void forwardReleased(); 96 void forwardReleased();
97 void backReleased(); 97 void backReleased();
98 void forwardClicked(); 98 void forwardClicked();
99 void backClicked(); 99 void backClicked();
100 void moreClicked(); 100 void moreClicked();
101 void lessClicked(); 101 void lessClicked();
102 102
103protected: 103protected:
104 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 104 void setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
105 const Skin &skin ); 105 const Skin &skin );
106 Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ); 106 Button setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin );
107 107
108 void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null ); 108 void loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix = QString::null );
109 void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ); 109 void loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin );
110 110
111 virtual void closeEvent( QCloseEvent * ); 111 virtual void closeEvent( QCloseEvent * );
112 112
113 virtual void paintEvent( QPaintEvent *pe ); 113 virtual void paintEvent( QPaintEvent *pe );
114 114
115 Button *buttonAt( const QPoint &position ); 115 Button *buttonAt( const QPoint &position );
116 116
117 virtual void mousePressEvent( QMouseEvent *event ); 117 virtual void mousePressEvent( QMouseEvent *event );
118 virtual void mouseReleaseEvent( QMouseEvent *event ); 118 virtual void mouseReleaseEvent( QMouseEvent *event );
119 119
120 virtual void makeVisible(); 120 virtual void makeVisible();
121 121
122 void handleCommand( Command command, bool buttonDown ); 122 void handleCommand( Command command, bool buttonDown );
123 123
124 bool isOverButton( const QPoint &position, int buttonId ) const; 124 bool isOverButton( const QPoint &position, int buttonId ) const;
125 125
126 void paintAllButtons( QPainter &p ); 126 void paintAllButtons( QPainter &p );
127 void paintButton( const Button &button ); 127 void paintButton( const Button &button );
128 void paintButton( QPainter &p, const Button &button ); 128 void paintButton( QPainter &p, const Button &button );
129 129
130 void setToggleButton( Button &button, bool down ); 130 void setToggleButton( Button &button, bool down );
131 void setToggleButton( Command command, bool down ); 131 void setToggleButton( Command command, bool down );
132 void toggleButton( Button &button ); 132 void toggleButton( Button &button );
133 133
134 MediaPlayerState &mediaPlayerState; 134 MediaPlayerState &mediaPlayerState;
135 PlayListWidget &playList; 135 PlayListWidget &playList;
136 136
137 ButtonVector buttons; 137 ButtonVector buttons;
138 138
139 QImage buttonMask; 139 QImage buttonMask;
140 140
141 QPoint upperLeftOfButtonMask; 141 QPoint upperLeftOfButtonMask;