Merge with b989fba4c24c34873648df6871da4d0d8cb0a6d1
This commit is contained in:
@@ -265,6 +265,8 @@ void Options::setDefaults () {
|
||||
toolPanelWidth = 390;
|
||||
browserToolPanelWidth = 430;
|
||||
browserToolPanelHeight = 600;
|
||||
browserToolPanelOpened = true;;
|
||||
browserDirPanelOpened = true;
|
||||
historyPanelWidth = 330;
|
||||
lastScale = 5;
|
||||
panAccelFactor = 5;
|
||||
@@ -686,8 +688,10 @@ if (keyFile.has_group ("GUI")) {
|
||||
if (keyFile.has_key ("GUI", "SaveAsDialogWidth")) saveAsDialogWidth = keyFile.get_integer ("GUI", "SaveAsDialogWidth");
|
||||
if (keyFile.has_key ("GUI", "SaveAsDialogHeight")) saveAsDialogHeight = keyFile.get_integer ("GUI", "SaveAsDialogHeight");
|
||||
if (keyFile.has_key ("GUI", "ToolPanelWidth")) toolPanelWidth = keyFile.get_integer ("GUI", "ToolPanelWidth");
|
||||
if (keyFile.has_key ("GUI", "BrowserToolPanelWidth"))browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth");
|
||||
if (keyFile.has_key ("GUI", "BrowserToolPanelHeight"))browserToolPanelHeight = keyFile.get_integer ("GUI", "BrowserToolPanelHeight");
|
||||
if (keyFile.has_key ("GUI", "BrowserToolPanelWidth")) browserToolPanelWidth = keyFile.get_integer ("GUI", "BrowserToolPanelWidth");
|
||||
if (keyFile.has_key ("GUI", "BrowserToolPanelHeight")) browserToolPanelHeight = keyFile.get_integer ("GUI", "BrowserToolPanelHeight");
|
||||
if (keyFile.has_key ("GUI", "BrowserToolPanelOpened")) browserToolPanelOpened = keyFile.get_boolean ("GUI", "BrowserToolPanelOpened");
|
||||
if (keyFile.has_key ("GUI", "BrowserDirPanelOpened")) browserDirPanelOpened = keyFile.get_boolean ("GUI", "BrowserDirPanelOpened");
|
||||
if (keyFile.has_key ("GUI", "HistoryPanelWidth")) historyPanelWidth = keyFile.get_integer ("GUI", "HistoryPanelWidth");
|
||||
if (keyFile.has_key ("GUI", "LastPreviewScale")) lastScale = keyFile.get_integer ("GUI", "LastPreviewScale");
|
||||
if (keyFile.has_key ("GUI", "PanAccelFactor")) panAccelFactor = keyFile.get_integer ("GUI", "PanAccelFactor");
|
||||
@@ -969,6 +973,8 @@ int Options::saveToFile (Glib::ustring fname) {
|
||||
keyFile.set_integer ("GUI", "ToolPanelWidth", toolPanelWidth);
|
||||
keyFile.set_integer ("GUI", "BrowserToolPanelWidth", browserToolPanelWidth);
|
||||
keyFile.set_integer ("GUI", "BrowserToolPanelHeight", browserToolPanelHeight);
|
||||
keyFile.set_boolean ("GUI", "BrowserToolPanelOpened", browserToolPanelOpened);
|
||||
keyFile.set_boolean ("GUI", "BrowserDirPanelOpened", browserDirPanelOpened);
|
||||
keyFile.set_integer ("GUI", "HistoryPanelWidth", historyPanelWidth);
|
||||
keyFile.set_integer ("GUI", "LastPreviewScale", lastScale);
|
||||
keyFile.set_integer ("GUI", "PanAccelFactor", panAccelFactor);
|
||||
@@ -1094,28 +1100,34 @@ int Options::saveToFile (Glib::ustring fname) {
|
||||
}
|
||||
}
|
||||
|
||||
void Options::load () {
|
||||
bool Options::load () {
|
||||
|
||||
// Find the application data path
|
||||
// Find the application data path
|
||||
|
||||
#ifdef WIN32
|
||||
const gchar* dataPath;
|
||||
Glib::ustring dPath;
|
||||
const gchar* path;
|
||||
Glib::ustring dPath;
|
||||
|
||||
dataPath = g_getenv("RT_CACHE");
|
||||
if (dataPath != NULL)
|
||||
rtdir = Glib::ustring(dataPath);
|
||||
else {
|
||||
path = g_getenv("RT_SETTINGS");
|
||||
if (path != NULL) {
|
||||
rtdir = Glib::ustring(path);
|
||||
if (!Glib::path_is_absolute(rtdir))
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
#ifdef WIN32
|
||||
WCHAR pathW[MAX_PATH]={0}; char pathA[MAX_PATH];
|
||||
|
||||
if (SHGetSpecialFolderPathW(NULL,pathW,CSIDL_LOCAL_APPDATA,false)) {
|
||||
WideCharToMultiByte(CP_UTF8,0,pathW,-1,pathA,MAX_PATH,0,0);
|
||||
rtdir = Glib::build_filename(Glib::ustring(pathA), Glib::ustring(CACHEFOLDERNAME));
|
||||
}
|
||||
}
|
||||
#else
|
||||
rtdir = Glib::build_filename(Glib::ustring(g_get_user_config_dir ()), Glib::ustring(CACHEFOLDERNAME));
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
rtdir = Glib::build_filename(Glib::ustring(g_get_user_config_dir ()), Glib::ustring(CACHEFOLDERNAME));
|
||||
#endif
|
||||
}
|
||||
|
||||
if (options.rtSettings.verbose)
|
||||
printf("Settings directory (rtdir) = %s\n", rtdir.c_str());
|
||||
|
||||
// Set the cache folder in RT's base folder
|
||||
cacheBaseDir = Glib::build_filename(argv0, "cache");
|
||||
@@ -1123,6 +1135,22 @@ void Options::load () {
|
||||
// Read the global option file (the one located in the application's base folder)
|
||||
options.readFromFile (Glib::build_filename(argv0, "options"));
|
||||
|
||||
// Modify the path of the cache folder to the one provided in RT_CACHE environment variable
|
||||
path = g_getenv("RT_CACHE");
|
||||
if (path != NULL) {
|
||||
cacheBaseDir = Glib::ustring(path);
|
||||
if (!Glib::path_is_absolute(cacheBaseDir))
|
||||
return false;
|
||||
}
|
||||
// No environment variable provided, so falling back to the multi user mode, is enabled
|
||||
else if (options.multiUser) {
|
||||
#ifdef WIN32
|
||||
cacheBaseDir = Glib::build_filename(rtdir, "cache");
|
||||
#else
|
||||
cacheBaseDir = Glib::build_filename(Glib::ustring(g_get_user_cache_dir()), Glib::ustring(CACHEFOLDERNAME));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Check if RT is installed in Multi-User mode
|
||||
if (options.multiUser) {
|
||||
// Read the user option file (the one located somewhere in the user's home folder)
|
||||
@@ -1133,12 +1161,6 @@ void Options::load () {
|
||||
// Save the option file
|
||||
options.saveToFile (Glib::build_filename(rtdir, "options"));
|
||||
}
|
||||
// Modify the path of the cache folder to the user's personal folder
|
||||
#ifdef WIN32
|
||||
cacheBaseDir = Glib::build_filename(rtdir, "cache");
|
||||
#else
|
||||
cacheBaseDir = Glib::build_filename(Glib::ustring(g_get_user_cache_dir()), Glib::ustring(CACHEFOLDERNAME));
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
// make sure .local/share exists on OS X so we don't get problems with recently-used.xbel
|
||||
@@ -1146,6 +1168,9 @@ void Options::load () {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (options.rtSettings.verbose)
|
||||
printf("Cache directory (cacheBaseDir) = %s\n", cacheBaseDir.c_str());
|
||||
|
||||
// Update profile's path and recreate it if necessary
|
||||
options.updatePaths();
|
||||
|
||||
@@ -1212,6 +1237,8 @@ void Options::load () {
|
||||
langMgr.load(localeTranslation, new MultiLangMgr(languageTranslation, new MultiLangMgr(defaultTranslation)));
|
||||
|
||||
rtengine::init (&options.rtSettings, argv0, rtdir);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Options::save () {
|
||||
|
Reference in New Issue
Block a user