Refactored settings backup, moved files and folders to back up into the preferences panel XUI file, more commenting, safeguarding, crash fixes. FIRE-1723

meow-7.2.2
ziree 2013-01-10 17:51:13 +01:00
parent b6812a32f3
commit 47300276ca
5 changed files with 556 additions and 139 deletions

View File

@ -9480,8 +9480,6 @@ Change of this parameter will affect the layout of buttons in notification toast
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
<key>Backup</key>
<integer>0</integer>
</map>
<key>QAModeEventHostPort</key>
<map>
@ -19669,6 +19667,30 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<string />
</map>
<key>RestoreGlobalSettings</key>
<map>
<key>Comment</key>
<string>Defines if the global settings should be restored when doing a settings restore.</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>RestorePerAccountSettings</key>
<map>
<key>Comment</key>
<string>Defines if the per account settings should be restored when doing a settings restore.</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<!-- <FS:Zi> -->
</map>
</llsd>

View File

@ -127,6 +127,7 @@
// <FS:Zi> Backup Settings
#include "llline.h"
#include "llscrolllistctrl.h"
#include "llspellcheck.h"
#include "lltoolbarview.h"
#include "llwaterparammanager.h"
@ -493,6 +494,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.SetBackupSettingsPath", boost::bind(&LLFloaterPreference::onClickSetBackupSettingsPath, this));
mCommitCallbackRegistrar.add("Pref.BackupSettings", boost::bind(&LLFloaterPreference::onClickBackupSettings, this));
mCommitCallbackRegistrar.add("Pref.RestoreSettings", boost::bind(&LLFloaterPreference::onClickRestoreSettings, this));
mCommitCallbackRegistrar.add("Pref.BackupSelectAll", boost::bind(&LLFloaterPreference::onClickSelectAll, this));
mCommitCallbackRegistrar.add("Pref.BackupDeselectAll", boost::bind(&LLFloaterPreference::onClickDeselectAll, this));
// </FS:Zi>
gSavedSettings.getControl("NameTagShowUsernames")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
@ -505,34 +508,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
gSavedSettings.getControl("FSPublishRadarTag")->getCommitSignal()->connect(boost::bind(&handlePublishRadarTagOptionChanged, _2));
LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
// <FS:Zi> Backup Settings
// make a list of global files to copy
mGlobalFiles.push_back("bin_conf.dat"); // login credentials and accounts
mGlobalFiles.push_back("colors.xml");
mGlobalFiles.push_back("ignorable_dialogs.xml");
mGlobalFiles.push_back("grids.user.xml");
mGlobalFiles.push_back("autoreplace.xml");
// make a list of per account files to copy
mPerAccountFiles.push_back("asset_blacklist.xml");
mPerAccountFiles.push_back("filters.xml");
mPerAccountFiles.push_back("landmarks_sorting.xml");
mPerAccountFiles.push_back("medialist.xml");
mPerAccountFiles.push_back("muted_groups.xml");
mPerAccountFiles.push_back("toolbars.xml");
mPerAccountFiles.push_back("volume_settings.xml"); // voice chat volumes
mPerAccountFiles.push_back("teleport_history.txt");
// make a list of folders to copy (flat file, non recursive)
mGlobalFolders.push_back("beams"); // custom selection beams
mGlobalFolders.push_back("beamsColors"); // custom selection beam colors
mGlobalFolders.push_back("dictionaries"); // user defined words/ignores
mGlobalFolders.push_back("windlight"); // base windlight settings folder
mGlobalFolders.push_back("windlight/days"); // windlight day cycles
mGlobalFolders.push_back("windlight/skies"); // windlight sky presets
mGlobalFolders.push_back("windlight/water"); // windlight water presets
// </FS:Zi>
}
void LLFloaterPreference::processProperties( void* pData, EAvatarProcessorType type )
@ -2994,28 +2969,36 @@ void LLPanelPreferenceSkins::refreshSkinThemeList()
// <FS:Zi> Backup Settings
// copied from llxfer_file.cpp - Hopefully this will be part of LLFile some day -Zi
// added a safeguard so the destination file is only created when the source file exists -Zi
S32 copy_prefs_file(const std::string& from, const std::string& to)
{
llwarns << "copying " << from << " to " << to << llendl;
S32 rv = 0;
LLFILE* in = LLFile::fopen(from, "rb"); /*Flawfinder: ignore*/
if(!in)
{
llwarns << "couldn't open source file " << from << " - copy aborted." << llendl;
return -1;
}
LLFILE* out = LLFile::fopen(to, "wb"); /*Flawfinder: ignore*/
if(in && out)
if(!out)
{
S32 read = 0;
const S32 COPY_BUFFER_SIZE = 16384;
U8 buffer[COPY_BUFFER_SIZE];
while(((read = fread(buffer, 1, sizeof(buffer), in)) > 0)
&& (fwrite(buffer, 1, read, out) == (U32)read)); /* Flawfinder : ignore */
if(ferror(in) || ferror(out)) rv = -2;
}
else
{
llwarns << "copy failed. in: " << in << " out: " << out << llendl;
rv = -1;
fclose(in);
llwarns << "couldn't open destination file " << to << " - copy aborted." << llendl;
return -1;
}
S32 read = 0;
const S32 COPY_BUFFER_SIZE = 16384;
U8 buffer[COPY_BUFFER_SIZE];
while(((read = fread(buffer, 1, sizeof(buffer), in)) > 0)
&& (fwrite(buffer, 1, read, out) == (U32)read)); /* Flawfinder : ignore */
if(ferror(in) || ferror(out)) rv = -2;
if(in) fclose(in);
if(out) fclose(out);
return rv;
}
@ -3068,17 +3051,6 @@ void LLFloaterPreference::onClickBackupSettings()
return;
}
// get path and file names to the relevant settings files
std::string userlower=gDirUtilp->getBaseFileName(gDirUtilp->getLindenUserDir(),false);
std::string backup_per_account_folder=dir_name+gDirUtilp->getDirDelimiter()+userlower;
std::string backup_global_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,
LLAppViewer::instance()->getSettingsFilename("Default","Global"));
std::string backup_per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
std::string per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
// define a couple of control groups to store the settings to back up
LLControlGroup backup_global_controls("BackupGlobal");
LLControlGroup backup_per_account_controls("BackupPerAccount");
@ -3125,21 +3097,41 @@ void LLFloaterPreference::onClickBackupSettings()
// set it to save defaults, too (FALSE), because our declaration automatically
// makes the value default
std::string backup_global_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,
LLAppViewer::instance()->getSettingsFilename("Default","Global"));
llwarns << "saving backup global settings" << llendl;
backup_global_controls.saveToFile(backup_global_name,FALSE);
for(S32 index=0;index<mGlobalFiles.size();index++)
// Get scroll list control that holds the list of global files
LLScrollListCtrl* globalScrollList=getChild<LLScrollListCtrl>("restore_global_files_list");
// Pull out all data
std::vector<LLScrollListItem*> globalFileList=globalScrollList->getAllData();
// Go over each entry
for(S32 index=0;index<globalFileList.size();index++)
{
llwarns << "copying global file " << mGlobalFiles[index] << llendl;
// Get the next item in the list
LLScrollListItem* item=globalFileList[index];
// Don't bother with the checkbox and get the path, since we back up all files
// and only restore selectively
std::string file=item->getColumn(2)->getValue().asString();
llwarns << "copying global file " << file << llendl;
copy_prefs_file(
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,mGlobalFiles[index]),
gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,mGlobalFiles[index]));
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,file),
gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,file));
}
// Only back up per-account settings when the path is available, meaning, the user
// has logged in
std::string per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
if(!per_account_name.empty())
{
// get path and file names to the relevant settings files
std::string userlower=gDirUtilp->getBaseFileName(gDirUtilp->getLindenUserDir(),false);
std::string backup_per_account_folder=dir_name+gDirUtilp->getDirDelimiter()+userlower;
std::string backup_per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
llwarns << "copying per account settings" << llendl;
// create per-user folder if it doesn't exist yet
LLFile::mkdir(backup_per_account_folder.c_str());
@ -3154,29 +3146,50 @@ void LLFloaterPreference::onClickBackupSettings()
llwarns << "saving backup per account settings" << llendl;
backup_per_account_controls.saveToFile(backup_per_account_name,FALSE);
for(S32 index=0;index<mPerAccountFiles.size();index++)
// Get scroll list control that holds the list of per account files
LLScrollListCtrl* perAccountScrollList=getChild<LLScrollListCtrl>("restore_per_account_files_list");
// Pull out all data
std::vector<LLScrollListItem*> perAccountFileList=perAccountScrollList->getAllData();
// Go over each entry
for(S32 index=0;index<perAccountFileList.size();index++)
{
llwarns << "copying per account file " << mPerAccountFiles[index] << llendl;
// Get the next item in the list
LLScrollListItem* item=perAccountFileList[index];
// Don't bother with the checkbox and get the path, since we back up all files
// and only restore selectively
std::string file=item->getColumn(2)->getValue().asString();
llwarns << "copying per account file " << file << llendl;
copy_prefs_file(
gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,mPerAccountFiles[index]),
gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,mPerAccountFiles[index]));
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,file),
gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,file));
}
}
else
llwarns << backup_per_account_folder << " is not a folder. Per account settings save aborted." << llendl;
}
// copy global folders and their contents
for(S32 index=0;index<mGlobalFolders.size();index++)
// Get scroll list control that holds the list of global folders
LLScrollListCtrl* globalFoldersScrollList=getChild<LLScrollListCtrl>("restore_global_folders_list");
// Pull out all data
std::vector<LLScrollListItem*> globalFoldersList=globalFoldersScrollList->getAllData();
// Go over each entry
for(S32 index=0;index<globalFoldersList.size();index++)
{
std::string file_name;
std::string folder_name=gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,mGlobalFolders[index])+gDirUtilp->getDirDelimiter();
std::string backup_folder_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,mGlobalFolders[index])+gDirUtilp->getDirDelimiter();
// Get the next item in the list
LLScrollListItem* item=globalFoldersList[index];
// Don't bother with the checkbox and get the path, since we back up all folders
// and only restore selectively
std::string folder=item->getColumn(2)->getValue().asString();
llwarns << "backing up folder: " << folder_name << llendl;
std::string folder_name=gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,folder)+gDirUtilp->getDirDelimiter();
std::string backup_folder_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,folder)+gDirUtilp->getDirDelimiter();
llwarns << "backing up global folder: " << folder_name << llendl;
// create folder if it's not there already
LLFile::mkdir(backup_folder_name.c_str());
std::string file_name;
while(gDirUtilp->getNextFileInDir(folder_name,"*",file_name))
{
llwarns << "found entry: " << folder_name+file_name << llendl;
@ -3185,8 +3198,10 @@ void LLFloaterPreference::onClickBackupSettings()
{
copy_prefs_file(folder_name+file_name,backup_folder_name+file_name);
}
llwarns << "skipping subfolder " << folder_name+file_name << llendl;
}
}
LLNotificationsUtil::add("BackupFinished");
}
@ -3219,7 +3234,7 @@ void LLFloaterPreference:: doRestoreSettings(const LLSD& notification,const LLSD
onClickSetBackupSettingsPath();
}
// Remember the backup path for next time
// Remember the backup path
dir_name=gSavedSettings.getString("SettingsBackupPath");
// If the backup path is still empty, complain to the user and do nothing else
@ -3241,50 +3256,92 @@ void LLFloaterPreference:: doRestoreSettings(const LLSD& notification,const LLSD
// Close the window so the restored settings can't be destroyed by the user
onBtnOK();
// get path and file names to the relevant settings files
std::string userlower=gDirUtilp->getBaseFileName(gDirUtilp->getLindenUserDir(),false);
std::string backup_per_account_folder=dir_name+gDirUtilp->getDirDelimiter()+userlower;
std::string global_name=gSavedSettings.getString("ClientSettingsFile");
std::string backup_global_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,
LLAppViewer::instance()->getSettingsFilename("Default","Global"));
std::string per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
std::string backup_per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
// start clean
llwarns << "clearing global settings" << llendl;
gSavedSettings.resetToDefaults();
// run restore on global controls
llwarns << "restoring global settings from backup" << llendl;
gSavedSettings.loadFromFile(backup_global_name);
llwarns << "saving global settings" << llendl;
gSavedSettings.saveToFile(global_name,TRUE);
for(S32 index=0;index<mGlobalFiles.size();index++)
if(gSavedSettings.getBOOL("RestoreGlobalSettings"))
{
llwarns << "copying global file " << mGlobalFiles[index] << llendl;
copy_prefs_file(
gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,mGlobalFiles[index]),
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,mGlobalFiles[index]));
// Get path and file names to backup and restore settings path
std::string global_name=gSavedSettings.getString("ClientSettingsFile");
std::string backup_global_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,
LLAppViewer::instance()->getSettingsFilename("Default","Global"));
// start clean
llwarns << "clearing global settings" << llendl;
gSavedSettings.resetToDefaults();
// run restore on global controls
llwarns << "restoring global settings from backup" << llendl;
gSavedSettings.loadFromFile(backup_global_name);
llwarns << "saving global settings" << llendl;
gSavedSettings.saveToFile(global_name,TRUE);
}
// Get scroll list control that holds the list of global files
LLScrollListCtrl* globalScrollList=getChild<LLScrollListCtrl>("restore_global_files_list");
// Pull out all data
std::vector<LLScrollListItem*>globalFileList=globalScrollList->getAllData();
// Go over each entry
for(S32 index=0;index<globalFileList.size();index++)
{
// Get the next item in the list
LLScrollListItem* item=globalFileList[index];
// Look at the first column and make sure it's a checkbox control
LLScrollListCheck* checkbox=dynamic_cast<LLScrollListCheck*>(item->getColumn(0));
if(!checkbox)
continue;
// Only restore if this item is checked on
if (checkbox->getCheckBox()->getValue().asBoolean())
{
// Get the path to restore for this item
std::string file=item->getColumn(2)->getValue().asString();
llwarns << "copying global file " << file << llendl;
copy_prefs_file(
gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,file),
gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,file));
}
}
// Only restore per-account settings when the path is available
std::string per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
if(!per_account_name.empty())
{
llwarns << "copying per account settings" << llendl;
// run restore on per-account controls
gSavedPerAccountSettings.loadFromFile(backup_per_account_name);
gSavedPerAccountSettings.saveToFile(per_account_name,TRUE);
// Get path and file names to the relevant settings files
std::string userlower=gDirUtilp->getBaseFileName(gDirUtilp->getLindenUserDir(),false);
std::string backup_per_account_folder=dir_name+gDirUtilp->getDirDelimiter()+userlower;
std::string backup_per_account_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,
LLAppViewer::instance()->getSettingsFilename("Default","PerAccount"));
for(S32 index=0;index<mPerAccountFiles.size();index++)
if(gSavedSettings.getBOOL("RestorePerAccountSettings"))
{
llwarns << "copying per account file " << mPerAccountFiles[index] << llendl;
copy_prefs_file(
gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,mPerAccountFiles[index]),
gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,mPerAccountFiles[index]));
// run restore on per-account controls
llwarns << "restoring per account settings" << llendl;
gSavedPerAccountSettings.loadFromFile(backup_per_account_name);
llwarns << "saving per account settings" << llendl;
gSavedPerAccountSettings.saveToFile(per_account_name,TRUE);
}
// Get scroll list control that holds the list of per account files
LLScrollListCtrl* perAccountScrollList=getChild<LLScrollListCtrl>("restore_per_account_files_list");
// Pull out all data
std::vector<LLScrollListItem*> perAccountFileList=perAccountScrollList->getAllData();
// Go over each entry
for(S32 index=0;index<perAccountFileList.size();index++)
{
// Get the next item in the list
LLScrollListItem* item=perAccountFileList[index];
// Look at the first column and make sure it's a checkbox control
LLScrollListCheck* checkbox=dynamic_cast<LLScrollListCheck*>(item->getColumn(0));
if(!checkbox)
continue;
// Only restore if this item is checked on
if (checkbox->getCheckBox()->getValue().asBoolean())
{
// Get the path to restore for this item
std::string file=item->getColumn(2)->getValue().asString();
llwarns << "copying per account file " << file << llendl;
copy_prefs_file(
gDirUtilp->getExpandedFilename(LL_PATH_NONE,backup_per_account_folder,file),
gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,file));
}
}
// toolbars get overwritten when LLToolbarView is destroyed, so make sure
@ -3295,35 +3352,104 @@ void LLFloaterPreference:: doRestoreSettings(const LLSD& notification,const LLSD
gToolBarView->loadToolbars(FALSE);
}
// restore global folders and their contents
for(S32 index=0;index<mGlobalFolders.size();index++)
// Get scroll list control that holds the list of global folders
LLScrollListCtrl* globalFoldersScrollList=getChild<LLScrollListCtrl>("restore_global_folders_list");
// Pull out all data
std::vector<LLScrollListItem*> globalFoldersList=globalFoldersScrollList->getAllData();
// Go over each entry
for(S32 index=0;index<globalFoldersList.size();index++)
{
std::string file_name;
std::string folder_name=gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,mGlobalFolders[index])+gDirUtilp->getDirDelimiter();
std::string backup_folder_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,mGlobalFolders[index])+gDirUtilp->getDirDelimiter();
llwarns << "restoring global folder " << folder_name << llendl;
// create folder if it's not there already
LLFile::mkdir(folder_name.c_str());
while(gDirUtilp->getNextFileInDir(folder_name,"*",file_name))
// Get the next item in the list
LLScrollListItem* item=globalFoldersList[index];
// Look at the first column and make sure it's a checkbox control
LLScrollListCheck* checkbox=dynamic_cast<LLScrollListCheck*>(item->getColumn(0));
if(!checkbox)
continue;
// Only restore if this item is checked on
if (checkbox->getCheckBox()->getValue().asBoolean())
{
llwarns << "found entry: " << backup_folder_name+file_name << llendl;
// only restore files, not subfolders
if(LLFile::isfile(backup_folder_name+file_name.c_str()))
// Get the path to restore for this item
std::string folder=item->getColumn(2)->getValue().asString();
std::string folder_name=gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,folder)+gDirUtilp->getDirDelimiter();
std::string backup_folder_name=gDirUtilp->getExpandedFilename(LL_PATH_NONE,dir_name,folder)+gDirUtilp->getDirDelimiter();
llwarns << "restoring global folder: " << folder_name << llendl;
// create folder if it's not there already
LLFile::mkdir(folder_name.c_str());
std::string file_name;
while(gDirUtilp->getNextFileInDir(backup_folder_name,"*",file_name))
{
copy_prefs_file(backup_folder_name+file_name,folder_name+file_name);
llwarns << "found entry: " << backup_folder_name+file_name << llendl;
// only restore files, not subfolders
if(LLFile::isfile(backup_folder_name+file_name.c_str()))
{
copy_prefs_file(backup_folder_name+file_name,folder_name+file_name);
}
else
llwarns << "skipping subfolder " << backup_folder_name+file_name << llendl;
}
}
}
// Tell the user we have finished restoring settings and the viewer must shut down
LLNotificationsUtil::add("RestoreFinished",LLSD(),LLSD(),boost::bind(&LLFloaterPreference::onQuitConfirmed,this,_1,_2));
}
// User confirmed the shutdown and we proceed
void LLFloaterPreference::onQuitConfirmed(const LLSD& notification,const LLSD& response)
{
// Make sure the viewer will not save any settings on exit, so our copied files will survive
LLAppViewer::instance()->setSaveSettingsOnExit(FALSE);
// Quit the viewer so all gets saved immediately
llwarns << "setting to quit" << llendl;
// And quit the viewer so all gets saved immediately
LLApp::instance()->setQuitting();
}
void LLFloaterPreference::onClickSelectAll()
{
doSelect(TRUE);
}
void LLFloaterPreference::onClickDeselectAll()
{
doSelect(FALSE);
}
void LLFloaterPreference::doSelect(BOOL all)
{
// Get scroll list control that holds the list of global files
LLScrollListCtrl* globalScrollList=getChild<LLScrollListCtrl>("restore_global_files_list");
// Get scroll list control that holds the list of per account files
LLScrollListCtrl* perAccountScrollList=getChild<LLScrollListCtrl>("restore_per_account_files_list");
// Get scroll list control that holds the list of global folders
LLScrollListCtrl* globalFoldersScrollList=getChild<LLScrollListCtrl>("restore_global_folders_list");
applySelection(globalScrollList,all);
applySelection(perAccountScrollList,all);
applySelection(globalFoldersScrollList,all);
}
void LLFloaterPreference::applySelection(LLScrollListCtrl* control,BOOL all)
{
// Pull out all data
std::vector<LLScrollListItem*> itemList=control->getAllData();
// Go over each entry
for(S32 index=0;index<itemList.size();index++)
{
// Get the next item in the list
LLScrollListItem* item=itemList[index];
// Check/uncheck the box only when the item is enabled
if(item->getEnabled())
{
// Look at the first column and make sure it's a checkbox control
LLScrollListCheck* checkbox=dynamic_cast<LLScrollListCheck*>(item->getColumn(0));
if(checkbox)
checkbox->getCheckBox()->setValue(all);
}
}
}
// </FS:Zi>
#ifdef HAS_OPENSIM_SUPPORT// <FS:AW optional opensim support>

