Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 68437
Collapse All | Expand All

(-)kdemultimedia-3.3.1/juk/k3bexporter.cpp (-2 / +2 lines)
Lines 222-229 Link Here
222
void K3bPlaylistExporter::slotExport()
222
void K3bPlaylistExporter::slotExport()
223
{
223
{
224
    if(m_playlistBox) {
224
    if(m_playlistBox) {
225
        setPlaylist(m_playlistBox->currentPlaylist());
225
        setPlaylist(m_playlistBox->visiblePlaylist());
226
        exportPlaylistItems(m_playlistBox->currentPlaylist()->items());
226
        exportPlaylistItems(m_playlistBox->visiblePlaylist()->items());
227
    }
227
    }
228
}
228
}
229
229
(-)kdemultimedia-3.3.1/juk/playlistbox.cpp (-22 / +4 lines)
Lines 205-221 Link Here
205
// PlaylistBox protected methods
205
// PlaylistBox protected methods
206
////////////////////////////////////////////////////////////////////////////////
206
////////////////////////////////////////////////////////////////////////////////
207
207
208
Playlist *PlaylistBox::currentPlaylist() const
209
{
210
    if(m_dynamicPlaylist)
211
	return m_dynamicPlaylist;
212
213
    if(currentItem() && static_cast<Item *>(currentItem())->playlist())
214
	return static_cast<Item *>(currentItem())->playlist();
215
    else
216
	return PlaylistCollection::currentPlaylist();
217
}
218
219
void PlaylistBox::setupPlaylist(Playlist *playlist, const QString &iconName)
208
void PlaylistBox::setupPlaylist(Playlist *playlist, const QString &iconName)
220
{
209
{
221
    PlaylistCollection::setupPlaylist(playlist, iconName);
210
    PlaylistCollection::setupPlaylist(playlist, iconName);
Lines 327-340 Link Here
327
	treeView->slotCanDeletePlaylist(canDelete);
316
	treeView->slotCanDeletePlaylist(canDelete);
328
}
317
}
329
318
330
Playlist *PlaylistBox::visiblePlaylist() const
331
{
332
    if ( m_dynamicPlaylist )
333
	return m_dynamicPlaylist;
334
335
    return PlaylistCollection::currentPlaylist();
336
}
337
338
void PlaylistBox::slotPlaylistDestroyed(Playlist *p)
319
void PlaylistBox::slotPlaylistDestroyed(Playlist *p)
339
{
320
{
340
    emit signalPlaylistDestroyed(p);
321
    emit signalPlaylistDestroyed(p);
Lines 385-391 Link Here
385
366
386
    if(KURLDrag::decode(s, urls) && !urls.isEmpty()) {
367
    if(KURLDrag::decode(s, urls) && !urls.isEmpty()) {
387
	QStringList files;
368
	QStringList files;
388
	for(KURL::List::Iterator it = urls.begin(); it != urls.end(); it++)
369
	for(KURL::List::Iterator it = urls.begin(); it != urls.end(); ++it)
389
	    files.append((*it).path());
370
	    files.append((*it).path());
390
371
391
	if(item) {
372
	if(item) {
Lines 525-535 Link Here
525
    KListView::keyReleaseEvent(e);
506
    KListView::keyReleaseEvent(e);
526
}
507
}
527
508
528
PlaylistBox::ItemList PlaylistBox::selectedItems()
509
PlaylistBox::ItemList PlaylistBox::selectedItems() const
529
{
510
{
530
    ItemList l;
511
    ItemList l;
531
512
532
    for(QListViewItemIterator it(this, QListViewItemIterator::Selected); it.current(); ++it)
513
    for(QListViewItemIterator it(const_cast<PlaylistBox *>(this),
514
				 QListViewItemIterator::Selected); it.current(); ++it)
533
	l.append(static_cast<Item *>(*it));
515
	l.append(static_cast<Item *>(*it));
534
516
535
    return l;
517
    return l;
(-)kdemultimedia-3.3.1/juk/playlistbox.h (-3 / +1 lines)
Lines 62-73 Link Here
62
    virtual void setCanDeletePlaylist(bool canDelete);
62
    virtual void setCanDeletePlaylist(bool canDelete);
63
63
64
    Item *dropItem() const { return m_dropItem; }
64
    Item *dropItem() const { return m_dropItem; }
65
    Playlist *visiblePlaylist() const;
66
65
67
public slots:
66
public slots:
68
    void paste();
67
    void paste();
69
    void clear() {}
68
    void clear() {}
70
    virtual Playlist *currentPlaylist() const;
71
69
72
protected:
70
protected:
73
    virtual void setupPlaylist(Playlist *playlist, const QString &iconName);
71
    virtual void setupPlaylist(Playlist *playlist, const QString &iconName);
Lines 89-95 Link Here
89
    virtual void keyPressEvent(QKeyEvent *e);
87
    virtual void keyPressEvent(QKeyEvent *e);
90
    virtual void keyReleaseEvent(QKeyEvent *e);
88
    virtual void keyReleaseEvent(QKeyEvent *e);
91
89
92
    QValueList<Item *> selectedItems();
90
    QValueList<Item *> selectedItems() const;
93
    void setSingleItem(QListViewItem *item);
91
    void setSingleItem(QListViewItem *item);
94
92
95
    void setupItem(Item *item);
93
    void setupItem(Item *item);
(-)kdemultimedia-3.3.1/juk/playlistcollection.cpp (-23 / +31 lines)
Lines 125-131 Link Here
125
    QObjectList *childList = m_playlistStack->queryList("Playlist");
125
    QObjectList *childList = m_playlistStack->queryList("Playlist");
126
    QObject *obj;
126
    QObject *obj;
127
    for(obj = childList->first(); obj; obj = childList->next()) {
127
    for(obj = childList->first(); obj; obj = childList->next()) {
128
        Playlist *p = static_cast<Playlist*>(obj);
128
        Playlist *p = static_cast<Playlist *>(obj);
129
        l.append(p->name());
129
        l.append(p->name());
130
    }
130
    }
131
131
Lines 200-206 Link Here
200
    if(files.isEmpty())
200
    if(files.isEmpty())
201
        return;
201
        return;
202
202
203
    if(currentPlaylist() == CollectionList::instance() ||
203
    if(visiblePlaylist() == CollectionList::instance() ||
204
       KMessageBox::questionYesNo(
204
       KMessageBox::questionYesNo(
205
           widget,
205
           widget,
206
           i18n("Do you want to add these items to the current list or to the collection list?"),
206
           i18n("Do you want to add these items to the current list or to the collection list?"),
Lines 211-217 Link Here
211
        CollectionList::instance()->addFiles(files, m_importPlaylists);
211
        CollectionList::instance()->addFiles(files, m_importPlaylists);
212
    }
212
    }
213
    else
213
    else
214
        currentPlaylist()->addFiles(files, m_importPlaylists);
214
        visiblePlaylist()->addFiles(files, m_importPlaylists);
215
215
216
    dataChanged();
216
    dataChanged();
217
}
217
}
Lines 256-262 Link Here
256
256
257
void PlaylistCollection::rename()
257
void PlaylistCollection::rename()
258
{
258
{
259
    QString old = currentPlaylist()->name();
259
    QString old = visiblePlaylist()->name();
260
    QString name = playlistNameDialog(i18n("Rename"), old, false);
260
    QString name = playlistNameDialog(i18n("Rename"), old, false);
261
261
262
    m_playlistNames.remove(old);
262
    m_playlistNames.remove(old);
Lines 264-288 Link Here
264
    if(name.isNull())
264
    if(name.isNull())
265
        return;
265
        return;
266
266
267
    currentPlaylist()->setName(name);
267
    visiblePlaylist()->setName(name);
268
}
268
}
269
269
270
void PlaylistCollection::duplicate()
270
void PlaylistCollection::duplicate()
271
{
271
{
272
    QString name = playlistNameDialog(i18n("Duplicate"), currentPlaylist()->name());
272
    QString name = playlistNameDialog(i18n("Duplicate"), visiblePlaylist()->name());
273
    if(name.isNull())
273
    if(name.isNull())
274
        return;
274
        return;
275
    raise(new Playlist(this, currentPlaylist()->items(), name));
275
    raise(new Playlist(this, visiblePlaylist()->items(), name));
276
}
276
}
277
277
278
void PlaylistCollection::save()
278
void PlaylistCollection::save()
279
{
279
{
280
    currentPlaylist()->save();
280
    visiblePlaylist()->save();
281
}
281
}
282
282
283
void PlaylistCollection::saveAs()
283
void PlaylistCollection::saveAs()
284
{
284
{
285
    currentPlaylist()->saveAs();
285
    visiblePlaylist()->saveAs();
286
}
286
}
287
287
288
void PlaylistCollection::remove()
288
void PlaylistCollection::remove()
Lines 292-307 Link Here
292
292
293
void PlaylistCollection::reload()
293
void PlaylistCollection::reload()
294
{
294
{
295
    if(currentPlaylist() == CollectionList::instance())
295
    if(visiblePlaylist() == CollectionList::instance())
296
        CollectionList::instance()->addFiles(m_folderList, m_importPlaylists);
296
        CollectionList::instance()->addFiles(m_folderList, m_importPlaylists);
297
    else
297
    else
298
        currentPlaylist()->slotReload();
298
        visiblePlaylist()->slotReload();
299
299
300
}
300
}
301
301
302
void PlaylistCollection::editSearch()
302
void PlaylistCollection::editSearch()
303
{
303
{
304
    SearchPlaylist *p = dynamic_cast<SearchPlaylist *>(currentPlaylist());
304
    SearchPlaylist *p = dynamic_cast<SearchPlaylist *>(visiblePlaylist());
305
305
306
    if(!p)
306
    if(!p)
307
        return;
307
        return;
Lines 322-343 Link Here
322
322
323
void PlaylistCollection::removeItems()
323
void PlaylistCollection::removeItems()
324
{
324
{
325
    currentPlaylist()->slotRemoveSelectedItems();
325
    visiblePlaylist()->slotRemoveSelectedItems();
326
}
326
}
327
327
328
void PlaylistCollection::refreshItems()
328
void PlaylistCollection::refreshItems()
329
{
329
{
330
    currentPlaylist()->slotRefresh();
330
    visiblePlaylist()->slotRefresh();
331
}
331
}
332
332
333
void PlaylistCollection::renameItems()
333
void PlaylistCollection::renameItems()
334
{
334
{
335
    currentPlaylist()->slotRenameFile();
335
    visiblePlaylist()->slotRenameFile();
336
}
336
}
337
337
338
PlaylistItemList PlaylistCollection::selectedItems()
338
PlaylistItemList PlaylistCollection::selectedItems()
339
{
339
{
340
    return currentPlaylist()->selectedItems();
340
    return visiblePlaylist()->selectedItems();
341
}
341
}
342
342
343
void PlaylistCollection::scanFolders()
343
void PlaylistCollection::scanFolders()
Lines 382-393 Link Here
382
382
383
void PlaylistCollection::guessTagFromFile()
383
void PlaylistCollection::guessTagFromFile()
384
{
384
{
385
    currentPlaylist()->slotGuessTagInfo(TagGuesser::FileName);
385
    visiblePlaylist()->slotGuessTagInfo(TagGuesser::FileName);
386
}
386
}
387
387
388
void PlaylistCollection::guessTagFromInternet()
388
void PlaylistCollection::guessTagFromInternet()
389
{
389
{
390
    currentPlaylist()->slotGuessTagInfo(TagGuesser::MusicBrainz);
390
    visiblePlaylist()->slotGuessTagInfo(TagGuesser::MusicBrainz);
391
}
391
}
392
392
393
void PlaylistCollection::setSearchEnabled(bool enable)
393
void PlaylistCollection::setSearchEnabled(bool enable)
Lines 397-403 Link Here
397
397
398
    m_searchEnabled = enable;
398
    m_searchEnabled = enable;
399
399
400
    currentPlaylist()->setSearchEnabled(enable);
400
    visiblePlaylist()->setSearchEnabled(enable);
401
}
401
}
402
402
403
HistoryPlaylist *PlaylistCollection::historyPlaylist() const
403
HistoryPlaylist *PlaylistCollection::historyPlaylist() const
Lines 429-443 Link Here
429
    return m_actionHandler;
429
    return m_actionHandler;
430
}
430
}
431
431
432
////////////////////////////////////////////////////////////////////////////////
433
// protected methods
434
////////////////////////////////////////////////////////////////////////////////
435
436
Playlist *PlaylistCollection::currentPlaylist() const
432
Playlist *PlaylistCollection::currentPlaylist() const
437
{
433
{
434
    if(Playlist::playingItem())
435
        return Playlist::playingItem()->playlist();
436
    else
437
        return visiblePlaylist();
438
}
439
440
Playlist *PlaylistCollection::visiblePlaylist() const
441
{
438
    return static_cast<Playlist *>(m_playlistStack->visibleWidget());
442
    return static_cast<Playlist *>(m_playlistStack->visibleWidget());
439
}
443
}
440
444
445
////////////////////////////////////////////////////////////////////////////////
446
// protected methods
447
////////////////////////////////////////////////////////////////////////////////
448
441
QWidgetStack *PlaylistCollection::playlistStack() const
449
QWidgetStack *PlaylistCollection::playlistStack() const
442
{
450
{
443
    return m_playlistStack;
451
    return m_playlistStack;
(-)kdemultimedia-3.3.1/juk/playlistcollection.h (-1 / +13 lines)
Lines 102-111 Link Here
102
102
103
    QObject *object() const;
103
    QObject *object() const;
104
104
105
    /**
106
     * This is the current playlist in all things relating to the player.  It
107
     * represents the playlist that either should be played from or is currently
108
     * playing.
109
     */
110
    virtual Playlist *currentPlaylist() const;
111
112
    /**
113
     * This is the currently visible playlist and should be used for all user
114
     * interaction elements.
115
     */
116
    virtual Playlist *visiblePlaylist() const;
117
105
    class ActionHandler;
118
    class ActionHandler;
106
119
107
protected:
120
protected:
108
    virtual Playlist *currentPlaylist() const;
109
    virtual QWidgetStack *playlistStack() const;
121
    virtual QWidgetStack *playlistStack() const;
110
    virtual void raise(Playlist *playlist);
122
    virtual void raise(Playlist *playlist);
111
    virtual void setupPlaylist(Playlist *playlist, const QString &iconName);
123
    virtual void setupPlaylist(Playlist *playlist, const QString &iconName);
(-)kdemultimedia-3.3.1/juk/playlistsplitter.cpp (-3 / +3 lines)
Lines 97-104 Link Here
97
97
98
    connect(m_playlistBox->object(), SIGNAL(signalSelectedItemsChanged()),
98
    connect(m_playlistBox->object(), SIGNAL(signalSelectedItemsChanged()),
99
            this, SLOT(slotPlaylistSelectionChanged()));
99
            this, SLOT(slotPlaylistSelectionChanged()));
100
    connect(m_playlistBox, SIGNAL(signalPlaylistDestroyed(Playlist*)),
100
    connect(m_playlistBox, SIGNAL(signalPlaylistDestroyed(Playlist *)),
101
            m_editor, SLOT(slotPlaylistDestroyed(Playlist*)));
101
            m_editor, SLOT(slotPlaylistDestroyed(Playlist *)));
102
102
103
    moveToFirst(m_playlistBox);
103
    moveToFirst(m_playlistBox);
104
104
Lines 157-163 Link Here
157
157
158
void PlaylistSplitter::slotPlaylistSelectionChanged()
158
void PlaylistSplitter::slotPlaylistSelectionChanged()
159
{
159
{
160
    m_editor->slotSetItems(static_cast<PlaylistCollection *>(m_playlistBox)->selectedItems());
160
    m_editor->slotSetItems(visiblePlaylist()->selectedItems());
161
}
161
}
162
162
163
void PlaylistSplitter::slotPlaylistChanged(QWidget *w)
163
void PlaylistSplitter::slotPlaylistChanged(QWidget *w)
(-)kdemultimedia-3.3.1/juk/statuslabel.cpp (-18 / +4 lines)
Lines 28-35 Link Here
28
#include "playlistinterface.h"
28
#include "playlistinterface.h"
29
#include "actioncollection.h"
29
#include "actioncollection.h"
30
#include "tag.h"
30
#include "tag.h"
31
#include "playlist.h"
32
#include "playlistitem.h"
33
31
34
using namespace ActionCollection;
32
using namespace ActionCollection;
35
33
Lines 101-116 Link Here
101
99
102
void StatusLabel::updateCurrent()
100
void StatusLabel::updateCurrent()
103
{
101
{
104
    //kdDebug(65432) << k_funcinfo << endl;
102
    if(playlist()->playing()) {
105
103
        FileHandle file = playlist()->currentFile();
106
    // Use a hack to always show the currently playing playlist in the status
107
    // bar.  We can't change PlaylistBox::currentPlaylist() to do this as that
108
    // has too many sideeffects at this point.
109
110
    if(Playlist::playingItem()) {
111
        PlaylistInterface *playlist = Playlist::playingItem()->playlist();
112
113
        FileHandle file = playlist->currentFile();
114
104
115
        QString mid =  file.tag()->artist().isEmpty() || file.tag()->title().isEmpty()
105
        QString mid =  file.tag()->artist().isEmpty() || file.tag()->title().isEmpty()
116
            ? QString::null : QString(" - ");
106
            ? QString::null : QString(" - ");
Lines 118-132 Link Here
118
        QString text = file.tag()->artist() + mid + file.tag()->title();
108
        QString text = file.tag()->artist() + mid + file.tag()->title();
119
109
120
        m_trackLabel->setText(text);
110
        m_trackLabel->setText(text);
121
        m_playlistLabel->setText(playlist->name().simplifyWhiteSpace());
111
        m_playlistLabel->setText(playlist()->name().simplifyWhiteSpace());
122
    }
112
    }
123
    else
124
        updateData();
125
}
113
}
126
114
127
void StatusLabel::updateData()
115
void StatusLabel::updateData()
128
{
116
{
129
    //kdDebug(65432) << k_funcinfo << endl;
117
    updateCurrent();
130
118
131
    if(!playlist()->playing()) {
119
    if(!playlist()->playing()) {
132
        setItemTotalTime(0);
120
        setItemTotalTime(0);
Lines 151-158 Link Here
151
        m_playlistLabel->setText(playlist()->name());
139
        m_playlistLabel->setText(playlist()->name());
152
        m_trackLabel->setText(i18n("1 item", "%n items", playlist()->count()) + " - " + time);
140
        m_trackLabel->setText(i18n("1 item", "%n items", playlist()->count()) + " - " + time);
153
    }
141
    }
154
    else
155
        updateCurrent();
156
}
142
}
157
143
158
////////////////////////////////////////////////////////////////////////////////
144
////////////////////////////////////////////////////////////////////////////////

Return to bug 68437