blob: 8755e5529718878a7e64a2336bf5307fe869e85c (
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
// Copyright (c) 2003-2005 Charles Samuels <charles@kde.org>
// See the file COPYING for redistribution terms.
#ifndef OBLITQUE_H
#define OBLITQUE_H
#include <noatun/playlist.h>
#include <noatun/plugin.h>
#include "query.h"
#include "kdatacollection.h"
#include <kio/global.h>
class View;
class Tree;
class Base;
class Selector;
class TreeItem;
class DirectoryAdder;
namespace KIO
{
class ListJob;
class Job;
}
class Oblique : public Playlist, public Plugin
{
Q_OBJECT
TQ_OBJECT
View *mView;
Base *mBase;
Selector *mSelector;
KDataCollection mSchemaCollection;
DirectoryAdder *mAdder;
public:
Oblique();
~Oblique();
Base *base() { return mBase; }
TQStringList schemaNames() const { return mSchemaCollection.names(); }
TQString loadSchema(Query &q, const TQString &name)
{
TQString t = q.load(mSchemaCollection.file(name));
if (t.length())
q.setName(name);
return t;
}
void saveSchema(Query &q, const TQString &name, const TQString &title)
{
q.save(title, mSchemaCollection.saveFile(name));
}
void removeSchema(const TQString &name)
{
mSchemaCollection.remove(name);
}
virtual void reset();
virtual void clear();
virtual void addFile(const KURL&, bool play=false);
virtual PlaylistItem next();
virtual PlaylistItem previous();
virtual PlaylistItem current();
virtual void setCurrent(const PlaylistItem &);
virtual PlaylistItem getFirst() const;
virtual PlaylistItem getAfter(const PlaylistItem &item) const;
virtual bool listVisible() const;
virtual void showList();
virtual void hideList();
virtual Playlist *playlist() { return this; }
public slots:
void selected(TreeItem *cur);
void beginDirectoryAdd(const KURL &url);
private slots:
void loopTypeChange(int i);
void adderDone();
};
/**
* loads the database into a Tree
**/
class Loader : public TQObject
{
Q_OBJECT
TQ_OBJECT
// the id of the next file to load
FileId mDeferredLoaderAt;
Tree *mTree;
Base *mBase;
public:
Loader(Tree *into);
signals:
void finished();
private slots:
void loadItemsDeferred();
};
/**
* Adds a directory to
* emits @ref done() when finished so you
* can delete it
**/
class DirectoryAdder : public TQObject
{
Q_OBJECT
TQ_OBJECT
Oblique *mOblique;
KURL::List pendingAddDirectories;
KURL::List::Iterator lastAddedSubDirectory;
KIO::ListJob *listJob;
KURL currentJobURL;
public:
DirectoryAdder(const KURL &dir, Oblique *oblique);
Oblique *oblique() { return mOblique; }
public slots:
void add(const KURL &dir);
signals:
void done();
private slots:
void slotResult(KIO::Job *job);
void slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries);
void slotRedirection(KIO::Job *, const KURL & url);
private:
void addNextPending();
};
#endif
|