Redesigned snapshot panel with advanced options at the bottom

master
ziree 2012-01-23 00:26:01 +01:00
parent 888569fa47
commit 19d0384cd8
10 changed files with 177 additions and 89 deletions

View File

@ -1144,12 +1144,16 @@ public:
// static
LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found)
{
LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container");
LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel_container->getCurrentPanel());
if (!ok_if_not_found)
{
llassert_always(active_panel != NULL);
}
// <FS:Zi> We don't use the <panel_container> in the new version, since a tab widget makes a lot more sense
// LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container");
// LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel_container->getCurrentPanel());
// if (!ok_if_not_found)
// {
// llassert_always(active_panel != NULL);
// }
LLTabContainer* tab_container=floater->getChild<LLTabContainer>("panel_tab_container");
LLPanelSnapshot* active_panel=(LLPanelSnapshot*) tab_container->getCurrentPanel();
// </FS:Zi>
return active_panel;
}
@ -1267,11 +1271,18 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
floaterp->getChild<LLButton>("advanced_options_btn")->setImageOverlay(advanced ? "TabIcon_Open_Off" : "TabIcon_Close_Off");
if (advanced != advanced_options_panel->getVisible())
{
S32 panel_width = advanced_options_panel->getRect().getWidth();
// <FS:Zi> New calculation method for advanced options at the bottom of the floater
// S32 panel_width = advanced_options_panel->getRect().getWidth();
floaterp->getChild<LLPanel>("advanced_options_panel")->setVisible(advanced);
S32 floater_width = floaterp->getRect().getWidth();
floater_width += (advanced ? panel_width : -panel_width);
floaterp->reshape(floater_width, floaterp->getRect().getHeight());
// S32 floater_width = floaterp->getRect().getWidth();
// floater_width += (advanced ? panel_width : -panel_width);
// floaterp->reshape(floater_width, floaterp->getRect().getHeight());
S32 panel_height = advanced_options_panel->getRect().getHeight();
S32 floater_height = floaterp->getRect().getHeight();
floater_height+=(advanced) ? panel_height : -panel_height;
floaterp->reshape(floaterp->getRect().getWidth(),floater_height);
floaterp->translate(0,(advanced) ? -panel_height : panel_height);
// </FS:Zi>
}
if(!advanced) //set to original window resolution
@ -2012,6 +2023,9 @@ LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
mFailureLblPanel(NULL),
impl (*(new Impl))
{
// <FS:Zi> Add a commit handler to react on switching snapshot destination tab pages
mCommitCallbackRegistrar.add("Snapshot.SelectDestination",boost::bind(&LLFloaterSnapshot::onSelectDestination,this));
// </FS:Zi>
}
// Destroys the object
@ -2446,12 +2460,38 @@ void LLFloaterSnapshot::setAgentEmail(const std::string& email)
LLFloaterSnapshot* instance = LLFloaterReg::findTypedInstance<LLFloaterSnapshot>("snapshot");
if (instance)
{
LLSideTrayPanelContainer* panel_container = instance->getChild<LLSideTrayPanelContainer>("panel_container");
LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard");
// <FS:Zi> Adapt code to new tab widget
// LLSideTrayPanelContainer* panel_container = instance->getChild<LLSideTrayPanelContainer>("panel_container");
// LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard");
LLPanel* postcard_panel=instance->getChild<LLPanel>("panel_snapshot_postcard");
postcard_panel->notify(LLSD().with("agent-email", email));
// </FS:Zi>
}
}
// <FS:Zi> Called whenever the snapshot destination is changed
void LLFloaterSnapshot::onSelectDestination()
{
static LLPanelSnapshot* previousPanel;
LLPanelSnapshot* panel=(LLPanelSnapshot*) getChild<LLTabContainer>("panel_tab_container")->getCurrentPanel();
if(!panel)
{
llwarns << "no active snapshot destination found" << llendl;
return;
}
// postPanelSwitch uses getInstance() on us, but we won't have retgistered in the singleton handler
// until then, so we'd run into a loop. Make sure we don't update on first run. <FS:Zi>
if(previousPanel!=0)
{
panel->onOpen(LLSD());
postPanelSwitch();
}
previousPanel=panel;
}
// </FS:Zi>
///----------------------------------------------------------------------------
/// Class LLSnapshotFloaterView
///----------------------------------------------------------------------------

