runtime debug infrastructure
[kmk.git] / src / kmkglobalsettings.h
blob4b4ffdbc43ebd1102b9bd57e0cc1f5d8bef92136
1 /***************************************************************************
2 * KMK - KDE Music Cataloger - the tool for personal *
3 * audio collection management *
4 * *
5 * Copyright (C) 2006,2007 by Plamen Petrov *
6 * carpo@abv.bg *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
24 /* This is a modified version of K3B's k3bglobalsettings.h to suit KMK's needs*/
26 #ifndef _KMK_GLOBAL_SETTINGS_H_
27 #define _KMK_GLOBAL_SETTINGS_H_
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
33 /** debug constants - a byte of which bits define debug levels for
34 * KMK's subsystems
35 * KMK_DBG_NONE 0
36 * KMK_DBG_CONFIG 1
37 * KMK_DBG_CATALOG_IO 2
38 * KMK_DBG_CAT_MEM_OPS 4
39 * KMK_DBG_EXT_PLAYER 8
40 * KMK_DBG_FS_OPS 16
41 * KMK_DBG_SIGNALS 32
42 * KMK_DBG_SETTINGS 64 --need to see a more fit name/disambig. with *_CONFIG
43 * KMK_DBG_OTHER 128
44 * KMK_DBG_ALL 255
46 #define KMK_DBG_NONE 0
47 #define KMK_DBG_CONFIG 1
48 #define KMK_DBG_CATALOG_IO 2
49 #define KMK_DBG_CAT_MEM_OPS 4
50 #define KMK_DBG_EXT_PLAYER 8
51 #define KMK_DBG_FS_OPS 16
52 #define KMK_DBG_SIGNALS 32
53 #define KMK_DBG_SETTINGS 64
54 #define KMK_DBG_OTHER 128
55 #define KMK_DBG_ALL 255
57 #include <qstring.h>
59 class KConfig;
61 /**
62 * The class KmkGlobalSettings defines a set of variables, which hold
63 * the current config used by KMK. Throughout the app these are accessed
64 * like this :
65 * \code
66 * if ( settings_obj->saveOnNavigate() ) { // do whats needed for saveOnNavigate }
67 * \endcode
68 * and here saveOnNavigate is defined as a private variable for KmkGlobalSettings.
70 class KmkGlobalSettings
72 public:
73 KmkGlobalSettings();
75 /**
76 * This method takes care of reading the config group
78 void readSettings( KConfig* );
80 /**
81 * This method takes care of writinging the config group
83 void saveSettings( KConfig* );
85 unsigned short dbg() const { return g_dbg; }
86 bool saveOnNavigate() const { return g_save_on_navigate; }
87 bool autoColumnWidth() const { return g_auto_column_width; }
88 bool loadLast() const { return g_load_last; }
89 bool saveGeo() const { return g_save_geo; }
90 QString lastCatalogUsed() const { return g_last_catalog_used; }
92 void setDbg( const unsigned short d ) { g_dbg = d; }
93 void setSaveOnNavigate( const bool b ) { g_save_on_navigate = b; }
94 void setAutoColumnWidth( const bool b ) { g_auto_column_width = b; }
95 void setLoadLast( const bool b ) { g_load_last = b; }
96 void setSaveGeo( const bool b ) { g_save_geo = b; }
97 void setLastCatalogUsed( const QString s ) { g_last_catalog_used = s; }
99 private:
100 unsigned short g_dbg;
101 bool g_save_on_navigate;
102 bool g_auto_column_width;
103 bool g_load_last;
104 bool g_save_geo;
105 QString g_last_catalog_used;
108 #endif //_KMK_GLOBAL_SETTINGS_H_