~ubuntu-branches/ubuntu/jaunty/psi/jaunty

« back to all changes in this revision

Viewing changes to libpsi/iconset/iconset.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-04-14 18:57:30 UTC
  • mfrom: (2.1.9 hardy)
  • Revision ID: james.westby@ubuntu.com-20080414185730-528re3zp0m2hdlhi
Tags: 0.11-8
* added CONFIG -= link_prl to .pro files and removed dependencies
  which are made unnecessary by this change
* Fix segfault when closing last chat tab with qt4.4
  (This is from upstream svn, rev. 1101) (Closes: Bug#476122)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * iconset.h - various graphics handling classes
3
 
 * Copyright (C) 2001-2003  Justin Karneges, Michail Pishchagin
4
 
 *
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Lesser General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2.1 of the License, or (at your option) any later version.
9
 
 *
10
 
 * This library is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * Lesser General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
 *
19
 
 */
20
 
 
21
 
#ifndef ICONSET_H
22
 
#define ICONSET_H
23
 
 
24
 
#include <qobject.h>
25
 
#include <qdict.h>
26
 
#include <qptrlist.h>
27
 
#include <qregexp.h>
28
 
#include <qstring.h>
29
 
#include <qstringlist.h>
30
 
#include <qvaluevector.h>
31
 
 
32
 
class QImage;
33
 
class QPixmap;
34
 
class QIconSet;
35
 
class QMimeSourceFactory;
36
 
class Anim;
37
 
 
38
 
class Impix
39
 
{
40
 
public:
41
 
        Impix();
42
 
        Impix(const QPixmap &);
43
 
        Impix(const QImage &);
44
 
        Impix(const Impix &);
45
 
        Impix & operator=(const Impix &from);
46
 
        ~Impix();
47
 
 
48
 
        void unload();
49
 
        bool isNull() const;
50
 
 
51
 
        const QPixmap & pixmap() const;
52
 
        const QImage & image() const;
53
 
        void setPixmap(const QPixmap &);
54
 
        void setImage(const QImage &);
55
 
 
56
 
        operator const QPixmap &() const { return pixmap(); }
57
 
        operator const QImage &() const { return image(); }
58
 
        Impix & operator=(const QPixmap &from) { setPixmap(from); return *this; }
59
 
        Impix & operator=(const QImage &from) { setImage(from); return *this; }
60
 
 
61
 
        bool loadFromData(const QByteArray &);
62
 
 
63
 
        Impix copy() const;
64
 
        void detach();
65
 
 
66
 
private:
67
 
        class Private;
68
 
        Private *d;
69
 
};
70
 
 
71
 
class Icon : public QObject
72
 
{
73
 
        Q_OBJECT
74
 
public:
75
 
        Icon();
76
 
        Icon(const Icon &);
77
 
        ~Icon();
78
 
 
79
 
        Icon & operator= (const Icon &);
80
 
 
81
 
        //!
82
 
        //! Returns impix().pixmap().
83
 
        operator const QPixmap &() const { return impix().pixmap(); }
84
 
 
85
 
        //!
86
 
        //! Returns impix().image().
87
 
        operator const QImage &() const { return impix().image(); }
88
 
 
89
 
        //!
90
 
        //! see iconSet().
91
 
        operator const QIconSet &() const { return iconSet(); }
92
 
 
93
 
        virtual bool isAnimated() const;
94
 
        virtual const QPixmap &pixmap() const;
95
 
        virtual const QImage &image() const;
96
 
        virtual const QIconSet & iconSet() const;
97
 
 
98
 
        virtual const Impix &impix() const;
99
 
        virtual const Impix &frameImpix() const;
100
 
        void setImpix(const Impix &, bool doDetach = true);
101
 
 
102
 
        const Anim *anim() const;
103
 
        void setAnim(const Anim &, bool doDetach = true);
104
 
        void removeAnim(bool doDetach = true);
105
 
 
106
 
        virtual int framenumber() const;
107
 
 
108
 
        virtual const QString &name() const;
109
 
        void setName(const QString &);
110
 
        void setName(const char *);
111
 
 
112
 
        const QRegExp &regExp() const;
113
 
        void setRegExp(const QRegExp &);
114
 
 
115
 
        const QDict<QString> &text() const;
116
 
        void setText(const QDict<QString> &);
117
 
 
118
 
        const QString &sound() const;
119
 
        void setSound(const QString &);
120
 
 
121
 
        bool loadFromData(const QByteArray &, bool isAnimation);
122
 
 
123
 
        void stripFirstAnimFrame();
124
 
 
125
 
        Icon copy() const;
126
 
        void detach();
127
 
 
128
 
signals:
129
 
        void pixmapChanged(const QPixmap &);
130
 
        void iconModified(const QPixmap &);
131
 
 
132
 
public slots:
133
 
        virtual void activated(bool playSound = true);  // it just has been inserted in the text, or now it's being displayed by
134
 
                                                        // some widget. icon should play sound and start animation
135
 
 
136
 
        virtual void stop();    // this icon is no more displaying. stop animation
137
 
 
138
 
public:
139
 
        class Private;
140
 
private:
141
 
        Private *d;
142
 
};
143
 
 
144
 
class Iconset
145
 
{
146
 
public:
147
 
        Iconset();
148
 
        Iconset(const Iconset &);
149
 
        ~Iconset();
150
 
 
151
 
        Iconset &operator=(const Iconset &);
152
 
        Iconset &operator+=(const Iconset &);
153
 
 
154
 
        void clear();
155
 
        uint count() const;
156
 
 
157
 
        bool load(const QString &dir);
158
 
 
159
 
        const Icon *icon(const QString &) const;
160
 
        void setIcon(const QString &, const Icon &);
161
 
        void removeIcon(const QString &);
162
 
 
163
 
        const QString &name() const;
164
 
        const QString &version() const;
165
 
        const QString &description() const;
166
 
        const QStringList &authors() const;
167
 
        const QString &creation() const;
168
 
        const QString &homeUrl() const;
169
 
 
170
 
        const QString &fileName() const;
171
 
        void setFileName(const QString &);
172
 
        
173
 
        void setInformation(const Iconset &from);
174
 
 
175
 
        const QDict<QString> info() const;
176
 
        void setInfo(const QDict<QString> &);
177
 
 
178
 
        QPtrListIterator<Icon> iterator() const;
179
 
 
180
 
        QMimeSourceFactory *createMimeSourceFactory() const;
181
 
 
182
 
        void addToFactory() const;
183
 
        void removeFromFactory() const;
184
 
 
185
 
        static void setSoundPrefs(QString unpackPath, QObject *receiver, const char *slot);
186
 
 
187
 
        Iconset copy() const;
188
 
        void detach();
189
 
 
190
 
private:
191
 
        class Private;
192
 
        Private *d;
193
 
};
194
 
 
195
 
class IconsetFactory
196
 
{
197
 
public:
198
 
        static Icon icon(const QString &name);
199
 
        static const QPixmap &iconPixmap(const QString &name);
200
 
 
201
 
        static const Icon *iconPtr(const QString &name);
202
 
        static const QStringList icons();
203
 
};
204
 
 
205
 
#endif