View File

@ -74,6 +74,8 @@ private:
LLUICtrl *mRefreshBtn, *mRefreshLabel;
LLUICtrl *mSucceessLblPanel, *mFailureLblPanel;
void onSelectDestination(); // <FS:Zi> Called whenever the snapshot destination is changed
class Impl;
Impl& impl;
};

View File

@ -32,6 +32,8 @@
#include "llfloatersnapshot.h" // FIXME: create a snapshot model
// <FS:Zi> This file is not used in Firestorm
/**
* Provides several ways to save a snapshot.
*/

View File

@ -4,14 +4,14 @@
legacy_header_height="18"
can_minimize="true"
can_close="true"
height="500"
height="560"
layout="topleft"
name="Snapshot"
help_topic="snapshot"
save_rect="true"
save_visibility="false"
title="SNAPSHOT PREVIEW"
width="470">
width="270">
<floater.string
name="unknown">
unknown
@ -64,23 +64,13 @@
name="local_failed_str">
Failed to save to computer.
</string>
<button
follows="left|top"
height="23"
image_overlay="TabIcon_Close_Off"
layout="topleft"
left="236"
name="advanced_options_btn"
tool_tip="Advanced options"
top="25"
width="23" />
<ui_ctrl
<ui_ctrl
follows="top|left|right"
height="160"
width="250"
layout="topleft"
name="thumbnail_placeholder"
top="50"
follows="left|top"
top="25"
left="10">
<panel
background_visible="true"
@ -208,7 +198,7 @@
layout="topleft"
name="img_info_border"
top_pad="3"
follows="left|top"
follows="left|right|top"
left_delta="0"
/>
<text
@ -226,11 +216,11 @@
[WIDTH] x [HEIGHT] px
</text>
<text
follows="left|top"
follows="right|top"
font="SansSerifSmall"
height="14"
layout="topleft"
left="200"
right="-14"
length="1"
halign="right"
name="file_size_label"
@ -239,7 +229,7 @@
width="50">
[SIZE] KB
</text>
<panel_container
<!-- <panel_container
follows="left|top"
height="260"
layout="topleft"
@ -247,48 +237,65 @@
name="panel_container"
default_panel_name="panel_snapshot_options"
top_pad="10"
width="270">
<panel
width="270">-->
<tab_container
follows="top|left|right"
height="210"
layout="topleft"
left="5"
name="panel_tab_container"
right="-5"
tab_min_width="10"
top_pad="10">
<tab_container.commit_callback
function="Snapshot.SelectDestination" />
<!-- <panel
class="llpanelsnapshotoptions"
filename="panel_snapshot_options.xml"
follows="all"
layout="topleft"
left="0"
name="panel_snapshot_options"
top="0" />
top="0" />-->
<panel
class="llpanelsnapshotprofile"
follows="all"
label="Profile"
layout="topleft"
name="panel_snapshot_profile"
filename="panel_snapshot_profile.xml" />
<panel
class="llpanelsnapshotpostcard"
follows="all"
label="Email"
layout="topleft"
name="panel_snapshot_postcard"
filename="panel_snapshot_postcard.xml" />
<panel
class="llpanelsnapshotinventory"
follows="all"
label="Inventory"
layout="topleft"
name="panel_snapshot_inventory"
filename="panel_snapshot_inventory.xml" />
<panel
class="llpanelsnapshotlocal"
follows="all"
label="Disk"
layout="topleft"
name="panel_snapshot_local"
filename="panel_snapshot_local.xml" />
</panel_container>
</tab_container>
<!-- </panel_container> -->
<panel
height="295"
follows="left|right|bottom"
height="120"
layout="topleft"
left="270"
left="0"
name="advanced_options_panel"
top="20"
width="200">
<text
right="-1"
top_pad="4">
<!-- <text
type="string"
font="SansSerifSmall"
length="1"
@ -311,7 +318,7 @@
name="advanced_options_hr"
right="-10"
top_pad="5"
/>
/> -->
<text
type="string"
length="1"
@ -320,7 +327,7 @@
layout="topleft"
left="10"
name="layer_type_label"
top_pad="10"
top_pad="0"
width="50">
Capture:
</text>
@ -370,4 +377,27 @@
width="180"
name="auto_snapshot_check" />
</panel>
<button
bottom="-1"
follows="left|right|bottom"
height="12"
image_overlay="Arrow_Up"
layout="topleft"
left="1"
right="-1"
name="advanced_options_btn"
tool_tip="Advanced options" />
<!-- <FS:Zi> to make the code not crash -->
<panel_container
enabled="false"
follows="none"
height="0"
layout="topleft"
left="0"
name="panel_container"
top="0"
visible="false"
width="0">
<panel />
</panel_container>
</floater>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
follows="all"
height="380"
layout="topleft"
name="panel_postcard_message"
@ -72,7 +73,7 @@
name="subject_form"
right="-10"
top_delta="-4" />
<text
<!-- <text
type="string"
length="1"
bottom_delta="23"
@ -83,22 +84,22 @@
name="msg_label"
right="-10">
Message:
</text>
</text> -->
<text_editor
type="string"
length="1"
follows="left|top|right"
height="60"
follows="all"
height="276"
layout="topleft"
left_delta="0"
left="12"
max_length="700"
name="msg_form"
right="-10"
top_pad="10"
top_pad="3"
word_wrap="true">
Type your message here.
</text_editor>
<button
<!-- <button
follows="right|bottom"
height="23"
label="Cancel"
@ -109,15 +110,15 @@
width="100">
<button.commit_callback
function="Postcard.Cancel" />
</button>
</button>-->
<button
bottom="-1"
follows="right|bottom"
height="23"
label="Send"
layout="topleft"
left_delta="-106"
right="-10"
name="send_btn"
top_delta="0"
width="100">
<button.commit_callback
function="Postcard.Send" />

