diff options
author | David Walter Seikel | 2012-04-01 00:30:02 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-04-01 00:30:02 +1000 |
commit | f51290b92f93818e16c059810c4a770e4cdb8798 (patch) | |
tree | 838fa91f2f032ef8b464cb5fba30c948a3b47ec5 /linden | |
parent | More automated whitespace fixes. (diff) | |
download | meta-impy-f51290b92f93818e16c059810c4a770e4cdb8798.zip meta-impy-f51290b92f93818e16c059810c4a770e4cdb8798.tar.gz meta-impy-f51290b92f93818e16c059810c4a770e4cdb8798.tar.bz2 meta-impy-f51290b92f93818e16c059810c4a770e4cdb8798.tar.xz |
Refactor all those little checks to see if a notecard is a WindLight setting card.
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/newview/llfloaterwindlight.cpp | 2 | ||||
-rw-r--r-- | linden/indra/newview/llinventorybridge.cpp | 28 | ||||
-rw-r--r-- | linden/indra/newview/llinventorybridge.h | 3 | ||||
-rw-r--r-- | linden/indra/newview/llpanelinventory.cpp | 26 | ||||
-rwxr-xr-x | linden/indra/newview/llviewermessage.cpp | 5 | ||||
-rw-r--r-- | linden/indra/newview/llwlparammanager.cpp | 18 | ||||
-rw-r--r-- | linden/indra/newview/llwlparammanager.h | 5 |
7 files changed, 37 insertions, 50 deletions
diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp index 4937232..9955783 100644 --- a/linden/indra/newview/llfloaterwindlight.cpp +++ b/linden/indra/newview/llfloaterwindlight.cpp | |||
@@ -873,7 +873,7 @@ void LLFloaterWindLight::onSavePreset(LLUICtrl* ctrl, void* userData) | |||
873 | { | 873 | { |
874 | // Make sure we have a ".wl" extension. | 874 | // Make sure we have a ".wl" extension. |
875 | std::string name = comboBox->getSelectedItemLabel(); | 875 | std::string name = comboBox->getSelectedItemLabel(); |
876 | if(name.length() > 2 && name.compare(name.length() - 3, 3, ".wl") != 0) | 876 | if(!LLWLParamManager::isSkySettingsNotecard(name)) |
877 | { | 877 | { |
878 | name += ".wl"; | 878 | name += ".wl"; |
879 | } | 879 | } |
diff --git a/linden/indra/newview/llinventorybridge.cpp b/linden/indra/newview/llinventorybridge.cpp index eb2170a..23d864e 100644 --- a/linden/indra/newview/llinventorybridge.cpp +++ b/linden/indra/newview/llinventorybridge.cpp | |||
@@ -3123,11 +3123,11 @@ void LLNotecardBridge::openItem() | |||
3123 | LLViewerInventoryItem* item = getItem(); | 3123 | LLViewerInventoryItem* item = getItem(); |
3124 | if (item) | 3124 | if (item) |
3125 | { | 3125 | { |
3126 | if(isSkySetting()) | 3126 | if(LLWLParamManager::isSkySettingsNotecard(getName())) |
3127 | { | 3127 | { |
3128 | LLWLParamManager::instance()->loadPresetNotecard(item->getName(), item->getAssetUUID(), mUUID); | 3128 | LLWLParamManager::instance()->loadPresetNotecard(item->getName(), item->getAssetUUID(), mUUID); |
3129 | } | 3129 | } |
3130 | else if(isWaterSetting()) | 3130 | else if(LLWLParamManager::isWaterSettingsNotecard(getName())) |
3131 | { | 3131 | { |
3132 | LLWaterParamManager::instance()->loadPresetNotecard(item->getName(), item->getAssetUUID(), mUUID); | 3132 | LLWaterParamManager::instance()->loadPresetNotecard(item->getName(), item->getAssetUUID(), mUUID); |
3133 | } | 3133 | } |
@@ -3158,13 +3158,13 @@ void LLNotecardBridge::buildContextMenu(LLMenuGL& menu, U32 flags) | |||
3158 | else | 3158 | else |
3159 | { | 3159 | { |
3160 | 3160 | ||
3161 | if(isWindLight()) | 3161 | if(LLWLParamManager::isSettingsNotecard(getName())) |
3162 | { | 3162 | { |
3163 | if(isSkySetting()) | 3163 | if(LLWLParamManager::isSkySettingsNotecard(getName())) |
3164 | { | 3164 | { |
3165 | items.push_back(std::string("Use WindLight Settings")); | 3165 | items.push_back(std::string("Use WindLight Settings")); |
3166 | } | 3166 | } |
3167 | else if(isWaterSetting()) | 3167 | else if(LLWLParamManager::isWaterSettingsNotecard(getName())) |
3168 | { | 3168 | { |
3169 | items.push_back(std::string("Use WaterLight Settings")); | 3169 | items.push_back(std::string("Use WaterLight Settings")); |
3170 | } | 3170 | } |
@@ -3221,11 +3221,11 @@ void LLNotecardBridge::performAction(LLFolderView* folder, LLInventoryModel* mod | |||
3221 | 3221 | ||
3222 | LLUIImagePtr LLNotecardBridge::getIcon() const | 3222 | LLUIImagePtr LLNotecardBridge::getIcon() const |
3223 | { | 3223 | { |
3224 | if(isSkySetting()) | 3224 | if(LLWLParamManager::isSkySettingsNotecard(getName())) |
3225 | { | 3225 | { |
3226 | return LLUI::getUIImage("Inv_WindLight"); | 3226 | return LLUI::getUIImage("Inv_WindLight"); |
3227 | } | 3227 | } |
3228 | else if(isWaterSetting()) | 3228 | else if(LLWLParamManager::isWaterSettingsNotecard(getName())) |
3229 | { | 3229 | { |
3230 | return LLUI::getUIImage("Inv_WaterLight"); | 3230 | return LLUI::getUIImage("Inv_WaterLight"); |
3231 | } | 3231 | } |
@@ -3235,20 +3235,6 @@ LLUIImagePtr LLNotecardBridge::getIcon() const | |||
3235 | } | 3235 | } |
3236 | } | 3236 | } |
3237 | 3237 | ||
3238 | bool LLNotecardBridge::isSkySetting() const | ||
3239 | { | ||
3240 | return (getName().length() > 2 && getName().compare(getName().length() - 3, 3, ".wl") == 0); | ||
3241 | } | ||
3242 | |||
3243 | bool LLNotecardBridge::isWaterSetting() const | ||
3244 | { | ||
3245 | return (getName().length() > 2 && getName().compare(getName().length() - 3, 3, ".ww") == 0); | ||
3246 | } | ||
3247 | |||
3248 | bool LLNotecardBridge::isWindLight() const | ||
3249 | { | ||
3250 | return (isSkySetting() || isWaterSetting()); | ||
3251 | } | ||
3252 | 3238 | ||
3253 | // +=================================================+ | 3239 | // +=================================================+ |
3254 | // | LLGestureBridge | | 3240 | // | LLGestureBridge | |
diff --git a/linden/indra/newview/llinventorybridge.h b/linden/indra/newview/llinventorybridge.h index 5a53aa5..0318e6c 100644 --- a/linden/indra/newview/llinventorybridge.h +++ b/linden/indra/newview/llinventorybridge.h | |||
@@ -511,9 +511,6 @@ public: | |||
511 | virtual const std::string& getPrefix() { return sPrefix; } | 511 | virtual const std::string& getPrefix() { return sPrefix; } |
512 | 512 | ||
513 | virtual LLUIImagePtr getIcon() const; | 513 | virtual LLUIImagePtr getIcon() const; |
514 | bool isSkySetting() const; | ||
515 | bool isWaterSetting() const; | ||
516 | bool isWindLight() const; | ||
517 | virtual void openItem(); | 514 | virtual void openItem(); |
518 | virtual void buildContextMenu(LLMenuGL& menu, U32 flags); | 515 | virtual void buildContextMenu(LLMenuGL& menu, U32 flags); |
519 | virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); | 516 | virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action); |
diff --git a/linden/indra/newview/llpanelinventory.cpp b/linden/indra/newview/llpanelinventory.cpp index 277ab15..8103ee9 100644 --- a/linden/indra/newview/llpanelinventory.cpp +++ b/linden/indra/newview/llpanelinventory.cpp | |||
@@ -81,6 +81,7 @@ | |||
81 | #include "llviewerobjectlist.h" | 81 | #include "llviewerobjectlist.h" |
82 | #include "llviewerwindow.h" | 82 | #include "llviewerwindow.h" |
83 | #include "llwearable.h" | 83 | #include "llwearable.h" |
84 | #include "llwlparammanager.h" | ||
84 | 85 | ||
85 | #include "hippogridmanager.h" | 86 | #include "hippogridmanager.h" |
86 | 87 | ||
@@ -1380,9 +1381,6 @@ public: | |||
1380 | virtual LLUIImagePtr getIcon() const; | 1381 | virtual LLUIImagePtr getIcon() const; |
1381 | virtual void openItem(); | 1382 | virtual void openItem(); |
1382 | virtual BOOL removeItem(); | 1383 | virtual BOOL removeItem(); |
1383 | bool isSkySetting() const; | ||
1384 | bool isWaterSetting() const; | ||
1385 | bool isWindLight() const; | ||
1386 | }; | 1384 | }; |
1387 | 1385 | ||
1388 | LLTaskNotecardBridge::LLTaskNotecardBridge( | 1386 | LLTaskNotecardBridge::LLTaskNotecardBridge( |
@@ -1412,7 +1410,7 @@ void LLTaskNotecardBridge::openItem() | |||
1412 | return; | 1410 | return; |
1413 | } | 1411 | } |
1414 | // [/RLVa:KB] | 1412 | // [/RLVa:KB] |
1415 | if(isWindLight()) | 1413 | if(LLWLParamManager::isSettingsNotecard(getName())) |
1416 | { | 1414 | { |
1417 | return; | 1415 | return; |
1418 | } | 1416 | } |
@@ -1442,11 +1440,11 @@ BOOL LLTaskNotecardBridge::removeItem() | |||
1442 | } | 1440 | } |
1443 | LLUIImagePtr LLTaskNotecardBridge::getIcon() const | 1441 | LLUIImagePtr LLTaskNotecardBridge::getIcon() const |
1444 | { | 1442 | { |
1445 | if(isSkySetting()) | 1443 | if(LLWLParamManager::isSkySettingsNotecard(getName())) |
1446 | { | 1444 | { |
1447 | return LLUI::getUIImage("Inv_WindLight"); | 1445 | return LLUI::getUIImage("Inv_WindLight"); |
1448 | } | 1446 | } |
1449 | else if(isWaterSetting()) | 1447 | else if(LLWLParamManager::isWaterSettingsNotecard(getName())) |
1450 | { | 1448 | { |
1451 | return LLUI::getUIImage("Inv_WaterLight"); | 1449 | return LLUI::getUIImage("Inv_WaterLight"); |
1452 | } | 1450 | } |
@@ -1456,22 +1454,6 @@ LLUIImagePtr LLTaskNotecardBridge::getIcon() const | |||
1456 | } | 1454 | } |
1457 | } | 1455 | } |
1458 | 1456 | ||
1459 | bool LLTaskNotecardBridge::isSkySetting() const | ||
1460 | { | ||
1461 | return (getName().length() > 2 && getName().compare(getName().length() - 3, 3, ".wl") == 0); | ||
1462 | } | ||
1463 | |||
1464 | bool LLTaskNotecardBridge::isWaterSetting() const | ||
1465 | { | ||
1466 | return (getName().length() > 2 && getName().compare(getName().length() - 3, 3, ".ww") == 0); | ||
1467 | } | ||
1468 | |||
1469 | bool LLTaskNotecardBridge::isWindLight() const | ||
1470 | { | ||
1471 | return (isSkySetting() || isWaterSetting()); | ||
1472 | } | ||
1473 | |||
1474 | |||
1475 | ///---------------------------------------------------------------------------- | 1457 | ///---------------------------------------------------------------------------- |
1476 | /// Class LLTaskGestureBridge | 1458 | /// Class LLTaskGestureBridge |
1477 | ///---------------------------------------------------------------------------- | 1459 | ///---------------------------------------------------------------------------- |
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index f0c7c0c..9b1b00d 100755 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp | |||
@@ -132,6 +132,7 @@ | |||
132 | #include "llvlmanager.h" | 132 | #include "llvlmanager.h" |
133 | #include "llvoavatar.h" | 133 | #include "llvoavatar.h" |
134 | #include "llvotextbubble.h" | 134 | #include "llvotextbubble.h" |
135 | #include "llwlparammanager.h" | ||
135 | #include "llweb.h" | 136 | #include "llweb.h" |
136 | #include "llworld.h" | 137 | #include "llworld.h" |
137 | #include "pipeline.h" | 138 | #include "pipeline.h" |
@@ -924,9 +925,7 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) | |||
924 | { | 925 | { |
925 | case LLAssetType::AT_NOTECARD: | 926 | case LLAssetType::AT_NOTECARD: |
926 | // Don't show WindLight settings as notecards. | 927 | // Don't show WindLight settings as notecards. |
927 | // *TODO: centralise all these damned .wl/.ww checks somewhere. | 928 | if(!LLWLParamManager::isSettingsNotecard(item->getName())) |
928 | if((item->getName().length() > 2 && item->getName().compare(item->getName().length() - 3, 3, ".wl") != 0) && | ||
929 | (item->getName().compare(item->getName().length() - 3, 3, ".ww") != 0)) | ||
930 | { | 929 | { |
931 | open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), | 930 | open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), |
932 | LLUUID::null, show_keep_discard, LLUUID::null, FALSE); | 931 | LLUUID::null, show_keep_discard, LLUUID::null, FALSE); |
diff --git a/linden/indra/newview/llwlparammanager.cpp b/linden/indra/newview/llwlparammanager.cpp index 010aa3d..1148576 100644 --- a/linden/indra/newview/llwlparammanager.cpp +++ b/linden/indra/newview/llwlparammanager.cpp | |||
@@ -836,3 +836,21 @@ void LLWLParamManager::notifyObservers() | |||
836 | observer->changed(); | 836 | observer->changed(); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | |||
840 | // static | ||
841 | bool LLWLParamManager::isWaterSettingsNotecard(std::string name) | ||
842 | { | ||
843 | return (name.length() > 2 && name.compare(name.length() - 3, 3, ".ww") == 0); | ||
844 | } | ||
845 | |||
846 | // static | ||
847 | bool LLWLParamManager::isSkySettingsNotecard(std::string name) | ||
848 | { | ||
849 | return (name.length() > 2 && name.compare(name.length() - 3, 3, ".wl") == 0); | ||
850 | } | ||
851 | |||
852 | // static | ||
853 | bool LLWLParamManager::isSettingsNotecard(std::string name) | ||
854 | { | ||
855 | return (isSkySettingsNotecard(name) || isWaterSettingsNotecard(name)); | ||
856 | } | ||
diff --git a/linden/indra/newview/llwlparammanager.h b/linden/indra/newview/llwlparammanager.h index 0f7b84a..5995b9d 100644 --- a/linden/indra/newview/llwlparammanager.h +++ b/linden/indra/newview/llwlparammanager.h | |||
@@ -223,6 +223,11 @@ public: | |||
223 | 223 | ||
224 | void SetMixTime(LLWLParamSet* mixSet, F32 mixTime); | 224 | void SetMixTime(LLWLParamSet* mixSet, F32 mixTime); |
225 | 225 | ||
226 | // Notecard settings checkers. | ||
227 | static bool isWaterSettingsNotecard(std::string name); | ||
228 | static bool isSkySettingsNotecard(std::string name); | ||
229 | static bool isSettingsNotecard(std::string name); | ||
230 | |||
226 | public: | 231 | public: |
227 | 232 | ||
228 | // helper variables | 233 | // helper variables |