viewer#1300 Update Inventory Settings

master
Andrey Kleshchev 2024-05-04 01:50:50 +03:00
parent db3e5afbfb
commit 1c170381ae
10 changed files with 229 additions and 32 deletions

View File

@ -58,6 +58,7 @@ LLUIColor LLFolderViewItem::sFilterBGColor;
LLUIColor LLFolderViewItem::sFilterTextColor;
LLUIColor LLFolderViewItem::sSuffixColor;
LLUIColor LLFolderViewItem::sSearchStatusColor;
LLUIColor LLFolderViewItem::sFavoriteColor;
// only integers can be initialized in header
const F32 LLFolderViewItem::FOLDER_CLOSE_TIME_CONSTANT = 0.02f;
@ -173,6 +174,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
sFavoriteColor = LLUIColorTable::instance().getColor("InventoryFavoriteColor", DEFAULT_WHITE);
sColorSetInitialized = true;
}
@ -764,6 +766,12 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L
void LLFolderViewItem::drawFavoriteIcon(const Params& default_params, const LLUIColor& fg_color)
{
static LLUICachedControl<bool> draw_star("InventoryFavoritesUseStar", true);
if (!draw_star)
{
return;
}
LLUIImage* favorite_image = NULL;
if (mIsFavorite)
{
@ -1019,7 +1027,20 @@ void LLFolderViewItem::draw()
}
}
LLColor4 color = (mIsSelected && filled) ? mFontHighlightColor : mFontColor;
static LLUICachedControl<bool> highlight_color("InventoryFavoritesColorText", true);
LLColor4 color;
if (mIsSelected && filled)
{
color = mFontHighlightColor;
}
else if (mIsFavorite && highlight_color)
{
color = sFavoriteColor;
}
else
{
color = mFontColor;
}
if (isFadeItem())
{

View File

@ -149,6 +149,8 @@ protected:
static LLUIColor sFilterTextColor;
static LLUIColor sSuffixColor;
static LLUIColor sSearchStatusColor;
static LLUIColor sFavoriteColor;
// this is an internal method used for adding items to folders. A
// no-op at this level, but reimplemented in derived classes.

View File

@ -17405,6 +17405,39 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>InventoryFavoritesUseStar</key>
<map>
<key>Comment</key>
<string>Show star near favorited items in inventory</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>InventoryFavoritesColorText</key>
<map>
<key>Comment</key>
<string>render favorite items using InventoryFavoriteText as color</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>InventoryAddAttachmentBehavior</key>
<map>
<key>Comment</key>
<string>Defines behavior when hitting return on an inventory item</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>StatsReportMaxDuration</key>
<map>
<key>Comment</key>

View File

@ -28,9 +28,13 @@
#include "llfloaterinventorysettings.h"
#include "llcolorswatch.h"
LLFloaterInventorySettings::LLFloaterInventorySettings(const LLSD& key)
: LLFloater(key)
{
mCommitCallbackRegistrar.add("ScriptPref.applyUIColor", boost::bind(&LLFloaterInventorySettings::applyUIColor, this, _1, _2));
mCommitCallbackRegistrar.add("ScriptPref.getUIColor", boost::bind(&LLFloaterInventorySettings::getUIColor, this, _1, _2));
}
LLFloaterInventorySettings::~LLFloaterInventorySettings()
@ -38,7 +42,24 @@ LLFloaterInventorySettings::~LLFloaterInventorySettings()
BOOL LLFloaterInventorySettings::postBuild()
{
getChild<LLButton>("ok_btn")->setCommitCallback(boost::bind(&LLFloater::closeFloater, this, false));
getChild<LLUICtrl>("favorites_color")->setCommitCallback(boost::bind(&LLFloaterInventorySettings::updateColorSwatch, this));
return TRUE;
}
void LLFloaterInventorySettings::updateColorSwatch()
{
bool val = getChild<LLUICtrl>("favorites_color")->getEnabled();
getChild<LLUICtrl>("favorites_color")->setEnabled(val);
}
void LLFloaterInventorySettings::applyUIColor(LLUICtrl* ctrl, const LLSD& param)
{
LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue()));
}
void LLFloaterInventorySettings::getUIColor(LLUICtrl* ctrl, const LLSD& param)
{
LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*)ctrl;
color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString()));
}

View File

@ -40,6 +40,11 @@ public:
private:
LLFloaterInventorySettings(const LLSD& key);
~LLFloaterInventorySettings();
void updateColorSwatch();
void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
void getUIColor(LLUICtrl* ctrl, const LLSD& param);
};
#endif

View File

@ -7851,7 +7851,8 @@ void LLObjectBridgeAction::attachOrDetach()
}
else
{
LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, false); // Don't replace if adding.
static LLCachedControl<bool> inventory_linking(gSavedSettings, "InventoryAddAttachmentBehavior", false);
LLAppearanceMgr::instance().wearItemOnAvatar(mUUID, true, inventory_linking()); // Don't replace if adding.
}
}

View File

@ -453,6 +453,9 @@
<color
name="InventoryBackgroundColor"
reference="DkGray2" />
<color
name="InventoryFavoriteColor"
reference="Yellow" />
<color
name="InventoryFocusOutlineColor"
reference="White_25" />

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

View File

@ -907,4 +907,5 @@ with the same filename but different name
<texture name="Single_Folder_Up" file_name="icons/single_folder_up.png" preload="true"/>
<texture name="Icon_Color_Palette" file_name="icons/Icon_Color_Palette.png" preload="false"/>
<texture name="Icon_Font_Size" file_name="icons/Icon_Font_Size.png" preload="false"/>
<texture name="Icon_Pointer" file_name="icons/Icon_Pointer.png" preload="false"/>
</textures>

