summaryrefslogtreecommitdiffstats
path: root/juk/folderplaylist.cpp
blob: 719343599e31f0db98c140b954b13920a64a3a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/***************************************************************************
    copyright            : (C) 2004 by Scott Wheeler
    email                : [email protected]
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "folderplaylist.h"
#include "playlistcollection.h"

#include <tqtimer.h>

////////////////////////////////////////////////////////////////////////////////
// public methods
////////////////////////////////////////////////////////////////////////////////

FolderPlaylist::FolderPlaylist(PlaylistCollection *collection, const TQString &folder,
                               const TQString &name) :
    Playlist(collection, name, "folder"),
    m_folder(folder)
{
    TQTimer::singleShot(0, this, TQT_SLOT(slotReload()));
}

FolderPlaylist::~FolderPlaylist()
{

}

TQString FolderPlaylist::folder() const
{
    return m_folder;
}

void FolderPlaylist::setFolder(const TQString &s)
{
    m_folder = s;
    TQTimer::singleShot(0, this, TQT_SLOT(slotReload()));
}

////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////

void FolderPlaylist::slotReload()
{
    if(!m_folder.isNull())
        addFiles(m_folder);
}

////////////////////////////////////////////////////////////////////////////////
// helper functions
////////////////////////////////////////////////////////////////////////////////

TQDataStream &operator<<(TQDataStream &s, const FolderPlaylist &p)
{
    s << p.name()
      << p.folder();
    return s;
}

TQDataStream &operator>>(TQDataStream &s, FolderPlaylist &p)
{
    TQString name;
    TQString folder;
    s >> name
      >> folder;

    p.setFolder(folder);
    p.setName(name);
    return s;
}

#include "folderplaylist.moc"