author | ar <ar> | 2004-02-14 17:15:39 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-14 17:15:39 (UTC) |
commit | f8e43c3ba35bc784fc332e27db2898d4191269ac (patch) (unidiff) | |
tree | 2783066d8dc6d902765d1f733e04618914b88f18 | |
parent | c6bca75c479533d064a782a5f27d3dfb3aa1c042 (diff) | |
download | opie-f8e43c3ba35bc784fc332e27db2898d4191269ac.zip opie-f8e43c3ba35bc784fc332e27db2898d4191269ac.tar.gz opie-f8e43c3ba35bc784fc332e27db2898d4191269ac.tar.bz2 |
improve support for BigScreen
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editinst.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editscale.cpp | 4 |
3 files changed, 9 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 2c54ae6..4242aa6 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -1,244 +1,246 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | 34 | ||
35 | #include "audiowidget.h" | 35 | #include "audiowidget.h" |
36 | #include "mediaplayerstate.h" | 36 | #include "mediaplayerstate.h" |
37 | #include "playlistwidget.h" | 37 | #include "playlistwidget.h" |
38 | 38 | ||
39 | #include <qpe/qpeapplication.h> | ||
40 | |||
39 | namespace | 41 | namespace |
40 | { | 42 | { |
41 | 43 | ||
42 | const int xo = -2; // movable x offset | 44 | const int xo = -2; // movable x offset |
43 | const int yo = 22; // movable y offset | 45 | const int yo = 22; // movable y offset |
44 | 46 | ||
45 | const MediaWidget::SkinButtonInfo skinInfo[] = | 47 | const MediaWidget::SkinButtonInfo skinInfo[] = |
46 | { | 48 | { |
47 | { MediaWidget::Play, "play", MediaWidget::ToggleButton }, | 49 | { MediaWidget::Play, "play", MediaWidget::ToggleButton }, |
48 | { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, | 50 | { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, |
49 | { MediaWidget::Next, "next", MediaWidget::NormalButton }, | 51 | { MediaWidget::Next, "next", MediaWidget::NormalButton }, |
50 | { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, | 52 | { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, |
51 | { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, | 53 | { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, |
52 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, | 54 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, |
53 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, | 55 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, |
54 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, | 56 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, |
55 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, | 57 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, |
56 | { MediaWidget::Back, "back", MediaWidget::NormalButton } | 58 | { MediaWidget::Back, "back", MediaWidget::NormalButton } |
57 | }; | 59 | }; |
58 | 60 | ||
59 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); | 61 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); |
60 | 62 | ||
61 | void changeTextColor( QWidget * w) { | 63 | void changeTextColor( QWidget * w) { |
62 | QPalette p = w->palette(); | 64 | QPalette p = w->palette(); |
63 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 65 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
64 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 66 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
65 | w->setPalette( p ); | 67 | w->setPalette( p ); |
66 | } | 68 | } |
67 | 69 | ||
68 | } | 70 | } |
69 | 71 | ||
70 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 72 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
71 | 73 | ||
72 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), | 74 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
73 | audioSliderBeingMoved( false ) | 75 | audioSliderBeingMoved( false ) |
74 | { | 76 | { |
75 | setCaption( tr("OpiePlayer") ); | 77 | setCaption( tr("OpiePlayer") ); |
76 | 78 | ||
77 | loadSkin(); | 79 | loadSkin(); |
78 | 80 | ||
79 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 81 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
80 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); | 82 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); |
81 | 83 | ||
82 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 84 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
83 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 85 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
84 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 86 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
85 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 87 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
86 | 88 | ||
87 | // Intialise state | 89 | // Intialise state |
88 | setLength( mediaPlayerState.length() ); | 90 | setLength( mediaPlayerState.length() ); |
89 | setPosition( mediaPlayerState.position() ); | 91 | setPosition( mediaPlayerState.position() ); |
90 | setLooping( mediaPlayerState.isFullscreen() ); | 92 | setLooping( mediaPlayerState.isFullscreen() ); |
91 | // setPaused( mediaPlayerState->paused() ); | 93 | // setPaused( mediaPlayerState->paused() ); |
92 | setPlaying( mediaPlayerState.isPlaying() ); | 94 | setPlaying( mediaPlayerState.isPlaying() ); |
93 | } | 95 | } |
94 | 96 | ||
95 | AudioWidget::~AudioWidget() { | 97 | AudioWidget::~AudioWidget() { |
96 | 98 | ||
97 | // mediaPlayerState->setPlaying(false); | 99 | // mediaPlayerState->setPlaying(false); |
98 | } | 100 | } |
99 | 101 | ||
100 | MediaWidget::GUIInfo AudioWidget::guiInfo() | 102 | MediaWidget::GUIInfo AudioWidget::guiInfo() |
101 | { | 103 | { |
102 | return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); | 104 | return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); |
103 | } | 105 | } |
104 | 106 | ||
105 | void AudioWidget::resizeEvent( QResizeEvent *e ) { | 107 | void AudioWidget::resizeEvent( QResizeEvent *e ) { |
106 | int h = height(); | 108 | int h = height(); |
107 | int w = width(); | 109 | int w = width(); |
108 | 110 | ||
109 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 111 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
110 | slider.setFixedWidth( w - 110 ); | 112 | slider.setFixedWidth( w - 110 ); |
111 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 113 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
112 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 114 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
113 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 115 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
114 | 116 | ||
115 | upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; | 117 | upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; |
116 | upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; | 118 | upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; |
117 | 119 | ||
118 | MediaWidget::resizeEvent( e ); | 120 | MediaWidget::resizeEvent( e ); |
119 | } | 121 | } |
120 | 122 | ||
121 | void AudioWidget::sliderPressed() { | 123 | void AudioWidget::sliderPressed() { |
122 | audioSliderBeingMoved = TRUE; | 124 | audioSliderBeingMoved = TRUE; |
123 | } | 125 | } |
124 | 126 | ||
125 | 127 | ||
126 | void AudioWidget::sliderReleased() { | 128 | void AudioWidget::sliderReleased() { |
127 | audioSliderBeingMoved = FALSE; | 129 | audioSliderBeingMoved = FALSE; |
128 | if ( slider.width() == 0 ) | 130 | if ( slider.width() == 0 ) |
129 | return; | 131 | return; |
130 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 132 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
131 | mediaPlayerState.setPosition( val ); | 133 | mediaPlayerState.setPosition( val ); |
132 | } | 134 | } |
133 | 135 | ||
134 | void AudioWidget::setPosition( long i ) { | 136 | void AudioWidget::setPosition( long i ) { |
135 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); | 137 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); |
136 | updateSlider( i, mediaPlayerState.length() ); | 138 | updateSlider( i, mediaPlayerState.length() ); |
137 | } | 139 | } |
138 | 140 | ||
139 | 141 | ||
140 | void AudioWidget::setLength( long max ) { | 142 | void AudioWidget::setLength( long max ) { |
141 | updateSlider( mediaPlayerState.position(), max ); | 143 | updateSlider( mediaPlayerState.position(), max ); |
142 | } | 144 | } |
143 | 145 | ||
144 | 146 | ||
145 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { | 147 | void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { |
146 | if ( mediaType == MediaPlayerState::Audio ) { | 148 | if ( mediaType == MediaPlayerState::Audio ) { |
147 | // startTimer( 150 ); | 149 | // startTimer( 150 ); |
148 | showMaximized(); | 150 | QPEApplication::showDialog( this ); |
149 | return; | 151 | return; |
150 | } | 152 | } |
151 | 153 | ||
152 | killTimers(); | 154 | killTimers(); |
153 | hide(); | 155 | hide(); |
154 | } | 156 | } |
155 | 157 | ||
156 | void AudioWidget::loadSkin() | 158 | void AudioWidget::loadSkin() |
157 | { | 159 | { |
158 | loadDefaultSkin( guiInfo() ); | 160 | loadDefaultSkin( guiInfo() ); |
159 | 161 | ||
160 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 162 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
161 | // changeTextColor( &songInfo ); | 163 | // changeTextColor( &songInfo ); |
162 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 164 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
163 | // songInfo.setFrameStyle( QFrame::NoFrame); | 165 | // songInfo.setFrameStyle( QFrame::NoFrame); |
164 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 166 | songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
165 | // songInfo.setForegroundColor(Qt::white); | 167 | // songInfo.setForegroundColor(Qt::white); |
166 | 168 | ||
167 | slider.setFixedHeight( 20 ); | 169 | slider.setFixedHeight( 20 ); |
168 | slider.setMinValue( 0 ); | 170 | slider.setMinValue( 0 ); |
169 | slider.setMaxValue( 1 ); | 171 | slider.setMaxValue( 1 ); |
170 | slider.setFocusPolicy( QWidget::NoFocus ); | 172 | slider.setFocusPolicy( QWidget::NoFocus ); |
171 | slider.setBackgroundPixmap( backgroundPixmap ); | 173 | slider.setBackgroundPixmap( backgroundPixmap ); |
172 | 174 | ||
173 | // Config cofg("qpe"); | 175 | // Config cofg("qpe"); |
174 | // cofg.setGroup("Appearance"); | 176 | // cofg.setGroup("Appearance"); |
175 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); | 177 | // QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); |
176 | 178 | ||
177 | time.setFocusPolicy( QWidget::NoFocus ); | 179 | time.setFocusPolicy( QWidget::NoFocus ); |
178 | time.setAlignment( Qt::AlignCenter ); | 180 | time.setAlignment( Qt::AlignCenter ); |
179 | 181 | ||
180 | // time.setFrame(FALSE); | 182 | // time.setFrame(FALSE); |
181 | // changeTextColor( &time ); | 183 | // changeTextColor( &time ); |
182 | 184 | ||
183 | resizeEvent( 0 ); | 185 | resizeEvent( 0 ); |
184 | } | 186 | } |
185 | 187 | ||
186 | void AudioWidget::setSeekable( bool isSeekable ) { | 188 | void AudioWidget::setSeekable( bool isSeekable ) { |
187 | 189 | ||
188 | if ( !isSeekable ) { | 190 | if ( !isSeekable ) { |
189 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); | 191 | qDebug("<<<<<<<<<<<<<<file is STREAMING>>>>>>>>>>>>>>>>>>>"); |
190 | if( !slider.isHidden()) { | 192 | if( !slider.isHidden()) { |
191 | slider.hide(); | 193 | slider.hide(); |
192 | } | 194 | } |
193 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 195 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
194 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 196 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
195 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 197 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
196 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 198 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
197 | } else { | 199 | } else { |
198 | // this stops the slider from being moved, thus | 200 | // this stops the slider from being moved, thus |
199 | // does not stop stream when it reaches the end | 201 | // does not stop stream when it reaches the end |
200 | slider.show(); | 202 | slider.show(); |
201 | qDebug( " CONNECT SET POSTION " ); | 203 | qDebug( " CONNECT SET POSTION " ); |
202 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 204 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
203 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 205 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
204 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 206 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
205 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 207 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
206 | } | 208 | } |
207 | } | 209 | } |
208 | 210 | ||
209 | 211 | ||
210 | static QString timeAsString( long length ) { | 212 | static QString timeAsString( long length ) { |
211 | int minutes = length / 60; | 213 | int minutes = length / 60; |
212 | int seconds = length % 60; | 214 | int seconds = length % 60; |
213 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 215 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
214 | } | 216 | } |
215 | 217 | ||
216 | void AudioWidget::updateSlider( long i, long max ) { | 218 | void AudioWidget::updateSlider( long i, long max ) { |
217 | 219 | ||
218 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 220 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
219 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 221 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
220 | 222 | ||
221 | if ( max == 0 ) { | 223 | if ( max == 0 ) { |
222 | return; | 224 | return; |
223 | } | 225 | } |
224 | // Will flicker too much if we don't do this | 226 | // Will flicker too much if we don't do this |
225 | // Scale to something reasonable | 227 | // Scale to something reasonable |
226 | int width = slider.width(); | 228 | int width = slider.width(); |
227 | int val = int((double)i * width / max); | 229 | int val = int((double)i * width / max); |
228 | if ( !audioSliderBeingMoved ) { | 230 | if ( !audioSliderBeingMoved ) { |
229 | if ( slider.value() != val ) { | 231 | if ( slider.value() != val ) { |
230 | slider.setValue( val ); | 232 | slider.setValue( val ); |
231 | } | 233 | } |
232 | 234 | ||
233 | if ( slider.maxValue() != width ) { | 235 | if ( slider.maxValue() != width ) { |
234 | slider.setMaxValue( width ); | 236 | slider.setMaxValue( width ); |
235 | } | 237 | } |
236 | } | 238 | } |
237 | } | 239 | } |
238 | 240 | ||
239 | void AudioWidget::skipFor() { | 241 | void AudioWidget::skipFor() { |
240 | skipDirection = +1; | 242 | skipDirection = +1; |
241 | startTimer( 50 ); | 243 | startTimer( 50 ); |
242 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 244 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
243 | } | 245 | } |
244 | 246 | ||
diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp index f172ef8..5616569 100644 --- a/noncore/multimedia/tonleiter/editinst.cpp +++ b/noncore/multimedia/tonleiter/editinst.cpp | |||
@@ -1,109 +1,111 @@ | |||
1 | #include "editinst.h" | 1 | #include "editinst.h" |
2 | 2 | ||
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | 5 | ||
6 | #include <qpe/qpeapplication.h> | ||
7 | |||
6 | Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) | 8 | Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) |
7 | :QDialog(parent,name,true,0),data(data) | 9 | :QDialog(parent,name,true,0),data(data) |
8 | { | 10 | { |
9 | setCaption("Tonleiter::"+tr("Instrument")); | 11 | setCaption("Tonleiter::"+tr("Instrument")); |
10 | QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); | 12 | QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); |
11 | instid=data->getCurrentInstrumentID(); | 13 | instid=data->getCurrentInstrumentID(); |
12 | stringlist.setAutoDelete(true); | 14 | stringlist.setAutoDelete(true); |
13 | 15 | ||
14 | QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); | 16 | QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); |
15 | 17 | ||
16 | //Name combo + Add + Delete | 18 | //Name combo + Add + Delete |
17 | boxInst=new QComboBox(this,"boxInst"); | 19 | boxInst=new QComboBox(this,"boxInst"); |
18 | boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | 20 | boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); |
19 | connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int))); | 21 | connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int))); |
20 | for(int i=0;i<data->noOfInstruments();i++) | 22 | for(int i=0;i<data->noOfInstruments();i++) |
21 | { | 23 | { |
22 | Instrument inst=data->getInstrument(i); | 24 | Instrument inst=data->getInstrument(i); |
23 | QString name=inst.instName(); | 25 | QString name=inst.instName(); |
24 | if(name.isNull()) continue; | 26 | if(name.isNull()) continue; |
25 | boxInst->insertItem(name,i); | 27 | boxInst->insertItem(name,i); |
26 | } | 28 | } |
27 | boxInst->setCurrentItem(instid); | 29 | boxInst->setCurrentItem(instid); |
28 | toplayout->addWidget(boxInst); | 30 | toplayout->addWidget(boxInst); |
29 | 31 | ||
30 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); | 32 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); |
31 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); | 33 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); |
32 | toplayout->addWidget(addButton); | 34 | toplayout->addWidget(addButton); |
33 | 35 | ||
34 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); | 36 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); |
35 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); | 37 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); |
36 | toplayout->addWidget(delButton); | 38 | toplayout->addWidget(delButton); |
37 | 39 | ||
38 | QPushButton* addhighButton=new QPushButton(tr("Add High String"),this,"addhighButton"); | 40 | QPushButton* addhighButton=new QPushButton(tr("Add High String"),this,"addhighButton"); |
39 | masterlayout->addWidget(addhighButton); | 41 | masterlayout->addWidget(addhighButton); |
40 | 42 | ||
41 | scrollview=new QScrollView(this); | 43 | scrollview=new QScrollView(this); |
42 | scrollview->setVScrollBarMode(QScrollView::AlwaysOn); | 44 | scrollview->setVScrollBarMode(QScrollView::AlwaysOn); |
43 | scrollview->setHScrollBarMode(QScrollView::AlwaysOff); | 45 | scrollview->setHScrollBarMode(QScrollView::AlwaysOff); |
44 | stringwidget=new QVBox(scrollview->viewport()); | 46 | stringwidget=new QVBox(scrollview->viewport()); |
45 | stringwidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)); | 47 | stringwidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)); |
46 | stringwidget->setSpacing(10); | 48 | stringwidget->setSpacing(10); |
47 | scrollview->addChild(stringwidget); | 49 | scrollview->addChild(stringwidget); |
48 | scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | 50 | scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); |
49 | masterlayout->addWidget(scrollview); | 51 | masterlayout->addWidget(scrollview); |
50 | 52 | ||
51 | loadInstrument(); | 53 | loadInstrument(); |
52 | 54 | ||
53 | QPushButton* addlowButton=new QPushButton(tr("Add Low String"),this,"addlowButton"); | 55 | QPushButton* addlowButton=new QPushButton(tr("Add Low String"),this,"addlowButton"); |
54 | masterlayout->addWidget(addlowButton); | 56 | masterlayout->addWidget(addlowButton); |
55 | 57 | ||
56 | //make dialog fit the screen | 58 | //make dialog fit the screen |
57 | showMaximized(); | 59 | QPEApplication::showDialog( this ); |
58 | } | 60 | } |
59 | //**************************************************************************** | 61 | //**************************************************************************** |
60 | Menu::InstEditDialog::~InstEditDialog() | 62 | Menu::InstEditDialog::~InstEditDialog() |
61 | { | 63 | { |
62 | } | 64 | } |
63 | //**************************************************************************** | 65 | //**************************************************************************** |
64 | void Menu::InstEditDialog::setCurrentInstrumetID(int id) | 66 | void Menu::InstEditDialog::setCurrentInstrumetID(int id) |
65 | { | 67 | { |
66 | saveInstrument(); | 68 | saveInstrument(); |
67 | instid=id; | 69 | instid=id; |
68 | data->setCurrentInstrumetID(id); | 70 | data->setCurrentInstrumetID(id); |
69 | loadInstrument(); | 71 | loadInstrument(); |
70 | } | 72 | } |
71 | //**************************************************************************** | 73 | //**************************************************************************** |
72 | void Menu::InstEditDialog::addInstrument() | 74 | void Menu::InstEditDialog::addInstrument() |
73 | { | 75 | { |
74 | } | 76 | } |
75 | //**************************************************************************** | 77 | //**************************************************************************** |
76 | void Menu::InstEditDialog::deleteInstrument() | 78 | void Menu::InstEditDialog::deleteInstrument() |
77 | { | 79 | { |
78 | } | 80 | } |
79 | //**************************************************************************** | 81 | //**************************************************************************** |
80 | void Menu::InstEditDialog::addLowString() | 82 | void Menu::InstEditDialog::addLowString() |
81 | { | 83 | { |
82 | } | 84 | } |
83 | //**************************************************************************** | 85 | //**************************************************************************** |
84 | void Menu::InstEditDialog::addHighString() | 86 | void Menu::InstEditDialog::addHighString() |
85 | { | 87 | { |
86 | } | 88 | } |
87 | //**************************************************************************** | 89 | //**************************************************************************** |
88 | void Menu::InstEditDialog::deleteString(int id) | 90 | void Menu::InstEditDialog::deleteString(int id) |
89 | { | 91 | { |
90 | } | 92 | } |
91 | //**************************************************************************** | 93 | //**************************************************************************** |
92 | void Menu::InstEditDialog::saveInstrument() | 94 | void Menu::InstEditDialog::saveInstrument() |
93 | { | 95 | { |
94 | //auto delete is set to true so widgets _should_ be deleted | 96 | //auto delete is set to true so widgets _should_ be deleted |
95 | stringlist.clear(); | 97 | stringlist.clear(); |
96 | } | 98 | } |
97 | //**************************************************************************** | 99 | //**************************************************************************** |
98 | void Menu::InstEditDialog::loadInstrument() | 100 | void Menu::InstEditDialog::loadInstrument() |
99 | { | 101 | { |
100 | stringlist.clear(); | 102 | stringlist.clear(); |
101 | Instrument inst=data->getInstrument(instid); | 103 | Instrument inst=data->getInstrument(instid); |
102 | qDebug("load Instrument : %d strings",inst.noOfStrings()); | 104 | qDebug("load Instrument : %d strings",inst.noOfStrings()); |
103 | for(uint s=0;s<inst.noOfStrings();s++) | 105 | for(uint s=0;s<inst.noOfStrings();s++) |
104 | { | 106 | { |
105 | stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); | 107 | stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); |
106 | } | 108 | } |
107 | } | 109 | } |
108 | //**************************************************************************** | 110 | //**************************************************************************** |
109 | //**************************************************************************** | 111 | //**************************************************************************** |
diff --git a/noncore/multimedia/tonleiter/editscale.cpp b/noncore/multimedia/tonleiter/editscale.cpp index 0be0058..28bd579 100644 --- a/noncore/multimedia/tonleiter/editscale.cpp +++ b/noncore/multimedia/tonleiter/editscale.cpp | |||
@@ -1,46 +1,48 @@ | |||
1 | #include "editscale.h" | 1 | #include "editscale.h" |
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qpushbutton.h> | 4 | #include <qpushbutton.h> |
5 | 5 | ||
6 | #include <qpe/qpeapplication.h> | ||
7 | |||
6 | Menu::ScaleEditDialog::ScaleEditDialog(TonleiterData* data,QWidget* parent,const char* name) | 8 | Menu::ScaleEditDialog::ScaleEditDialog(TonleiterData* data,QWidget* parent,const char* name) |
7 | :QDialog(parent,name,true,0),data(data) | 9 | :QDialog(parent,name,true,0),data(data) |
8 | { | 10 | { |
9 | setCaption("Tonleiter::"+tr("Scale")); | 11 | setCaption("Tonleiter::"+tr("Scale")); |
10 | QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); | 12 | QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); |
11 | 13 | ||
12 | QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); | 14 | QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); |
13 | 15 | ||
14 | boxScale=new QComboBox(this,"boxScale"); | 16 | boxScale=new QComboBox(this,"boxScale"); |
15 | for(int s=0;s<data->noOfScales();s++) | 17 | for(int s=0;s<data->noOfScales();s++) |
16 | { | 18 | { |
17 | Scale scale=data->getScale(s); | 19 | Scale scale=data->getScale(s); |
18 | QString name=scale.scaleName(); | 20 | QString name=scale.scaleName(); |
19 | if(name.isNull()) continue; | 21 | if(name.isNull()) continue; |
20 | //boxScale->insertItem(name,s); | 22 | //boxScale->insertItem(name,s); |
21 | } | 23 | } |
22 | boxScale->setCurrentItem(data->getCurrentScaleID()); | 24 | boxScale->setCurrentItem(data->getCurrentScaleID()); |
23 | boxScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | 25 | boxScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); |
24 | connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); | 26 | connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); |
25 | toplayout->addWidget(boxScale); | 27 | toplayout->addWidget(boxScale); |
26 | 28 | ||
27 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); | 29 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); |
28 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); | 30 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); |
29 | toplayout->addWidget(addButton); | 31 | toplayout->addWidget(addButton); |
30 | 32 | ||
31 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); | 33 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); |
32 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); | 34 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); |
33 | toplayout->addWidget(delButton); | 35 | toplayout->addWidget(delButton); |
34 | 36 | ||
35 | pianoscale=new PianoScale(this); | 37 | pianoscale=new PianoScale(this); |
36 | masterlayout->addWidget(pianoscale); | 38 | masterlayout->addWidget(pianoscale); |
37 | 39 | ||
38 | //make dialog fit the screen | 40 | //make dialog fit the screen |
39 | showMaximized(); | 41 | QPEApplication::showDialog( this ); |
40 | } | 42 | } |
41 | //**************************************************************************** | 43 | //**************************************************************************** |
42 | Menu::ScaleEditDialog::~ScaleEditDialog() | 44 | Menu::ScaleEditDialog::~ScaleEditDialog() |
43 | { | 45 | { |
44 | } | 46 | } |
45 | //**************************************************************************** | 47 | //**************************************************************************** |
46 | //**************************************************************************** | 48 | //**************************************************************************** |