1
#ifndef _KVI_IDENTITY_PROFILE_SET_H_
2
#define _KVI_IDENTITY_PROFILE_SET_H_
3
//=============================================================================
5
// File : KviIdentityProfileSet.h
6
// Creation date : Thu Dec 30 2010 15:54:48 by Elvio Basello
8
// This file is part of the KVIrc irc client distribution
9
// Copyright (C) 2010 Elvio Basello (hellvis69 at netsons dot org)
11
// This program is FREE software. You can redistribute it and/or
12
// modify it under the terms of the GNU General Public License
13
// as published by the Free Software Foundation; either version 2
14
// of the License, or (at your opinion) any later version.
16
// This program 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.
19
// See the GNU General Public License for more details.
21
// You should have received a copy of the GNU General Public License
22
// along with this program. If not, write to the Free Software Foundation,
23
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
//=============================================================================
28
* \file KviIdentityProfileSet.h
29
* \author Elvio Basello
30
* \brief Identity profiles handling
33
#include "kvi_settings.h"
34
#include "KviHeapObject.h"
35
#include "KviPointerList.h"
36
#include "KviIdentityProfile.h"
38
class KviConfigurationFile;
41
* \class KviIdentityProfileSet
42
* \brief Class which manages the list of identity profiles
44
class KVILIB_API KviIdentityProfileSet : public KviHeapObject
48
* \brief Constructs the identity profile set object
49
* \return KviIdentityProfileSet
51
KviIdentityProfileSet();
54
* \brief Constructs the identity profile set object
56
* This is a carbon copy.
57
* \param set A profile set to copy from
58
* \return KviIdentityProfileSet
60
KviIdentityProfileSet(const KviIdentityProfileSet & set);
63
* \brief Destroys the identity profile set object
65
~KviIdentityProfileSet();
67
static KviIdentityProfileSet * m_pSelf;
68
static unsigned int m_uCount;
70
KviPointerList<KviIdentityProfile> * m_pProfiles;
74
* \brief Initializes the class instance
80
* \brief Destroys the class instance
86
* \brief Returns the instance of the class
87
* \return KviIdentityProfileSet *
89
static inline KviIdentityProfileSet * instance(){ return m_pSelf; };
92
* \brief Returns the number of instances of the class
93
* \return unsigned int
95
unsigned int count(){ return m_uCount; };
98
* \brief Returns the profiles set
99
* \return KviPointerList<KviIdentityProfile> *
101
KviPointerList<KviIdentityProfile> * profiles(){ return m_pProfiles; };
104
* \brief Searches for a profile name. Returns true if the profile exists
105
* \param szName The name of the profile
106
* \return KviIdentityProfile *
108
KviIdentityProfile * findName(const QString & szName);
111
* \brief Searches for a profile network. Returns true if the profile exists
112
* \param szNetwork The network name of the profile
113
* \return KviIdentityProfile *
115
KviIdentityProfile * findNetwork(const QString & szNetwork);
118
* \brief Clears the list
124
* \brief Returns true if the profile set is empty
127
bool isEmpty(){ return m_pProfiles ? m_pProfiles->isEmpty() : true; };
130
* \brief Returns true if the profile set is enabled
133
bool isEnabled(){ return m_bEnabled; };
136
* \brief Enables the profile set
137
* \param bEnabled Whether to enable the profile set
140
void setEnabled(bool bEnabled){ m_bEnabled = bEnabled; };
144
* \param src The source profile set
147
void copyFrom(const KviIdentityProfileSet & src);
150
* \brief Adds a profile to the set
151
* \param pProfile The source profile to add
154
void addProfile(KviIdentityProfile * pProfile);
157
* \brief Loads the configuration of the profiles from file
158
* \param szConfigFile The file where to load
161
void load(const QString & szConfigFile);
164
* \brief Saves the configuration of the profiles to file
165
* \param szConfigFile The file to save
168
void save(const QString & szConfigFile);
171
* \brief Saves the configuration of the profiles
172
* \param pCfg The configuration file
173
* \param szPrefix The prefix of the rules
176
void save(KviConfigurationFile * pCfg, const QString & szPrefix);
179
* \brief Loads the configuration of the profiles from file
180
* \param pCfg The configuration file
181
* \param szPrefix The prefix of the rules
182
* \param uEntries The number of entries
185
bool loadPrivate(KviConfigurationFile * pCfg, const QString & szPrefix, unsigned int uEntries);
188
#endif // _KVI_IDENTITY_PROFILE_SET_H_