33 #include "YSettings.h" 34 #include "YUIException.h" 36 #define YUILogComponent "ui" 38 #include "Libyui_config.h" 42 std::string YSettings::_progDir =
"";
43 std::string YSettings::_iconDir =
"";
44 std::string YSettings::_themeDir =
"";
45 std::string YSettings::_localeDir =
"";
46 std::string YSettings::_loadedUI =
"";
48 YSettings::YSettings()
52 YSettings::~YSettings ()
58 if ( _progDir.empty() )
61 yuiMilestone () <<
"Set progDir to \"" << directory <<
"\"" << endl;
62 yuiMilestone () <<
"progDir is now locked." << endl;
66 yuiMilestone () <<
"Can't set progDir to \"" << directory <<
"\"" << endl;
67 yuiMilestone () <<
"It is locked to: \"" << _progDir <<
"\"" << endl;
68 YUI_THROW (
YUIException (
"progSubDir is locked to: \"" + _progDir +
"\"" ) );
74 yuiMilestone () <<
"progDir: \"" << _progDir <<
"\"" << endl;
82 if ( _iconDir.empty() )
85 yuiMilestone () <<
"Set iconDir to \"" << directory <<
"\"" << endl;
86 yuiMilestone () <<
"iconDir is now locked." << endl;
90 yuiMilestone () <<
"Can't set iconDir to \"" << directory <<
"\"" << endl;
91 yuiMilestone () <<
"It is locked to: \"" << _iconDir <<
"\"" << endl;
92 YUI_THROW (
YUIException (
"progIconDir is locked to: \"" + _iconDir +
"\"" ) );
100 yuiMilestone () <<
"iconDir: \"" << _iconDir <<
"\"" << endl;
103 else if (_progDir.size())
104 return _progDir +
"/icons/";
106 return THEMEDIR
"/icons/";
111 if ( _themeDir.empty() )
113 _themeDir = directory;
114 yuiMilestone () <<
"Set themeDir to \"" << directory <<
"\"" << endl;
115 yuiMilestone () <<
"themeDir is now locked." << endl;
119 yuiMilestone () <<
"Can't set themeDir to \"" << directory <<
"\"" << endl;
120 yuiMilestone () <<
"It is locked to: \"" << _themeDir <<
"\"" << endl;
121 YUI_THROW (
YUIException (
"themeDir is locked to: \"" + _themeDir +
"\"" ) );
127 if ( _themeDir.size() )
129 yuiMilestone () <<
"themeDir: \"" << _themeDir <<
"\"" << endl;
132 else if ( _progDir.size() )
135 return _progDir +
"/theme/current/wizard/";
138 return THEMEDIR
"/current/wizard/";
144 if ( _localeDir.empty() )
146 _localeDir = directory;
147 yuiMilestone () <<
"Set localeDir to \"" << directory <<
"\"" << endl;
148 yuiMilestone () <<
"localeDir is now locked." << endl;
152 yuiMilestone () <<
"Can't set localeDir to \"" << directory <<
"\"" << endl;
153 yuiMilestone () <<
"It is locked to: \"" << _localeDir <<
"\"" << endl;
154 YUI_THROW (
YUIException (
"localeDir is locked to: \"" + _localeDir +
"\"" ) );
160 if ( _localeDir.size() )
162 yuiMilestone () <<
"localeDir: \"" << _localeDir <<
"\"" << endl;
165 else if ( _progDir.size() )
168 return _progDir +
"/locale/";
171 return "/usr/share/locale/";
176 if ( _loadedUI.empty() || force )
179 yuiMilestone () <<
"Set loadedUI to \"" << ui <<
"\"" << endl;
180 yuiMilestone () <<
"loadedUI is now locked." << endl;
184 yuiMilestone () <<
"Can't set loadedUI to \"" << ui <<
"\"" << endl;
185 yuiMilestone () <<
"It is locked to: \"" << _loadedUI <<
"\"" << endl;
186 YUI_THROW (
YUIException (
"loadedUI is locked to: \"" + _loadedUI +
"\"" ) );
197 yuiMilestone () <<
"loadedUI: \"" << _loadedUI <<
"\"" << endl;
static std::string localeDir()
Returns the value of your program's locale subdir.
static void setIconDir(std::string directory)
This can be used to set a subdir ICONDIR, where your program stores a custom icons.
static void setThemeDir(std::string directory)
This can be used to set a subdir THEMEDIR, where your program stores a custom icons.
static std::string loadedUI()
Returns the value of the loaded UI-backend.
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 setLocaleDir(std::string directory)
This can be used to set a subdir LOCALEDIR, where your program stores translations.
static std::string iconDir()
Returns the value of your program's icons subdir.
static std::string themeDir()
Returns the value of your program's theme subdir.
static std::string progDir()
Returns the value of your program's subdir.
Base class for UI Exceptions.