KVIrc  4.9.2
DeveloperAPIs
KviTextIconManager.h
Go to the documentation of this file.
1 #ifndef _KVI_TEXTICONMANAGER_H_
2 #define _KVI_TEXTICONMANAGER_H_
3 
4 //=============================================================================
5 //
6 // File : KviTextIconManager.h
7 // Creation date : Thu 15 May 2002 12:04:12 by Szymon Stefanek
8 //
9 // This file is part of the KVIrc IRC client distribution
10 // Copyright (C) 2002-2010 Szymon Stefanek (pragma at kvirc dot net)
11 //
12 // This program is FREE software. You can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the HOPE that it will be USEFUL,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 // See the GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, write to the Free Software Foundation,
24 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 //
26 //=============================================================================
27 
36 #include "kvi_settings.h"
37 #include "KviPointerHashTable.h"
38 #include "KviAnimatedPixmap.h"
39 #include "KviIconManager.h"
40 
41 #include <QPixmap>
42 
43 #define TEXTICONMANAGER_CURRENT_CONFIG_UPDATE 9
44 
50 typedef struct _KviTextIconAssocEntry
51 {
52  const char * name;
53  int iVal;
55 
61 {
62 protected:
64  QString m_szFileName;
66 
67 public:
74 
80  KviTextIcon(QString szFile);
81 
87  KviTextIcon(KviTextIcon * pIcon);
88 
92  ~KviTextIcon();
93 
94 public:
99  inline KviIconManager::SmallIcon id() { return m_eIcon; };
100 
106  void setId(KviIconManager::SmallIcon eIcon);
107 
114  void setId(int iIcon);
115 
121  void setFilename(QString szFileName);
122 
127  inline QString filename() { return m_szFileName; };
128 
133  QPixmap * pixmap();
134 
135  void setPixmap(QPixmap * pIcon);
136 
142 };
143 
148 class KVIRC_API KviTextIconManager : public QObject
149 {
150  friend class KviTextIconWindow;
151  friend class KviTextIconsOptionsWidget;
152  Q_OBJECT
153 public:
159 
164 
165 private:
167 
168 public:
173  inline KviPointerHashTable<QString, KviTextIcon> * textIconDict() { return m_pTextIconDict; };
174 
179  void checkDefaultAssociations();
180 
185  void clear();
186 
193  void insert(const QString & szName, int iId);
194 
201  void insert(const QString & szName, KviTextIcon & icon);
202 
208  inline KviTextIcon * lookupTextIcon(const QString & szName) { return m_pTextIconDict->find(szName); };
209 
214  void load();
215 
220  void save();
221 
226  void applyOptions();
227 
228 protected:
236  void save(const QString & szFileName);
237 
247  int load(const QString & szFileName, bool bMerge = false);
248 signals:
253  void changed();
254 };
255 
256 #ifndef _KVI_TEXTICONMANAGER_CPP_
258 #endif
259 
260 #endif //_KVI_TEXTICONMANAGER_H_
m_pAnimatedPixmap
Definition: KvsObject_pixmap.cpp:110
Definition: KviAnimatedPixmap.h:67
A struct that contains the icon association entries.
Definition: KviTextIconManager.h:50
#define KVIRC_API
Definition: kvi_settings.h:128
KVIRC_API KviTextIconManager * g_pTextIconManager
Definition: KviTextIconManager.cpp:58
The class that manages the icons.
Definition: KviTextIconManager.h:148
KviAnimatedPixmap * m_pAnimatedPixmap
Definition: KviTextIconManager.h:65
KviIconManager::SmallIcon id()
Returns the id of the icon.
Definition: KviTextIconManager.h:99
btnDict clear()
Icon manager.
Pointer Hash Table.
SmallIcon
Contains all KVIrc's small icons.
Definition: KviIconManager.h:168
QString m_szFileName
Definition: KviTextIconManager.h:64
KviPointerHashTable< QString, KviTextIcon > * textIconDict()
Returns the dictionary of the icons.
Definition: KviTextIconManager.h:173
Text icon window class.
Definition: KviTextIconWindow.h:50
bool save(KviThemeInfo &options, bool bSaveIcons)
Definition: KviOptions.cpp:986
The class that holds the icons.
Definition: KviTextIconManager.h:60
const char * name
Definition: KviTextIconManager.h:52
int iVal
Definition: KviTextIconManager.h:53
KviAnimatedPixmap * animatedPixmap()
Returns the animated pixmap associated to the icon.
Definition: KviTextIconManager.h:141
KviTextIcon * lookupTextIcon(const QString &szName)
Returns the text of the icon.
Definition: KviTextIconManager.h:208
struct _KviTextIconAssocEntry KviTextIconAssocEntry
QString filename()
Returns the filename of the icon.
Definition: KviTextIconManager.h:127
KviPointerHashTable< QString, KviTextIcon > * m_pTextIconDict
Definition: KviTextIconManager.h:166
KviIconManager::SmallIcon m_eIcon
Definition: KviTextIconManager.h:63
This file contains compile time settings.