diff --git a/indra/newview/lldaycyclemanager.cpp b/indra/newview/lldaycyclemanager.cpp index ab442d7c83f360bf8ce4a8d66f5facdc43e39872..347a467a8bfa3ce7c05f7cea334451e9e5dd71ea 100644 --- a/indra/newview/lldaycyclemanager.cpp +++ b/indra/newview/lldaycyclemanager.cpp @@ -30,12 +30,40 @@ #include "lldiriterator.h" -const LLDayCycleManager::dc_map_t& LLDayCycleManager::getPresets() +void LLDayCycleManager::getPresetNames(preset_name_list_t& names) const { - // Refresh day cycles. - loadAllPresets(); + names.clear(); + + for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) + { + names.push_back(it->first); + } +} + +void LLDayCycleManager::getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const +{ + user.clear(); + sys.clear(); - return mDayCycleMap; + for (dc_map_t::const_iterator it = mDayCycleMap.begin(); it != mDayCycleMap.end(); ++it) + { + const std::string& name = it->first; + + if (isSystemPreset(name)) + { + sys.push_back(name); + } + else + { + user.push_back(name); + } + } +} + +void LLDayCycleManager::getUserPresetNames(preset_name_list_t& user) const +{ + preset_name_list_t sys; // unused + getPresetNames(user, sys); } bool LLDayCycleManager::getPreset(const std::string name, LLWLDayCycle& day_cycle) const diff --git a/indra/newview/lldaycyclemanager.h b/indra/newview/lldaycyclemanager.h index 032e336491ac1412672f234a255ac3ee40013ef4..3d2144960da160d3429ec6b039f7db70f554911a 100644 --- a/indra/newview/lldaycyclemanager.h +++ b/indra/newview/lldaycyclemanager.h @@ -43,10 +43,15 @@ class LLDayCycleManager : public LLSingleton<LLDayCycleManager> LOG_CLASS(LLDayCycleManager); public: + typedef std::list<std::string> preset_name_list_t; + typedef std::map<std::string, LLWLDayCycle> dc_map_t; typedef boost::signals2::signal<void()> modify_signal_t; - const dc_map_t& getPresets(); + void getPresetNames(preset_name_list_t& names) const; + void getPresetNames(preset_name_list_t& user, preset_name_list_t& sys) const; + void getUserPresetNames(preset_name_list_t& user) const; + bool getPreset(const std::string name, LLWLDayCycle& day_cycle) const; bool getPreset(const std::string name, LLSD& day_cycle) const; bool presetExists(const std::string name) const; diff --git a/indra/newview/llenvmanager.cpp b/indra/newview/llenvmanager.cpp index c08ef3468550a62a3769ad39948363a1d12be9c6..4051a4d8db532d51556aaf457fdaa901727acb5e 100644 --- a/indra/newview/llenvmanager.cpp +++ b/indra/newview/llenvmanager.cpp @@ -918,10 +918,11 @@ void LLEnvManagerNew::dumpPresets() { LL_DEBUGS("Windlight") << " - " << region_name << LL_ENDL; } - const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + LLDayCycleManager::preset_name_list_t days; + LLDayCycleManager::instance().getPresetNames(days); + for (LLDayCycleManager::preset_name_list_t::const_iterator it = days.begin(); it != days.end(); ++it) { - LL_DEBUGS("Windlight") << " - " << it->first << LL_ENDL; + LL_DEBUGS("Windlight") << " - " << *it << LL_ENDL; } } diff --git a/indra/newview/llfloaterdeleteenvpreset.cpp b/indra/newview/llfloaterdeleteenvpreset.cpp index cd9f46e5a24913a0d833610ff4d992af575fc836..4fefd2242a13d9d33d2e9d2652543f7fbfeb42aa 100644 --- a/indra/newview/llfloaterdeleteenvpreset.cpp +++ b/indra/newview/llfloaterdeleteenvpreset.cpp @@ -244,17 +244,11 @@ void LLFloaterDeleteEnvPreset::populateDayCyclesList() } LLDayCycleManager& day_mgr = LLDayCycleManager::instance(); - const LLDayCycleManager::dc_map_t& map = day_mgr.getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + LLDayCycleManager::preset_name_list_t user_days; + day_mgr.getUserPresetNames(user_days); // list only user presets + for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) { - const std::string& name = it->first; - - // list only user presets - if (day_mgr.isSystemPreset(name)) - { - continue; - } - + const std::string& name = *it; mPresetCombo->add(name, ADD_BOTTOM, name != cur_day); } diff --git a/indra/newview/llfloatereditdaycycle.cpp b/indra/newview/llfloatereditdaycycle.cpp index 4f4739384d8d58f7af50d9dc5b5f44795ad1454b..165b27113334195c3747e16d4b4d5c60d28da67b 100644 --- a/indra/newview/llfloatereditdaycycle.cpp +++ b/indra/newview/llfloatereditdaycycle.cpp @@ -287,11 +287,24 @@ void LLFloaterEditDayCycle::refreshDayCyclesList() } #endif - const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + LLDayCycleManager::preset_name_list_t user_days, sys_days; + LLDayCycleManager::instance().getPresetNames(user_days, sys_days); + + // Add user days. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) { - LLWLParamKey key(it->first, LLEnvKey::SCOPE_LOCAL); - mDayCyclesCombo->add(key.name, key.toLLSD()); + mDayCyclesCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); + } + + if (user_days.size() > 0) + { + mDayCyclesCombo->addSeparator(); + } + + // Add system days. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it) + { + mDayCyclesCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toLLSD()); } mDayCyclesCombo->setLabel(getString("combo_label")); diff --git a/indra/newview/llfloaterenvironmentsettings.cpp b/indra/newview/llfloaterenvironmentsettings.cpp index e8d123a9550747aa8efcbcac5daffc3052cf20ea..4dbc8cdee0070109dbbd8e65b55cd05cf051a9d1 100644 --- a/indra/newview/llfloaterenvironmentsettings.cpp +++ b/indra/newview/llfloaterenvironmentsettings.cpp @@ -260,9 +260,23 @@ void LLFloaterEnvironmentSettings::populateDayCyclePresetsList() { mDayCyclePresetCombo->removeall(); - const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + LLDayCycleManager::preset_name_list_t user_days, sys_days; + LLDayCycleManager::instance().getPresetNames(user_days, sys_days); + + // Add user days. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) + { + mDayCyclePresetCombo->add(*it); + } + + if (user_days.size() > 0) + { + mDayCyclePresetCombo->addSeparator(); + } + + // Add system days. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it) { - mDayCyclePresetCombo->add(it->first); + mDayCyclePresetCombo->add(*it); } } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 3734e5e28019b6eaa22589482577f41d52ac10db..4535ad0240d49ab6cebd7572324dd7a175b94132 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3504,13 +3504,23 @@ void LLPanelEnvironmentInfo::populateDayCyclesList() mDayCyclePresetCombo->addSeparator(); } - // Add local day cycles. - const LLDayCycleManager::dc_map_t& map = LLDayCycleManager::instance().getPresets(); - for (LLDayCycleManager::dc_map_t::const_iterator it = map.begin(); it != map.end(); ++it) + // Add local user day cycles. + LLDayCycleManager::preset_name_list_t user_days, sys_days; + LLDayCycleManager::instance().getPresetNames(user_days, sys_days); + for (LLDayCycleManager::preset_name_list_t::const_iterator it = user_days.begin(); it != user_days.end(); ++it) { - std::string name = it->first; - LLWLParamKey key(name, LLEnvKey::SCOPE_LOCAL); - mDayCyclePresetCombo->add(name, key.toStringVal()); + mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); + } + + if (user_days.size() > 0) + { + mDayCyclePresetCombo->addSeparator(); + } + + // Add local system day cycles. + for (LLDayCycleManager::preset_name_list_t::const_iterator it = sys_days.begin(); it != sys_days.end(); ++it) + { + mDayCyclePresetCombo->add(*it, LLWLParamKey(*it, LLEnvKey::SCOPE_LOCAL).toStringVal()); } // Current day cycle is already selected.