View File

@ -200,10 +200,16 @@ public:
// <FS:Zi> Backup settings
void onClickSetBackupSettingsPath();
void onClickSelectAll();
void onClickDeselectAll();
void onClickBackupSettings();
void onClickRestoreSettings();
void doSelect(BOOL all); // calls applySelection for each list
void applySelection(LLScrollListCtrl* control,BOOL all); // selects or deselects all items in a scroll list
void doRestoreSettings(const LLSD& notification,const LLSD& response); // callback for restore dialog
// </FS:Zi>
void onQuitConfirmed(const LLSD& notification,const LLSD& response); // callback for finished restore dialog
// </FS:Zi>
private:
static std::string sSkin;
bool mClickActionDirty; ///< Set to true when the click/double-click options get changed by user.
@ -216,13 +222,6 @@ private:
std::string mDirectoryVisibility;
LLAvatarData mAvatarProperties;
// <FS:Zi> Backup settings
protected:
std::vector<std::string> mGlobalFiles; // list of global settings files to copy
std::vector<std::string> mGlobalFolders; // list of global folders to copy
std::vector<std::string> mPerAccountFiles; // list of per account settings files to copy
// </FS:Zi>
};
class LLPanelPreference : public LLPanel

View File

@ -9434,7 +9434,17 @@ Settings restore requires a viewer restart. Do you want to restore your settings
<usetemplate
name="okcancelbuttons"
notext="Cancel"
yestext="Restore"/>
yestext="Restore and Quit"/>
</notification>
<notification
icon="alertmodal.tga"
name="RestoreFinished"
type="alertmodal">
Restore complete! Please restart your viewer now.
<usetemplate
name="okbutton"
yestext="Quit"/>
</notification>
<!-- </FS:Zi> -->

