libyui  3.3.2
YSettings.h
1 /*
2  Copyright (c) 2012 Björn Esser
3 
4  Permission is hereby granted, free of charge, to any person obtaining
5  a copy of this software and associated documentation files (the
6  "Software"), to deal in the Software without restriction, including
7  without limitation the rights to use, copy, modify, merge, publish,
8  distribute, sublicense, and/or sell
9  copies of the Software, and to permit persons to whom the Software is
10  furnished to do so, subject to the following conditions:
11 
12  The above copyright notice and this permission notice shall be
13  included in all copies or substantial portions of the Software.
14 
15  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
18  SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19  DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
21  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23 
24 
25 /*-/
26 
27  File: YSettings.h
28 
29  Author: Björn Esser <bjoern.esser@gmail.com>
30 
31 /-*/
32 
33 #ifndef YSettings_h
34 #define YSettings_h
35 
36 #include <string>
37 
38 
39 /**
40  * Predeclaration of YUILoader
41  **/
42 class YUILoader;
43 
44 /**
45  * Settings for libyui
46  *
47  * This singleton-object hold some presets for libyui.
48  **/
49 class YSettings
50 {
51 friend YUILoader;
52 
53 public:
54  /**
55  * This can be used to set a subdir beneath PLUGINDIR or THEMEDIR,
56  * where your program stores a custom plugin or theme.
57  *
58  * Once this is set, it can't be altered. If you do so although an
59  * exception will be thrown.
60  **/
61  static void setProgDir ( std::string directory );
62  /**
63  * Returns the value of your program's subdir.
64  **/
65  static std::string progDir ();
66 
67  /**
68  * This can be used to set a subdir ICONDIR,
69  * where your program stores a custom icons.
70  *
71  * Once this is set, it can't be altered. If you do so although an
72  * exception will be thrown.
73  **/
74  static void setIconDir ( std::string directory );
75  /**
76  * Returns the value of your program's icons subdir.
77  **/
78  static std::string iconDir ();
79 
80  /**
81  * This can be used to set a subdir THEMEDIR,
82  * where your program stores a custom icons.
83  *
84  * Once this is set, it can't be altered. If you do so although an
85  * exception will be thrown.
86  **/
87  static void setThemeDir ( std::string directory );
88  /**
89  * Returns the value of your program's theme subdir.
90  **/
91  static std::string themeDir ();
92 
93  /**
94  * This can be used to set a subdir LOCALEDIR,
95  * where your program stores translations
96  *
97  * Once this is set, it can't be altered. If you do so although an
98  * exception will be thrown.
99  **/
100  static void setLocaleDir ( std::string directory );
101  /**
102  * Returns the value of your program's locale subdir.
103  **/
104  static std::string localeDir ();
105 
106  /**
107  * This can be used to set the loaded UI-backend.
108  *
109  * Once this is set, it can't be altered. If you do so although an
110  * exception will be thrown.
111  **/
112  static void loadedUI ( std::string ui );
113  /**
114  * Returns the value of the loaded UI-backend.
115  **/
116  static std::string loadedUI ();
117 
118 protected:
119  /**
120  * This can be used to set the loaded UI-backend.
121  *
122  * Once this is set, it can't be altered, except if you force it.
123  * If you do so without force an exception will be thrown.
124  **/
125  static void loadedUI ( std::string ui, bool force );
126 
127 private:
128  static std::string _progDir;
129  static std::string _iconDir;
130  static std::string _themeDir;
131  static std::string _localeDir;
132  static std::string _loadedUI;
133 
134  YSettings ();
135  YSettings ( const YSettings& );
136  ~YSettings ();
137 };
138 
139 #endif // YSettings_h
static std::string localeDir()
Returns the value of your program&#39;s locale subdir.
Definition: YSettings.cc:158
static void setIconDir(std::string directory)
This can be used to set a subdir ICONDIR, where your program stores a custom icons.
Definition: YSettings.cc:80
static void setThemeDir(std::string directory)
This can be used to set a subdir THEMEDIR, where your program stores a custom icons.
Definition: YSettings.cc:109
static std::string loadedUI()
Returns the value of the loaded UI-backend.
Definition: YSettings.cc:195
static void setProgDir(std::string directory)
This can be used to set a subdir beneath PLUGINDIR or THEMEDIR, where your program stores a custom pl...
Definition: YSettings.cc:56
static void setLocaleDir(std::string directory)
This can be used to set a subdir LOCALEDIR, where your program stores translations.
Definition: YSettings.cc:142
Settings for libyui.
Definition: YSettings.h:49
static std::string iconDir()
Returns the value of your program&#39;s icons subdir.
Definition: YSettings.cc:96
static std::string themeDir()
Returns the value of your program&#39;s theme subdir.
Definition: YSettings.cc:125
Class to load one of the concrete UI plug-ins: Qt, NCurses, Gtk.
Definition: YUILoader.h:45
static std::string progDir()
Returns the value of your program&#39;s subdir.
Definition: YSettings.cc:72