author | drw <drw> | 2005-05-24 21:43:34 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-24 21:43:34 (UTC) |
commit | c3acfb9caacd7c83f9798940aed5b7d2624ecc01 (patch) (unidiff) | |
tree | 1cf1afe6d0d23adc2b66161a32e5b78684b3cbfb | |
parent | dd673552565f6faa1898ff7e54bb2d374c17ac22 (diff) | |
download | opie-c3acfb9caacd7c83f9798940aed5b7d2624ecc01.zip opie-c3acfb9caacd7c83f9798940aed5b7d2624ecc01.tar.gz opie-c3acfb9caacd7c83f9798940aed5b7d2624ecc01.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.cpp | 38 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.cpp | 2 |
2 files changed, 25 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp index 0898c7b..982d732 100644 --- a/noncore/multimedia/opieplayer3/mwindow.cpp +++ b/noncore/multimedia/opieplayer3/mwindow.cpp | |||
@@ -1,482 +1,494 @@ | |||
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 | #include "mwindow.h" | 34 | #include "mwindow.h" |
35 | #include "playlist.h" | 35 | #include "playlist.h" |
36 | #include "audiowidget.h" | 36 | #include "audiowidget.h" |
37 | #include "videowidget.h" | 37 | #include "videowidget.h" |
38 | #include "../opieplayer2/lib.h" | 38 | #include "../opieplayer2/lib.h" |
39 | 39 | ||
40 | #include <opie2/oapplicationfactory.h> | 40 | #include <opie2/oapplicationfactory.h> |
41 | #include <opie2/owidgetstack.h> | 41 | #include <opie2/owidgetstack.h> |
42 | #include <opie2/ofileselector.h> | 42 | #include <opie2/ofileselector.h> |
43 | #include <opie2/odebug.h> | 43 | #include <opie2/odebug.h> |
44 | #include <opie2/oresource.h> | ||
44 | 45 | ||
45 | #include <qpe/resource.h> | ||
46 | #include <qpe/qpeapplication.h> | 46 | #include <qpe/qpeapplication.h> |
47 | 47 | ||
48 | #include <qfileinfo.h> | 48 | #include <qfileinfo.h> |
49 | #include <qfile.h> | 49 | #include <qfile.h> |
50 | #include <qtoolbar.h> | 50 | #include <qtoolbar.h> |
51 | #include <qpopupmenu.h> | 51 | #include <qpopupmenu.h> |
52 | #include <qmenubar.h> | 52 | #include <qmenubar.h> |
53 | #include <qtimer.h> | 53 | #include <qtimer.h> |
54 | #include <qslider.h> | 54 | #include <qslider.h> |
55 | #include <qlayout.h> | 55 | #include <qlayout.h> |
56 | 56 | ||
57 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 57 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
58 | 58 | ||
59 | using namespace Opie::Ui; | 59 | using namespace Opie::Ui; |
60 | 60 | ||
61 | PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) | 61 | PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) |
62 | : QMainWindow(w,name,f) | 62 | : QMainWindow(w,name,f) |
63 | { | 63 | { |
64 | checkLib(); | 64 | checkLib(); |
65 | setCaption(appTitle()); | 65 | setCaption(appTitle()); |
66 | 66 | ||
67 | m_MainBox = new QWidget(this); | 67 | m_MainBox = new QWidget(this); |
68 | 68 | ||
69 | QVBoxLayout*m_l = new QVBoxLayout(m_MainBox); | 69 | QVBoxLayout*m_l = new QVBoxLayout(m_MainBox); |
70 | 70 | ||
71 | m_stack = new OWidgetStack(m_MainBox); | 71 | m_stack = new OWidgetStack(m_MainBox); |
72 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); | 72 | m_stack->forceMode(Opie::Ui::OWidgetStack::SmallScreen); |
73 | m_l->addWidget(m_stack); | 73 | m_l->addWidget(m_stack); |
74 | m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox); | 74 | m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox); |
75 | m_l->addWidget(m_PosSlider); | 75 | m_l->addWidget(m_PosSlider); |
76 | m_PosSlider->setEnabled(false); | 76 | m_PosSlider->setEnabled(false); |
77 | 77 | ||
78 | m_playList = new PlaylistView(m_stack,"playlist"); | 78 | m_playList = new PlaylistView(m_stack,"playlist"); |
79 | m_stack->addWidget(m_playList,stack_list); | 79 | m_stack->addWidget(m_playList,stack_list); |
80 | connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int))); | 80 | connect(m_playList,SIGNAL(contentChanged(int)),this,SLOT(slotListChanged(int))); |
81 | m_sfl = new OFileSelector("video/*;audio/*",m_stack); | 81 | m_sfl = new OFileSelector("video/*;audio/*",m_stack); |
82 | m_stack->addWidget(m_sfl,stack_file); | 82 | m_stack->addWidget(m_sfl,stack_file); |
83 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); | 83 | connect(m_sfl, SIGNAL(fileSelected(const DocLnk &)), m_playList, SLOT(slotAddFile(const DocLnk &))); |
84 | m_AudioPlayer = new AudioWidget(m_stack); | 84 | m_AudioPlayer = new AudioWidget(m_stack); |
85 | m_stack->addWidget(m_AudioPlayer,stack_audio); | 85 | m_stack->addWidget(m_AudioPlayer,stack_audio); |
86 | connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); | 86 | connect(this,SIGNAL(sigPos(int)),m_AudioPlayer,SLOT(updatePos(int))); |
87 | m_VideoPlayer = new VideoWidget(m_stack); | 87 | m_VideoPlayer = new VideoWidget(m_stack); |
88 | m_stack->addWidget(m_VideoPlayer,stack_video); | 88 | m_stack->addWidget(m_VideoPlayer,stack_video); |
89 | connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); | 89 | connect(this,SIGNAL(sigPos(int)),m_VideoPlayer,SLOT(updatePos(int))); |
90 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); | 90 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); |
91 | 91 | ||
92 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); | 92 | connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int))); |
93 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); | 93 | connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int))); |
94 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); | 94 | connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed())); |
95 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); | 95 | connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased())); |
96 | m_pressed = false; | 96 | m_pressed = false; |
97 | m_uppos=0; | 97 | m_uppos=0; |
98 | 98 | ||
99 | m_stack->raiseWidget(stack_list); | 99 | m_stack->raiseWidget(stack_list); |
100 | m_LastItem = 0; | 100 | m_LastItem = 0; |
101 | setupActions(); | 101 | setupActions(); |
102 | setupToolBar(); | 102 | setupToolBar(); |
103 | setupMenu(); | 103 | setupMenu(); |
104 | 104 | ||
105 | setCentralWidget(m_MainBox ); | 105 | setCentralWidget(m_MainBox ); |
106 | } | 106 | } |
107 | 107 | ||
108 | void PMainWindow::slotListChanged(int count) | 108 | void PMainWindow::slotListChanged(int count) |
109 | { | 109 | { |
110 | playersGroup->setEnabled(count>0); | 110 | playersGroup->setEnabled(count>0); |
111 | if (!m_playList->isVisible()) { | 111 | if (!m_playList->isVisible()) { |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | a_removeFiles->setEnabled(count>0); | 114 | a_removeFiles->setEnabled(count>0); |
115 | } | 115 | } |
116 | 116 | ||
117 | void PMainWindow::mediaWindowraised() | 117 | void PMainWindow::mediaWindowraised() |
118 | { | 118 | { |
119 | playlistOnly->setEnabled(false); | 119 | playlistOnly->setEnabled(false); |
120 | a_appendFiles->setEnabled(true); | 120 | a_appendFiles->setEnabled(true); |
121 | a_loadPlaylist->setEnabled(true); | 121 | a_loadPlaylist->setEnabled(true); |
122 | a_showPlaylist->setEnabled(true); | 122 | a_showPlaylist->setEnabled(true); |
123 | a_ShowMedia->setEnabled(false); | 123 | a_ShowMedia->setEnabled(false); |
124 | } | 124 | } |
125 | 125 | ||
126 | void PMainWindow::checkLib() | 126 | void PMainWindow::checkLib() |
127 | { | 127 | { |
128 | if (m_PlayLib == 0) { | 128 | if (m_PlayLib == 0) { |
129 | m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread); | 129 | m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread); |
130 | qApp->processEvents(); | 130 | qApp->processEvents(); |
131 | // m_PlayLib->ensureInitialized(); | 131 | // m_PlayLib->ensureInitialized(); |
132 | connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped())); | 132 | connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped())); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | PMainWindow::~PMainWindow() | 136 | PMainWindow::~PMainWindow() |
137 | { | 137 | { |
138 | if (m_PlayLib) { | 138 | if (m_PlayLib) { |
139 | m_PlayLib->stop(); | 139 | m_PlayLib->stop(); |
140 | delete m_PlayLib; | 140 | delete m_PlayLib; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void PMainWindow::fileSelected(const DocLnk&) | 144 | void PMainWindow::fileSelected(const DocLnk&) |
145 | { | 145 | { |
146 | } | 146 | } |
147 | 147 | ||
148 | void PMainWindow::slotAppendFiles() | 148 | void PMainWindow::slotAppendFiles() |
149 | { | 149 | { |
150 | m_stack->raiseWidget(m_sfl); | 150 | m_stack->raiseWidget(m_sfl); |
151 | playlistOnly->setEnabled(false); | 151 | playlistOnly->setEnabled(false); |
152 | 152 | ||
153 | a_showPlaylist->setEnabled(true); | 153 | a_showPlaylist->setEnabled(true); |
154 | if (m_PlayLib && m_playing) { | 154 | if (m_PlayLib && m_playing) { |
155 | a_ShowMedia->setEnabled(true); | 155 | a_ShowMedia->setEnabled(true); |
156 | } else { | 156 | } else { |
157 | a_ShowMedia->setEnabled(false); | 157 | a_ShowMedia->setEnabled(false); |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | void PMainWindow::slotShowList() | 161 | void PMainWindow::slotShowList() |
162 | { | 162 | { |
163 | m_stack->raiseWidget(m_playList); | 163 | m_stack->raiseWidget(m_playList); |
164 | playlistOnly->setEnabled(true); | 164 | playlistOnly->setEnabled(true); |
165 | a_showPlaylist->setEnabled(false); | 165 | a_showPlaylist->setEnabled(false); |
166 | if (m_playList->childCount()) { | 166 | if (m_playList->childCount()) { |
167 | a_removeFiles->setEnabled(true); | 167 | a_removeFiles->setEnabled(true); |
168 | } else { | 168 | } else { |
169 | a_removeFiles->setEnabled(false); | 169 | a_removeFiles->setEnabled(false); |
170 | } | 170 | } |
171 | if (m_PlayLib && m_playing) { | 171 | if (m_PlayLib && m_playing) { |
172 | a_ShowMedia->setEnabled(true); | 172 | a_ShowMedia->setEnabled(true); |
173 | } else { | 173 | } else { |
174 | a_ShowMedia->setEnabled(false); | 174 | a_ShowMedia->setEnabled(false); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | void PMainWindow::slotShowMediaWindow() | 178 | void PMainWindow::slotShowMediaWindow() |
179 | { | 179 | { |
180 | if (m_playing && m_LastItem && m_PlayLib) { | 180 | if (m_playing && m_LastItem && m_PlayLib) { |
181 | if (!m_LastItem->isVideo()) { | 181 | if (!m_LastItem->isVideo()) { |
182 | m_stack->raiseWidget(stack_audio); | 182 | m_stack->raiseWidget(stack_audio); |
183 | } else { | 183 | } else { |
184 | m_stack->raiseWidget(stack_video); | 184 | m_stack->raiseWidget(stack_video); |
185 | } | 185 | } |
186 | mediaWindowraised(); | 186 | mediaWindowraised(); |
187 | return; | 187 | return; |
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | void PMainWindow::slotPlayList() | 191 | void PMainWindow::slotPlayList() |
192 | { | 192 | { |
193 | if (m_playing && m_LastItem && m_PlayLib) { | 193 | if (m_playing && m_LastItem && m_PlayLib) { |
194 | slotShowMediaWindow(); | 194 | slotShowMediaWindow(); |
195 | return; | 195 | return; |
196 | } | 196 | } |
197 | 197 | ||
198 | m_LastItem = m_playList->currentItem(); | 198 | m_LastItem = m_playList->currentItem(); |
199 | if (!m_LastItem) { | 199 | if (!m_LastItem) { |
200 | slotPlayNext(); | 200 | slotPlayNext(); |
201 | return; | 201 | return; |
202 | } | 202 | } |
203 | //m_VideoPlayer->setFullScreen(a_ShowFull->isOn()); | 203 | //m_VideoPlayer->setFullScreen(a_ShowFull->isOn()); |
204 | slotPlayCurrent(); | 204 | slotPlayCurrent(); |
205 | } | 205 | } |
206 | 206 | ||
207 | void PMainWindow::slotUserStop() | 207 | void PMainWindow::slotUserStop() |
208 | { | 208 | { |
209 | if (!m_playing || !m_PlayLib) return; | 209 | if (!m_playing || !m_PlayLib) return; |
210 | m_playing = false; | 210 | m_playing = false; |
211 | m_PlayLib->stop(); | 211 | m_PlayLib->stop(); |
212 | m_PosSlider->setEnabled(false); | 212 | m_PosSlider->setEnabled(false); |
213 | hideVideo(); | 213 | hideVideo(); |
214 | slotShowList(); | 214 | slotShowList(); |
215 | setCaption(appTitle()); | 215 | setCaption(appTitle()); |
216 | } | 216 | } |
217 | 217 | ||
218 | void PMainWindow::slotTogglePlay(bool how) | 218 | void PMainWindow::slotTogglePlay(bool how) |
219 | { | 219 | { |
220 | if (how == m_playing) { | 220 | if (how == m_playing) { |
221 | if (how) { | 221 | if (how) { |
222 | slotShowMediaWindow(); | 222 | slotShowMediaWindow(); |
223 | } | 223 | } |
224 | return; | 224 | return; |
225 | } | 225 | } |
226 | if (how) { | 226 | if (how) { |
227 | slotPlayList(); | 227 | slotPlayList(); |
228 | } else { | 228 | } else { |
229 | slotUserStop(); | 229 | slotUserStop(); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | void PMainWindow::hideVideo() | 233 | void PMainWindow::hideVideo() |
234 | { | 234 | { |
235 | if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) { | 235 | if (m_VideoPlayer->isVisible() && a_ShowFull->isOn()) { |
236 | //m_VideoPlayer->showNormal(); | 236 | //m_VideoPlayer->showNormal(); |
237 | m_VideoPlayer->hide(); | 237 | m_VideoPlayer->hide(); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ||
241 | void PMainWindow::slotPlayCurrent() | 241 | void PMainWindow::slotPlayCurrent() |
242 | { | 242 | { |
243 | if (!m_LastItem) { | 243 | if (!m_LastItem) { |
244 | if (m_PlayLib) m_PlayLib->stop(); | 244 | if (m_PlayLib) m_PlayLib->stop(); |
245 | m_PosSlider->setEnabled(false); | 245 | m_PosSlider->setEnabled(false); |
246 | a_playAction->setOn(false); | 246 | a_playAction->setOn(false); |
247 | hideVideo(); | 247 | hideVideo(); |
248 | slotShowList(); | 248 | slotShowList(); |
249 | setCaption(appTitle()); | 249 | setCaption(appTitle()); |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | m_CurrentPos = 0; | 252 | m_CurrentPos = 0; |
253 | m_playList->setCurrentItem(m_LastItem); | 253 | m_playList->setCurrentItem(m_LastItem); |
254 | m_uppos = 0; | 254 | m_uppos = 0; |
255 | m_PosSlider->setValue(0); | 255 | m_PosSlider->setValue(0); |
256 | int result = 0; | 256 | int result = 0; |
257 | if (!m_LastItem->isVideo()) { | 257 | if (!m_LastItem->isVideo()) { |
258 | hideVideo(); | 258 | hideVideo(); |
259 | m_playing = true; | 259 | m_playing = true; |
260 | m_stack->raiseWidget(stack_audio); | 260 | m_stack->raiseWidget(stack_audio); |
261 | result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | 261 | result = m_AudioPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); |
262 | } else { | 262 | } else { |
263 | m_playing = true; | 263 | m_playing = true; |
264 | setupVideo(a_ShowFull->isOn()); | 264 | setupVideo(a_ShowFull->isOn()); |
265 | result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); | 265 | result = m_VideoPlayer->playFile(m_LastItem->Lnk(),m_PlayLib); |
266 | } | 266 | } |
267 | if (result<0) { | 267 | if (result<0) { |
268 | // fehler | 268 | // fehler |
269 | return; | 269 | return; |
270 | } | 270 | } |
271 | mediaWindowraised(); | 271 | mediaWindowraised(); |
272 | setCaption(appTitle()+" - "+m_LastItem->Lnk().name()); | 272 | setCaption(appTitle()+" - "+m_LastItem->Lnk().name()); |
273 | odebug << "Range: " << result << oendl; | 273 | odebug << "Range: " << result << oendl; |
274 | m_PosSlider->setEnabled(true); | 274 | m_PosSlider->setEnabled(true); |
275 | m_PosSlider->setRange(0,m_PlayLib->length()); | 275 | m_PosSlider->setRange(0,m_PlayLib->length()); |
276 | m_PosSlider->setValue(m_PlayLib->currentTime()); | 276 | m_PosSlider->setValue(m_PlayLib->currentTime()); |
277 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); | 277 | QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) ); |
278 | } | 278 | } |
279 | 279 | ||
280 | void PMainWindow::slotPlayNext() | 280 | void PMainWindow::slotPlayNext() |
281 | { | 281 | { |
282 | PlaylistItem*item = m_playList->nextItem(m_LastItem); | 282 | PlaylistItem*item = m_playList->nextItem(m_LastItem); |
283 | if (!item) return; | 283 | if (!item) return; |
284 | m_LastItem = item; | 284 | m_LastItem = item; |
285 | slotPlayCurrent(); | 285 | slotPlayCurrent(); |
286 | } | 286 | } |
287 | 287 | ||
288 | void PMainWindow::slotGoNext() | 288 | void PMainWindow::slotGoNext() |
289 | { | 289 | { |
290 | m_LastItem = m_playList->nextItem(m_LastItem); | 290 | m_LastItem = m_playList->nextItem(m_LastItem); |
291 | slotPlayCurrent(); | 291 | slotPlayCurrent(); |
292 | } | 292 | } |
293 | 293 | ||
294 | void PMainWindow::slotPlayPrevious() | 294 | void PMainWindow::slotPlayPrevious() |
295 | { | 295 | { |
296 | PlaylistItem*item = m_playList->prevItem(m_LastItem); | 296 | PlaylistItem*item = m_playList->prevItem(m_LastItem); |
297 | if (!item) return; | 297 | if (!item) return; |
298 | m_LastItem = item; | 298 | m_LastItem = item; |
299 | slotPlayCurrent(); | 299 | slotPlayCurrent(); |
300 | } | 300 | } |
301 | 301 | ||
302 | void PMainWindow::slotStopped() | 302 | void PMainWindow::slotStopped() |
303 | { | 303 | { |
304 | if (!m_playing) return; | 304 | if (!m_playing) return; |
305 | odebug << "Slot stopped" << oendl; | 305 | odebug << "Slot stopped" << oendl; |
306 | m_playing = false; | 306 | m_playing = false; |
307 | slotGoNext(); | 307 | slotGoNext(); |
308 | } | 308 | } |
309 | 309 | ||
310 | void PMainWindow::slotCheckPos() | 310 | void PMainWindow::slotCheckPos() |
311 | { | 311 | { |
312 | if (!m_playing) return; | 312 | if (!m_playing) return; |
313 | if (!m_pressed) { | 313 | if (!m_pressed) { |
314 | m_uppos = m_PlayLib->currentTime(); | 314 | m_uppos = m_PlayLib->currentTime(); |
315 | emit sigPos(m_uppos); | 315 | emit sigPos(m_uppos); |
316 | m_PosSlider->setValue(m_PlayLib->currentTime()); | 316 | m_PosSlider->setValue(m_PlayLib->currentTime()); |
317 | } | 317 | } |
318 | qApp->processEvents(100); | 318 | qApp->processEvents(100); |
319 | QTimer::singleShot( 900, this, SLOT( slotCheckPos() ) ); | 319 | QTimer::singleShot( 900, this, SLOT( slotCheckPos() ) ); |
320 | } | 320 | } |
321 | 321 | ||
322 | void PMainWindow::slotRemoveFiles() | 322 | void PMainWindow::slotRemoveFiles() |
323 | { | 323 | { |
324 | if (m_playing||!m_playList->isVisible()) return; | 324 | if (m_playing||!m_playList->isVisible()) return; |
325 | PlaylistItem* Item = m_playList->currentItem(); | 325 | PlaylistItem* Item = m_playList->currentItem(); |
326 | slotShowList(); | 326 | slotShowList(); |
327 | m_playList->removeFromList(Item); | 327 | m_playList->removeFromList(Item); |
328 | } | 328 | } |
329 | 329 | ||
330 | void PMainWindow::setupActions() | 330 | void PMainWindow::setupActions() |
331 | { | 331 | { |
332 | a_appendFiles = new QAction(tr("Append file(s)"),Resource::loadIconSet( "opieplayer2/add_to_playlist" ), 0, 0, this, 0, false ); | 332 | a_appendFiles = new QAction(tr("Append file(s)"),Opie::Core::OResource::loadPixmap( "opieplayer2/add_to_playlist", |
333 | Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false ); | ||
333 | connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); | 334 | connect(a_appendFiles,SIGNAL(activated()),this,SLOT(slotAppendFiles())); |
334 | a_addDir = new QAction(tr("Add directory"),Resource::loadIconSet("folder_open"),0,0,this,0,false); | 335 | a_addDir = new QAction(tr("Add directory"),Opie::Core::OResource::loadPixmap("folder_open", |
336 | Opie::Core::OResource::SmallIcon),0,0,this,0,false); | ||
335 | connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir())); | 337 | connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir())); |
336 | a_loadPlaylist = new QAction(tr("Append playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false); | 338 | a_loadPlaylist = new QAction(tr("Append playlist"),Opie::Core::OResource::loadPixmap("opieplayer2/add_to_playlist", |
339 | Opie::Core::OResource::SmallIcon),0,0,this,0,false); | ||
337 | connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u())); | 340 | connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u())); |
338 | a_savePlaylist = new QAction(tr("Save playlist"),Resource::loadIconSet("save"),0,0,this,0,false); | 341 | a_savePlaylist = new QAction(tr("Save playlist"),Opie::Core::OResource::loadPixmap("save", |
342 | Opie::Core::OResource::SmallIcon),0,0,this,0,false); | ||
339 | connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u())); | 343 | connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u())); |
340 | 344 | ||
341 | playlistOnly = new QActionGroup(this,"playlistgroup",false); | 345 | playlistOnly = new QActionGroup(this,"playlistgroup",false); |
342 | playlistOnly->insert(a_appendFiles); | 346 | playlistOnly->insert(a_appendFiles); |
343 | playlistOnly->insert(a_addDir); | 347 | playlistOnly->insert(a_addDir); |
344 | playlistOnly->insert(a_loadPlaylist); | 348 | playlistOnly->insert(a_loadPlaylist); |
345 | playlistOnly->insert(a_savePlaylist); | 349 | playlistOnly->insert(a_savePlaylist); |
346 | 350 | ||
347 | a_showPlaylist = new QAction(tr("Show playlist"),Resource::loadIconSet( "txt" ), 0, 0, this, 0, false ); | 351 | a_showPlaylist = new QAction(tr("Show playlist"),Opie::Core::OResource::loadPixmap( "txt", |
352 | Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false ); | ||
348 | connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList())); | 353 | connect(a_showPlaylist,SIGNAL(activated()),this,SLOT(slotShowList())); |
349 | a_ShowMedia = new QAction(tr("Show media window"),Resource::loadIconSet("opieplayer2/musicfile"), 0, 0, this, 0, false ); | 354 | a_ShowMedia = new QAction(tr("Show media window"),Opie::Core::OResource::loadPixmap("opieplayer2/musicfile", |
355 | Opie::Core::OResource::SmallIcon), 0, 0, this, 0, false ); | ||
350 | connect(a_ShowMedia,SIGNAL(activated()),this,SLOT(slotShowMediaWindow())); | 356 | connect(a_ShowMedia,SIGNAL(activated()),this,SLOT(slotShowMediaWindow())); |
351 | 357 | ||
352 | a_removeFiles = new QAction(tr("Remove file"),Resource::loadIconSet( "opieplayer2/remove_from_playlist" ), 0, 0, this, 0, false ); | 358 | a_removeFiles = new QAction(tr("Remove file"),Opie::Core::OResource::loadPixmap( "opieplayer2/remove_from_playlist", |
359 | Opie::Core::OResource::SmallIcon), 0, 0, this, 0, false ); | ||
353 | connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles())); | 360 | connect(a_removeFiles,SIGNAL(activated()),this,SLOT(slotRemoveFiles())); |
354 | 361 | ||
355 | playersGroup = new QActionGroup(this,"playgroup",false); | 362 | playersGroup = new QActionGroup(this,"playgroup",false); |
356 | 363 | ||
357 | a_playAction = new QAction(tr("Play list"),Resource::loadIconSet( "opieplayer2/play" ), 0, 0, this, 0, true); | 364 | a_playAction = new QAction(tr("Play list"),Opie::Core::OResource::loadPixmap( "opieplayer2/play", |
365 | Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, true); | ||
358 | a_playAction->setOn(false); | 366 | a_playAction->setOn(false); |
359 | connect(a_playAction,SIGNAL(toggled(bool)),this,SLOT(slotTogglePlay(bool))); | 367 | connect(a_playAction,SIGNAL(toggled(bool)),this,SLOT(slotTogglePlay(bool))); |
360 | 368 | ||
361 | a_playNext = new QAction(tr("Play next in list"),Resource::loadIconSet( "fastforward" ), 0, 0, this, 0, false ); | 369 | a_playNext = new QAction(tr("Play next in list"),Opie::Core::OResource::loadPixmap( "fastforward", |
370 | Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false ); | ||
362 | connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext())); | 371 | connect(a_playNext,SIGNAL(activated()),this,SLOT(slotPlayNext())); |
363 | a_playPrevious = new QAction(tr("Play previous in list"),Resource::loadIconSet( "fastback" ), 0, 0, this, 0, false ); | 372 | a_playPrevious = new QAction(tr("Play previous in list"),Opie::Core::OResource::loadPixmap( "fastback", |
373 | Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, false ); | ||
364 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); | 374 | connect(a_playPrevious,SIGNAL(activated()),this,SLOT(slotPlayPrevious())); |
365 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); | 375 | a_ShowFull = new QAction(tr("Show videos fullscreen"),Opie::Core::OResource::loadPixmap( "fullscreen", |
376 | Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, true ); | ||
366 | connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); | 377 | connect(a_ShowFull,SIGNAL(toggled(bool)),this,SLOT(slotToggleFull(bool))); |
367 | 378 | ||
368 | playersGroup->insert(a_playPrevious); | 379 | playersGroup->insert(a_playPrevious); |
369 | playersGroup->insert(a_playAction); | 380 | playersGroup->insert(a_playAction); |
370 | playersGroup->insert(a_playNext); | 381 | playersGroup->insert(a_playNext); |
371 | 382 | ||
372 | 383 | ||
373 | /* initial states of actions */ | 384 | /* initial states of actions */ |
374 | a_showPlaylist->setEnabled(false); | 385 | a_showPlaylist->setEnabled(false); |
375 | a_removeFiles->setEnabled(false); | 386 | a_removeFiles->setEnabled(false); |
376 | a_ShowMedia->setEnabled(false); | 387 | a_ShowMedia->setEnabled(false); |
377 | playersGroup->setEnabled(false); | 388 | playersGroup->setEnabled(false); |
378 | 389 | ||
379 | settingsGroup = new QActionGroup(this,"configgroup",false); | 390 | settingsGroup = new QActionGroup(this,"configgroup",false); |
380 | 391 | ||
381 | a_Scaleup = new QAction(tr("Scale videos larger"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true ); | 392 | a_Scaleup = new QAction(tr("Scale videos larger"),Opie::Core::OResource::loadPixmap( "fullscreen", |
393 | Opie::Core::OResource::SmallIcon ), 0, 0, this, 0, true ); | ||
382 | connect(a_Scaleup,SIGNAL(toggled(bool)),this,SLOT(slot_scaleupToggled(bool))); | 394 | connect(a_Scaleup,SIGNAL(toggled(bool)),this,SLOT(slot_scaleupToggled(bool))); |
383 | settingsGroup->insert(a_Scaleup); | 395 | settingsGroup->insert(a_Scaleup); |
384 | } | 396 | } |
385 | 397 | ||
386 | void PMainWindow::setupToolBar() | 398 | void PMainWindow::setupToolBar() |
387 | { | 399 | { |
388 | setToolBarsMovable( false ); | 400 | setToolBarsMovable( false ); |
389 | m_toolBar = new QToolBar( this ); | 401 | m_toolBar = new QToolBar( this ); |
390 | //m_menuBar = new QMenuBar(m_toolBar); | 402 | //m_menuBar = new QMenuBar(m_toolBar); |
391 | m_menuBar=menuBar(); | 403 | m_menuBar=menuBar(); |
392 | addToolBar(m_toolBar); | 404 | addToolBar(m_toolBar); |
393 | m_toolBar->setHorizontalStretchable( true ); | 405 | m_toolBar->setHorizontalStretchable( true ); |
394 | a_appendFiles->addTo(m_toolBar); | 406 | a_appendFiles->addTo(m_toolBar); |
395 | a_removeFiles->addTo(m_toolBar); | 407 | a_removeFiles->addTo(m_toolBar); |
396 | a_showPlaylist->addTo(m_toolBar); | 408 | a_showPlaylist->addTo(m_toolBar); |
397 | a_ShowMedia->addTo(m_toolBar); | 409 | a_ShowMedia->addTo(m_toolBar); |
398 | a_ShowFull->addTo(m_toolBar); | 410 | a_ShowFull->addTo(m_toolBar); |
399 | playersGroup->addTo(m_toolBar); | 411 | playersGroup->addTo(m_toolBar); |
400 | } | 412 | } |
401 | 413 | ||
402 | void PMainWindow::setupVideo(bool full) | 414 | void PMainWindow::setupVideo(bool full) |
403 | { | 415 | { |
404 | if (full) { | 416 | if (full) { |
405 | m_VideoPlayer->setBackgroundColor(black); | 417 | m_VideoPlayer->setBackgroundColor(black); |
406 | m_VideoPlayer->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); | 418 | m_VideoPlayer->reparent(0, WStyle_Customize | WStyle_NoBorderEx, QPoint(0,0)); |
407 | m_VideoPlayer->setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); | 419 | m_VideoPlayer->setGeometry(0,0,qApp->desktop()->size().width(),qApp->desktop()->size().height()); |
408 | m_VideoPlayer->showFullScreen(); | 420 | m_VideoPlayer->showFullScreen(); |
409 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); | 421 | connect(m_VideoPlayer,SIGNAL(videoclicked()),this,SLOT(slotVideoclicked())); |
410 | } else { | 422 | } else { |
411 | m_VideoPlayer->hide(); | 423 | m_VideoPlayer->hide(); |
412 | m_VideoPlayer->disconnect(this); | 424 | m_VideoPlayer->disconnect(this); |
413 | m_stack->addWidget(m_VideoPlayer,stack_video); | 425 | m_stack->addWidget(m_VideoPlayer,stack_video); |
414 | m_stack->raiseWidget(stack_video); | 426 | m_stack->raiseWidget(stack_video); |
415 | } | 427 | } |
416 | mediaWindowraised(); | 428 | mediaWindowraised(); |
417 | m_VideoPlayer->fullScreen(full); | 429 | m_VideoPlayer->fullScreen(full); |
418 | } | 430 | } |
419 | 431 | ||
420 | void PMainWindow::slotVideoclicked() | 432 | void PMainWindow::slotVideoclicked() |
421 | { | 433 | { |
422 | odebug << "PMainWindow::slotVideoclicked()" << oendl; | 434 | odebug << "PMainWindow::slotVideoclicked()" << oendl; |
423 | if (a_ShowFull->isOn()) { | 435 | if (a_ShowFull->isOn()) { |
424 | a_ShowFull->setOn(false); | 436 | a_ShowFull->setOn(false); |
425 | slotToggleFull(false); | 437 | slotToggleFull(false); |
426 | } | 438 | } |
427 | } | 439 | } |
428 | 440 | ||
429 | void PMainWindow::slotToggleFull(bool how) | 441 | void PMainWindow::slotToggleFull(bool how) |
430 | { | 442 | { |
431 | if (m_PlayLib && m_VideoPlayer->isVisible() && m_PlayLib->isShowingVideo()) { | 443 | if (m_PlayLib && m_VideoPlayer->isVisible() && m_PlayLib->isShowingVideo()) { |
432 | m_PlayLib->pause(true); | 444 | m_PlayLib->pause(true); |
433 | setupVideo(how); | 445 | setupVideo(how); |
434 | m_PlayLib->pause(false); | 446 | m_PlayLib->pause(false); |
435 | } | 447 | } |
436 | } | 448 | } |
437 | 449 | ||
438 | void PMainWindow::setupMenu() | 450 | void PMainWindow::setupMenu() |
439 | { | 451 | { |
440 | fileMenu = new QPopupMenu( m_menuBar ); | 452 | fileMenu = new QPopupMenu( m_menuBar ); |
441 | m_menuBar->insertItem( tr( "Playlist" ), fileMenu ); | 453 | m_menuBar->insertItem( tr( "Playlist" ), fileMenu ); |
442 | a_appendFiles->addTo(fileMenu); | 454 | a_appendFiles->addTo(fileMenu); |
443 | a_removeFiles->addTo(fileMenu); | 455 | a_removeFiles->addTo(fileMenu); |
444 | a_addDir->addTo(fileMenu); | 456 | a_addDir->addTo(fileMenu); |
445 | fileMenu->insertSeparator(); | 457 | fileMenu->insertSeparator(); |
446 | a_loadPlaylist->addTo(fileMenu); | 458 | a_loadPlaylist->addTo(fileMenu); |
447 | a_savePlaylist->addTo(fileMenu); | 459 | a_savePlaylist->addTo(fileMenu); |
448 | 460 | ||
449 | dispMenu = new QPopupMenu( m_menuBar ); | 461 | dispMenu = new QPopupMenu( m_menuBar ); |
450 | m_menuBar->insertItem( tr( "Show" ), dispMenu ); | 462 | m_menuBar->insertItem( tr( "Show" ), dispMenu ); |
451 | a_showPlaylist->addTo(dispMenu); | 463 | a_showPlaylist->addTo(dispMenu); |
452 | a_ShowMedia->addTo(dispMenu); | 464 | a_ShowMedia->addTo(dispMenu); |
453 | a_ShowFull->addTo(dispMenu); | 465 | a_ShowFull->addTo(dispMenu); |
454 | playMenu = new QPopupMenu(m_menuBar); | 466 | playMenu = new QPopupMenu(m_menuBar); |
455 | m_menuBar->insertItem(tr("Playing"),playMenu); | 467 | m_menuBar->insertItem(tr("Playing"),playMenu); |
456 | playersGroup->addTo(playMenu); | 468 | playersGroup->addTo(playMenu); |
457 | configMenu = new QPopupMenu(m_menuBar); | 469 | configMenu = new QPopupMenu(m_menuBar); |
458 | m_menuBar->insertItem(tr("Config"),configMenu); | 470 | m_menuBar->insertItem(tr("Config"),configMenu); |
459 | settingsGroup->addTo(configMenu); | 471 | settingsGroup->addTo(configMenu); |
460 | } | 472 | } |
461 | 473 | ||
462 | void PMainWindow::slotNewPos(int pos) | 474 | void PMainWindow::slotNewPos(int pos) |
463 | { | 475 | { |
464 | if (!m_PlayLib) return; | 476 | if (!m_PlayLib) return; |
465 | if (m_uppos==pos) return; | 477 | if (m_uppos==pos) return; |
466 | m_PlayLib->seekTo(pos); | 478 | m_PlayLib->seekTo(pos); |
467 | } | 479 | } |
468 | 480 | ||
469 | void PMainWindow::sliderPressed() | 481 | void PMainWindow::sliderPressed() |
470 | { | 482 | { |
471 | m_pressed = true; | 483 | m_pressed = true; |
472 | } | 484 | } |
473 | 485 | ||
474 | void PMainWindow::sliderReleased() | 486 | void PMainWindow::sliderReleased() |
475 | { | 487 | { |
476 | m_pressed = false; | 488 | m_pressed = false; |
477 | } | 489 | } |
478 | 490 | ||
479 | void PMainWindow::slot_scaleupToggled(bool how) | 491 | void PMainWindow::slot_scaleupToggled(bool how) |
480 | { | 492 | { |
481 | m_VideoPlayer->scaleUp(how); | 493 | m_VideoPlayer->scaleUp(how); |
482 | } | 494 | } |
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp index fe2dde3..eebb068 100644 --- a/noncore/multimedia/opieplayer3/playlist.cpp +++ b/noncore/multimedia/opieplayer3/playlist.cpp | |||
@@ -1,337 +1,335 @@ | |||
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 | #include "playlist.h" | 33 | #include "playlist.h" |
34 | #include "../opieplayer2/lib.h" | 34 | #include "../opieplayer2/lib.h" |
35 | #include "../opieplayer2/om3u.h" | 35 | #include "../opieplayer2/om3u.h" |
36 | 36 | ||
37 | #include <opie2/odebug.h> | 37 | #include <opie2/odebug.h> |
38 | #include <opie2/oresource.h> | 38 | #include <opie2/oresource.h> |
39 | #include <opie2/ofiledialog.h> | 39 | #include <opie2/ofiledialog.h> |
40 | 40 | ||
41 | #include <qpe/resource.h> | ||
42 | |||
43 | #include <qfileinfo.h> | 41 | #include <qfileinfo.h> |
44 | #include <qmessagebox.h> | 42 | #include <qmessagebox.h> |
45 | #include <qdir.h> | 43 | #include <qdir.h> |
46 | 44 | ||
47 | //#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.pls;*.m3u;*.mp4;*.m4a" | 45 | //#define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.pls;*.m3u;*.mp4;*.m4a" |
48 | #define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.mp4;*.m4a" | 46 | #define DEFAULT_FILE_TYPES "*.mp3;*.ogg;*.ogm;*.wma;*.wav;*.asf;*.au;*.avi;*.mpeg;*.mpg;*.mv1;*.mov;*.wmv;*.mp4;*.m4a" |
49 | 47 | ||
50 | PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent) | 48 | PlaylistItem::PlaylistItem(const DocLnk& aLink,PlaylistView*parent) |
51 | :QListViewItem(parent),m_Content(aLink),m_video(false) | 49 | :QListViewItem(parent),m_Content(aLink),m_video(false) |
52 | { | 50 | { |
53 | } | 51 | } |
54 | 52 | ||
55 | PlaylistItem::PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after) | 53 | PlaylistItem::PlaylistItem(const DocLnk&aLink,PlaylistView*parent,PlaylistItem*after) |
56 | :QListViewItem(parent,after),m_Content(aLink),m_video(false) | 54 | :QListViewItem(parent,after),m_Content(aLink),m_video(false) |
57 | { | 55 | { |
58 | } | 56 | } |
59 | 57 | ||
60 | void PlaylistItem::Video(bool y) | 58 | void PlaylistItem::Video(bool y) |
61 | { | 59 | { |
62 | m_video=y; | 60 | m_video=y; |
63 | if (m_video) { | 61 | if (m_video) { |
64 | setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/videofile")); | 62 | setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/videofile")); |
65 | } else { | 63 | } else { |
66 | setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/musicfile")); | 64 | setPixmap(0,Opie::Core::OResource::loadPixmap("opieplayer2/musicfile")); |
67 | } | 65 | } |
68 | } | 66 | } |
69 | 67 | ||
70 | PlaylistItem::~PlaylistItem() | 68 | PlaylistItem::~PlaylistItem() |
71 | { | 69 | { |
72 | } | 70 | } |
73 | 71 | ||
74 | /* PlaylistView Methods */ | 72 | /* PlaylistView Methods */ |
75 | PlaylistView::PlaylistView(QWidget *parent, const char *name) | 73 | PlaylistView::PlaylistView(QWidget *parent, const char *name) |
76 | : QListView(parent,name) | 74 | : QListView(parent,name) |
77 | { | 75 | { |
78 | // columnLabels << tr("FullName"); | 76 | // columnLabels << tr("FullName"); |
79 | columnLabels << tr(""); // icon | 77 | columnLabels << tr(""); // icon |
80 | columnLabels << tr("File"); | 78 | columnLabels << tr("File"); |
81 | columnLabels << tr("Playtime"); | 79 | columnLabels << tr("Playtime"); |
82 | columnLabels << tr("Artist"); | 80 | columnLabels << tr("Artist"); |
83 | columnLabels << tr("Album"); | 81 | columnLabels << tr("Album"); |
84 | columnLabels << tr("Title"); | 82 | columnLabels << tr("Title"); |
85 | columnLabels << tr("Type"); | 83 | columnLabels << tr("Type"); |
86 | columnLabels << tr("Size"); | 84 | columnLabels << tr("Size"); |
87 | for (QStringList::Iterator it = columnLabels.begin(); it != columnLabels.end(); ++it) { | 85 | for (QStringList::Iterator it = columnLabels.begin(); it != columnLabels.end(); ++it) { |
88 | addColumn(*it); | 86 | addColumn(*it); |
89 | } | 87 | } |
90 | m_Infolib=0; | 88 | m_Infolib=0; |
91 | setAllColumnsShowFocus(true); | 89 | setAllColumnsShowFocus(true); |
92 | setSelectionMode(Single); | 90 | setSelectionMode(Single); |
93 | setSorting(-1); | 91 | setSorting(-1); |
94 | m_lastItem = 0; | 92 | m_lastItem = 0; |
95 | m_lastDir = QDir::homeDirPath(); | 93 | m_lastDir = QDir::homeDirPath(); |
96 | } | 94 | } |
97 | 95 | ||
98 | PlaylistView::~PlaylistView() | 96 | PlaylistView::~PlaylistView() |
99 | { | 97 | { |
100 | if (m_Infolib) delete m_Infolib; | 98 | if (m_Infolib) delete m_Infolib; |
101 | } | 99 | } |
102 | 100 | ||
103 | void PlaylistView::checkLib() | 101 | void PlaylistView::checkLib() |
104 | { | 102 | { |
105 | if (!m_Infolib) { | 103 | if (!m_Infolib) { |
106 | m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); | 104 | m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately); |
107 | connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop())); | 105 | connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop())); |
108 | m_Infolib->ensureInitialized(); | 106 | m_Infolib->ensureInitialized(); |
109 | } | 107 | } |
110 | } | 108 | } |
111 | 109 | ||
112 | void PlaylistView::slotDummyStop() | 110 | void PlaylistView::slotDummyStop() |
113 | { | 111 | { |
114 | odebug << "void PlaylistView::slotDummyStop()" << oendl; | 112 | odebug << "void PlaylistView::slotDummyStop()" << oendl; |
115 | } | 113 | } |
116 | 114 | ||
117 | void PlaylistView::slotAddFile(const DocLnk&aLink) | 115 | void PlaylistView::slotAddFile(const DocLnk&aLink) |
118 | { | 116 | { |
119 | QFileInfo f(aLink.file()); | 117 | QFileInfo f(aLink.file()); |
120 | if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") { | 118 | if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") { |
121 | readPlayList(aLink.file()); | 119 | readPlayList(aLink.file()); |
122 | } else { | 120 | } else { |
123 | addFile(aLink.file(),aLink.name()); | 121 | addFile(aLink.file(),aLink.name()); |
124 | } | 122 | } |
125 | emit contentChanged(childCount()); | 123 | emit contentChanged(childCount()); |
126 | } | 124 | } |
127 | 125 | ||
128 | void PlaylistView::addFile(const QString&aFile,const QString&aName) | 126 | void PlaylistView::addFile(const QString&aFile,const QString&aName) |
129 | { | 127 | { |
130 | QFileInfo fileInfo(aFile); | 128 | QFileInfo fileInfo(aFile); |
131 | if (!fileInfo.exists()) return; | 129 | if (!fileInfo.exists()) return; |
132 | checkLib(); | 130 | checkLib(); |
133 | QString name = aName; | 131 | QString name = aName; |
134 | if (name.isEmpty()) { | 132 | if (name.isEmpty()) { |
135 | name = fileInfo.fileName(); | 133 | name = fileInfo.fileName(); |
136 | } | 134 | } |
137 | int i = m_Infolib->setfile(aFile.utf8().data()); | 135 | int i = m_Infolib->setfile(aFile.utf8().data()); |
138 | /* realy! otherwise we get an "stopped" signal when playing! - I don't know why */ | 136 | /* realy! otherwise we get an "stopped" signal when playing! - I don't know why */ |
139 | m_Infolib->stop(); | 137 | m_Infolib->stop(); |
140 | odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl; | 138 | odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl; |
141 | if (i<1) { | 139 | if (i<1) { |
142 | i = m_Infolib->error(); | 140 | i = m_Infolib->error(); |
143 | odebug << "Errorcode: " << i << oendl; | 141 | odebug << "Errorcode: " << i << oendl; |
144 | QString msg; | 142 | QString msg; |
145 | msg = QString(tr("Error open file %1: ")).arg(name); | 143 | msg = QString(tr("Error open file %1: ")).arg(name); |
146 | switch (i) { | 144 | switch (i) { |
147 | case 1: | 145 | case 1: |
148 | msg += tr("No input plugin"); | 146 | msg += tr("No input plugin"); |
149 | break; | 147 | break; |
150 | case 2: | 148 | case 2: |
151 | msg += tr("No demuxer plugin"); | 149 | msg += tr("No demuxer plugin"); |
152 | break; | 150 | break; |
153 | case 3: | 151 | case 3: |
154 | msg += tr("Demuxer failed"); | 152 | msg += tr("Demuxer failed"); |
155 | break; | 153 | break; |
156 | case 4: | 154 | case 4: |
157 | msg+=tr("Malformed mrl"); | 155 | msg+=tr("Malformed mrl"); |
158 | break; | 156 | break; |
159 | default: | 157 | default: |
160 | msg += tr("Unknown error"); | 158 | msg += tr("Unknown error"); |
161 | break; | 159 | break; |
162 | } | 160 | } |
163 | QMessageBox::warning(0,tr("Error reading fileheader"),msg); | 161 | QMessageBox::warning(0,tr("Error reading fileheader"),msg); |
164 | return; | 162 | return; |
165 | } | 163 | } |
166 | if (m_items.count()>0) { | 164 | if (m_items.count()>0) { |
167 | m_lastItem = m_items.last(); | 165 | m_lastItem = m_items.last(); |
168 | } else { | 166 | } else { |
169 | m_lastItem = 0; | 167 | m_lastItem = 0; |
170 | } | 168 | } |
171 | PlaylistItem*_it = currentItem(); | 169 | PlaylistItem*_it = currentItem(); |
172 | 170 | ||
173 | if (m_lastItem) { | 171 | if (m_lastItem) { |
174 | m_lastItem = new PlaylistItem(aFile,this,m_lastItem); | 172 | m_lastItem = new PlaylistItem(aFile,this,m_lastItem); |
175 | } else { | 173 | } else { |
176 | m_lastItem = new PlaylistItem(aFile,this); | 174 | m_lastItem = new PlaylistItem(aFile,this); |
177 | } | 175 | } |
178 | m_lastItem->setExpandable(false); | 176 | m_lastItem->setExpandable(false); |
179 | m_lastItem->setText(1,name); | 177 | m_lastItem->setText(1,name); |
180 | 178 | ||
181 | QString codec = m_Infolib->metaInfo(6); | 179 | QString codec = m_Infolib->metaInfo(6); |
182 | if (codec.isEmpty()) { | 180 | if (codec.isEmpty()) { |
183 | codec = m_Infolib->metaInfo(7); | 181 | codec = m_Infolib->metaInfo(7); |
184 | } | 182 | } |
185 | // codec | 183 | // codec |
186 | m_lastItem->setText(COL_TYPE,codec); | 184 | m_lastItem->setText(COL_TYPE,codec); |
187 | // title | 185 | // title |
188 | m_lastItem->setText(COL_TITLE,m_Infolib->metaInfo(0)); | 186 | m_lastItem->setText(COL_TITLE,m_Infolib->metaInfo(0)); |
189 | // artist | 187 | // artist |
190 | m_lastItem->setText(COL_ARTIST,m_Infolib->metaInfo(2)); | 188 | m_lastItem->setText(COL_ARTIST,m_Infolib->metaInfo(2)); |
191 | // album | 189 | // album |
192 | m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4)); | 190 | m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4)); |
193 | int l = m_Infolib->length(); | 191 | int l = m_Infolib->length(); |
194 | int h = l/3600; | 192 | int h = l/3600; |
195 | l-=h*3600; | 193 | l-=h*3600; |
196 | int m = l/60; | 194 | int m = l/60; |
197 | l-=m*60; | 195 | l-=m*60; |
198 | codec = ""; | 196 | codec = ""; |
199 | if (h>0) { | 197 | if (h>0) { |
200 | codec.sprintf("%2i:%2i:%2i h",h,m,l); | 198 | codec.sprintf("%2i:%2i:%2i h",h,m,l); |
201 | } else { | 199 | } else { |
202 | codec.sprintf("%02i:%02i m",m,l); | 200 | codec.sprintf("%02i:%02i m",m,l); |
203 | } | 201 | } |
204 | // time | 202 | // time |
205 | m_lastItem->setText(COL_TIME,codec); | 203 | m_lastItem->setText(COL_TIME,codec); |
206 | m_lastItem->Video(m_Infolib->hasVideo()); | 204 | m_lastItem->Video(m_Infolib->hasVideo()); |
207 | m_items.append(m_lastItem); | 205 | m_items.append(m_lastItem); |
208 | if (_it==NULL) { | 206 | if (_it==NULL) { |
209 | setSelected(m_lastItem,true); | 207 | setSelected(m_lastItem,true); |
210 | } | 208 | } |
211 | } | 209 | } |
212 | 210 | ||
213 | void PlaylistView::slotAppendDir() | 211 | void PlaylistView::slotAppendDir() |
214 | { | 212 | { |
215 | QString _dir = Opie::Ui::OFileDialog::getDirectory(Opie::Ui::OFileSelector::Extended,m_lastDir,0,m_lastDir); | 213 | QString _dir = Opie::Ui::OFileDialog::getDirectory(Opie::Ui::OFileSelector::Extended,m_lastDir,0,m_lastDir); |
216 | if (_dir.isEmpty()) return; | 214 | if (_dir.isEmpty()) return; |
217 | m_lastDir = _dir; | 215 | m_lastDir = _dir; |
218 | QDir sDir(_dir); | 216 | QDir sDir(_dir); |
219 | QStringList list = sDir.entryList(DEFAULT_FILE_TYPES,QDir::Files,QDir::Name | QDir::IgnoreCase); | 217 | QStringList list = sDir.entryList(DEFAULT_FILE_TYPES,QDir::Files,QDir::Name | QDir::IgnoreCase); |
220 | for (unsigned i = 0; i < list.count();++i) { | 218 | for (unsigned i = 0; i < list.count();++i) { |
221 | addFile(_dir+QString("/")+list[i]); | 219 | addFile(_dir+QString("/")+list[i]); |
222 | } | 220 | } |
223 | emit contentChanged(childCount()); | 221 | emit contentChanged(childCount()); |
224 | } | 222 | } |
225 | 223 | ||
226 | void PlaylistView::slotOpenM3u() | 224 | void PlaylistView::slotOpenM3u() |
227 | { | 225 | { |
228 | QStringList types; | 226 | QStringList types; |
229 | QMap<QString, QStringList> mimeTypes; | 227 | QMap<QString, QStringList> mimeTypes; |
230 | types << "audio/x-mpegurl"; | 228 | types << "audio/x-mpegurl"; |
231 | mimeTypes.insert("Playlists",types); | 229 | mimeTypes.insert("Playlists",types); |
232 | // mimeTypes.insert("All",types); | 230 | // mimeTypes.insert("All",types); |
233 | QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED, | 231 | QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED, |
234 | m_lastDir,"playlist.m3u", mimeTypes); | 232 | m_lastDir,"playlist.m3u", mimeTypes); |
235 | if (fileName.isEmpty()) { | 233 | if (fileName.isEmpty()) { |
236 | return; | 234 | return; |
237 | } | 235 | } |
238 | readPlayList(fileName); | 236 | readPlayList(fileName); |
239 | emit contentChanged(childCount()); | 237 | emit contentChanged(childCount()); |
240 | } | 238 | } |
241 | 239 | ||
242 | void PlaylistView::readPlayList(const QString&fileName) | 240 | void PlaylistView::readPlayList(const QString&fileName) |
243 | { | 241 | { |
244 | QFileInfo f(fileName); | 242 | QFileInfo f(fileName); |
245 | 243 | ||
246 | Om3u _om3u(fileName, IO_ReadOnly); | 244 | Om3u _om3u(fileName, IO_ReadOnly); |
247 | if (f.extension(FALSE).lower()=="m3u") { | 245 | if (f.extension(FALSE).lower()=="m3u") { |
248 | _om3u.readM3u(); | 246 | _om3u.readM3u(); |
249 | } else if (f.extension(FALSE).lower()=="pls") { | 247 | } else if (f.extension(FALSE).lower()=="pls") { |
250 | _om3u.readPls(); | 248 | _om3u.readPls(); |
251 | } | 249 | } |
252 | for (unsigned int j=0; j<_om3u.count();++j) { | 250 | for (unsigned int j=0; j<_om3u.count();++j) { |
253 | addFile(_om3u[j]); | 251 | addFile(_om3u[j]); |
254 | } | 252 | } |
255 | } | 253 | } |
256 | 254 | ||
257 | void PlaylistView::slotSaveAsM3u() | 255 | void PlaylistView::slotSaveAsM3u() |
258 | { | 256 | { |
259 | QStringList types; | 257 | QStringList types; |
260 | QMap<QString, QStringList> mimeTypes; | 258 | QMap<QString, QStringList> mimeTypes; |
261 | types << "audio/x-mpegurl"; | 259 | types << "audio/x-mpegurl"; |
262 | mimeTypes.insert("Playlists",types); | 260 | mimeTypes.insert("Playlists",types); |
263 | QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED, | 261 | QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED, |
264 | m_lastDir,"playlist.m3u", mimeTypes); | 262 | m_lastDir,"playlist.m3u", mimeTypes); |
265 | odebug << "Save as " << fileName << oendl; | 263 | odebug << "Save as " << fileName << oendl; |
266 | if (fileName.isEmpty()) { | 264 | if (fileName.isEmpty()) { |
267 | return; | 265 | return; |
268 | } | 266 | } |
269 | Om3u _om3u(fileName, IO_ReadWrite | IO_Truncate); | 267 | Om3u _om3u(fileName, IO_ReadWrite | IO_Truncate); |
270 | for (unsigned j=0; j<m_items.count();++j) { | 268 | for (unsigned j=0; j<m_items.count();++j) { |
271 | _om3u.add(m_items[j]->Lnk().file()); | 269 | _om3u.add(m_items[j]->Lnk().file()); |
272 | } | 270 | } |
273 | _om3u.write(); | 271 | _om3u.write(); |
274 | } | 272 | } |
275 | 273 | ||
276 | void PlaylistView::removeFromList(PlaylistItem*Item) | 274 | void PlaylistView::removeFromList(PlaylistItem*Item) |
277 | { | 275 | { |
278 | if (!Item)return; | 276 | if (!Item)return; |
279 | t_itemlist::Iterator iter,it2; | 277 | t_itemlist::Iterator iter,it2; |
280 | iter = m_items.find(Item); | 278 | iter = m_items.find(Item); |
281 | it2 = m_items.end(); | 279 | it2 = m_items.end(); |
282 | if (iter!=m_items.end()) { | 280 | if (iter!=m_items.end()) { |
283 | it2 = iter; | 281 | it2 = iter; |
284 | ++it2; | 282 | ++it2; |
285 | m_items.remove(iter); | 283 | m_items.remove(iter); |
286 | } | 284 | } |
287 | delete Item; | 285 | delete Item; |
288 | if (it2!=m_items.end()) { | 286 | if (it2!=m_items.end()) { |
289 | setSelected((*it2),true); | 287 | setSelected((*it2),true); |
290 | } else if (m_items.count()) { | 288 | } else if (m_items.count()) { |
291 | QListViewItem * it = m_items.last(); | 289 | QListViewItem * it = m_items.last(); |
292 | setSelected(it,true); | 290 | setSelected(it,true); |
293 | } | 291 | } |
294 | emit contentChanged(childCount()); | 292 | emit contentChanged(childCount()); |
295 | } | 293 | } |
296 | 294 | ||
297 | XINE::Lib*PlaylistView::getXine() | 295 | XINE::Lib*PlaylistView::getXine() |
298 | { | 296 | { |
299 | checkLib(); | 297 | checkLib(); |
300 | return m_Infolib; | 298 | return m_Infolib; |
301 | } | 299 | } |
302 | 300 | ||
303 | void PlaylistView::setCurrentItem(PlaylistItem*aItem) | 301 | void PlaylistView::setCurrentItem(PlaylistItem*aItem) |
304 | { | 302 | { |
305 | setSelected(aItem,true); | 303 | setSelected(aItem,true); |
306 | } | 304 | } |
307 | 305 | ||
308 | PlaylistItem* PlaylistView::currentItem()const | 306 | PlaylistItem* PlaylistView::currentItem()const |
309 | { | 307 | { |
310 | QListViewItem*it = selectedItem(); | 308 | QListViewItem*it = selectedItem(); |
311 | if (!it) return 0; | 309 | if (!it) return 0; |
312 | return (PlaylistItem*)it; | 310 | return (PlaylistItem*)it; |
313 | } | 311 | } |
314 | 312 | ||
315 | PlaylistItem* PlaylistView::nextItem(PlaylistItem*parent)const | 313 | PlaylistItem* PlaylistView::nextItem(PlaylistItem*parent)const |
316 | { | 314 | { |
317 | if (m_items.count()==0) return 0; | 315 | if (m_items.count()==0) return 0; |
318 | if (!parent) return m_items[0]; | 316 | if (!parent) return m_items[0]; |
319 | for (unsigned j=0; j<m_items.count()-1;++j) { | 317 | for (unsigned j=0; j<m_items.count()-1;++j) { |
320 | if (m_items[j]==parent) { | 318 | if (m_items[j]==parent) { |
321 | return m_items[j+1]; | 319 | return m_items[j+1]; |
322 | } | 320 | } |
323 | } | 321 | } |
324 | return 0; | 322 | return 0; |
325 | } | 323 | } |
326 | 324 | ||
327 | PlaylistItem* PlaylistView::prevItem(PlaylistItem*parent)const | 325 | PlaylistItem* PlaylistView::prevItem(PlaylistItem*parent)const |
328 | { | 326 | { |
329 | if (m_items.count()==0) return 0; | 327 | if (m_items.count()==0) return 0; |
330 | if (!parent) return m_items[m_items.count()-1]; | 328 | if (!parent) return m_items[m_items.count()-1]; |
331 | for (unsigned j=m_items.count()-1; j>0;--j) { | 329 | for (unsigned j=m_items.count()-1; j>0;--j) { |
332 | if (m_items[j]==parent) { | 330 | if (m_items[j]==parent) { |
333 | return m_items[j-1]; | 331 | return m_items[j-1]; |
334 | } | 332 | } |
335 | } | 333 | } |
336 | return 0; | 334 | return 0; |
337 | } | 335 | } |