summaryrefslogtreecommitdiffstats
path: root/juk/folderplaylist.cpp
blob: e12e0746875446ae701e68da870a388060b503f5 (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, TQ_SLOT(slotReload()));
}

FolderPlaylist::~FolderPlaylist()
{

}

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

void FolderPlaylist::setFolder(const TQString &s)
{
    m_folder = s;
    TQTimer::singleShot(0, this, TQ_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"