File indexing completed on 2024-04-14 04:00:10

0001 //
0002 // C++ Interface: cProfileSettings
0003 //
0004 // Description: profile settings
0005 //
0006 /*
0007 Copyright 2008-2011 Tomas Mecir <kmuddy@kmuddy.com>
0008 
0009 This program is free software; you can redistribute it and/or
0010 modify it under the terms of the GNU General Public License as
0011 published by the Free Software Foundation; either version 2 of 
0012 the License, or (at your option) any later version.
0013 
0014 This program is distributed in the hope that it will be useful,
0015 but WITHOUT ANY WARRANTY; without even the implied warranty of
0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017 GNU General Public License for more details.
0018 
0019 You should have received a copy of the GNU General Public License
0020 along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021 */
0022 
0023 #ifndef CPROFILESETTINGS_H
0024 #define CPROFILESETTINGS_H
0025 
0026 #include <QString>
0027 #include <kmuddy_export.h>
0028 
0029 /** cProfileSettings - manages the profile settings of one profile */
0030 
0031 class KMUDDY_EXPORT cProfileSettings {
0032  public:
0033   cProfileSettings (QString profileId);
0034   ~cProfileSettings ();
0035 
0036   // only bool, int and string for now - more may get added later
0037   void setBool (const QString &name, bool value);
0038   void setInt (const QString &name, int value);
0039   void setString (const QString &name, const QString &value);
0040 
0041   bool getBool (const QString &name) const;
0042   int getInt (const QString &name) const;
0043   QString getString (const QString &name) const;
0044 
0045   static void setDefaultBool (const QString &name, bool value);
0046   static void setDefaultInt (const QString &name, int value);
0047   static void setDefaultString (const QString &name, const QString &value);
0048 
0049   /** save the settings */
0050   void save ();
0051  private:
0052   /** load the settings */
0053   void load ();
0054   /** Fill in the default values for main preferences. Plugins can add more in the profile-init or profile-load handler. */
0055   static void fillDefaultValues ();
0056   static void initDefaultStorage ();
0057 
0058   struct Private;
0059   Private *d;
0060   static Private *defd;
0061 };
0062 
0063 #endif   // CPROFILESETTINGS_H
0064