~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to noatun/noatun/library/pluginmodule.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 2000-2001 Charles Samuels <charles@kde.org>
 
2
// Copyright (c) 2000-2001 Neil Stevens <multivac@fcmail.com>
 
3
// 
 
4
// Permission is hereby granted, free of charge, to any person obtaining a copy
 
5
// of this software and associated documentation files (the "Software"), to deal
 
6
// in the Software without restriction, including without limitation the rights
 
7
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
8
// copies of the Software, and to permit persons to whom the Software is
 
9
// furnished to do so, subject to the following conditions:
 
10
// 
 
11
// The above copyright notice and this permission notice shall be included in
 
12
// all copies or substantial portions of the Software.
 
13
// 
 
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
15
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
16
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
17
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIAB\ILITY, WHETHER IN
 
18
// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
19
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
20
 
 
21
#ifndef PLUGINMODULE_H
 
22
#define PLUGINMODULE_H
 
23
 
 
24
#include <klistview.h>
 
25
#include <qframe.h>
 
26
#include <qstringlist.h>
 
27
 
 
28
#include "noatunpref.h"
 
29
#include "pluginloader.h"
 
30
 
 
31
class KTabCtl;
 
32
 
 
33
class PluginListItem : public QCheckListItem
 
34
{
 
35
public:
 
36
        PluginListItem(const bool _exclusive, bool _checked, const NoatunLibraryInfo &_info, QListView *_parent);
 
37
        const NoatunLibraryInfo &info() const { return mInfo; }
 
38
 
 
39
        // This will toggle the state without "emitting" the stateChange
 
40
        void setChecked(bool);
 
41
 
 
42
protected:      
 
43
        virtual void stateChange(bool);
 
44
        virtual void paintCell(QPainter *, const QColorGroup &, int, int, int); 
 
45
private:
 
46
        NoatunLibraryInfo mInfo;
 
47
        bool silentStateChange;
 
48
        bool exclusive;
 
49
};
 
50
 
 
51
class PluginListView : public KListView
 
52
{
 
53
Q_OBJECT
 
54
 
 
55
friend class PluginListItem;
 
56
 
 
57
public:
 
58
        PluginListView(QWidget *_parent = 0, const char *_name = 0);
 
59
        PluginListView(unsigned _min, QWidget *_parent = 0, const char *_name = 0);
 
60
        PluginListView(unsigned _min, unsigned _max, QWidget *_parent = 0, const char *_name = 0);
 
61
 
 
62
        virtual void clear();
 
63
 
 
64
signals:
 
65
        void stateChange(PluginListItem *, bool);
 
66
 
 
67
private:
 
68
        void stateChanged(PluginListItem *, bool);
 
69
        
 
70
        bool hasMaximum;
 
71
        unsigned max, min;
 
72
        unsigned count;
 
73
};
 
74
 
 
75
class Plugins : public CModule
 
76
{
 
77
Q_OBJECT
 
78
public:
 
79
        Plugins(QObject *_parent = 0);
 
80
        virtual void save();
 
81
        virtual void reopen();
 
82
 
 
83
private slots:
 
84
        void stateChange(PluginListItem *, bool);
 
85
 
 
86
private:
 
87
        void addPlugin(const NoatunLibraryInfo &);
 
88
        void removePlugin(const NoatunLibraryInfo &);
 
89
        PluginListItem *findItem(const NoatunLibraryInfo &) const;
 
90
 
 
91
        QStringList mAdded, mDeleted;
 
92
        PluginListView *interfaceList, *playlistList, *otherList;
 
93
};
 
94
 
 
95
#endif