A lot more refactoring

meow-7.2.2
Ansariel 2026-01-24 19:57:08 +01:00
parent 9eb7ca3f8b
commit 08082cbf2a
14 changed files with 257 additions and 319 deletions

View File

@ -34,15 +34,12 @@
#include "llscrolllistctrl.h"
#include "llsd.h"
#include "llsdserialize.h"
#include "llsdserialize_xml.h"
#include "lltextbox.h"
// newview
#include "llagent.h"
#include "llfloaterworldmap.h"
#include "llfloaterreg.h"
#include "llnotificationsutil.h"
#include "llviewermessage.h"
#include "llworldmap.h"
#include "llworldmapmessage.h"
@ -52,10 +49,10 @@ const F64 REGION_UPDATE_TIMER = 60.0;
ALFloaterRegionTracker::ALFloaterRegionTracker(const LLSD& key)
: LLFloater(key),
LLEventTimer(5.f),
mRefreshRegionListBtn(NULL),
mRemoveRegionBtn(NULL),
mOpenMapBtn(NULL),
mRegionScrollList(NULL),
mRefreshRegionListBtn(nullptr),
mRemoveRegionBtn(nullptr),
mOpenMapBtn(nullptr),
mRegionScrollList(nullptr),
mLastRegionUpdate(0.0)
{
loadFromJSON();
@ -128,10 +125,8 @@ void ALFloaterRegionTracker::refresh()
mLastRegionUpdate = time_now;
}
for (LLSD::map_const_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++)
for (const auto& [sim_name, data] : llsd::inMap(mRegionMap))
{
const std::string& sim_name = it->first;
const LLSD& data = it->second;
if (data.isMap()) // Assume the rest is correct.
{
LLScrollListCell::Params label;
@ -174,7 +169,8 @@ void ALFloaterRegionTracker::refresh()
count.color(LLColor4::grey);
LLWorldMapMessage::getInstance()->sendNamedRegionRequest(sim_name);
if (!mEventTimer.getStarted()) mEventTimer.start();
if (!mEventTimer.getStarted())
mEventTimer.start();
}
LLScrollListItem::Params row;
row.value = sim_name;
@ -203,9 +199,8 @@ void ALFloaterRegionTracker::requestRegionData()
if (!mRegionMap.size())
return;
for (LLSD::map_const_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++)
for (const auto& [name, data] : llsd::inMap(mRegionMap))
{
const std::string& name = it->first;
if (LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromName(name))
{
info->updateAgentCount(LLTimer::getElapsedSeconds());
@ -220,11 +215,9 @@ void ALFloaterRegionTracker::requestRegionData()
void ALFloaterRegionTracker::removeRegions()
{
typedef std::vector<LLScrollListItem*> item_t;
item_t items = mRegionScrollList->getAllSelected();
for (item_t::const_iterator it = items.begin(); it != items.end(); ++it)
for (auto item : mRegionScrollList->getAllSelected())
{
mRegionMap.erase((*it)->getValue().asString());
mRegionMap.erase(item->getValue().asString());
}
mRegionScrollList->deleteSelectedItems();
saveToJSON();
@ -234,9 +227,7 @@ void ALFloaterRegionTracker::removeRegions()
bool ALFloaterRegionTracker::saveToJSON()
{
const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, TRACKER_FILE);
llofstream out_file;
out_file.open(filename.c_str());
if (out_file.is_open())
if (llofstream out_file(filename.c_str()); out_file.is_open())
{
LLSDSerialize::toPrettyNotation(mRegionMap, out_file);
out_file.close();
@ -248,9 +239,7 @@ bool ALFloaterRegionTracker::saveToJSON()
bool ALFloaterRegionTracker::loadFromJSON()
{
const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, TRACKER_FILE);
llifstream in_file;
in_file.open(filename.c_str());
if (in_file.is_open())
if (llifstream in_file(filename.c_str()); in_file.is_open())
{
LLSDSerialize::fromNotation(mRegionMap, in_file, LLSDSerialize::SIZE_UNLIMITED);
in_file.close();
@ -266,8 +255,7 @@ std::string ALFloaterRegionTracker::getRegionLabelIfExists(const std::string& na
void ALFloaterRegionTracker::onRegionAddedCallback(const LLSD& notification, const LLSD& response)
{
const S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0)
if (const S32 option = LLNotificationsUtil::getSelectedOption(notification, response); option == 0)
{
const std::string& name = notification["payload"]["name"].asString();
std::string label = response["label"].asString();
@ -276,8 +264,9 @@ void ALFloaterRegionTracker::onRegionAddedCallback(const LLSD& notification, con
{
if (mRegionMap.has(name))
{
for (LLSD::map_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++)
if (it->first == name) it->second["label"] = label;
for (auto& [sim_name, data] : llsd::inMap(mRegionMap))
if (sim_name == name)
data["label"] = label;
}
else
{
@ -300,7 +289,7 @@ void ALFloaterRegionTracker::openMap()
else
{
const std::string& region = mRegionScrollList->getFirstSelected()->getValue().asString();
LLFloaterWorldMap* worldmap_floaterp = LLFloaterWorldMap::getInstance();
LLFloaterWorldMap* worldmap_floaterp = LLFloaterReg::findTypedInstance<LLFloaterWorldMap>("world_map");
if (!region.empty() && worldmap_floaterp)
{
worldmap_floaterp->trackURL(region, 128, 128, 0);

View File

@ -30,11 +30,9 @@
#include "indra_constants.h" // for MASK_ALT etc.
#include "message.h" // for gMessageSystem
//#include "stdenums.h" // for ADD_TOP
#include "llagent.h" // for gAgent
#include "llanimationstates.h"
#include "llbutton.h"
#include "llcachename.h" // for gCacheName
#include "llcheckboxctrl.h"
#include "llfloater.h"
#include "llfloaterreg.h"
@ -64,9 +62,6 @@ RecentAnimationList::RecentAnimationList()
{
}
RecentAnimationList::~RecentAnimationList()
{
}
void RecentAnimationList::addAnimation(const LLUUID& id, const LLUUID& playedBy)
{
@ -241,7 +236,7 @@ void AnimationExplorer::onStopAndRevokePressed()
if (mCurrentObject.notNull())
{
if (LLViewerObject* vo = gObjectList.findObject(mCurrentObject); vo)
if (LLViewerObject* vo = gObjectList.findObject(mCurrentObject))
{
gAgentAvatarp->revokePermissionsOnObject(vo);
}
@ -287,8 +282,7 @@ void AnimationExplorer::draw()
// update tiems and "Still playing" status in the list once every few seconds
static F64 last_update = 0.0;
F64 time = LLTimer::getElapsedSeconds();
if (time - last_update > 5.0)
if (F64 time = LLTimer::getElapsedSeconds(); time - last_update > 5.0)
{
last_update = time;
updateList(time);
@ -313,11 +307,8 @@ void AnimationExplorer::updateList(F64 current_timestamp)
S32 anim_id_column = mAnimationScrollList->getColumn("animation_id")->mIndex;
// go through the full animation scroll list
std::vector<LLScrollListItem*> items = mAnimationScrollList->getAllData();
for (std::vector<LLScrollListItem*>::iterator list_iter = items.begin(); list_iter != items.end(); ++list_iter)
for (auto item : mAnimationScrollList->getAllData())
{
LLScrollListItem* item = *list_iter;
// get a pointer to the "Played" column text
LLScrollListText* played_text = dynamic_cast<LLScrollListText*>(item->getColumn(played_column));
@ -385,8 +376,7 @@ void AnimationExplorer::addAnimation(const LLUUID& id, const LLUUID& played_by,
// if it was an avatar, get the name here
if (vo->isAvatar())
{
LLAvatarName av_name;
if (LLAvatarNameCache::get(played_by, &av_name))
if (LLAvatarName av_name; LLAvatarNameCache::get(played_by, &av_name))
{
playedByName = av_name.getCompleteName();
}
@ -404,10 +394,8 @@ void AnimationExplorer::addAnimation(const LLUUID& id, const LLUUID& played_by,
// not an avatar, do a lookup by UUID
else
{
// find out if we know the name to this UUID already
std::map<LLUUID, std::string>::iterator iter = mKnownIDs.find(played_by);
// if we don't know it yet, start a lookup
if (iter == mKnownIDs.end())
// find out if we know the name to this UUID already; if we don't know it yet, start a lookup
if (!mKnownIDs.contains(played_by))
{
// if we are not already looking up this object's name, send a request out
if (std::find(mRequestedIDs.begin(), mRequestedIDs.end(), played_by) == mRequestedIDs.end())

View File

@ -29,7 +29,7 @@
#define ANIMATIONEXPLORER_H
#include "llfloater.h"
#include "llfloaterbvhpreview.h" // for LLPreviewAnimation
#include "llfloaterbvhpreview.h" // for LLPreviewAnimation
#include "llsingleton.h"
// --------------------------------------------------------------------------
@ -40,24 +40,23 @@
class AnimationExplorer;
class RecentAnimationList
: public LLSingleton<RecentAnimationList>
class RecentAnimationList : public LLSingleton<RecentAnimationList>
{
LLSINGLETON(RecentAnimationList);
~RecentAnimationList();
~RecentAnimationList() = default;
public:
struct AnimationEntry
{
LLUUID animationID; // asset ID of the animation
LLUUID playedBy; // object/agent who played this animation
F64 time; // time in seconds since viewer start when the animation started
LLUUID animationID; // asset ID of the animation
LLUUID playedBy; // object/agent who played this animation
F64 time; // time in seconds since viewer start when the animation started
};
std::deque<AnimationEntry> mAnimationList;
void addAnimation(const LLUUID& id, const LLUUID& playedBy); // called in llviewermessage.cpp
void requestList(AnimationExplorer* explorer); // request animation list
void addAnimation(const LLUUID& id, const LLUUID& playedBy); // called in llviewermessage.cpp
void requestList(AnimationExplorer* explorer); // request animation list
};
// --------------------------------------------------------------------------
@ -72,63 +71,62 @@ class LLMessageSystem;
class LLScrollListCtrl;
class LLView;
class AnimationExplorer
: public LLFloater
class AnimationExplorer : public LLFloater
{
friend class LLFloaterReg;
private:
AnimationExplorer(const LLSD& key);
~AnimationExplorer();
private:
AnimationExplorer(const LLSD& key);
~AnimationExplorer();
public:
/*virtual*/ bool postBuild();
void addAnimation(const LLUUID& id, const LLUUID& playedBy, F64 time); // called from RecentAnimationList
public:
bool postBuild() override;
void addAnimation(const LLUUID& id, const LLUUID& playedBy, F64 time); // called from RecentAnimationList
// copied from llfloaterbvhpreview.h
bool handleMouseDown(S32 x, S32 y, MASK mask);
bool handleMouseUp(S32 x, S32 y, MASK mask);
bool handleHover(S32 x, S32 y, MASK mask);
bool handleScrollWheel(S32 x, S32 y, S32 clicks);
void onMouseCaptureLost();
// copied from llfloaterbvhpreview.h
bool handleMouseDown(S32 x, S32 y, MASK mask) override;
bool handleMouseUp(S32 x, S32 y, MASK mask) override;
bool handleHover(S32 x, S32 y, MASK mask) override;
bool handleScrollWheel(S32 x, S32 y, S32 clicks) override;
void onMouseCaptureLost() override;
void requestNameCallback(LLMessageSystem* msg); // object name query callback
void requestNameCallback(LLMessageSystem* msg); // object name query callback
protected:
void onAvatarNameCallback(const LLUUID& id, const LLAvatarName& av_name);
void updateListEntry(const LLUUID& id, const std::string& name);
protected:
void onAvatarNameCallback(const LLUUID& id, const LLAvatarName& av_name);
void updateListEntry(const LLUUID& id, const std::string& name);
LLScrollListCtrl* mAnimationScrollList;
LLButton* mStopButton;
LLButton* mBlacklistButton;
LLButton* mStopAndRevokeButton;
LLCheckBoxCtrl* mNoOwnedAnimationsCheckBox;
LLScrollListCtrl* mAnimationScrollList;
LLButton* mStopButton;
LLButton* mBlacklistButton;
LLButton* mStopAndRevokeButton;
LLCheckBoxCtrl* mNoOwnedAnimationsCheckBox;
LLView* mPreviewCtrl; // dummy control on the floater where the avatar preview should go
LLPointer<LLPreviewAnimation> mAnimationPreview; // actual avatar preview
LLView* mPreviewCtrl; // dummy control on the floater where the avatar preview should go
LLPointer<LLPreviewAnimation> mAnimationPreview; // actual avatar preview
S32 mLastMouseX;
S32 mLastMouseY;
S32 mLastMouseX;
S32 mLastMouseY;
LLUUID mCurrentAnimationID; // currently selected animation's asset ID
LLUUID mCurrentObject; // object ID that played the currently selected animation
LLUUID mCurrentAnimationID; // currently selected animation's asset ID
LLUUID mCurrentObject; // object ID that played the currently selected animation
std::vector<LLUUID> mRequestedIDs; // list of object IDs we requested named for
std::map<LLUUID, std::string> mKnownIDs; // known list of names for object IDs
std::vector<LLUUID> mRequestedIDs; // list of object IDs we requested named for
std::map<LLUUID, std::string> mKnownIDs; // known list of names for object IDs
typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
void draw();
void update(); // request list update from RecentAnimationList
void updateList(F64 current_timestamp); // update times and playing status in animation list
void startMotion(const LLUUID& motionID);
void draw() override;
void update(); // request list update from RecentAnimationList
void updateList(F64 current_timestamp); // update times and playing status in animation list
void startMotion(const LLUUID& motionID);
void onSelectAnimation();
void onStopPressed();
void onBlacklistPressed();
void onStopAndRevokePressed();
void onOwnedCheckToggled();
void onSelectAnimation();
void onStopPressed();
void onBlacklistPressed();
void onStopAndRevokePressed();
void onOwnedCheckToggled();
};
#endif // ANIMATIONEXPLORER_H

View File

@ -25,7 +25,6 @@
#include "llviewerprecompiledheaders.h"
#include "dialogstack.h"
#include "llviewercontrol.h"
void DialogStack::update()
@ -55,8 +54,7 @@ void DialogStack::pop(const LLUUID& uuid)
const LLUUID& DialogStack::flip(const LLUUID& uuid)
{
std::list<LLUUID>::iterator found = std::find(mNotificationIDs.begin(), mNotificationIDs.end(), uuid);
if (found != mNotificationIDs.end())
if (auto found = std::find(mNotificationIDs.begin(), mNotificationIDs.end(), uuid); found != mNotificationIDs.end())
{
if (found == mNotificationIDs.begin())
{

View File

@ -31,7 +31,7 @@ class DialogStack
: public LLSingleton<DialogStack>
{
LLSINGLETON_EMPTY_CTOR(DialogStack);
~DialogStack() {}
~DialogStack() = default;
protected:
void update();

View File

@ -37,63 +37,62 @@ class LLLineEditor;
class LLPanel;
class LLTextEditor;
class Omnifilter
: public LLFloater
class Omnifilter : public LLFloater
{
friend class LLFloaterReg;
private:
Omnifilter(const LLSD& key);
private:
Omnifilter(const LLSD& key);
public:
bool postBuild() override final;
LLScrollListItem* addNeedle(const std::string& name, const OmnifilterEngine::Needle& needle);
public:
bool postBuild() override final;
LLScrollListItem* addNeedle(const std::string& name, const OmnifilterEngine::Needle& needle);
protected:
OmnifilterEngine::Needle* getSelectedNeedle();
protected:
OmnifilterEngine::Needle* getSelectedNeedle();
void onSelectNeedle();
void onNeedleChanged();
void onAddNeedleClicked();
void onRemoveNeedleClicked();
void onNeedleNameChanged();
void onNeedleCheckboxChanged(LLUICtrl* ctrl);
void onOwnerChanged();
void onSelectNeedle();
void onNeedleChanged();
void onAddNeedleClicked();
void onRemoveNeedleClicked();
void onNeedleNameChanged();
void onNeedleCheckboxChanged(LLUICtrl* ctrl);
void onOwnerChanged();
void onLogLine(time_t time, const std::string& logLine);
void onLogLine(time_t time, const std::string& logLine);
FSScrollListCtrl* mNeedleListCtrl{ nullptr };
LLButton* mAddNeedleBtn{ nullptr };
LLButton* mRemoveNeedleBtn{ nullptr };
FSScrollListCtrl* mFilterLogCtrl{ nullptr };
LLPanel* mPanelDetails{ nullptr };
LLLineEditor* mNeedleNameCtrl{ nullptr };
LLLineEditor* mSenderNameCtrl{ nullptr };
LLCheckBoxCtrl* mSenderCaseSensitiveCheck{ nullptr };
LLComboBox* mSenderMatchTypeCombo{ nullptr };
LLTextEditor* mContentCtrl{ nullptr };
LLCheckBoxCtrl* mContentCaseSensitiveCheck{ nullptr };
LLComboBox* mContentMatchTypeCombo{ nullptr };
LLLineEditor* mRegionNameCtrl{ nullptr };
LLLineEditor* mOwnerCtrl{ nullptr };
FSScrollListCtrl* mNeedleListCtrl{ nullptr };
LLButton* mAddNeedleBtn{ nullptr };
LLButton* mRemoveNeedleBtn{ nullptr };
FSScrollListCtrl* mFilterLogCtrl{ nullptr };
LLPanel* mPanelDetails{ nullptr };
LLLineEditor* mNeedleNameCtrl{ nullptr };
LLLineEditor* mSenderNameCtrl{ nullptr };
LLCheckBoxCtrl* mSenderCaseSensitiveCheck{ nullptr };
LLComboBox* mSenderMatchTypeCombo{ nullptr };
LLTextEditor* mContentCtrl{ nullptr };
LLCheckBoxCtrl* mContentCaseSensitiveCheck{ nullptr };
LLComboBox* mContentMatchTypeCombo{ nullptr };
LLLineEditor* mRegionNameCtrl{ nullptr };
LLLineEditor* mOwnerCtrl{ nullptr };
LLButton* mTypeNearbyBtn{ nullptr };
LLButton* mTypeIMBtn{ nullptr };
LLButton* mTypeGroupIMBtn{ nullptr };
LLButton* mTypeObjectChatBtn{ nullptr };
LLButton* mTypeObjectIMBtn{ nullptr };
LLButton* mTypeScriptErrorBtn{ nullptr };
LLButton* mTypeDialogBtn{ nullptr };
LLButton* mTypeOfferBtn{ nullptr };
LLButton* mTypeInviteBtn{ nullptr };
LLButton* mTypeLureBtn{ nullptr };
LLButton* mTypeLoadURLBtn{ nullptr };
LLButton* mTypeFriendshipOfferBtn{ nullptr };
LLButton* mTypeTeleportRequestBtn{ nullptr };
LLButton* mTypeGroupNoticeBtn{ nullptr };
LLButton* mTypeNearbyBtn{ nullptr };
LLButton* mTypeIMBtn{ nullptr };
LLButton* mTypeGroupIMBtn{ nullptr };
LLButton* mTypeObjectChatBtn{ nullptr };
LLButton* mTypeObjectIMBtn{ nullptr };
LLButton* mTypeScriptErrorBtn{ nullptr };
LLButton* mTypeDialogBtn{ nullptr };
LLButton* mTypeOfferBtn{ nullptr };
LLButton* mTypeInviteBtn{ nullptr };
LLButton* mTypeLureBtn{ nullptr };
LLButton* mTypeLoadURLBtn{ nullptr };
LLButton* mTypeFriendshipOfferBtn{ nullptr };
LLButton* mTypeTeleportRequestBtn{ nullptr };
LLButton* mTypeGroupNoticeBtn{ nullptr };
LLLineEditor* mChatReplaceCtrl{ nullptr };
LLLineEditor* mButtonReplyCtrl{ nullptr };
LLTextEditor* mTextBoxReplyCtrl{ nullptr };
LLLineEditor* mChatReplaceCtrl{ nullptr };
LLLineEditor* mButtonReplyCtrl{ nullptr };
LLTextEditor* mTextBoxReplyCtrl{ nullptr };
};
#endif // OMNIFILTER_H

View File

@ -27,7 +27,6 @@
#include "llcheckboxctrl.h"
#include "llcolorswatch.h"
#include "llcombobox.h"
#include "lldir.h"
#include "llfoldertype.h"
#include "llinventoryfunctions.h" // for ROOT_FIRESTORM_FOLDER
#include "llinventorytype.h"
@ -41,7 +40,6 @@
#include "llviewerobject.h"
#include "llviewerpartsim.h"
#include "llviewerpartsource.h"
#include "llviewerregion.h"
#include "llwindow.h"
#include "llviewerassetupload.h"

View File

@ -148,7 +148,7 @@ class ParticleScriptCreationCallback : public LLInventoryCallback
{
public:
ParticleScriptCreationCallback(ParticleEditor* editor);
void fire(const LLUUID& inventoryItem);
void fire(const LLUUID& inventoryItem) override;
protected:
~ParticleScriptCreationCallback() = default;

View File

@ -35,16 +35,13 @@
#include "fscommon.h"
#include "llagent.h"
#include "llappviewer.h"
#include "llcallbacklist.h"
#include "llcheckboxctrl.h"
#include "llcolorswatch.h"
#include "llcombobox.h"
#include "llcubemap.h"
#include "llenvironment.h"
#include "llf32uictrl.h"
#include "llfeaturemanager.h"
#include "llfloaterpreference.h" // for LLAvatarComplexityControls
#include "llfloaterreg.h"
#include "llinventoryfunctions.h"
#include "lllayoutstack.h"
#include "llnotificationsutil.h"
@ -66,7 +63,7 @@ public:
mMarketplaceFolderUUID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MARKETPLACE_LISTINGS);
}
virtual ~FSSettingsCollector() {}
~FSSettingsCollector() = default;
bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
@ -85,7 +82,7 @@ public:
protected:
LLUUID mMarketplaceFolderUUID;
std::set<LLUUID> mSeen;
uuid_set_t mSeen;
};
@ -106,8 +103,8 @@ FloaterQuickPrefs::QuickPrefsXMLEntry::QuickPrefsXMLEntry()
// </FS:Zi>
FloaterQuickPrefs::FloaterQuickPrefs(const LLSD& key)
: LLTransientDockableFloater(NULL, false, key),
mAvatarZOffsetSlider(NULL),
: LLTransientDockableFloater(nullptr, false, key),
mAvatarZOffsetSlider(nullptr),
mRlvBehaviorCallbackConnection(),
mEnvChangedConnection(),
mRegionChangedSlot()
@ -166,20 +163,16 @@ void FloaterQuickPrefs::onOpen(const LLSD& key)
// Scan widgets and reapply control variables because some control types
// (LLSliderCtrl for example) don't update their GUI when hidden
control_list_t::iterator it;
for (it = mControlsList.begin(); it != mControlsList.end(); ++it)
for (const auto& [name, entry] : mControlsList)
{
const ControlEntry& entry = it->second;
LLUICtrl* current_widget = entry.widget;
if (!current_widget)
{
LL_WARNS() << "missing widget for control " << it->first << LL_ENDL;
LL_WARNS() << "missing widget for control " << name << LL_ENDL;
continue;
}
LLControlVariable* var = current_widget->getControlVariable();
if (var)
if (LLControlVariable* var = current_widget->getControlVariable())
{
current_widget->setValue(var->getValue());
}
@ -283,17 +276,15 @@ void FloaterQuickPrefs::loadDayCyclePresets(const std::multimap<std::string, LLU
mDayCyclePresetsCombo->addSeparator();
// Add setting presets.
for (std::multimap<std::string, LLUUID>::const_iterator it = daycycle_map.begin(); it != daycycle_map.end(); ++it)
for (const auto& [preset_name, asset_id] : daycycle_map)
{
const std::string& preset_name = (*it).first;
const LLUUID& asset_id = (*it).second;
if (!preset_name.empty())
{
mDayCyclePresetsCombo->add(preset_name, LLSD(asset_id));
}
}
// <FS:Beq> Opensim legacy windlight support
// <FS:Beq> Opensim legacy windlight support
// Opensim may support both environment and extenvironment caps on the same region
// we also need these disabled in SL on the OpenSim build.
#ifdef OPENSIM
@ -305,7 +296,7 @@ void FloaterQuickPrefs::loadDayCyclePresets(const std::multimap<std::string, LLU
{
mDayCyclePresetsCombo->addSeparator();
}
for(const auto& preset_name : LLEnvironment::getInstance()->mLegacyDayCycles)
for (const auto& preset_name : LLEnvironment::getInstance()->mLegacyDayCycles)
{
// we add by name and only build the envp on demand
LL_DEBUGS("WindlightCaps") << "Adding legacy day cycle " << preset_name << LL_ENDL;
@ -324,17 +315,15 @@ void FloaterQuickPrefs::loadSkyPresets(const std::multimap<std::string, LLUUID>&
mWLPresetsCombo->addSeparator();
// Add setting presets.
for (std::multimap<std::string, LLUUID>::const_iterator it = sky_map.begin(); it != sky_map.end(); ++it)
for (const auto& [preset_name, asset_id] : sky_map)
{
const std::string& preset_name = (*it).first;
const LLUUID& asset_id = (*it).second;
if (!preset_name.empty())
{
mWLPresetsCombo->add(preset_name, LLSD(asset_id));
}
}
// <FS:Beq> Opensim legacy windlight support
// <FS:Beq> Opensim legacy windlight support
// Opensim may support both environment and extenvironment caps on the same region
// we also need these disabled in SL on the OpenSim build.
#ifdef OPENSIM
@ -346,7 +335,7 @@ void FloaterQuickPrefs::loadSkyPresets(const std::multimap<std::string, LLUUID>&
{
mWLPresetsCombo->addSeparator();
}
for(const auto& preset_name : LLEnvironment::getInstance()->mLegacySkies)
for (const auto& preset_name : LLEnvironment::getInstance()->mLegacySkies)
{
// we add by name and only build the envp on demand
LL_DEBUGS("WindlightCaps") << "Adding legacy sky " << preset_name << LL_ENDL;
@ -366,17 +355,15 @@ void FloaterQuickPrefs::loadWaterPresets(const std::multimap<std::string, LLUUID
mWaterPresetsCombo->addSeparator();
// Add setting presets.
for (std::multimap<std::string, LLUUID>::const_iterator it = water_map.begin(); it != water_map.end(); ++it)
for (const auto& [preset_name, asset_id] : water_map)
{
const std::string& preset_name = (*it).first;
const LLUUID& asset_id = (*it).second;
if (!preset_name.empty())
{
mWaterPresetsCombo->add(preset_name, LLSD(asset_id));
}
}
// <FS:Beq> Opensim legacy windlight support
// <FS:Beq> Opensim legacy windlight support
// Opensim may support both environment and extenvironment caps on the same region
// we also need these disabled in SL on the OpenSim build.
#ifdef OPENSIM
@ -388,7 +375,7 @@ void FloaterQuickPrefs::loadWaterPresets(const std::multimap<std::string, LLUUID
{
mWaterPresetsCombo->addSeparator();
}
for(const auto& preset_name : LLEnvironment::getInstance()->mLegacyWater)
for (const auto& preset_name : LLEnvironment::getInstance()->mLegacyWater)
{
// we add by name and only build the envp on demand
LL_DEBUGS("WindlightCaps") << "Adding legacy water " << preset_name << LL_ENDL;
@ -414,21 +401,19 @@ void FloaterQuickPrefs::loadPresets()
std::multimap<std::string, LLUUID> water_map;
std::multimap<std::string, LLUUID> daycycle_map;
for (LLInventoryModel::item_array_t::const_iterator it = items.begin(); it != items.end(); ++it)
for (const auto& item : items)
{
LLInventoryItem* item = *it;
LLSettingsType::type_e type = LLSettingsType::fromInventoryFlags(item->getFlags());
switch (type)
{
case LLSettingsType::ST_SKY:
sky_map.insert(std::make_pair(item->getName(), item->getAssetUUID()));
sky_map.emplace(item->getName(), item->getAssetUUID());
break;
case LLSettingsType::ST_WATER:
water_map.insert(std::make_pair(item->getName(), item->getAssetUUID()));
water_map.emplace(item->getName(), item->getAssetUUID());
break;
case LLSettingsType::ST_DAYCYCLE:
daycycle_map.insert(std::make_pair(item->getName(), item->getAssetUUID()));
daycycle_map.emplace(item->getName(), item->getAssetUUID());
break;
default:
LL_WARNS() << "Found invalid setting: " << item->getName() << LL_ENDL;
@ -443,25 +428,23 @@ void FloaterQuickPrefs::loadPresets()
void FloaterQuickPrefs::setDefaultPresetsEnabled(bool enabled)
{
LLScrollListItem* item{ nullptr };
if (auto item = mWLPresetsCombo->getItemByValue(LLSD(PRESET_NAME_REGION_DEFAULT)))
item->setEnabled(enabled);
item = mWLPresetsCombo->getItemByValue(LLSD(PRESET_NAME_REGION_DEFAULT));
if (item) item->setEnabled(enabled);
if (auto item = mWLPresetsCombo->getItemByValue(LLSD(PRESET_NAME_DAY_CYCLE)))
item->setEnabled(enabled);
item = mWLPresetsCombo->getItemByValue(LLSD(PRESET_NAME_DAY_CYCLE));
if (item) item->setEnabled(enabled);
if (auto item = mWaterPresetsCombo->getItemByValue(LLSD(PRESET_NAME_REGION_DEFAULT)))
item->setEnabled(enabled);
item = mWaterPresetsCombo->getItemByValue(LLSD(PRESET_NAME_REGION_DEFAULT));
if (item) item->setEnabled(enabled);
if (auto item = mWaterPresetsCombo->getItemByValue(LLSD(PRESET_NAME_DAY_CYCLE)))
item->setEnabled(enabled);
item = mWaterPresetsCombo->getItemByValue(LLSD(PRESET_NAME_DAY_CYCLE));
if (item) item->setEnabled(enabled);
if (auto item = mDayCyclePresetsCombo->getItemByValue(LLSD(PRESET_NAME_REGION_DEFAULT)))
item->setEnabled(enabled);
item = mDayCyclePresetsCombo->getItemByValue(LLSD(PRESET_NAME_REGION_DEFAULT));
if (item) item->setEnabled(enabled);
item = mDayCyclePresetsCombo->getItemByValue(LLSD(PRESET_NAME_NONE));
if (item) item->setEnabled(enabled);
if (auto item = mDayCyclePresetsCombo->getItemByValue(LLSD(PRESET_NAME_NONE)))
item->setEnabled(enabled);
}
void FloaterQuickPrefs::setSelectedEnvironment()
@ -480,11 +463,10 @@ void FloaterQuickPrefs::setSelectedEnvironment()
// the sky and water settings in a day cycle, so check them after the
// day cycle. If no fixed sky or fixed water is set, they are either
// defined in the day cycle or inherited from a higher environment level.
LLSettingsDay::ptr_t day = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_LOCAL);
if (day)
if (LLSettingsDay::ptr_t day = LLEnvironment::instance().getEnvironmentDay(LLEnvironment::ENV_LOCAL))
{
//LL_INFOS() << "EEP: day name = " << day->getName() << " - asset id = " << day->getAssetId() << LL_ENDL;
if( day->getAssetId().notNull())
if (day->getAssetId().notNull())
{ // EEP processing
mDayCyclePresetsCombo->selectByValue(LLSD(day->getAssetId()));
// Sky and Water are part of a day cycle in EEP
@ -504,13 +486,11 @@ void FloaterQuickPrefs::setSelectedEnvironment()
// Sky is part of day so treat that as day cycle
mWLPresetsCombo->selectByValue(LLSD(PRESET_NAME_DAY_CYCLE));
// Water is not part of legacy day so we need to hunt around
LLSettingsWater::ptr_t water = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_LOCAL);
if (water)
if (LLSettingsWater::ptr_t water = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_LOCAL))
{
// This is going to be possible. OS will support both Legacy and EEP
// so having a water EEP asset with a Legacy day cycle could happen.
LLUUID asset_id = water->getAssetId();
if (asset_id.notNull())
if (LLUUID asset_id = water->getAssetId(); asset_id.notNull())
{
mWaterPresetsCombo->selectByValue(LLSD(asset_id));
}
@ -532,11 +512,10 @@ void FloaterQuickPrefs::setSelectedEnvironment()
mDayCyclePresetsCombo->selectByValue(LLSD(PRESET_NAME_NONE));
}
LLSettingsSky::ptr_t sky = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL);
if (sky)
if (LLSettingsSky::ptr_t sky = LLEnvironment::instance().getEnvironmentFixedSky(LLEnvironment::ENV_LOCAL))
{
//LL_INFOS() << "EEP: sky name = " << sky->getName() << " - asset id = " << sky->getAssetId() << LL_ENDL;
if(sky->getAssetId().notNull())
if (sky->getAssetId().notNull())
{
mWLPresetsCombo->selectByValue(LLSD(sky->getAssetId()));
}
@ -554,11 +533,9 @@ void FloaterQuickPrefs::setSelectedEnvironment()
#endif
}
// Water is not part of legacy day so we need to hunt around
LLSettingsWater::ptr_t water = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_LOCAL);
if (water)
if (LLSettingsWater::ptr_t water = LLEnvironment::instance().getEnvironmentFixedWater(LLEnvironment::ENV_LOCAL))
{
LLUUID asset_id = water->getAssetId();
if (asset_id.notNull())
if (LLUUID asset_id = water->getAssetId(); asset_id.notNull())
{
mWaterPresetsCombo->selectByValue(LLSD(asset_id));
}
@ -713,7 +690,7 @@ void FloaterQuickPrefs::loadSavedSettingsFromFile(const std::string& settings_pa
QuickPrefsXML xml;
LLXMLNodePtr root;
if (!LLXMLNode::parseFile(settings_path, root, NULL))
if (!LLXMLNode::parseFile(settings_path, root, nullptr))
{
LL_WARNS() << "Unable to load quick preferences from file: " << settings_path << LL_ENDL;
}
@ -754,7 +731,7 @@ void FloaterQuickPrefs::loadSavedSettingsFromFile(const std::string& settings_pa
addControl(
xml_entry.control_name,
label,
NULL,
nullptr,
(ControlType)type,
xml_entry.integer,
xml_entry.min_value,
@ -771,7 +748,7 @@ void FloaterQuickPrefs::loadSavedSettingsFromFile(const std::string& settings_pa
addControl(
"IndirectMaxNonImpostors",
label,
NULL,
nullptr,
(ControlType)type,
xml_entry.integer,
1,
@ -800,14 +777,17 @@ bool FloaterQuickPrefs::isValidPreset(const LLSD& preset)
{
if (preset.isUUID())
{
if(!preset.asUUID().isNull()){ return true;}
if (!preset.asUUID().isNull())
{
return true;
}
}
else if (preset.isString())
{
if(!preset.asString().empty() &&
preset.asString() != PRESET_NAME_REGION_DEFAULT &&
preset.asString() != PRESET_NAME_DAY_CYCLE &&
preset.asString() != PRESET_NAME_NONE)
if (!preset.asString().empty() &&
preset.asString() != PRESET_NAME_REGION_DEFAULT &&
preset.asString() != PRESET_NAME_DAY_CYCLE &&
preset.asString() != PRESET_NAME_NONE)
{
return true;
}
@ -840,22 +820,20 @@ void FloaterQuickPrefs::stepComboBox(LLComboBox* ctrl, bool forward)
void FloaterQuickPrefs::selectSkyPreset(const LLSD& preset)
{
// Opensim continued W/L support
auto& instance = LLEnvironment::instance();
// Opensim continued W/L support
#ifdef OPENSIM
if(!preset.isUUID() && LLGridManager::getInstance()->isInOpenSim())
{
LLSettingsSky::ptr_t legacy_sky = nullptr;
LLSD messages;
legacy_sky = LLEnvironment::createSkyFromLegacyPreset(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "skies", preset.asString() + ".xml"), messages);
if (legacy_sky)
if (auto legacy_sky = LLEnvironment::createSkyFromLegacyPreset(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "skies", preset.asString() + ".xml"), messages))
{
// Need to preserve current sky manually in this case in contrast to asset-based settings
LLSettingsWater::ptr_t current_water = LLEnvironment::instance().getCurrentWater();
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, legacy_sky, current_water);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().updateEnvironment(static_cast<LLSettingsBase::Seconds>(gSavedSettings.getF32("FSEnvironmentManualTransitionTime")));
LLSettingsWater::ptr_t current_water = instance.getCurrentWater();
instance.setEnvironment(LLEnvironment::ENV_LOCAL, legacy_sky, current_water);
instance.setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
instance.updateEnvironment(static_cast<LLSettingsBase::Seconds>(gSavedSettings.getF32("FSEnvironmentManualTransitionTime")));
}
else
{
@ -866,26 +844,26 @@ void FloaterQuickPrefs::selectSkyPreset(const LLSD& preset)
else // note the else here bridges the endif
#endif
{
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().setManualEnvironment(LLEnvironment::ENV_LOCAL, preset.asUUID());
instance.setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
instance.setManualEnvironment(LLEnvironment::ENV_LOCAL, preset.asUUID());
}
}
void FloaterQuickPrefs::selectWaterPreset(const LLSD& preset)
{
auto& instance = LLEnvironment::instance();
#ifdef OPENSIM
if(!preset.isUUID() && LLGridManager::getInstance()->isInOpenSim())
{
LLSettingsWater::ptr_t legacy_water = nullptr;
LLSD messages;
legacy_water = LLEnvironment::createWaterFromLegacyPreset(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "water", preset.asString() + ".xml"), messages);
if (legacy_water)
if (auto legacy_water = LLEnvironment::createWaterFromLegacyPreset(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "water", preset.asString() + ".xml"), messages))
{
// Need to preserve current sky manually in this case in contrast to asset-based settings
LLSettingsSky::ptr_t current_sky = LLEnvironment::instance().getCurrentSky();
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, current_sky, legacy_water);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().updateEnvironment(static_cast<LLSettingsBase::Seconds>(gSavedSettings.getF32("FSEnvironmentManualTransitionTime")));
LLSettingsSky::ptr_t current_sky = instance.getCurrentSky();
instance.setEnvironment(LLEnvironment::ENV_LOCAL, current_sky, legacy_water);
instance.setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
instance.updateEnvironment(static_cast<LLSettingsBase::Seconds>(gSavedSettings.getF32("FSEnvironmentManualTransitionTime")));
}
else
{
@ -896,24 +874,24 @@ void FloaterQuickPrefs::selectWaterPreset(const LLSD& preset)
else // beware the trailing else here.
#endif
{
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().setManualEnvironment(LLEnvironment::ENV_LOCAL, preset.asUUID());
instance.setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
instance.setManualEnvironment(LLEnvironment::ENV_LOCAL, preset.asUUID());
}
}
void FloaterQuickPrefs::selectDayCyclePreset(const LLSD& preset)
{
auto& instance = LLEnvironment::instance();
#ifdef OPENSIM
if(!preset.isUUID() && LLGridManager::getInstance()->isInOpenSim())
{
LLSettingsDay::ptr_t legacyday = nullptr;
LLSD messages;
legacyday = LLEnvironment::createDayCycleFromLegacyPreset(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "days", preset.asString() + ".xml"), messages);
if (legacyday)
if (auto legacyday = LLEnvironment::createDayCycleFromLegacyPreset(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", "days", preset.asString() + ".xml"), messages))
{
LLEnvironment::instance().setEnvironment(LLEnvironment::ENV_LOCAL, legacyday);
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().updateEnvironment(static_cast<LLSettingsBase::Seconds>(gSavedSettings.getF32("FSEnvironmentManualTransitionTime")));
instance.setEnvironment(LLEnvironment::ENV_LOCAL, legacyday);
instance.setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
instance.updateEnvironment(static_cast<LLSettingsBase::Seconds>(gSavedSettings.getF32("FSEnvironmentManualTransitionTime")));
}
else
{
@ -924,8 +902,8 @@ void FloaterQuickPrefs::selectDayCyclePreset(const LLSD& preset)
else // beware trailing else that bridges the endif
#endif
{
LLEnvironment::instance().setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
LLEnvironment::instance().setManualEnvironment(LLEnvironment::ENV_LOCAL, preset.asUUID());
instance.setSelectedEnvironment(LLEnvironment::ENV_LOCAL);
instance.setManualEnvironment(LLEnvironment::ENV_LOCAL, preset.asUUID());
}
}
@ -1176,11 +1154,11 @@ void FloaterQuickPrefs::updateControl(const std::string& controlName, ControlEnt
// hide all widget types except for the one the user wants
LLUICtrl* widget{ nullptr };
for (it = typeMap.begin(); it != typeMap.end(); ++it)
for (const auto& [control_type, control_name] : typeMap)
{
if (entry.type != it->first)
if (entry.type != control_type)
{
widget = entry.panel->getChild<LLUICtrl>(it->second);
widget = entry.panel->findChild<LLUICtrl>(control_name);
if (widget)
{
@ -1317,7 +1295,7 @@ LLUICtrl* FloaterQuickPrefs::addControl(const std::string& controlName, const st
if (!panel)
{
LL_WARNS() << "could not add panel" << LL_ENDL;
return NULL;
return nullptr;
}
// sanity checks
@ -1335,8 +1313,8 @@ LLUICtrl* FloaterQuickPrefs::addControl(const std::string& controlName, const st
// create a new internal entry for this control
ControlEntry newControl;
newControl.panel = panel->getChild<LLPanel>("option_ordering_panel");
newControl.widget = NULL;
newControl.label_textbox = NULL;
newControl.widget = nullptr;
newControl.label_textbox = nullptr;
newControl.label = controlLabel;
newControl.type = type;
newControl.integer = integer;
@ -1419,7 +1397,7 @@ void FloaterQuickPrefs::removeControl(const std::string& controlName, bool remov
}
}
void FloaterQuickPrefs::selectControl(std::string controlName)
void FloaterQuickPrefs::selectControl(const std::string& controlName)
{
// remove previously selected marker, if any
if (!mSelectedControl.empty() && hasControl(mSelectedControl))
@ -1492,8 +1470,7 @@ void FloaterQuickPrefs::selectControl(std::string controlName)
}
// the rest will not need them
default:
{
}
break;
}
}
@ -1544,14 +1521,13 @@ void FloaterQuickPrefs::onEditModeChanged()
std::string settings_path = getSettingsPath(true);
// loop through the list of controls, in the displayed order
std::list<std::string>::iterator it;
for (it = mControlsOrder.begin(); it != mControlsOrder.end(); ++it)
for (const auto& control_name : mControlsOrder)
{
const ControlEntry& entry = mControlsList[*it];
const ControlEntry& entry = mControlsList[control_name];
QuickPrefsXMLEntry xml_entry;
// add control values to the XML entry
xml_entry.control_name = *it;
xml_entry.control_name = control_name;
xml_entry.label = entry.label;
xml_entry.control_type = (U32)entry.type;
xml_entry.integer = entry.integer;
@ -1571,8 +1547,7 @@ void FloaterQuickPrefs::onEditModeChanged()
// Write the resulting XML to file
if (!output_node->isNull())
{
LLFILE* fp = LLFile::fopen(settings_path, "w");
if (fp)
if (LLFILE* fp = LLFile::fopen(settings_path, "w"))
{
LLXMLNode::writeHeaderToFile(fp);
output_node->writeToFile(fp);
@ -1614,12 +1589,11 @@ void FloaterQuickPrefs::onValuesChanged()
// disable selection so the border doesn't cause a crash
selectControl("");
// rename the old ordering entry
std::list<std::string>::iterator it;
for (it = mControlsOrder.begin(); it != mControlsOrder.end(); ++it)
for (auto& control_name : mControlsOrder)
{
if (*it == old_control_name)
if (control_name == old_control_name)
{
*it = new_control_name;
control_name = new_control_name;
break;
}
}
@ -1689,6 +1663,7 @@ void FloaterQuickPrefs::onValuesChanged()
case TYPE_U32:
{
min_value = 0.0f;
[[fallthrough]];
}
// Fallthrough, S32 and U32 are integer values
case TYPE_S32:
@ -1701,7 +1676,8 @@ void FloaterQuickPrefs::onValuesChanged()
// Everything else gets a text widget for now
default:
{
type=ControlTypeText;
type = ControlTypeText;
break;
}
}
@ -1805,8 +1781,7 @@ void FloaterQuickPrefs::swapControls(const std::string& control1, const std::str
void FloaterQuickPrefs::onMoveUpClicked()
{
// find the control in the ordering list
std::list<std::string>::iterator it;
for (it = mControlsOrder.begin(); it != mControlsOrder.end(); ++it)
for (auto it = mControlsOrder.begin(); it != mControlsOrder.end(); ++it)
{
if (*it == mSelectedControl)
{
@ -1835,8 +1810,7 @@ void FloaterQuickPrefs::onMoveUpClicked()
void FloaterQuickPrefs::onMoveDownClicked()
{
// find the control in the ordering list
std::list<std::string>::iterator it;
for (it = mControlsOrder.begin(); it != mControlsOrder.end(); ++it)
for (auto it = mControlsOrder.begin(); it != mControlsOrder.end(); ++it)
{
if (*it == mSelectedControl)
{
@ -2050,8 +2024,7 @@ void FloaterQuickPrefs::onClickResetRenderSSAOEffectX()
void FloaterQuickPrefs::callbackRestoreDefaults(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( option == 0 ) // YES
if (S32 option = LLNotificationsUtil::getSelectedOption(notification, response); option == 0) // YES
{
selectControl("");
for (const auto& control : mControlsOrder)

View File

@ -97,8 +97,8 @@ private:
void setDefaultPresetsEnabled(bool enabled);
public:
/*virtual*/ bool postBuild();
virtual void onOpen(const LLSD& key);
bool postBuild() override;
void onOpen(const LLSD& key) override;
void setSelectedSky(const std::string& preset_name);
void setSelectedWater(const std::string& preset_name);
@ -196,7 +196,7 @@ private:
boost::signals2::connection mRegionChangedSlot;
public:
virtual void onClose(bool app_quitting);
void onClose(bool app_quitting) override;
protected:
enum ControlType
@ -277,14 +277,14 @@ protected:
std::string getSettingsPath(bool save_mode);
// adds a new control and returns a pointer to the chosen widget
LLUICtrl* addControl(const std::string& controlName, const std::string& controlLabel, LLView* slot = NULL, ControlType type = ControlTypeRadio, bool integer = false, F32 min_value = -1000000.0f, F32 max_value = 1000000.0f, F32 increment = 0.0f);
LLUICtrl* addControl(const std::string& controlName, const std::string& controlLabel, LLView* slot = nullptr, ControlType type = ControlTypeRadio, bool integer = false, F32 min_value = -1000000.0f, F32 max_value = 1000000.0f, F32 increment = 0.0f);
// removes a control
void removeControl(const std::string& controlName, bool remove_slot = true);
// updates a single control
void updateControl(const std::string& controlName, ControlEntry& entry);
// make this control the currently selected one
void selectControl(std::string controlName);
void selectControl(const std::string& controlName);
// toggles edit mode
void onDoubleClickLabel(LLUICtrl* ctrl, LLPanel* panel);
@ -305,8 +305,9 @@ protected:
// swaps two controls, used for move up and down
void swapControls(const std::string& control1, const std::string& control2);
bool hasControl( std::string const &aName ) const
{ return mControlsList.end() != mControlsList.find( aName ); }
bool hasControl(std::string const &aName) const
{
return mControlsList.end() != mControlsList.find(aName);
}
};
#endif // QUICKPREFS_H

View File

@ -29,7 +29,7 @@ class LLControlVariable;
class SanityCheck : public LLSingleton<SanityCheck>
{
LLSINGLETON_EMPTY_CTOR(SanityCheck);
~SanityCheck() { };
~SanityCheck() = default;
public:
void init();

View File

@ -42,7 +42,7 @@ public:
protected:
void initSingleton() override;
void checkMetadata(const LLSD& metadata);
void sendStreamTitleToChat(std::string_view Title);
void sendStreamTitleToChat(std::string_view title);
boost::signals2::connection mMetadataUpdateConnection{};
};

View File

@ -37,21 +37,17 @@
UtilityBar::UtilityBar() :
LLSingleton<UtilityBar>(),
LLEventTimer(0.5f),
mAOInterfaceButton(NULL),
mVolumeControlsInterfaceButton(NULL),
mParcelMediaPlayButton(NULL),
mParcelStreamPlayButton(NULL),
mTalkButton(NULL),
mPTTButton(NULL)
mAOInterfaceButton(nullptr),
mVolumeControlsInterfaceButton(nullptr),
mParcelMediaPlayButton(nullptr),
mParcelStreamPlayButton(nullptr),
mTalkButton(nullptr),
mPTTButton(nullptr)
{
// Tried to do this cleanly with callbacks and controls, but ran into dead ends on every approach.
// This helper class works, but I am not at all satisfied with it. -Zi
}
UtilityBar::~UtilityBar()
{
}
void UtilityBar::init()
{
LLView* rootView = LLUI::getInstance()->getRootView();

View File

@ -30,29 +30,27 @@
class LLButton;
class UtilityBar
: public LLSingleton<UtilityBar>,
public LLEventTimer
class UtilityBar : public LLSingleton<UtilityBar>, public LLEventTimer
{
LLSINGLETON(UtilityBar);
~UtilityBar();
~UtilityBar() = default;
public:
void init();
virtual bool tick() override;
void setAOInterfaceButtonExpanded(bool expanded);
void setVolumeControlsButtonExpanded(bool expanded);
public:
void init();
bool tick() override;
void setAOInterfaceButtonExpanded(bool expanded);
void setVolumeControlsButtonExpanded(bool expanded);
protected:
void onParcelStreamClicked();
void onParcelMediaClicked();
protected:
void onParcelStreamClicked();
void onParcelMediaClicked();
LLButton* mParcelStreamPlayButton;
LLButton* mParcelMediaPlayButton;
LLButton* mTalkButton;
LLButton* mAOInterfaceButton;
LLButton* mVolumeControlsInterfaceButton;
LLButton* mPTTButton;
LLButton* mParcelStreamPlayButton;
LLButton* mParcelMediaPlayButton;
LLButton* mTalkButton;
LLButton* mAOInterfaceButton;
LLButton* mVolumeControlsInterfaceButton;
LLButton* mPTTButton;
};
#endif // UTILITYBAR_H