33 #include "YSettings.h"
34 #include "YUIException.h"
36 #define YUILogComponent "ui"
38 #include "Libyui_config.h"
42 string YSettings::_progDir =
"";
43 string YSettings::_iconDir =
"";
44 string YSettings::_themeDir =
"";
45 string YSettings::_localeDir =
"";
46 string YSettings::_loadedUI =
"";
49 YSettings::YSettings()
54 YSettings::~YSettings ()
60 if ( _progDir.empty() )
63 yuiDebug () <<
"Set progDir to \"" << directory <<
"\"" << endl;
64 yuiDebug () <<
"progDir is now locked." << endl;
68 yuiDebug () <<
"Can't set progDir to \"" << directory <<
"\"" << endl;
69 yuiDebug () <<
"It is locked to: \"" << _progDir <<
"\"" << endl;
70 YUI_THROW (
YUIException (
"progSubDir is locked to: \"" + _progDir +
"\"" ) );
76 yuiDebug () <<
"progDir: \"" << _progDir <<
"\"" << endl;
84 if ( _iconDir.empty() )
87 yuiDebug () <<
"Set iconDir to \"" << directory <<
"\"" << endl;
88 yuiDebug () <<
"iconDir is now locked." << endl;
92 yuiDebug () <<
"Can't set iconDir to \"" << directory <<
"\"" << endl;
93 yuiDebug () <<
"It is locked to: \"" << _iconDir <<
"\"" << endl;
94 YUI_THROW (
YUIException (
"progIconDir is locked to: \"" + _iconDir +
"\"" ) );
103 yuiDebug () <<
"iconDir: \"" << _iconDir <<
"\"" << endl;
106 else if (_progDir.size())
107 return _progDir +
"/icons/";
109 return THEMEDIR
"/icons/";
115 if ( _themeDir.empty() )
117 _themeDir = directory;
118 yuiDebug () <<
"Set themeDir to \"" << directory <<
"\"" << endl;
119 yuiDebug () <<
"themeDir is now locked." << endl;
123 yuiDebug () <<
"Can't set themeDir to \"" << directory <<
"\"" << endl;
124 yuiDebug () <<
"It is locked to: \"" << _themeDir <<
"\"" << endl;
125 YUI_THROW (
YUIException (
"themeDir is locked to: \"" + _themeDir +
"\"" ) );
132 if ( _themeDir.size() )
134 yuiDebug () <<
"themeDir: \"" << _themeDir <<
"\"" << endl;
137 else if ( _progDir.size() )
140 return _progDir +
"/theme/current/wizard/";
143 return THEMEDIR
"/current/wizard/";
149 if ( _localeDir.empty() )
151 _localeDir = directory;
152 yuiDebug () <<
"Set localeDir to \"" << directory <<
"\"" << endl;
153 yuiDebug () <<
"localeDir is now locked." << endl;
157 yuiDebug () <<
"Can't set localeDir to \"" << directory <<
"\"" << endl;
158 yuiDebug () <<
"It is locked to: \"" << _localeDir <<
"\"" << endl;
159 YUI_THROW (
YUIException (
"localeDir is locked to: \"" + _localeDir +
"\"" ) );
165 if ( _localeDir.size() )
167 yuiDebug () <<
"localeDir: \"" << _localeDir <<
"\"" << endl;
170 else if ( _progDir.size() )
173 return _progDir +
"/locale/";
176 return "/usr/share/locale/";
181 if ( _loadedUI.empty() || force )
184 yuiDebug () <<
"Set loadedUI to \"" << ui <<
"\"" << endl;
185 yuiDebug () <<
"loadedUI is now locked." << endl;
189 yuiDebug () <<
"Can't set loadedUI to \"" << ui <<
"\"" << endl;
190 yuiDebug () <<
"It is locked to: \"" << _loadedUI <<
"\"" << endl;
191 YUI_THROW (
YUIException (
"loadedUI is locked to: \"" + _loadedUI +
"\"" ) );
204 yuiDebug () <<
"loadedUI: \"" << _loadedUI <<
"\"" << endl;
static std::string themeDir()
Returns the value of your program's theme subdir.
static std::string iconDir()
Returns the value of your program's icons subdir.
static void setIconDir(std::string directory)
This can be used to set a subdir ICONDIR, where your program stores a custom icons.
static std::string progDir()
Returns the value of your program's subdir.
static std::string loadedUI()
Returns the value of the loaded UI-backend.
static std::string localeDir()
Returns the value of your program's locale subdir.
static void setLocaleDir(std::string directory)
This can be used to set a subdir LOCALEDIR, where your program stores translations.
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...
static void setThemeDir(std::string directory)
This can be used to set a subdir THEMEDIR, where your program stores a custom icons.
Base class for UI Exceptions.