View File

@ -4,7 +4,7 @@
layout="topleft"
name="panel_snapshot_inventory"
width="490">
<icon
<!-- <icon
follows="top|left"
height="18"
image_name="Snapshot_Inventory"
@ -37,17 +37,16 @@
name="hr"
right="-10"
top_pad="5"
/>
/>-->
<text
bottom="35"
follows="top|left|right"
font="SansSerif"
height="56"
height="68"
layout="topleft"
left="12"
length="1"
name="hint_lbl"
top_pad="10"
top="5"
type="string"
word_wrap="true">
Saving an image to your inventory costs L$[UPLOAD_COST]. To save your image as a texture select one of the square formats.
@ -113,14 +112,14 @@
top_delta="0"
width="95" />
<check_box
bottom_delta="20"
top_pad="4"
follows="left|top"
label="Constrain proportions"
layout="topleft"
left="10"
name="inventory_keep_aspect_check"
visible="false" />
<button
<!-- <button
follows="right|bottom"
height="23"
label="Cancel"
@ -131,15 +130,15 @@
width="100">
<button.commit_callback
function="Inventory.Cancel" />
</button>
</button>-->
<button
bottom="-1"
follows="right|bottom"
height="23"
label="Save"
layout="topleft"
left_delta="-106"
right="-10"
name="save_btn"
top_delta="0"
width="100">
<button.commit_callback
function="Inventory.Save" />

View File

@ -4,7 +4,7 @@
layout="topleft"
name="panel_snapshot_local"
width="490">
<icon
<!-- <icon
follows="top|left"
height="18"
image_name="Snapshot_Download"
@ -37,7 +37,7 @@
name="hr"
right="-10"
top_pad="5"
/>
/>-->
<combo_box
follows="left|top|right"
height="23"
@ -46,7 +46,7 @@
left_delta="0"
name="local_size_combo"
right="-10"
top_pad="10">
top="5">
<combo_box.item
label="Current Window"
name="CurrentWindow"
@ -202,7 +202,7 @@
</text>
</layout_panel>
</layout_stack>
<button
<!-- <button
follows="right|bottom"
height="23"
label="Cancel"
@ -213,16 +213,16 @@
width="100">
<button.commit_callback
function="Local.Cancel" />
</button>
</button>-->
<flyout_button
bottom="-1"
follows="right|bottom"
height="23"
label="Save"
layout="topleft"
left_delta="-106"
right="-1"
name="save_btn"
tool_tip="Save image to a file"
top_delta="0"
width="100">
<flyout_button.item
label="Save"

