diff --git a/indra/newview/fspanelprefs.cpp b/indra/newview/fspanelprefs.cpp index b5f4cc6ae3..b63458f2e3 100644 --- a/indra/newview/fspanelprefs.cpp +++ b/indra/newview/fspanelprefs.cpp @@ -25,50 +25,52 @@ */ #include "llviewerprecompiledheaders.h" + #include "fspanelprefs.h" -#include "llcombobox.h" -#include "llcolorswatch.h" -#include "llcheckboxctrl.h" -#include "llviewercontrol.h" -#include "llfloaterreg.h" -#include "lggbeammaps.h" -#include "lggbeammapfloater.h" + #include "lggbeamcolormapfloater.h" +#include "lggbeammapfloater.h" +#include "lggbeammaps.h" +#include "llcheckboxctrl.h" +#include "llcolorswatch.h" +#include "llcombobox.h" +#include "lldiriterator.h" // for populating the cloud combo +#include "llfloaterreg.h" +#include "llinventorymodel.h" +#include "llspinctrl.h" +#include "lltexturectrl.h" +#include "llviewercontrol.h" #include "llvoavatar.h" #include "llvoavatarself.h" -#include "llspinctrl.h" -#include "lldiriterator.h" // for populating the cloud combo -#include "lltexturectrl.h" -#include "llinventorymodel.h" -static LLPanelInjector t_pref_fs("panel_preference_firestorm"); +static LLPanelInjector t_pref_fs("panel_preference_firestorm"); -PanelPreferenceFirestorm::PanelPreferenceFirestorm() : LLPanelPreference() +FSPanelPrefs::FSPanelPrefs() : LLPanelPreference() { - mCommitCallbackRegistrar.add("Perms.Copy", boost::bind(&PanelPreferenceFirestorm::onCommitCopy, this)); - mCommitCallbackRegistrar.add("Perms.Trans", boost::bind(&PanelPreferenceFirestorm::onCommitTrans, this)); - mCommitCallbackRegistrar.add("FS.CheckContactListColumnMode", boost::bind(&PanelPreferenceFirestorm::onCheckContactListColumnMode, this)); + mCommitCallbackRegistrar.add("Perms.Copy", boost::bind(&FSPanelPrefs::onCommitCopy, this)); + mCommitCallbackRegistrar.add("Perms.Trans", boost::bind(&FSPanelPrefs::onCommitTrans, this)); + mCommitCallbackRegistrar.add("FS.CheckContactListColumnMode", boost::bind(&FSPanelPrefs::onCheckContactListColumnMode, this)); } -BOOL PanelPreferenceFirestorm::postBuild() +BOOL FSPanelPrefs::postBuild() { // LGG's Color Beams refreshBeamLists(); // Beam Colors - getChild("BeamColor_new")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::onBeamColor_new, this)); - getChild("BeamColor_refresh")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::refreshBeamLists, this)); - getChild("BeamColor_delete")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::onBeamColorDelete, this)); + getChild("BeamColor_new")->setCommitCallback(boost::bind(&FSPanelPrefs::onBeamColor_new, this)); + getChild("BeamColor_refresh")->setCommitCallback(boost::bind(&FSPanelPrefs::refreshBeamLists, this)); + getChild("BeamColor_delete")->setCommitCallback(boost::bind(&FSPanelPrefs::onBeamColorDelete, this)); // Beam Shapes - getChild("custom_beam_btn")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::onBeam_new, this)); - getChild("refresh_beams")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::refreshBeamLists, this)); - getChild("delete_beam")->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::onBeamDelete, this)); + getChild("custom_beam_btn")->setCommitCallback(boost::bind(&FSPanelPrefs::onBeam_new, this)); + getChild("refresh_beams")->setCommitCallback(boost::bind(&FSPanelPrefs::refreshBeamLists, this)); + getChild("delete_beam")->setCommitCallback(boost::bind(&FSPanelPrefs::onBeamDelete, this)); populateCloudCombo(); LLTextureCtrl* tex_ctrl = getChild("texture control"); - tex_ctrl->setCommitCallback(boost::bind(&PanelPreferenceFirestorm::onCommitTexture, this, _2)); + tex_ctrl->setCommitCallback(boost::bind(&FSPanelPrefs::onCommitTexture, this, _2)); tex_ctrl->setDefaultImageAssetID(LLUUID(gSavedSettings.getString("DefaultObjectTexture"))); onCheckContactListColumnMode(); @@ -76,141 +78,139 @@ BOOL PanelPreferenceFirestorm::postBuild() return LLPanelPreference::postBuild(); } -void PanelPreferenceFirestorm::apply() +void FSPanelPrefs::apply() { LLPanelPreference::apply(); } -void PanelPreferenceFirestorm::cancel() +void FSPanelPrefs::cancel() { LLPanelPreference::cancel(); } -void PanelPreferenceFirestorm::refreshBeamLists() +void FSPanelPrefs::refreshBeamLists() { - LLComboBox* comboBox = getChild("FSBeamShape_combo"); + LLComboBox* comboBox = findChild("FSBeamShape_combo"); - if(comboBox != NULL) + if (comboBox) { comboBox->removeall(); comboBox->add("===OFF==="); - std::vector names = gLggBeamMaps.getFileNames(); - for(int i=0; i<(int)names.size(); i++) + string_vec_t names = gLggBeamMaps.getFileNames(); + for (string_vec_t::iterator it = names.begin(); it != names.end(); ++it) { - comboBox->add(names[i]); + comboBox->add(*it); } comboBox->setSimple(gSavedSettings.getString("FSBeamShape")); } - comboBox = getChild("BeamColor_combo"); - if(comboBox != NULL) + comboBox = findChild("BeamColor_combo"); + if (comboBox) { comboBox->removeall(); comboBox->add("===OFF==="); - std::vector names = gLggBeamMaps.getColorsFileNames(); - for(int i=0; i<(int)names.size(); i++) + string_vec_t names = gLggBeamMaps.getColorsFileNames(); + for (string_vec_t::iterator it = names.begin(); it != names.end(); ++it) { - comboBox->add(names[i]); + comboBox->add(*it); } comboBox->setSimple(gSavedSettings.getString("FSBeamColorFile")); } } -void PanelPreferenceFirestorm::onBeamColor_new() +void FSPanelPrefs::onBeamColor_new() { lggBeamColorMapFloater* colorMapFloater = (lggBeamColorMapFloater*)LLFloaterReg::showInstance("lgg_beamcolormap"); colorMapFloater->setData(this); } -void PanelPreferenceFirestorm::onBeam_new() +void FSPanelPrefs::onBeam_new() { lggBeamMapFloater* beamMapFloater = (lggBeamMapFloater*)LLFloaterReg::showInstance("lgg_beamshape"); beamMapFloater->setData(this); } -void PanelPreferenceFirestorm::onBeamColorDelete() +void FSPanelPrefs::onBeamColorDelete() { - LLComboBox* comboBox = getChild("BeamColor_combo"); + LLComboBox* comboBox = findChild("BeamColor_combo"); - if(comboBox != NULL) + if (comboBox) { std::string filename = comboBox->getValue().asString()+".xml"; - std::string path_name1(gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS , "beamsColors", filename)); - std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "beamsColors", filename)); + std::string path_name1(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "beamsColors", filename)); + std::string path_name2(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "beamsColors", filename)); - if(gDirUtilp->fileExists(path_name1)) + if (gDirUtilp->fileExists(path_name1)) { LLFile::remove(path_name1); - gSavedSettings.setString("FSBeamColorFile","===OFF==="); + gSavedSettings.setString("FSBeamColorFile", "===OFF==="); } - if(gDirUtilp->fileExists(path_name2)) + if (gDirUtilp->fileExists(path_name2)) { LLFile::remove(path_name2); - gSavedSettings.setString("FSBeamColorFile","===OFF==="); + gSavedSettings.setString("FSBeamColorFile", "===OFF==="); } } refreshBeamLists(); } -void PanelPreferenceFirestorm::onBeamDelete() +void FSPanelPrefs::onBeamDelete() { - LLComboBox* comboBox = getChild("FSBeamShape_combo"); + LLComboBox* comboBox = findChild("FSBeamShape_combo"); - if(comboBox != NULL) + if (comboBox) { - std::string filename = comboBox->getValue().asString()+".xml"; - std::string path_name1(gDirUtilp->getExpandedFilename( LL_PATH_APP_SETTINGS , "beams", filename)); - std::string path_name2(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "beams", filename)); + std::string filename = comboBox->getValue().asString() + ".xml"; + std::string path_name1(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "beams", filename)); + std::string path_name2(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "beams", filename)); - if(gDirUtilp->fileExists(path_name1)) + if (gDirUtilp->fileExists(path_name1)) { LLFile::remove(path_name1); - gSavedSettings.setString("FSBeamShape","===OFF==="); + gSavedSettings.setString("FSBeamShape", "===OFF==="); } - if(gDirUtilp->fileExists(path_name2)) + if (gDirUtilp->fileExists(path_name2)) { LLFile::remove(path_name2); - gSavedSettings.setString("FSBeamShape","===OFF==="); + gSavedSettings.setString("FSBeamShape", "===OFF==="); } } refreshBeamLists(); } - -void PanelPreferenceFirestorm::populateCloudCombo() +void FSPanelPrefs::populateCloudCombo() { - LLComboBox* cloud_combo = getChild("cloud_combo"); - if(cloud_combo) + LLComboBox* cloud_combo = findChild("cloud_combo"); + if (cloud_combo) { const std::string cloudDir(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight" + gDirUtilp->getDirDelimiter() + "clouds")); LLDirIterator dir_iter(cloudDir, "*.tga"); - while (1) + std::string file; + while (dir_iter.next(file)) { - std::string file; - if (!dir_iter.next(file)) - { - break; // no more files - } - cloud_combo->add(file); } cloud_combo->setSimple(gSavedSettings.getString("FSCloudTexture")); } } -void PanelPreferenceFirestorm::onCommitTexture(const LLSD& data) +void FSPanelPrefs::onCommitTexture(const LLSD& data) { LLTextureCtrl* texture_ctrl = getChild("texture control"); - if(!texture_ctrl) return; - if( !texture_ctrl->getTentative() ) + if (!texture_ctrl) + { + return; + } + + if (!texture_ctrl->getTentative()) { // we grab the item id first, because we want to do a // permissions check LLUUID id = texture_ctrl->getImageItemID(); - if(id.isNull()) + if (id.isNull()) { id = texture_ctrl->getImageAssetID(); } @@ -218,7 +218,7 @@ void PanelPreferenceFirestorm::onCommitTexture(const LLSD& data) // Texture picker defaults aren't inventory items // * Don't need to worry about permissions for them LLViewerInventoryItem* item = gInventory.getItem(id); - if(item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) + if (item && !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())) { // Do not have permission to copy the texture. return; @@ -228,11 +228,11 @@ void PanelPreferenceFirestorm::onCommitTexture(const LLSD& data) } } -void PanelPreferenceFirestorm::onCommitCopy() +void FSPanelPrefs::onCommitCopy() { // Implements fair use BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy"); - if(!copyable) + if (!copyable) { gSavedSettings.setBOOL("NextOwnerTransfer", TRUE); } @@ -240,7 +240,7 @@ void PanelPreferenceFirestorm::onCommitCopy() xfer->setEnabled(copyable); } -void PanelPreferenceFirestorm::onCommitTrans() +void FSPanelPrefs::onCommitTrans() { BOOL transferable = gSavedSettings.getBOOL("NextOwnerTransfer"); if (!transferable) @@ -249,7 +249,7 @@ void PanelPreferenceFirestorm::onCommitTrans() } } -void PanelPreferenceFirestorm::onCheckContactListColumnMode() +void FSPanelPrefs::onCheckContactListColumnMode() { childSetEnabled("FSFriendListColumnShowUserName", gSavedSettings.getBOOL("FSFriendListColumnShowDisplayName") || gSavedSettings.getBOOL("FSFriendListColumnShowFullName")); childSetEnabled("FSFriendListColumnShowDisplayName", gSavedSettings.getBOOL("FSFriendListColumnShowUserName") || gSavedSettings.getBOOL("FSFriendListColumnShowFullName")); diff --git a/indra/newview/fspanelprefs.h b/indra/newview/fspanelprefs.h index 2670530aa3..89727fbfba 100644 --- a/indra/newview/fspanelprefs.h +++ b/indra/newview/fspanelprefs.h @@ -29,10 +29,10 @@ #include "llfloaterpreference.h" -class PanelPreferenceFirestorm : public LLPanelPreference +class FSPanelPrefs : public LLPanelPreference { public: - PanelPreferenceFirestorm(); + FSPanelPrefs(); /*virtual*/ BOOL postBuild(); /*virtual*/ void apply(); diff --git a/indra/newview/lggbeamcolormapfloater.cpp b/indra/newview/lggbeamcolormapfloater.cpp index 979181751f..f92c8d0dc5 100644 --- a/indra/newview/lggbeamcolormapfloater.cpp +++ b/indra/newview/lggbeamcolormapfloater.cpp @@ -328,7 +328,7 @@ void lggBeamColorMapFloater::fixOrder() void lggBeamColorMapFloater::setData(void* data) { - fspanel = (PanelPreferenceFirestorm*)data; + fspanel = (FSPanelPrefs*)data; if (fspanel) { gFloaterView->getParentFloater(fspanel)->addDependentFloater(this); diff --git a/indra/newview/lggbeamcolormapfloater.h b/indra/newview/lggbeamcolormapfloater.h index e9fe7c7be1..499421e4a4 100644 --- a/indra/newview/lggbeamcolormapfloater.h +++ b/indra/newview/lggbeamcolormapfloater.h @@ -67,7 +67,7 @@ public: protected: F32 mContextConeOpacity; - PanelPreferenceFirestorm * fspanel; + FSPanelPrefs * fspanel; lggBeamsColors myData; LLSliderCtrl* mColorSlider; diff --git a/indra/newview/lggbeammapfloater.cpp b/indra/newview/lggbeammapfloater.cpp index 266ae6eceb..59644fea58 100644 --- a/indra/newview/lggbeammapfloater.cpp +++ b/indra/newview/lggbeammapfloater.cpp @@ -162,7 +162,7 @@ BOOL lggBeamMapFloater::handleMouseDown(S32 x,S32 y,MASK mask) void lggBeamMapFloater::setData(void* data) { - fspanel = (PanelPreferenceFirestorm*)data; + fspanel = (FSPanelPrefs*)data; if (fspanel) { gFloaterView->getParentFloater(fspanel)->addDependentFloater(this); diff --git a/indra/newview/lggbeammapfloater.h b/indra/newview/lggbeammapfloater.h index 27cb005ed9..a24a879c41 100644 --- a/indra/newview/lggbeammapfloater.h +++ b/indra/newview/lggbeammapfloater.h @@ -58,7 +58,7 @@ public: BOOL handleRightMouseDown(S32 x,S32 y,MASK mask); void setData(void* data); - PanelPreferenceFirestorm* fspanel; + FSPanelPrefs* fspanel; void draw(); void clearPoints();