View File

@ -4,8 +4,8 @@
can_minimize="true"
can_resize="false"
save_rect="true"
height="370"
width="370"
height="460"
width="460"
name="inventory_settings"
title="INVENTORY SETTINGS">
<icon
@ -16,7 +16,7 @@
left="18"
mouse_opaque="true"
name="multi_folder_icon"
top="25"
top="20"
width="18" />
<text
type="string"
@ -40,10 +40,10 @@
font="SansSerifMedium"
left="60"
width="300"
height="70"
height="66"
name="multi_double_click_setting">
<radio_item
height="20"
height="18"
label="Expands &amp; collapses folder"
label_text.text_color="White"
follows="left|top"
@ -51,24 +51,24 @@
name="0"
width="200"/>
<radio_item
height="20"
height="18"
follows="left|top"
label="Opens a new window"
label_text.text_color="White"
layout="topleft"
left_delta="0"
name="1"
top_pad ="5"
top_pad ="3"
width="200" />
<radio_item
height="20"
height="18"
follows="left|top"
label="Switches view"
label_text.text_color="White"
layout="topleft"
left_delta="0"
name="2"
top_pad ="5"
top_pad ="3"
width="200" />
</radio_group>
<icon
@ -79,7 +79,7 @@
left="18"
mouse_opaque="true"
name="single_folder_icon"
top_pad="30"
top_pad="19"
width="18" />
<text
type="string"
@ -103,10 +103,10 @@
font="SansSerifMedium"
left="60"
width="300"
height="45"
height="44"
name="single_double_click_setting">
<radio_item
height="20"
height="18"
label="Stays in current window"
label_text.text_color="White"
follows="left|top"
@ -114,27 +114,37 @@
name="false"
width="200"/>
<radio_item
height="20"
height="18"
follows="left|top"
label="Opens a new window"
label_text.text_color="White"
layout="topleft"
left_delta="0"
name="true"
top_pad ="5"
top_pad ="3"
width="200" />
</radio_group>
<icon
follows="top|left"
height="15"
image_name="Icon_Pointer"
layout="topleft"
left="20"
mouse_opaque="true"
name="single_folder_icon"
top_pad="20"
width="15" />
<text
type="string"
length="1"
follows="left|top|right"
height="13"
layout="topleft"
left="48"
left_pad="13"
name="find_original_txt"
font="SansSerifMedium"
text_color="White"
top_pad="30"
top_delta="1"
width="300">
Clicking on "Show in inventory" or "Find original"
</text>
@ -146,10 +156,10 @@
font="SansSerifMedium"
left="60"
width="300"
height="45"
height="44"
name="find_original_settings">
<radio_item
height="20"
height="18"
label="Shows item in main inventory window"
label_text.text_color="White"
follows="left|top"
@ -157,23 +167,123 @@
name="false"
width="200"/>
<radio_item
height="20"
height="18"
follows="left|top"
label="Opens a new single-folder window"
label_text.text_color="White"
layout="topleft"
left_delta="0"
name="true"
top_pad ="5"
top_pad ="3"
width="200" />
</radio_group>
<button
height="20"
label="OK"
layout="topleft"
left="140"
bottom="-20"
name="ok_btn"
label_color="White"
width="90" />
<icon
follows="top|left"
height="18"
image_name="Inv_Favorite_Star_Full"
layout="topleft"
left="18"
mouse_opaque="true"
name="favorites_icon"
top_pad="19"
width="18" />
<text
type="string"
length="1"
layout="topleft"
follows="left|top|right"
height="13"
left_pad="12"
top_delta="2"
name="favorites_txt"
font="SansSerifMedium"
text_color="White"
width="300">
Favorites
</text>
<check_box
control_name="InventoryFavoritesUseStar"
layout="topleft"
follows="left|top"
top_pad="8"
font="SansSerifMedium"
left="60"
width="300"
height="18"
label="Star"
name="favorite_star"
label_text.text_color="White"
initial_value="false"/>
<check_box
control_name="InventoryFavoritesColorText"
follows="left|top"
top_pad="5"
layout="topleft"
font="SansSerifMedium"
left="60"
width="150"
height="18"
label="Colored text"
name="favorites_color"
label_text.text_color="White"
initial_value="false"/>
<color_swatch
can_apply_immediately="true"
follows="left|top"
layout="topleft"
height="24"
label_height="0"
left_pad="40"
name="favorites_swatch"
top_delta="-6"
width="44" >
<color_swatch.init_callback
function="ScriptPref.getUIColor"
parameter="InventoryFavoriteColor" />
<color_swatch.commit_callback
function="ScriptPref.applyUIColor"
parameter="InventoryFavoriteColor" />
</color_swatch>
<icon
follows="top|left"
height="18"
image_name="Inv_Object"
layout="topleft"
left="18"
mouse_opaque="true"
name="obj_icon"
top_pad="19"
width="18" />
<text
type="string"
length="1"
follows="left|top|right"
height="13"
layout="topleft"
left_pad="12"
top_delta="2"
name="single_folder_txt"
font="SansSerifMedium"
text_color="White"
width="300">
Pressing return on an avatar attachment
</text>
<combo_box
control_name="InventoryAddAttachmentBehavior"
layout="topleft"
follows="left|top"
top_pad="8"
height="24"
left="60"
name="attach_combo"
width="300">
<combo_box.item
label="Adds attachment (recommended)"
name="0"
value="0"/>
<combo_box.item
label="Wear (removes attachment at that point)"
name="1"
value="1"/>
</combo_box>
</floater>