~ubuntu-branches/ubuntu/feisty/kdetv/feisty

« back to all changes in this revision

Viewing changes to kdetv/plugins/misc/channelsuite/channelsuitedb.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-09-17 23:25:16 UTC
  • Revision ID: james.westby@ubuntu.com-20050917232516-9wdsn3ckagbqieh8
Tags: upstream-0.8.8
ImportĀ upstreamĀ versionĀ 0.8.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
/***************************************************************************
 
3
                           channeldb.h
 
4
                           -----------
 
5
    begin                : Sat Apr 10 2004
 
6
    copyright            : (C) 2004 by Dirk Ziegelmeier
 
7
    email                : dziegel@gmx.de
 
8
***************************************************************************/
 
9
 
 
10
/*
 
11
 * This library is free software; you can redistribute it and/or
 
12
 * modify it under the terms of the GNU Library General Public
 
13
 * License as published by the Free Software Foundation; either
 
14
 * version 2 of the License, or (at your option) any later version.
 
15
 *
 
16
 * This library is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
19
 * Library General Public License for more details.
 
20
 *
 
21
 * You should have received a copy of the GNU Library General Public License
 
22
 * along with this library; see the file COPYING.LIB.  If not, write to
 
23
 * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
 
24
 * Boston, MA 02110-1301, USA.
 
25
 */
 
26
 
 
27
#ifndef __CHANNELDB_H
 
28
#define __CHANNELDB_H
 
29
 
 
30
#include <qobject.h>
 
31
#include <qstring.h>
 
32
#include <qptrlist.h>
 
33
#include <qstringlist.h>
 
34
#include <qcstring.h>
 
35
 
 
36
#include <kurl.h>
 
37
#include <kio/job.h>
 
38
 
 
39
class ChannelStore;
 
40
class QDomElement;
 
41
class QBuffer;
 
42
 
 
43
class ChannelSuiteDbEntry
 
44
{
 
45
public:
 
46
    ChannelSuiteDbEntry();
 
47
 
 
48
    const QString& country() const { return _country; }
 
49
    const QString& region()  const { return _region;  }
 
50
    const QString& type()    const { return _type;    }
 
51
    const QString& comment() const { return _comment; }
 
52
 
 
53
 
 
54
private:
 
55
    friend class ChannelSuiteDb;
 
56
 
 
57
    QString _country;
 
58
    QString _region;
 
59
    QString _type;
 
60
    QString _comment;
 
61
    KURL    _url;
 
62
};
 
63
 
 
64
typedef QPtrList<ChannelSuiteDbEntry> ChannelSuiteDbEntryList;
 
65
 
 
66
class ChannelSuiteDb : public QObject
 
67
{
 
68
    Q_OBJECT
 
69
 
 
70
public:
 
71
    ChannelSuiteDb();
 
72
    virtual ~ChannelSuiteDb();
 
73
 
 
74
    void loadIndex(const KURL& url);
 
75
    const QStringList& getCountries() const { return _countries; }
 
76
    const QStringList& getRegions()   const { return _regions;   }
 
77
    const QStringList& getTypes()     const { return _types;     }
 
78
    ChannelSuiteDbEntryList* getEntries(const QString& country = QString::null,
 
79
                                        const QString& region  = QString::null,
 
80
                                        const QString& type    = QString::null);
 
81
    void importList(ChannelStore& store, ChannelSuiteDbEntry& e);
 
82
 
 
83
 
 
84
signals:
 
85
    void loadDone(bool success);
 
86
    void importDone(bool success);
 
87
 
 
88
 
 
89
private slots:
 
90
    void indexDataArrived(KIO::Job*, const QByteArray&);
 
91
    void indexDataResult(KIO::Job*);
 
92
 
 
93
    void importDataArrived(KIO::Job*, const QByteArray&);
 
94
    void importDataResult(KIO::Job*);
 
95
 
 
96
 
 
97
private:
 
98
    ChannelSuiteDbEntryList _entries;
 
99
    QStringList             _countries;
 
100
    QStringList             _regions;
 
101
    QStringList             _types;
 
102
 
 
103
    QBuffer*                _indexBuf;
 
104
    QBuffer*                _importBuf;
 
105
 
 
106
    ChannelStore*           _importStore;
 
107
};
 
108
 
 
109
#endif
 
110
 
 
111
// vim: ts=4 sw=4 et