author | simon <simon> | 2002-12-09 16:12:41 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 16:12:41 (UTC) |
commit | eeb797c68aca5cad9989b8438facebee13eede5e (patch) (unidiff) | |
tree | 74a95774f68967a1b4ecd01d1c2296ebb7019d0c | |
parent | d8aead05894e6a28b5aab45807ff2e6f27620f97 (diff) | |
download | opie-eeb797c68aca5cad9989b8438facebee13eede5e.zip opie-eeb797c68aca5cad9989b8438facebee13eede5e.tar.gz opie-eeb797c68aca5cad9989b8438facebee13eede5e.tar.bz2 |
- starting to migrate the videowidget to MediaWidget::Command and friends
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 40 |
2 files changed, 21 insertions, 21 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index efba6f3..3bf01b6 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -34,9 +34,9 @@ | |||
34 | class MediaWidget : public QWidget | 34 | class MediaWidget : public QWidget |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | public: | 37 | public: |
38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, Undefined }; | 38 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined }; |
39 | enum ButtonType { NormalButton, ToggleButton }; | 39 | enum ButtonType { NormalButton, ToggleButton }; |
40 | 40 | ||
41 | struct Button | 41 | struct Button |
42 | { | 42 | { |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 8409e5c..4867ef1 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -58,30 +58,28 @@ namespace | |||
58 | 58 | ||
59 | const int xo = 2; // movable x offset | 59 | const int xo = 2; // movable x offset |
60 | const int yo = 0; // movable y offset | 60 | const int yo = 0; // movable y offset |
61 | 61 | ||
62 | const char * const skinV_mask_file_names[7] = { | 62 | const MediaWidget::SkinButtonInfo skinInfo[] = |
63 | "play","stop","fwd","back","up","down","full" | 63 | { |
64 | { MediaWidget::Play, "play", MediaWidget::ToggleButton }, | ||
65 | { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, | ||
66 | { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, | ||
67 | { MediaWidget::Previous, "back", MediaWidget::NormalButton }, | ||
68 | { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, | ||
69 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, | ||
70 | { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } | ||
64 | }; | 71 | }; |
65 | 72 | ||
73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); | ||
74 | |||
66 | } | 75 | } |
67 | 76 | ||
68 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 77 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
69 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 78 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) |
70 | { | 79 | { |
71 | setCaption( tr("OpiePlayer - Video") ); | 80 | setCaption( tr("OpiePlayer - Video") ); |
72 | 81 | ||
73 | Button defaultButton; | ||
74 | Button toggleButton = defaultButton; | ||
75 | toggleButton.type = ToggleButton; | ||
76 | |||
77 | buttons.push_back( toggleButton ); // play | ||
78 | buttons.push_back( toggleButton ); // stop | ||
79 | buttons.push_back( toggleButton ); // next | ||
80 | buttons.push_back( toggleButton ); // previous | ||
81 | buttons.push_back( toggleButton ); // volUp | ||
82 | buttons.push_back( toggleButton ); // volDown | ||
83 | buttons.push_back( toggleButton ); // fullscreen | ||
84 | 82 | ||
85 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 83 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
86 | 84 | ||
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 85 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
@@ -98,26 +96,28 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
98 | 96 | ||
99 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 97 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
100 | buttonMask.fill( 0 ); | 98 | buttonMask.fill( 0 ); |
101 | 99 | ||
102 | uint i = 0; | 100 | for ( uint i = 0; i < buttonCount; i++ ) { |
103 | for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it, ++i ) { | 101 | Button button; |
104 | Button &button = *it; | 102 | button.command = skinInfo[ i ].command; |
103 | button.type = skinInfo[ i ].type; | ||
105 | 104 | ||
106 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 105 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinInfo[i].fileName + ".png" ); |
107 | button.mask = QBitmap( filename ); | 106 | button.mask =QBitmap( filename ); |
108 | 107 | ||
109 | if ( !button.mask.isNull() ) { | 108 | if ( !button.mask.isNull() ) { |
110 | QImage imgMask = button.mask.convertToImage(); | 109 | QImage imgMask = button.mask.convertToImage(); |
111 | uchar **dest = buttonMask.jumpTable(); | 110 | uchar **dest = buttonMask.jumpTable(); |
112 | for ( int y = 0; y < imgUp.height(); y++ ) { | 111 | for ( int y = 0; y < imgUp.height(); y++ ) { |
113 | uchar *line = dest[y]; | 112 | uchar *line = dest[y]; |
114 | for ( int x = 0; x < imgUp.width(); x++ ) { | 113 | for ( int x = 0; x < imgUp.width(); x++ ) |
115 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 114 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
116 | line[x] = i + 1; | 115 | line[x] = i + 1; |
117 | } | ||
118 | } | 116 | } |
119 | } | 117 | } |
118 | |||
119 | buttons.push_back( button ); | ||
120 | } | 120 | } |
121 | 121 | ||
122 | setBackgroundPixmap( backgroundPixmap ); | 122 | setBackgroundPixmap( backgroundPixmap ); |
123 | 123 | ||