View File

@ -14,7 +14,7 @@
name="backup_path_label"
layout="topleft"
follows="left|top"
top="20"
top="10"
left="30"
width="80"
height="20">
@ -44,8 +44,8 @@ Backup Path:
<layout_stack
name="ls_account_specific_label"
follows="top|left|right"
height="150"
follows="all"
height="350"
orientation="vertical"
top_pad="10"
left="30"
@ -82,15 +82,276 @@ You are currently logged out. Be aware that your account specific settings can o
follows="all"
left="1"
right="-1"
height="100"
height="210"
user_resize="false"
auto_resize="true"
layout="topleft">
<text
name="account_specific_label"
follows="top|left|right"
layout="topleft"
left="0"
right="-1"
top="0"
word_wrap="false"
height="18">
Settings groups to be restored (backup will always save all):
</text>
<layout_stack
name="ls_list_view_stack"
follows="top|left|right"
height="190"
orientation="horizontal"
top_pad="4"
left="1"
right="-1"
layout="topleft">
<layout_panel
name="lp_restore_global_files"
follows="all"
user_resize="false"
auto_resize="true"
layout="topleft">
<scroll_list
name="restore_global_files_list"
layout="topleft"
follows="all"
left="1"
top="0"
right="-1"
height="180"
draw_heading="true"
multi_select="false">
<column label="" name="restore_global_files_check" width="16" />
<column label="Global Files:" name="restore_global_files_label" />
<column label="Value" name="value" width="-1" />
<row>
<column type="checkbox" column="restore_global_files_check" value="true" />
<column column="restore_global_files_label">Login Credentials</column>
<column column="value">bin_conf.dat</column>
</row>
<row>
<column type="checkbox" column="restore_global_files_check" value="true" />
<column column="restore_global_files_label">Colors</column>
<column column="value">colors.xml</column>
</row>
<row>
<column type="checkbox" column="restore_global_files_check" value="true" />
<column column="restore_global_files_label">Ignorable Dialogs</column>
<column column="value">ignorable_dialogs.xml</column>
</row>
<row>
<column type="checkbox" column="restore_global_files_check" value="true" />
<column column="restore_global_files_label">User-Defined Grids</column>
<column column="value">grids.user.xml</column>
</row>
<row>
<column type="checkbox" column="restore_global_files_check" value="true" />
<column column="restore_global_files_label">Autoreplace</column>
<column column="value">autoreplace.xml</column>
</row>
</scroll_list>
</layout_panel>
<layout_panel
name="lp_restore_per_account_files"
follows="all"
user_resize="false"
auto_resize="true"
layout="topleft">
<scroll_list
name="restore_per_account_files_list"
layout="topleft"
follows="all"
left="1"
top="0"
right="-1"
height="180"
draw_heading="true"
multi_select="false">
<column label="" name="restore_per_account_files_check" width="16" />
<column label="Per Account Files:" name="restore_per_account_files_label" />
<column label="Value" name="value" width="-1" />
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Asset Blacklist</column>
<column column="value">asset_blacklist.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Contact Sets</column>
<column column="value">settings_friends_groups.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Inventory Filters</column>
<column column="value">filters.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Favorites Sort Order</column>
<column column="value">landmarks_sorting.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Media Black/Whitelist</column>
<column column="value">medialist.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Muted Group Chats</column>
<column column="value">muted_groups.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Toolbars</column>
<column column="value">toolbars.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Voice Chat Volumes</column>
<column column="value">volume_settings.xml</column>
</row>
<row>
<column type="checkbox" column="restore_per_account_files_check" value="true" />
<column column="restore_per_account_files_label">Teleport History</column>
<column column="value">teleport_history.xml</column>
</row>
</scroll_list>
</layout_panel>
<layout_panel
name="lp_restore_folders"
follows="all"
user_resize="false"
auto_resize="true"
layout="topleft">
<text
name="restore_folders_label"
layout="topleft"
follows="left|right|top"
left="1"
top="0"
right="-1"
height="16">
Folders:
</text>
<scroll_list
name="restore_global_folders_list"
layout="topleft"
follows="all"
left="1"
top="0"
right="-1"
height="180"
draw_heading="true"
multi_select="false">
<column label="" name="restore_global_folders_check" width="16" />
<column label="Folders:" name="restore_global_folders_label" />
<column label="Value" name="value" width="-1" />
<row>
<column type="checkbox" column="restore_global_folders_check" value="true" />
<column column="restore_global_folders_label">Selection Beams</column>
<column column="value">beams</column>
</row>
<row>
<column type="checkbox" column="restore_global_folders_check" value="true" />
<column column="restore_global_folders_label">Selection Beam Colors</column>
<column column="value">beamsColors</column>
</row>
<row>
<column type="checkbox" column="restore_global_folders_check" value="true" />
<column column="restore_global_folders_label">Custom Spell Check</column>
<column column="value">dictionaries</column>
</row>
<!-- We must hae this entry before the other windlight entries to have the
windlight/ base folder created. Since we can't hide rows make it so the
user can't deselect it at least -->
<row enabled="false">
<column type="checkbox" column="restore_global_folders_check" value="true" enabled="false" />
<column column="restore_global_folders_label">Windlight (Mandatory)</column>
<column column="value">windlight</column>
</row>
<row>
<column type="checkbox" column="restore_global_folders_check" value="true" />
<column column="restore_global_folders_label">Windlight Day Cycles</column>
<column column="value">windlight/days</column>
</row>
<row>
<column type="checkbox" column="restore_global_folders_check" value="true" />
<column column="restore_global_folders_label">Windlight Skies</column>
<column column="value">windlight/skies</column>
</row>
<row>
<column type="checkbox" column="restore_global_folders_check" value="true" />
<column column="restore_global_folders_label">Windlight Waters</column>
<column column="value">windlight/water</column>
</row>
</scroll_list>
</layout_panel>
</layout_stack>
<button
layout="topleft"
top_pad="5"
follows="left|top"
height="20"
label="Select all"
left="30"
name="select_all_button"
width="120" >
<button.commit_callback
function="Pref.BackupSelectAll" />
</button>
<button
layout="topleft"
right="-30"
top_delta="0"
follows="right|top"
height="20"
label="Deselect All"
name="deselect_all_button"
width="120" >
<button.commit_callback
function="Pref.BackupDeselectAll" />
</button>
<check_box
label="Restore global settings"
layout="topleft"
follows="top|left"
top_pad="10"
left="30"
width="200"
height="16"
name="restore_global_settings_checkbox"
control_name="RestoreGlobalSettings" />
<check_box
label="Restore per account settings"
layout="topleft"
follows="top|left"
left_pad="0"
width="200"
height="16"
name="restore_per_account_settings_checkbox"
control_name="RestorePerAccountSettings" />
<button
enabled_control="SettingsBackupPath"
layout="topleft"
top_pad="5"
top_pad="10"
follows="left|top"
height="20"
label="Backup Settings"
@ -106,7 +367,7 @@ You are currently logged out. Be aware that your account specific settings can o
layout="topleft"
right="-50"
top_delta="0"
follows="left|top"
follows="right|top"
height="20"
label="Restore Settings"
name="restore_settings"
@ -118,15 +379,14 @@ You are currently logged out. Be aware that your account specific settings can o
</layout_panel>
</layout_stack>
<!-- Enable only for debugging of show/hide warning text
<!-- Enable only for debugging of show/hide warning text -->
<check_box
label="Hide Warning"
layout="topleft"
follows="top|left"
follows="bottom|left"
top="-20"
width="100"
height="16"
name="Debug Show/Hide - Don't use in production"
control_name="PerAccountSettingsFile" />
-->
</panel>