Add Open Picture button to Pick Panels (and Further LLPanelPick cleanup)

This commit is contained in:
Lirusaito
2013-06-15 18:34:14 -04:00
parent c5d21cfb1c
commit 657d3f704c
3 changed files with 41 additions and 39 deletions

View File

@@ -30,46 +30,43 @@
* $/LicenseInfo$
*/
// Display of a "Top Pick" used both for the global top picks in the
// Find directory, and also for each individual user's picks in their
// profile.
// Display of each individual user's picks in their profile.
#include "llviewerprecompiledheaders.h"
#include "llpanelpick.h"
#include "lldir.h"
#include "lllineeditor.h"
#include "llnotificationsutil.h"
#include "llparcel.h"
#include "message.h"
#include "lltexteditor.h"
#include "lltexturectrl.h"
#include "lluictrlfactory.h"
#include "llagent.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llviewercontrol.h"
#include "lllineeditor.h"
#include "lltextbox.h"
#include "llviewertexteditor.h"
#include "lltexturectrl.h"
#include "lluiconstants.h"
#include "llviewergenericmessage.h"
#include "lluictrlfactory.h"
#include "llviewerparcelmgr.h"
#include "llworldmap.h"
#include "llfloaterworldmap.h"
#include "llpreviewtexture.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewerwindow.h"
#include "llnotificationsutil.h"
// [RLVa:KB]
#include "rlvhandler.h"
// [/RLVa:KB]
//For pick import and export - RK
#include "statemachine/aifilepicker.h"
#include "llviewernetwork.h"
#include "llsdserialize.h"
#include "hippogridmanager.h"
#include "llsdserialize.h"
void show_picture(const LLUUID& id, const std::string& name)
{
// Try to show and focus existing preview
if (LLPreview::show(id)) return;
// If there isn't one, make a new preview
LLPreview* preview = new LLPreviewTexture("preview texture", gSavedSettings.getRect("PreviewTextureRect"), name, id);
preview->setFocus(true);
}
//static
std::list<LLPanelPick*> LLPanelPick::sAllPanels;
@@ -78,14 +75,15 @@ LLPanelPick::LLPanelPick()
mPickID(),
mCreatorID(),
mParcelID(),
mDataRequested(FALSE),
mDataReceived(FALSE),
mDataRequested(false),
mDataReceived(false),
mPosGlobal(),
mSnapshotCtrl(NULL),
mNameEditor(NULL),
mDescEditor(NULL),
mLocationEditor(NULL),
mSetBtn(NULL),
mOpenBtn(NULL),
mImporting(0)
{
sAllPanels.push_back(this);
@@ -115,8 +113,8 @@ void LLPanelPick::reset()
mParcelID.setNull();
// Don't request data, this isn't valid
mDataRequested = TRUE;
mDataReceived = FALSE;
mDataRequested = true;
mDataReceived = false;
mPosGlobal.clearVec();
@@ -130,18 +128,21 @@ BOOL LLPanelPick::postBuild()
mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelPick::onCommitAny, this));
mNameEditor = getChild<LLLineEditor>("given_name_editor");
mNameEditor->setCommitOnFocusLost(TRUE);
mNameEditor->setCommitOnFocusLost(true);
mNameEditor->setCommitCallback(boost::bind(&LLPanelPick::onCommitAny, this));
mDescEditor = getChild<LLTextEditor>("desc_editor");
mDescEditor->setCommitOnFocusLost(TRUE);
mDescEditor->setCommitOnFocusLost(true);
mDescEditor->setCommitCallback(boost::bind(&LLPanelPick::onCommitAny, this));
mDescEditor->setTabsToNextField(TRUE);
mDescEditor->setTabsToNextField(true);
mLocationEditor = getChild<LLLineEditor>("location_editor");
mSetBtn = getChild<LLButton>( "set_location_btn");
mSetBtn->setCommitCallback(boost::bind(&LLPanelPick::onClickSet,this));
mSetBtn = getChild<LLUICtrl>( "set_location_btn");
mSetBtn->setCommitCallback(boost::bind(&LLPanelPick::onClickSet,this));
mOpenBtn = getChild<LLUICtrl>("open_picture_btn");
mOpenBtn->setCommitCallback(boost::bind(show_picture, boost::bind(&LLTextureCtrl::getImageAssetID, mSnapshotCtrl), boost::bind(&LLLineEditor::getText, mNameEditor)));
getChild<LLUICtrl>("pick_teleport_btn")->setCommitCallback(boost::bind(&LLPanelPick::onClickTeleport,this));
getChild<LLUICtrl>("pick_map_btn")->setCommitCallback(boost::bind(&LLPanelPick::onClickMap,this));
@@ -182,7 +183,7 @@ void LLPanelPick::processProperties(void* data, EAvatarProcessorType type)
S32 region_z = llround((F32)pick_info->pos_global.mdV[VZ]);
location_text.append(llformat("(%d, %d, %d)", region_x, region_y, region_z));
mDataReceived = TRUE;
mDataReceived = true;
// Found the panel, now fill in the information
mPickID = pick_info->pick_id;
@@ -299,8 +300,8 @@ void LLPanelPick::setPickID(const LLUUID& pick_id, const LLUUID& creator_id)
// from the server next time it is drawn.
void LLPanelPick::markForServerRequest()
{
mDataRequested = FALSE;
mDataReceived = FALSE;
mDataRequested = false;
mDataReceived = false;
}
@@ -309,7 +310,7 @@ void LLPanelPick::sendPickInfoRequest()
LLAvatarPropertiesProcessor::getInstance()->addObserver(mCreatorID, this);
LLAvatarPropertiesProcessor::getInstance()->sendPickInfoRequest(mCreatorID, mPickID);
mDataRequested = TRUE;
mDataRequested = true;
}
@@ -359,6 +360,7 @@ void LLPanelPick::draw()
// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
mSetBtn->setEnabled(is_self && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC));
// [/RLVa]
mOpenBtn->setVisible(!is_self);
LLPanel::draw();
}

View File

@@ -38,9 +38,7 @@
#include "llpanel.h"
#include "llavatarpropertiesprocessor.h"
class LLButton;
class LLLineEditor;
class LLTextBox;
class LLTextEditor;
class LLTextureCtrl;
class AIFilePicker;
@@ -111,8 +109,9 @@ protected:
LLTextEditor* mDescEditor;
LLLineEditor* mLocationEditor;
LLButton* mTeleportBtn;
LLButton* mSetBtn;
LLUICtrl* mTeleportBtn;
LLUICtrl* mSetBtn;
LLUICtrl* mOpenBtn;
typedef std::list<LLPanelPick*> panel_list_t;
static panel_list_t sAllPanels;

View File

@@ -14,6 +14,7 @@
width="290" />
<button bottom_delta="-27" follows="left|top" height="20" label="Set Location"
left="180" name="set_location_btn" width="120" />
<button bottom_delta="0" follows="left|top" height="20" width="120" label="Open Picture" name="open_picture_btn"/>
<button bottom_delta="0" follows="left|top" height="20" label="Teleport" left="10"
name="pick_teleport_btn" width="70" />
<button bottom_delta="0" follows="left|top" height="20" label="Show on Map" left="80"