Make the settings backup panel a proper preferences panel and register it as such
parent
e75939344f
commit
e6882176d2
|
|
@ -480,14 +480,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
|
|||
|
||||
mCommitCallbackRegistrar.add("Pref.ClickActionChange", boost::bind(&LLFloaterPreference::onClickActionChange, this));
|
||||
|
||||
// <FS:Zi> Backup settings
|
||||
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));
|
||||
gSavedSettings.getControl("NameTagShowFriends")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged, _2));
|
||||
// <FS:CR>
|
||||
|
|
@ -669,12 +661,6 @@ BOOL LLFloaterPreference::postBuild()
|
|||
// <FS:Ansariel> Show email address in preferences (FIRE-1071)
|
||||
getChild<LLCheckBoxCtrl>("send_im_to_email")->setLabelArg("[EMAIL]", getString("LoginToChange"));
|
||||
|
||||
// <FS:Zi> Backup Settings
|
||||
// Apparently, line editors don't update with their settings controls, so do that manually here
|
||||
std::string dir_name=gSavedSettings.getString("SettingsBackupPath");
|
||||
getChild<LLLineEditor>("settings_backup_path")->setValue(dir_name);
|
||||
// </FS:Zi>
|
||||
|
||||
// <FS:Kadah> Load the list of font settings
|
||||
populateFontSelectionCombo();
|
||||
// </FS:Kadah>
|
||||
|
|
@ -1098,7 +1084,7 @@ void LLFloaterPreference::onBtnOK()
|
|||
if(mGotPersonalInfo)
|
||||
{
|
||||
gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -3260,16 +3246,38 @@ S32 copy_prefs_file(const std::string& from, const std::string& to)
|
|||
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 */
|
||||
&& (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;
|
||||
}
|
||||
|
||||
void LLFloaterPreference::onClickSetBackupSettingsPath()
|
||||
static LLRegisterPanelClassWrapper<FSPanelPreferenceBackup> t_pref_backup("panel_preference_backup");
|
||||
|
||||
FSPanelPreferenceBackup::FSPanelPreferenceBackup() : LLPanelPreference()
|
||||
{
|
||||
mCommitCallbackRegistrar.add("Pref.SetBackupSettingsPath", boost::bind(&FSPanelPreferenceBackup::onClickSetBackupSettingsPath, this));
|
||||
mCommitCallbackRegistrar.add("Pref.BackupSettings", boost::bind(&FSPanelPreferenceBackup::onClickBackupSettings, this));
|
||||
mCommitCallbackRegistrar.add("Pref.RestoreSettings", boost::bind(&FSPanelPreferenceBackup::onClickRestoreSettings, this));
|
||||
mCommitCallbackRegistrar.add("Pref.BackupSelectAll", boost::bind(&FSPanelPreferenceBackup::onClickSelectAll, this));
|
||||
mCommitCallbackRegistrar.add("Pref.BackupDeselectAll", boost::bind(&FSPanelPreferenceBackup::onClickDeselectAll, this));
|
||||
}
|
||||
|
||||
BOOL FSPanelPreferenceBackup::postBuild()
|
||||
{
|
||||
// <FS:Zi> Backup Settings
|
||||
// Apparently, line editors don't update with their settings controls, so do that manually here
|
||||
std::string dir_name=gSavedSettings.getString("SettingsBackupPath");
|
||||
getChild<LLLineEditor>("settings_backup_path")->setValue(dir_name);
|
||||
// </FS:Zi>
|
||||
|
||||
return LLPanelPreference::postBuild();
|
||||
}
|
||||
|
||||
void FSPanelPreferenceBackup::onClickSetBackupSettingsPath()
|
||||
{
|
||||
std::string dir_name=gSavedSettings.getString("SettingsBackupPath");
|
||||
LLDirPicker& picker=LLDirPicker::instance();
|
||||
|
|
@ -3284,7 +3292,7 @@ void LLFloaterPreference::onClickSetBackupSettingsPath()
|
|||
getChild<LLLineEditor>("settings_backup_path")->setValue(dir_name);
|
||||
}
|
||||
|
||||
void LLFloaterPreference::onClickBackupSettings()
|
||||
void FSPanelPreferenceBackup::onClickBackupSettings()
|
||||
{
|
||||
llwarns << "entered" << llendl;
|
||||
// Get settings backup path
|
||||
|
|
@ -3472,13 +3480,13 @@ void LLFloaterPreference::onClickBackupSettings()
|
|||
LLNotificationsUtil::add("BackupFinished");
|
||||
}
|
||||
|
||||
void LLFloaterPreference::onClickRestoreSettings()
|
||||
void FSPanelPreferenceBackup::onClickRestoreSettings()
|
||||
{
|
||||
// ask the user if they really want to restore and restart
|
||||
LLNotificationsUtil::add("SettingsRestoreNeedsLogout",LLSD(),LLSD(),boost::bind(&LLFloaterPreference::doRestoreSettings,this,_1,_2));
|
||||
LLNotificationsUtil::add("SettingsRestoreNeedsLogout",LLSD(),LLSD(),boost::bind(&FSPanelPreferenceBackup::doRestoreSettings,this,_1,_2));
|
||||
}
|
||||
|
||||
void LLFloaterPreference:: doRestoreSettings(const LLSD& notification,const LLSD& response)
|
||||
void FSPanelPreferenceBackup:: doRestoreSettings(const LLSD& notification,const LLSD& response)
|
||||
{
|
||||
llwarns << "entered" << llendl;
|
||||
// Check the user's answer about restore and restart
|
||||
|
|
@ -3521,7 +3529,11 @@ void LLFloaterPreference:: doRestoreSettings(const LLSD& notification,const LLSD
|
|||
}
|
||||
|
||||
// Close the window so the restored settings can't be destroyed by the user
|
||||
onBtnOK();
|
||||
LLFloaterPreference* instance = LLFloaterReg::findTypedInstance<LLFloaterPreference>("preferences");
|
||||
if (instance)
|
||||
{
|
||||
instance->onBtnOK();
|
||||
}
|
||||
|
||||
if(gSavedSettings.getBOOL("RestoreGlobalSettings"))
|
||||
{
|
||||
|
|
@ -3661,11 +3673,11 @@ void LLFloaterPreference:: doRestoreSettings(const LLSD& notification,const LLSD
|
|||
}
|
||||
}
|
||||
// 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));
|
||||
LLNotificationsUtil::add("RestoreFinished",LLSD(),LLSD(),boost::bind(&FSPanelPreferenceBackup::onQuitConfirmed,this,_1,_2));
|
||||
}
|
||||
|
||||
// User confirmed the shutdown and we proceed
|
||||
void LLFloaterPreference::onQuitConfirmed(const LLSD& notification,const LLSD& response)
|
||||
void FSPanelPreferenceBackup::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);
|
||||
|
|
@ -3674,17 +3686,17 @@ void LLFloaterPreference::onQuitConfirmed(const LLSD& notification,const LLSD& r
|
|||
LLAppViewer::instance()->requestQuit();
|
||||
}
|
||||
|
||||
void LLFloaterPreference::onClickSelectAll()
|
||||
void FSPanelPreferenceBackup::onClickSelectAll()
|
||||
{
|
||||
doSelect(TRUE);
|
||||
}
|
||||
|
||||
void LLFloaterPreference::onClickDeselectAll()
|
||||
void FSPanelPreferenceBackup::onClickDeselectAll()
|
||||
{
|
||||
doSelect(FALSE);
|
||||
}
|
||||
|
||||
void LLFloaterPreference::doSelect(BOOL all)
|
||||
void FSPanelPreferenceBackup::doSelect(BOOL all)
|
||||
{
|
||||
// Get scroll list control that holds the list of global files
|
||||
LLScrollListCtrl* globalScrollList=getChild<LLScrollListCtrl>("restore_global_files_list");
|
||||
|
|
@ -3698,7 +3710,7 @@ void LLFloaterPreference::doSelect(BOOL all)
|
|||
applySelection(globalFoldersScrollList,all);
|
||||
}
|
||||
|
||||
void LLFloaterPreference::applySelection(LLScrollListCtrl* control,BOOL all)
|
||||
void FSPanelPreferenceBackup::applySelection(LLScrollListCtrl* control,BOOL all)
|
||||
{
|
||||
// Pull out all data
|
||||
std::vector<LLScrollListItem*> itemList=control->getAllData();
|
||||
|
|
|
|||
|
|
@ -93,8 +93,11 @@ public:
|
|||
void selectPrivacyPanel();
|
||||
void selectChatPanel();
|
||||
|
||||
protected:
|
||||
// <FS:CR> Make onBtnOk() public for settings backup panel
|
||||
//protected:
|
||||
void onBtnOK();
|
||||
protected:
|
||||
// </FS:CR>
|
||||
void onBtnCancel();
|
||||
void onBtnApply();
|
||||
|
||||
|
|
@ -211,18 +214,6 @@ public:
|
|||
static void refreshSkin(void* data);
|
||||
void selectPanel(const LLSD& name);
|
||||
|
||||
// <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
|
||||
void onQuitConfirmed(const LLSD& notification,const LLSD& response); // callback for finished restore dialog
|
||||
// </FS:Zi>
|
||||
private:
|
||||
|
||||
void onDeleteTranscripts();
|
||||
|
|
@ -346,6 +337,28 @@ public:
|
|||
};
|
||||
// [/SL:KB]
|
||||
|
||||
// <FS:CR> Settings Backup
|
||||
class FSPanelPreferenceBackup : public LLPanelPreference
|
||||
{
|
||||
public:
|
||||
FSPanelPreferenceBackup();
|
||||
/*virtual*/ BOOL postBuild();
|
||||
|
||||
protected:
|
||||
// <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
|
||||
void onQuitConfirmed(const LLSD& notification,const LLSD& response); // callback for finished restore dialog
|
||||
// </FS:Zi>
|
||||
};
|
||||
|
||||
#ifdef OPENSIM // <FS:AW optional opensim support>
|
||||
// <FS:AW opensim preferences>
|
||||
class LLPanelPreferenceOpensim : public LLPanelPreference
|
||||
|
|
|
|||
Loading…
Reference in New Issue