View File

@ -1,3 +1,5 @@
<!-- <FS:Zi> This file is unused in Firestorm -->
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
follows="all"

View File

@ -16,7 +16,7 @@
name="upload_message">
Sending...
</string>
<icon
<!-- <icon
follows="top|left"
height="18"
image_name="Snapshot_Email"
@ -84,16 +84,27 @@
name="postcard_panel_container"
default_panel_name="panel_postcard_message"
top_pad="10"
width="490">-->
<tab_container
follows="all"
height="376"
layout="topleft"
left="1"
name="postcard_panel_container"
top="5"
width="490">
<panel
follows="all"
label="Message"
layout="topleft"
name="panel_postcard_message"
filename="panel_postcard_message.xml" />
<panel
follows="all"
label="Settings"
layout="topleft"
name="panel_postcard_settings"
filename="panel_postcard_settings.xml" />
</panel_container>
</tab_container>
<!-- </panel_container>-->
</panel>

View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
follows="all"
height="380"
layout="topleft"
name="panel_snapshot_profile"
width="490">
<icon
<!-- <icon
follows="top|left"
height="18"
image_name="Snapshot_Profile"
@ -37,16 +38,16 @@
name="hr"
right="-10"
top_pad="5"
/>
/>-->
<combo_box
follows="left|top"
follows="left|right|top"
height="23"
label="Resolution"
layout="topleft"
left_delta="0"
left="1"
name="profile_size_combo"
top_pad="10"
width="250">
right="-1"
top="5">
<combo_box.item
label="Current Window"
name="CurrentWindow"
@ -68,7 +69,7 @@
name="Custom"
value="[i-1,i-1]" />
</combo_box>
<layout_stack
<!-- <layout_stack
animate="false"
follows="all"
height="270"
@ -88,7 +89,7 @@
auto_resize="false"
top="0"
right="-1"
visible="true">
visible="true">-->
<spinner
allow_text_entry="false"
decimal_digits="0"
@ -98,7 +99,7 @@
label="Width"
label_width="40"
layout="topleft"
left="10"
left="0"
max_val="6016"
min_val="32"
name="profile_snapshot_width"
@ -125,7 +126,7 @@
layout="topleft"
left="10"
name="profile_keep_aspect_check" />
</layout_panel>
<!-- </layout_panel>
<layout_panel
follows="top|left|right"
height="200"
@ -136,7 +137,7 @@
auto_resize="true"
top="0"
right="-1"
visible="true">
visible="true">-->
<text
length="1"
follows="top|left|right"
@ -145,20 +146,20 @@
layout="topleft"
left="0"
name="caption_label"
right="-10"
right="-1"
top_pad="0"
type="string">
Caption:
</text>
<text_editor
follows="all"
height="155"
height="215"
layout="topleft"
left_delta="0"
length="1"
max_length="700"
name="caption"
right="-10"
right="-1"
top_pad="5"
type="string"
word_wrap="true">
@ -171,7 +172,7 @@
left_delta="0"
name="add_location_cb"
top_pad="15" />
</layout_panel>
<!-- </layout_panel>
</layout_stack>
<button
follows="right|bottom"
@ -184,15 +185,15 @@
width="100">
<button.commit_callback
function="PostToProfile.Cancel" />
</button>
</button>-->
<button
bottom="-1"
follows="right|bottom"
height="23"
label="Post"
layout="topleft"
left_delta="-106"
right="-10"
name="post_btn"
top_delta="0"
width="100">
<button.commit_callback
function="PostToProfile.Send" />