Eliminated most instances of the legacy setCallbackUserData (and modernized up a bunch of callbacks)
Also cleaned up slfloatermediafilter to act as a proper singleton. Removes childSetUserData entirely.
This commit is contained in:
@@ -759,8 +759,7 @@ void LLPanel::childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*
|
|||||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
||||||
if (child)
|
if (child)
|
||||||
{
|
{
|
||||||
child->setCommitCallback(cb);
|
child->setCommitCallback(cb, userdata);
|
||||||
child->setCallbackUserData(userdata);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,15 +772,6 @@ void LLPanel::childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanel::childSetUserData(const std::string& id, void* userdata)
|
|
||||||
{
|
|
||||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
|
||||||
if (child)
|
|
||||||
{
|
|
||||||
child->setCallbackUserData(userdata);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
|
void LLPanel::childSetColor(const std::string& id, const LLColor4& color)
|
||||||
{
|
{
|
||||||
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
LLUICtrl* child = getChild<LLUICtrl>(id, true);
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ public:
|
|||||||
|
|
||||||
void childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL );
|
void childSetCommitCallback(const std::string& id, void (*cb)(LLUICtrl*, void*), void* userdata = NULL );
|
||||||
void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) );
|
void childSetValidate(const std::string& id, BOOL (*cb)(LLUICtrl*, void*) );
|
||||||
void childSetUserData(const std::string& id, void* userdata);
|
|
||||||
|
|
||||||
void childSetColor(const std::string& id, const LLColor4& color);
|
void childSetColor(const std::string& id, const LLColor4& color);
|
||||||
void childSetAlpha(const std::string& id, F32 alpha);
|
void childSetAlpha(const std::string& id, F32 alpha);
|
||||||
|
|||||||
@@ -3869,16 +3869,14 @@ LLScrollColumnHeader::LLScrollColumnHeader(const std::string& label, const LLRec
|
|||||||
mHasResizableElement(FALSE)
|
mHasResizableElement(FALSE)
|
||||||
{
|
{
|
||||||
mListPosition = LLComboBox::ABOVE;
|
mListPosition = LLComboBox::ABOVE;
|
||||||
setCommitCallback(onSelectSort);
|
setCommitCallback(boost::bind(&LLScrollColumnHeader::onSelectSort, this));
|
||||||
setCallbackUserData(this);
|
|
||||||
mButton->setTabStop(FALSE);
|
mButton->setTabStop(FALSE);
|
||||||
// require at least two frames between mouse down and mouse up event to capture intentional "hold" not just bad framerate
|
// require at least two frames between mouse down and mouse up event to capture intentional "hold" not just bad framerate
|
||||||
mButton->setHeldDownDelay(LLUI::sConfigGroup->getF32("ColumnHeaderDropDownDelay"), 2);
|
mButton->setHeldDownDelay(LLUI::sConfigGroup->getF32("ColumnHeaderDropDownDelay"), 2);
|
||||||
mButton->setHeldDownCallback(boost::bind(&LLScrollColumnHeader::onHeldDown, this));
|
mButton->setHeldDownCallback(boost::bind(&LLScrollColumnHeader::showList, this));
|
||||||
mButton->setClickedCallback(boost::bind(&LLScrollColumnHeader::onClick, this));
|
mButton->setClickedCallback(boost::bind(&LLScrollColumnHeader::onClick, this));
|
||||||
mButton->setMouseDownCallback(boost::bind(&LLScrollColumnHeader::onMouseDown, this));
|
mButton->setMouseDownCallback(boost::bind(&LLScrollColumnHeader::onMouseDown, this));
|
||||||
|
|
||||||
mButton->setCallbackUserData(this);
|
|
||||||
mButton->setToolTip(label);
|
mButton->setToolTip(label);
|
||||||
|
|
||||||
mAscendingText = std::string("[LOW]...[HIGH](Ascending)"); // *TODO: Translate
|
mAscendingText = std::string("[LOW]...[HIGH](Ascending)"); // *TODO: Translate
|
||||||
@@ -4037,7 +4035,7 @@ BOOL LLScrollColumnHeader::handleDoubleClick(S32 x, S32 y, MASK mask)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
onClick(this);
|
onClick();
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -4065,42 +4063,29 @@ void LLScrollColumnHeader::setImageOverlay(const std::string &image_name, LLFont
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
void LLScrollColumnHeader::onClick()
|
||||||
void LLScrollColumnHeader::onClick(void* user_data)
|
|
||||||
{
|
{
|
||||||
LLScrollColumnHeader* headerp = (LLScrollColumnHeader*)user_data;
|
if (!mColumn) return;
|
||||||
if (!headerp) return;
|
|
||||||
|
|
||||||
LLScrollListColumn* column = headerp->mColumn;
|
if (mList->getVisible())
|
||||||
if (!column) return;
|
|
||||||
|
|
||||||
if (headerp->mList->getVisible())
|
|
||||||
{
|
{
|
||||||
headerp->hideList();
|
hideList();
|
||||||
}
|
}
|
||||||
|
|
||||||
LLScrollListCtrl::onClickColumn(column);
|
LLScrollListCtrl::onClickColumn(mColumn);
|
||||||
|
|
||||||
// propagate new sort order to sort order list
|
// propagate new sort order to sort order list
|
||||||
headerp->mList->selectNthItem(column->mParentCtrl->getSortAscending() ? 0 : 1);
|
mList->selectNthItem(mColumn->mParentCtrl->getSortAscending() ? 0 : 1);
|
||||||
|
|
||||||
headerp->mList->setFocus(TRUE);
|
mList->setFocus(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
void LLScrollColumnHeader::onMouseDown()
|
||||||
void LLScrollColumnHeader::onMouseDown(void* user_data)
|
|
||||||
{
|
{
|
||||||
// for now, do nothing but block the normal showList() behavior
|
// for now, do nothing but block the normal showList() behavior
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
|
||||||
void LLScrollColumnHeader::onHeldDown(void* user_data)
|
|
||||||
{
|
|
||||||
LLScrollColumnHeader* headerp = (LLScrollColumnHeader*)user_data;
|
|
||||||
headerp->showList();
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLScrollColumnHeader::showList()
|
void LLScrollColumnHeader::showList()
|
||||||
{
|
{
|
||||||
if (mShowSortOptions)
|
if (mShowSortOptions)
|
||||||
@@ -4183,30 +4168,25 @@ void LLScrollColumnHeader::showList()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
void LLScrollColumnHeader::onSelectSort()
|
||||||
void LLScrollColumnHeader::onSelectSort(LLUICtrl* ctrl, void* user_data)
|
|
||||||
{
|
{
|
||||||
LLScrollColumnHeader* headerp = (LLScrollColumnHeader*)user_data;
|
if (!mColumn) return;
|
||||||
if (!headerp) return;
|
LLScrollListCtrl* parent = mColumn->mParentCtrl;
|
||||||
|
|
||||||
LLScrollListColumn* column = headerp->mColumn;
|
|
||||||
if (!column) return;
|
|
||||||
LLScrollListCtrl *parent = column->mParentCtrl;
|
|
||||||
if (!parent) return;
|
if (!parent) return;
|
||||||
|
|
||||||
if (headerp->getCurrentIndex() == 0)
|
if (getCurrentIndex() == 0)
|
||||||
{
|
{
|
||||||
// ascending
|
// ascending
|
||||||
parent->sortByColumn(column->mSortingColumn, TRUE);
|
parent->sortByColumn(mColumn->mSortingColumn, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// descending
|
// descending
|
||||||
parent->sortByColumn(column->mSortingColumn, FALSE);
|
parent->sortByColumn(mColumn->mSortingColumn, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore original column header
|
// restore original column header
|
||||||
headerp->setLabel(headerp->mOrigLabel);
|
setLabel(mOrigLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLView* LLScrollColumnHeader::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding)
|
LLView* LLScrollColumnHeader::findSnapEdge(S32& new_edge_val, const LLCoordGL& mouse_dir, ESnapEdge snap_edge, ESnapType snap_type, S32 threshold, S32 padding)
|
||||||
|
|||||||
@@ -241,10 +241,9 @@ public:
|
|||||||
void enableResizeBar(BOOL enable);
|
void enableResizeBar(BOOL enable);
|
||||||
std::string getLabel() { return mOrigLabel; }
|
std::string getLabel() { return mOrigLabel; }
|
||||||
|
|
||||||
static void onSelectSort(LLUICtrl* ctrl, void* user_data);
|
void onSelectSort();
|
||||||
static void onClick(void* user_data);
|
void onClick();
|
||||||
static void onMouseDown(void* user_data);
|
void onMouseDown();
|
||||||
static void onHeldDown(void* user_data);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LLScrollListColumn* mColumn;
|
LLScrollListColumn* mColumn;
|
||||||
|
|||||||
@@ -263,8 +263,7 @@ BOOL LLFloaterNotification::postBuild()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
responses_combo->setCommitCallback(onCommitResponse);
|
responses_combo->setCommitCallback(boost::bind(&LLFloaterNotification::respond, this));
|
||||||
responses_combo->setCallbackUserData(this);
|
|
||||||
|
|
||||||
LLSD form_sd = form->asLLSD();
|
LLSD form_sd = form->asLLSD();
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ public:
|
|||||||
void onClose(bool app_quitting) { setVisible(FALSE); }
|
void onClose(bool app_quitting) { setVisible(FALSE); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void onCommitResponse(LLUICtrl* ctrl, void* data) { ((LLFloaterNotification*)data)->respond(); }
|
|
||||||
LLNotification* mNote;
|
LLNotification* mNote;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -244,40 +244,37 @@ void LLPanelClassified::reset()
|
|||||||
BOOL LLPanelClassified::postBuild()
|
BOOL LLPanelClassified::postBuild()
|
||||||
{
|
{
|
||||||
mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
|
mSnapshotCtrl = getChild<LLTextureCtrl>("snapshot_ctrl");
|
||||||
mSnapshotCtrl->setCommitCallback(onCommitAny);
|
mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mSnapshotCtrl->setCallbackUserData(this);
|
|
||||||
mSnapshotSize = mSnapshotCtrl->getRect();
|
mSnapshotSize = mSnapshotCtrl->getRect();
|
||||||
|
|
||||||
mNameEditor = getChild<LLLineEditor>("given_name_editor");
|
mNameEditor = getChild<LLLineEditor>("given_name_editor");
|
||||||
mNameEditor->setMaxTextLength(DB_PARCEL_NAME_LEN);
|
mNameEditor->setMaxTextLength(DB_PARCEL_NAME_LEN);
|
||||||
mNameEditor->setCommitOnFocusLost(TRUE);
|
mNameEditor->setCommitOnFocusLost(TRUE);
|
||||||
mNameEditor->setFocusReceivedCallback(boost::bind(focusReceived, _1, this));
|
mNameEditor->setFocusReceivedCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mNameEditor->setCommitCallback(onCommitAny);
|
mNameEditor->setCommitCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mNameEditor->setCallbackUserData(this);
|
|
||||||
mNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII );
|
mNameEditor->setPrevalidate( LLLineEditor::prevalidateASCII );
|
||||||
|
|
||||||
mDescEditor = getChild<LLTextEditor>("desc_editor");
|
mDescEditor = getChild<LLTextEditor>("desc_editor");
|
||||||
mDescEditor->setCommitOnFocusLost(TRUE);
|
mDescEditor->setCommitOnFocusLost(TRUE);
|
||||||
mDescEditor->setFocusReceivedCallback(boost::bind(focusReceived, _1, this));
|
mDescEditor->setFocusReceivedCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mDescEditor->setCommitCallback(onCommitAny);
|
mDescEditor->setCommitCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mDescEditor->setCallbackUserData(this);
|
|
||||||
mDescEditor->setTabsToNextField(TRUE);
|
mDescEditor->setTabsToNextField(TRUE);
|
||||||
|
|
||||||
mLocationEditor = getChild<LLLineEditor>("location_editor");
|
mLocationEditor = getChild<LLLineEditor>("location_editor");
|
||||||
|
|
||||||
mSetBtn = getChild<LLButton>( "set_location_btn");
|
mSetBtn = getChild<LLButton>( "set_location_btn");
|
||||||
mSetBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickSet, this));
|
mSetBtn->setCommitCallback(boost::bind(&LLPanelClassified::onClickSet, this));
|
||||||
|
|
||||||
mTeleportBtn = getChild<LLButton>( "classified_teleport_btn");
|
mTeleportBtn = getChild<LLButton>( "classified_teleport_btn");
|
||||||
mTeleportBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickTeleport, this));
|
mTeleportBtn->setCommitCallback(boost::bind(&LLPanelClassified::onClickTeleport, this));
|
||||||
|
|
||||||
mMapBtn = getChild<LLButton>( "classified_map_btn");
|
mMapBtn = getChild<LLButton>( "classified_map_btn");
|
||||||
mMapBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickMap, this));
|
mMapBtn->setCommitCallback(boost::bind(&LLPanelClassified::onClickMap, this));
|
||||||
|
|
||||||
if(mInFinder)
|
if(mInFinder)
|
||||||
{
|
{
|
||||||
mProfileBtn = getChild<LLButton>( "classified_profile_btn");
|
mProfileBtn = getChild<LLButton>( "classified_profile_btn");
|
||||||
mProfileBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickProfile, this));
|
mProfileBtn->setCommitCallback(boost::bind(&LLPanelClassified::onClickProfile, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
mCategoryCombo = getChild<LLComboBox>( "classified_category_combo");
|
mCategoryCombo = getChild<LLComboBox>( "classified_category_combo");
|
||||||
@@ -289,13 +286,11 @@ BOOL LLPanelClassified::postBuild()
|
|||||||
mCategoryCombo->add(iter->second, (void *)((intptr_t)iter->first), ADD_BOTTOM);
|
mCategoryCombo->add(iter->second, (void *)((intptr_t)iter->first), ADD_BOTTOM);
|
||||||
}
|
}
|
||||||
mCategoryCombo->setCurrentByIndex(0);
|
mCategoryCombo->setCurrentByIndex(0);
|
||||||
mCategoryCombo->setCommitCallback(onCommitAny);
|
mCategoryCombo->setCommitCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mCategoryCombo->setCallbackUserData(this);
|
|
||||||
|
|
||||||
mMatureCombo = getChild<LLComboBox>( "classified_mature_check");
|
mMatureCombo = getChild<LLComboBox>( "classified_mature_check");
|
||||||
mMatureCombo->setCurrentByIndex(0);
|
mMatureCombo->setCurrentByIndex(0);
|
||||||
mMatureCombo->setCommitCallback(onCommitAny);
|
mMatureCombo->setCommitCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mMatureCombo->setCallbackUserData(this);
|
|
||||||
if (gAgent.wantsPGOnly())
|
if (gAgent.wantsPGOnly())
|
||||||
{
|
{
|
||||||
// Teens don't get to set mature flag. JC
|
// Teens don't get to set mature flag. JC
|
||||||
@@ -306,13 +301,11 @@ BOOL LLPanelClassified::postBuild()
|
|||||||
if (!mInFinder)
|
if (!mInFinder)
|
||||||
{
|
{
|
||||||
mAutoRenewCheck = getChild<LLCheckBoxCtrl>( "auto_renew_check");
|
mAutoRenewCheck = getChild<LLCheckBoxCtrl>( "auto_renew_check");
|
||||||
mAutoRenewCheck->setCommitCallback(onCommitAny);
|
mAutoRenewCheck->setCommitCallback(boost::bind(&LLPanelClassified::checkDirty, this));
|
||||||
mAutoRenewCheck->setCallbackUserData(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mUpdateBtn = getChild<LLButton>("classified_update_btn");
|
mUpdateBtn = getChild<LLButton>("classified_update_btn");
|
||||||
mUpdateBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickUpdate, this));
|
mUpdateBtn->setCommitCallback(boost::bind(&LLPanelClassified::onClickUpdate, this));
|
||||||
mUpdateBtn->setCallbackUserData(this);
|
|
||||||
|
|
||||||
if (!mInFinder)
|
if (!mInFinder)
|
||||||
{
|
{
|
||||||
@@ -392,9 +385,6 @@ void LLPanelClassified::processProperties(void* data, EAvatarProcessorType type)
|
|||||||
mUpdateBtn->setLabel(getString("update_txt"));
|
mUpdateBtn->setLabel(getString("update_txt"));
|
||||||
|
|
||||||
resetDirty();
|
resetDirty();
|
||||||
|
|
||||||
// I don't know if a second call is deliberate or a bad merge, so I'm leaving it here.
|
|
||||||
resetDirty();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,7 +486,7 @@ void LLPanelClassified::initNewClassified()
|
|||||||
mUpdateBtn->setLabel(getString("publish_txt"));
|
mUpdateBtn->setLabel(getString("publish_txt"));
|
||||||
|
|
||||||
// simulate clicking the "location" button
|
// simulate clicking the "location" button
|
||||||
LLPanelClassified::onClickSet(this);
|
onClickSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -713,33 +703,28 @@ void LLPanelClassified::refresh()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLPanelClassified::onClickUpdate()
|
||||||
void LLPanelClassified::onClickUpdate(void* data)
|
|
||||||
{
|
{
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
|
||||||
|
|
||||||
if(self == NULL) return;
|
|
||||||
|
|
||||||
// Disallow leading spaces, punctuation, etc. that screw up
|
// Disallow leading spaces, punctuation, etc. that screw up
|
||||||
// sort order.
|
// sort order.
|
||||||
if ( ! self->titleIsValid() )
|
if (!titleIsValid())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
// If user has not set mature, do not allow publish
|
// If user has not set mature, do not allow publish
|
||||||
if(self->mMatureCombo->getCurrentIndex() == DECLINE_TO_STATE)
|
if (mMatureCombo->getCurrentIndex() == DECLINE_TO_STATE)
|
||||||
{
|
{
|
||||||
// Tell user about it
|
// Tell user about it
|
||||||
LLNotificationsUtil::add("SetClassifiedMature",
|
LLNotificationsUtil::add("SetClassifiedMature",
|
||||||
LLSD(),
|
LLSD(),
|
||||||
LLSD(),
|
LLSD(),
|
||||||
boost::bind(&LLPanelClassified::confirmMature, self, _1, _2));
|
boost::bind(&LLPanelClassified::confirmMature, this, _1, _2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mature content flag is set, proceed
|
// Mature content flag is set, proceed
|
||||||
self->gotMature();
|
gotMature();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Callback from a dialog indicating response to mature notification
|
// Callback from a dialog indicating response to mature notification
|
||||||
@@ -781,38 +766,30 @@ void LLPanelClassified::gotMature()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Ask the user how much they want to pay
|
// Ask the user how much they want to pay
|
||||||
LLFloaterPriceForListing::show( callbackGotPriceForListing, this );
|
new LLFloaterPriceForListing(boost::bind(&LLPanelClassified::callbackGotPriceForListing, this, _1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLPanelClassified::callbackGotPriceForListing(const std::string& text)
|
||||||
void LLPanelClassified::callbackGotPriceForListing(S32 option, std::string text, void* data)
|
|
||||||
{
|
{
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
|
||||||
|
|
||||||
// Only do something if user hits publish
|
|
||||||
if (option != 0) return;
|
|
||||||
|
|
||||||
S32 price_for_listing = strtol(text.c_str(), NULL, 10);
|
S32 price_for_listing = strtol(text.c_str(), NULL, 10);
|
||||||
if (price_for_listing < MINIMUM_PRICE_FOR_LISTING)
|
if (price_for_listing < MINIMUM_PRICE_FOR_LISTING)
|
||||||
{
|
{
|
||||||
LLSD args;
|
LLSD args;
|
||||||
std::string price_text = llformat("%d", MINIMUM_PRICE_FOR_LISTING);
|
args["MIN_PRICE"] = llformat("%d", MINIMUM_PRICE_FOR_LISTING);
|
||||||
args["MIN_PRICE"] = price_text;
|
|
||||||
|
|
||||||
LLNotificationsUtil::add("MinClassifiedPrice", args);
|
LLNotificationsUtil::add("MinClassifiedPrice", args);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// price is acceptable, put it in the dialog for later read by
|
// price is acceptable, put it in the dialog for later read by
|
||||||
// update send
|
// update send
|
||||||
self->mPriceForListing = price_for_listing;
|
mPriceForListing = price_for_listing;
|
||||||
|
|
||||||
LLSD args;
|
LLSD args;
|
||||||
args["AMOUNT"] = llformat("%d", price_for_listing);
|
args["AMOUNT"] = llformat("%d", price_for_listing);
|
||||||
args["CURRENCY"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
|
args["CURRENCY"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
|
||||||
LLNotificationsUtil::add("PublishClassified", args, LLSD(),
|
LLNotificationsUtil::add("PublishClassified", args, LLSD(),
|
||||||
boost::bind(&LLPanelClassified::confirmPublish, self, _1, _2));
|
boost::bind(&LLPanelClassified::confirmPublish, this, _1, _2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelClassified::resetDirty()
|
void LLPanelClassified::resetDirty()
|
||||||
@@ -862,51 +839,39 @@ bool LLPanelClassified::confirmPublish(const LLSD& notification, const LLSD& res
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLPanelClassified::onClickTeleport()
|
||||||
// static
|
|
||||||
void LLPanelClassified::onClickTeleport(void* data)
|
|
||||||
{
|
{
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
if (!mPosGlobal.isExactlyZero())
|
||||||
|
|
||||||
if (!self->mPosGlobal.isExactlyZero())
|
|
||||||
{
|
{
|
||||||
gAgent.teleportViaLocation(self->mPosGlobal);
|
gAgent.teleportViaLocation(mPosGlobal);
|
||||||
gFloaterWorldMap->trackLocation(self->mPosGlobal);
|
gFloaterWorldMap->trackLocation(mPosGlobal);
|
||||||
|
|
||||||
self->sendClassifiedClickMessage("teleport");
|
sendClassifiedClickMessage("teleport");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLPanelClassified::onClickMap()
|
||||||
// static
|
|
||||||
void LLPanelClassified::onClickMap(void* data)
|
|
||||||
{
|
{
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
gFloaterWorldMap->trackLocation(mPosGlobal);
|
||||||
gFloaterWorldMap->trackLocation(self->mPosGlobal);
|
|
||||||
LLFloaterWorldMap::show(true);
|
LLFloaterWorldMap::show(true);
|
||||||
|
|
||||||
self->sendClassifiedClickMessage("map");
|
sendClassifiedClickMessage("map");
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
void LLPanelClassified::onClickProfile()
|
||||||
void LLPanelClassified::onClickProfile(void* data)
|
|
||||||
{
|
{
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
LLAvatarActions::showProfile(mCreatorID);
|
||||||
LLAvatarActions::showProfile(self->mCreatorID);
|
sendClassifiedClickMessage("profile");
|
||||||
self->sendClassifiedClickMessage("profile");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
/*
|
/*
|
||||||
void LLPanelClassified::onClickLandmark(void* data)
|
void LLPanelClassified::onClickLandmark()
|
||||||
{
|
{
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
create_landmark(mNameEditor->getText(), "", mPosGlobal);
|
||||||
create_landmark(self->mNameEditor->getText(), "", self->mPosGlobal);
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// static
|
void LLPanelClassified::onClickSet()
|
||||||
void LLPanelClassified::onClickSet(void* data)
|
|
||||||
{
|
{
|
||||||
// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
|
// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a)
|
||||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
|
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
|
||||||
@@ -914,10 +879,9 @@ void LLPanelClassified::onClickSet(void* data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// [/RLVa:KB]
|
// [/RLVa:KB]
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
|
||||||
|
|
||||||
// Save location for later.
|
// Save location for later.
|
||||||
self->mPosGlobal = gAgent.getPositionGlobal();
|
mPosGlobal = gAgent.getPositionGlobal();
|
||||||
|
|
||||||
std::string location_text;
|
std::string location_text;
|
||||||
std::string regionName = "(will update after publish)";
|
std::string regionName = "(will update after publish)";
|
||||||
@@ -929,22 +893,22 @@ void LLPanelClassified::onClickSet(void* data)
|
|||||||
location_text.assign(regionName);
|
location_text.assign(regionName);
|
||||||
location_text.append(", ");
|
location_text.append(", ");
|
||||||
|
|
||||||
S32 region_x = llround((F32)self->mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS;
|
S32 region_x = llround((F32)mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS;
|
||||||
S32 region_y = llround((F32)self->mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS;
|
S32 region_y = llround((F32)mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS;
|
||||||
S32 region_z = llround((F32)self->mPosGlobal.mdV[VZ]);
|
S32 region_z = llround((F32)mPosGlobal.mdV[VZ]);
|
||||||
|
|
||||||
location_text.append(self->mSimName);
|
location_text.append(mSimName);
|
||||||
location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
|
location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z));
|
||||||
|
|
||||||
self->mLocationEditor->setText(location_text);
|
mLocationEditor->setText(location_text);
|
||||||
self->mLocationChanged = true;
|
mLocationChanged = true;
|
||||||
|
|
||||||
self->setDefaultAccessCombo();
|
setDefaultAccessCombo();
|
||||||
|
|
||||||
// Set this to null so it updates on the next save.
|
// Set this to null so it updates on the next save.
|
||||||
self->mParcelID.setNull();
|
mParcelID.setNull();
|
||||||
|
|
||||||
onCommitAny(NULL, data);
|
checkDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -963,23 +927,6 @@ BOOL LLPanelClassified::checkDirty()
|
|||||||
return mDirty;
|
return mDirty;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
|
||||||
void LLPanelClassified::onCommitAny(LLUICtrl* ctrl, void* data)
|
|
||||||
{
|
|
||||||
LLPanelClassified* self = (LLPanelClassified*)data;
|
|
||||||
if (self)
|
|
||||||
{
|
|
||||||
self->checkDirty();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
|
||||||
void LLPanelClassified::focusReceived(LLFocusableElement* ctrl, void* data)
|
|
||||||
{
|
|
||||||
// allow the data to be saved
|
|
||||||
onCommitAny((LLUICtrl*)ctrl, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LLPanelClassified::sendClassifiedClickMessage(const std::string& type)
|
void LLPanelClassified::sendClassifiedClickMessage(const std::string& type)
|
||||||
{
|
{
|
||||||
@@ -1000,15 +947,22 @@ void LLPanelClassified::sendClassifiedClickMessage(const std::string& type)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
LLFloaterPriceForListing::LLFloaterPriceForListing()
|
LLFloaterPriceForListing::LLFloaterPriceForListing(const signal_t::slot_type& cb)
|
||||||
: LLFloater(std::string("PriceForListing")),
|
: LLFloater(std::string("PriceForListing")),
|
||||||
mCallback(NULL),
|
mSignal(new signal_t)
|
||||||
mUserData(NULL)
|
{
|
||||||
{ }
|
// Builds and adds to gFloaterView
|
||||||
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_price_for_listing.xml");
|
||||||
|
center();
|
||||||
|
|
||||||
|
mSignal->connect(cb);
|
||||||
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
LLFloaterPriceForListing::~LLFloaterPriceForListing()
|
LLFloaterPriceForListing::~LLFloaterPriceForListing()
|
||||||
{ }
|
{
|
||||||
|
delete mSignal;
|
||||||
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
BOOL LLFloaterPriceForListing::postBuild()
|
BOOL LLFloaterPriceForListing::postBuild()
|
||||||
@@ -1023,50 +977,18 @@ BOOL LLFloaterPriceForListing::postBuild()
|
|||||||
edit->setFocus(TRUE);
|
edit->setFocus(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
childSetAction("set_price_btn", onClickSetPrice, this);
|
getChild<LLUICtrl>("set_price_btn")->setCommitCallback(boost::bind(&LLFloaterPriceForListing::buttonCore, this));
|
||||||
|
|
||||||
childSetAction("cancel_btn", onClickCancel, this);
|
getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloater::close, this, false));
|
||||||
|
|
||||||
setDefaultBtn("set_price_btn");
|
setDefaultBtn("set_price_btn");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
void LLFloaterPriceForListing::buttonCore()
|
||||||
void LLFloaterPriceForListing::show( void (*callback)(S32, std::string, void*), void* userdata)
|
|
||||||
{
|
{
|
||||||
LLFloaterPriceForListing *self = new LLFloaterPriceForListing();
|
(*mSignal)(childGetText("price_edit"));
|
||||||
|
close();
|
||||||
// Builds and adds to gFloaterView
|
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(self, "floater_price_for_listing.xml");
|
|
||||||
self->center();
|
|
||||||
|
|
||||||
self->mCallback = callback;
|
|
||||||
self->mUserData = userdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
void LLFloaterPriceForListing::onClickSetPrice(void* data)
|
|
||||||
{
|
|
||||||
buttonCore(0, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
void LLFloaterPriceForListing::onClickCancel(void* data)
|
|
||||||
{
|
|
||||||
buttonCore(1, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
//static
|
|
||||||
void LLFloaterPriceForListing::buttonCore(S32 button, void* data)
|
|
||||||
{
|
|
||||||
LLFloaterPriceForListing* self = (LLFloaterPriceForListing*)data;
|
|
||||||
|
|
||||||
if (self->mCallback)
|
|
||||||
{
|
|
||||||
std::string text = self->childGetText("price_edit");
|
|
||||||
self->mCallback(button, text, self->mUserData);
|
|
||||||
self->close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelClassified::setDefaultAccessCombo()
|
void LLPanelClassified::setDefaultAccessCombo()
|
||||||
|
|||||||
@@ -38,23 +38,19 @@
|
|||||||
#define LL_LLPANELCLASSIFIED_H
|
#define LL_LLPANELCLASSIFIED_H
|
||||||
|
|
||||||
#include "llavatarpropertiesprocessor.h"
|
#include "llavatarpropertiesprocessor.h"
|
||||||
#include "llpanel.h"
|
|
||||||
#include "llclassifiedinfo.h"
|
#include "llclassifiedinfo.h"
|
||||||
#include "v3dmath.h"
|
#include "v3dmath.h"
|
||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
//#include "llrect.h"
|
|
||||||
|
|
||||||
class LLButton;
|
class LLButton;
|
||||||
class LLCheckBoxCtrl;
|
class LLCheckBoxCtrl;
|
||||||
class LLComboBox;
|
class LLComboBox;
|
||||||
class LLIconCtrl;
|
|
||||||
class LLLineEditor;
|
class LLLineEditor;
|
||||||
class LLTextBox;
|
class LLTextBox;
|
||||||
class LLTextEditor;
|
class LLTextEditor;
|
||||||
class LLTextureCtrl;
|
class LLTextureCtrl;
|
||||||
class LLUICtrl;
|
class LLUICtrl;
|
||||||
class LLMessageSystem;
|
|
||||||
|
|
||||||
class LLPanelClassified : public LLPanel, public LLAvatarPropertiesObserver
|
class LLPanelClassified : public LLPanel, public LLAvatarPropertiesObserver
|
||||||
{
|
{
|
||||||
@@ -104,7 +100,7 @@ public:
|
|||||||
// Confirmation dialogs flow in this order
|
// Confirmation dialogs flow in this order
|
||||||
bool confirmMature(const LLSD& notification, const LLSD& response);
|
bool confirmMature(const LLSD& notification, const LLSD& response);
|
||||||
void gotMature();
|
void gotMature();
|
||||||
static void callbackGotPriceForListing(S32 option, std::string text, void* data);
|
void callbackGotPriceForListing(const std::string& text);
|
||||||
bool confirmPublish(const LLSD& notification, const LLSD& response);
|
bool confirmPublish(const LLSD& notification, const LLSD& response);
|
||||||
|
|
||||||
void sendClassifiedClickMessage(const std::string& type);
|
void sendClassifiedClickMessage(const std::string& type);
|
||||||
@@ -112,14 +108,11 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool saveCallback(const LLSD& notification, const LLSD& response);
|
bool saveCallback(const LLSD& notification, const LLSD& response);
|
||||||
|
|
||||||
static void onClickUpdate(void* data);
|
void onClickUpdate();
|
||||||
static void onClickTeleport(void* data);
|
void onClickTeleport();
|
||||||
static void onClickMap(void* data);
|
void onClickMap();
|
||||||
static void onClickProfile(void* data);
|
void onClickProfile();
|
||||||
static void onClickSet(void* data);
|
void onClickSet();
|
||||||
|
|
||||||
static void focusReceived(LLFocusableElement* ctrl, void* data);
|
|
||||||
static void onCommitAny(LLUICtrl* ctrl, void* data);
|
|
||||||
|
|
||||||
void setDefaultAccessCombo(); // Default AO and PG regions to proper classified access
|
void setDefaultAccessCombo(); // Default AO and PG regions to proper classified access
|
||||||
|
|
||||||
@@ -183,20 +176,15 @@ class LLFloaterPriceForListing
|
|||||||
: public LLFloater
|
: public LLFloater
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLFloaterPriceForListing();
|
typedef boost::signals2::signal<void(const std::string& value)> signal_t;
|
||||||
|
LLFloaterPriceForListing(const signal_t::slot_type& cb);
|
||||||
virtual ~LLFloaterPriceForListing();
|
virtual ~LLFloaterPriceForListing();
|
||||||
virtual BOOL postBuild();
|
virtual BOOL postBuild();
|
||||||
|
|
||||||
static void show( void (*callback)(S32 option, std::string value, void* userdata), void* userdata );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void onClickSetPrice(void*);
|
void buttonCore();
|
||||||
static void onClickCancel(void*);
|
|
||||||
static void buttonCore(S32 button, void* data);
|
|
||||||
|
|
||||||
private:
|
signal_t* mSignal;
|
||||||
void (*mCallback)(S32 option, std::string, void*);
|
|
||||||
void* mUserData;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -222,8 +222,7 @@ BOOL LLPanelGroupNotices::postBuild()
|
|||||||
|
|
||||||
mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
|
mNoticesList = getChild<LLScrollListCtrl>("notice_list",recurse);
|
||||||
mNoticesList->setCommitOnSelectionChange(TRUE);
|
mNoticesList->setCommitOnSelectionChange(TRUE);
|
||||||
mNoticesList->setCommitCallback(onSelectNotice);
|
mNoticesList->setCommitCallback(boost::bind(&LLPanelGroupNotices::onSelectNotice, this));
|
||||||
mNoticesList->setCallbackUserData(this);
|
|
||||||
|
|
||||||
mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
|
mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
|
||||||
mBtnNewMessage->setClickedCallback(boost::bind(&LLPanelGroupNotices::onClickNewMessage,this));
|
mBtnNewMessage->setClickedCallback(boost::bind(&LLPanelGroupNotices::onClickNewMessage,this));
|
||||||
@@ -494,14 +493,11 @@ void LLPanelGroupNotices::processNotices(LLMessageSystem* msg)
|
|||||||
mNoticesList->updateSort();
|
mNoticesList->updateSort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelGroupNotices::onSelectNotice(LLUICtrl* ctrl, void* data)
|
void LLPanelGroupNotices::onSelectNotice()
|
||||||
{
|
{
|
||||||
LLPanelGroupNotices* self = (LLPanelGroupNotices*)data;
|
LLScrollListItem* item = mNoticesList->getFirstSelected();
|
||||||
|
|
||||||
if(!self) return;
|
|
||||||
LLScrollListItem* item = self->mNoticesList->getFirstSelected();
|
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
LLMessageSystem* msg = gMessageSystem;
|
LLMessageSystem* msg = gMessageSystem;
|
||||||
msg->newMessage("GroupNoticeRequest");
|
msg->newMessage("GroupNoticeRequest");
|
||||||
msg->nextBlock("AgentData");
|
msg->nextBlock("AgentData");
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
static void onClickRefreshNotices(void* data);
|
static void onClickRefreshNotices(void* data);
|
||||||
|
|
||||||
void processNotices(LLMessageSystem* msg);
|
void processNotices(LLMessageSystem* msg);
|
||||||
static void onSelectNotice(LLUICtrl* ctrl, void* data);
|
void onSelectNotice();
|
||||||
|
|
||||||
enum ENoticeView
|
enum ENoticeView
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public:
|
|||||||
static void onBtnRemove( void* userdata );
|
static void onBtnRemove( void* userdata );
|
||||||
static void onBtnBrowser( void* userdata );
|
static void onBtnBrowser( void* userdata );
|
||||||
|
|
||||||
static void onLocalScrollCommit ( LLUICtrl* ctrl, void *userdata );
|
void onLocalScrollCommit();
|
||||||
// tag: vaa emerald local_asset_browser [end]
|
// tag: vaa emerald local_asset_browser [end]
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -483,8 +483,7 @@ BOOL LLFloaterTexturePicker::postBuild()
|
|||||||
childSetAction("Browser", LLFloaterTexturePicker::onBtnBrowser, this);
|
childSetAction("Browser", LLFloaterTexturePicker::onBtnBrowser, this);
|
||||||
|
|
||||||
mLocalScrollCtrl = getChild<LLScrollListCtrl>("local_name_list");
|
mLocalScrollCtrl = getChild<LLScrollListCtrl>("local_name_list");
|
||||||
mLocalScrollCtrl->setCallbackUserData(this);
|
mLocalScrollCtrl->setCommitCallback(boost::bind(&LLFloaterTexturePicker::onLocalScrollCommit, this));
|
||||||
mLocalScrollCtrl->setCommitCallback(onLocalScrollCommit);
|
|
||||||
LocalAssetBrowser::UpdateTextureCtrlList( mLocalScrollCtrl );
|
LocalAssetBrowser::UpdateTextureCtrlList( mLocalScrollCtrl );
|
||||||
// tag: vaa emerald local_asset_browser [end]
|
// tag: vaa emerald local_asset_browser [end]
|
||||||
|
|
||||||
@@ -906,15 +905,14 @@ void LLFloaterTexturePicker::onBtnBrowser(void *userdata)
|
|||||||
FloaterLocalAssetBrowser::show(NULL);
|
FloaterLocalAssetBrowser::show(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// static, reacts to user clicking a valid field in the local scroll list.
|
// reacts to user clicking a valid field in the local scroll list.
|
||||||
void LLFloaterTexturePicker::onLocalScrollCommit(LLUICtrl *ctrl, void *userdata)
|
void LLFloaterTexturePicker::onLocalScrollCommit()
|
||||||
{
|
{
|
||||||
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
|
LLUUID id(mLocalScrollCtrl->getSelectedItemLabel(LOCALLIST_COL_ID));
|
||||||
LLUUID id = (LLUUID)self->mLocalScrollCtrl->getSelectedItemLabel( LOCALLIST_COL_ID );
|
|
||||||
|
|
||||||
self->mOwner->setImageAssetID( id );
|
mOwner->setImageAssetID(id);
|
||||||
if ( self->childGetValue("apply_immediate_check").asBoolean() )
|
if (childGetValue("apply_immediate_check").asBoolean())
|
||||||
{ self->mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE, id); } // calls an overridden function.
|
mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE, id); // calls an overridden function.
|
||||||
}
|
}
|
||||||
|
|
||||||
// tag: vaa emerald local_asset_browser [end]
|
// tag: vaa emerald local_asset_browser [end]
|
||||||
|
|||||||
@@ -766,9 +766,9 @@ void LLViewerParcelMedia::filterMedia(LLParcel* parcel, U32 type)
|
|||||||
sDeniedMedia.erase(ip);
|
sDeniedMedia.erase(ip);
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
if (dirty)
|
if (dirty && SLFloaterMediaFilter::findInstance())
|
||||||
{
|
{
|
||||||
SLFloaterMediaFilter::setDirty();
|
SLFloaterMediaFilter::getInstance()->setDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -944,7 +944,7 @@ void callback_media_alert(const LLSD ¬ification, const LLSD &response, LLParc
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLViewerParcelMedia::sMediaQueries.erase(domain);
|
LLViewerParcelMedia::sMediaQueries.erase(domain);
|
||||||
SLFloaterMediaFilter::setDirty();
|
if (SLFloaterMediaFilter::findInstance()) SLFloaterMediaFilter::getInstance()->setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLViewerParcelMedia::saveDomainFilterList()
|
void LLViewerParcelMedia::saveDomainFilterList()
|
||||||
@@ -975,7 +975,7 @@ bool LLViewerParcelMedia::loadDomainFilterList()
|
|||||||
llifstream medialistFile(medialist_filename);
|
llifstream medialistFile(medialist_filename);
|
||||||
LLSDSerialize::fromXML(sMediaFilterList, medialistFile);
|
LLSDSerialize::fromXML(sMediaFilterList, medialistFile);
|
||||||
medialistFile.close();
|
medialistFile.close();
|
||||||
SLFloaterMediaFilter::setDirty();
|
if (SLFloaterMediaFilter::findInstance()) SLFloaterMediaFilter::getInstance()->setDirty();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -991,7 +991,7 @@ void LLViewerParcelMedia::clearDomainFilterList()
|
|||||||
sDeniedMedia.clear();
|
sDeniedMedia.clear();
|
||||||
saveDomainFilterList();
|
saveDomainFilterList();
|
||||||
LLNotificationsUtil::add("MediaFiltersCleared");
|
LLNotificationsUtil::add("MediaFiltersCleared");
|
||||||
SLFloaterMediaFilter::setDirty();
|
if (SLFloaterMediaFilter::findInstance()) SLFloaterMediaFilter::getInstance()->setDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LLViewerParcelMedia::extractDomain(std::string url)
|
std::string LLViewerParcelMedia::extractDomain(std::string url)
|
||||||
|
|||||||
@@ -33,18 +33,12 @@
|
|||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "llviewerprecompiledheaders.h"
|
||||||
|
|
||||||
#include "lllineeditor.h"
|
#include "slfloatermediafilter.h"
|
||||||
|
|
||||||
#include "llscrolllistctrl.h"
|
#include "llscrolllistctrl.h"
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
|
|
||||||
#include "slfloatermediafilter.h"
|
|
||||||
#include "llviewercontrol.h"
|
|
||||||
#include "llviewerparcelmedia.h"
|
#include "llviewerparcelmedia.h"
|
||||||
|
|
||||||
SLFloaterMediaFilter* SLFloaterMediaFilter::sInstance = NULL;
|
|
||||||
bool SLFloaterMediaFilter::sIsWhitelist = false;
|
|
||||||
bool SLFloaterMediaFilter::sShowIPs = false;
|
|
||||||
|
|
||||||
SLFloaterMediaFilter::SLFloaterMediaFilter(const LLSD& key) : LLFloater(std::string("media filter")), mIsDirty(false)
|
SLFloaterMediaFilter::SLFloaterMediaFilter(const LLSD& key) : LLFloater(std::string("media filter")), mIsDirty(false)
|
||||||
{
|
{
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_media_filter.xml");
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_media_filter.xml");
|
||||||
@@ -52,7 +46,6 @@ SLFloaterMediaFilter::SLFloaterMediaFilter(const LLSD& key) : LLFloater(std::str
|
|||||||
|
|
||||||
SLFloaterMediaFilter::~SLFloaterMediaFilter()
|
SLFloaterMediaFilter::~SLFloaterMediaFilter()
|
||||||
{
|
{
|
||||||
sInstance = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SLFloaterMediaFilter::postBuild()
|
BOOL SLFloaterMediaFilter::postBuild()
|
||||||
@@ -62,15 +55,13 @@ BOOL SLFloaterMediaFilter::postBuild()
|
|||||||
|
|
||||||
if (mWhitelistSLC && mBlacklistSLC)
|
if (mWhitelistSLC && mBlacklistSLC)
|
||||||
{
|
{
|
||||||
childSetAction("clear_lists", onClearLists, this);
|
getChild<LLUICtrl>("clear_lists")->setCommitCallback(boost::bind(LLViewerParcelMedia::clearDomainFilterList));
|
||||||
childSetAction("show_ips", onShowIPs, this);
|
getChild<LLUICtrl>("show_ips")->setCommitCallback(boost::bind(&SLFloaterMediaFilter::onShowIPs, this));
|
||||||
childSetAction("add_whitelist", onWhitelistAdd, this);
|
getChild<LLUICtrl>("add_whitelist")->setCommitCallback(boost::bind(&SLFloaterMediaFilter::onWhitelistAdd, this));
|
||||||
childSetAction("remove_whitelist", onWhitelistRemove, this);
|
getChild<LLUICtrl>("remove_whitelist")->setCommitCallback(boost::bind(&SLFloaterMediaFilter::onWhitelistRemove, this));
|
||||||
childSetAction("add_blacklist", onBlacklistAdd, this);
|
getChild<LLUICtrl>("add_blacklist")->setCommitCallback(boost::bind(&SLFloaterMediaFilter::onBlacklistAdd, this));
|
||||||
childSetAction("remove_blacklist", onBlacklistRemove, this);
|
getChild<LLUICtrl>("remove_blacklist")->setCommitCallback(boost::bind(&SLFloaterMediaFilter::onBlacklistRemove, this));
|
||||||
childSetAction("commit_domain", onCommitDomain, this);
|
getChild<LLUICtrl>("commit_domain")->setCommitCallback(boost::bind(&SLFloaterMediaFilter::onCommitDomain, this));
|
||||||
childSetUserData("whitelist_list", this);
|
|
||||||
childSetUserData("blacklist_list", this);
|
|
||||||
mIsDirty = true;
|
mIsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +87,7 @@ void SLFloaterMediaFilter::draw()
|
|||||||
for (S32 i = 0; i < (S32)LLViewerParcelMedia::sMediaFilterList.size(); i++)
|
for (S32 i = 0; i < (S32)LLViewerParcelMedia::sMediaFilterList.size(); i++)
|
||||||
{
|
{
|
||||||
domain = LLViewerParcelMedia::sMediaFilterList[i]["domain"].asString();
|
domain = LLViewerParcelMedia::sMediaFilterList[i]["domain"].asString();
|
||||||
if (sShowIPs)
|
if (mShowIPs)
|
||||||
{
|
{
|
||||||
host.setHostByName(domain);
|
host.setHostByName(domain);
|
||||||
ip = host.getIPString();
|
ip = host.getIPString();
|
||||||
@@ -137,7 +128,7 @@ void SLFloaterMediaFilter::draw()
|
|||||||
for (it = LLViewerParcelMedia::sAllowedMedia.begin(); it != LLViewerParcelMedia::sAllowedMedia.end(); it++)
|
for (it = LLViewerParcelMedia::sAllowedMedia.begin(); it != LLViewerParcelMedia::sAllowedMedia.end(); it++)
|
||||||
{
|
{
|
||||||
domain = *it;
|
domain = *it;
|
||||||
if (sShowIPs)
|
if (mShowIPs)
|
||||||
{
|
{
|
||||||
host.setHostByName(domain);
|
host.setHostByName(domain);
|
||||||
ip = host.getIPString();
|
ip = host.getIPString();
|
||||||
@@ -156,7 +147,7 @@ void SLFloaterMediaFilter::draw()
|
|||||||
for (it = LLViewerParcelMedia::sDeniedMedia.begin(); it != LLViewerParcelMedia::sDeniedMedia.end(); it++)
|
for (it = LLViewerParcelMedia::sDeniedMedia.begin(); it != LLViewerParcelMedia::sDeniedMedia.end(); it++)
|
||||||
{
|
{
|
||||||
domain = *it;
|
domain = *it;
|
||||||
if (sShowIPs)
|
if (mShowIPs)
|
||||||
{
|
{
|
||||||
host.setHostByName(domain);
|
host.setHostByName(domain);
|
||||||
ip = host.getIPString();
|
ip = host.getIPString();
|
||||||
@@ -191,7 +182,7 @@ void SLFloaterMediaFilter::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
mIsDirty = false;
|
mIsDirty = false;
|
||||||
sShowIPs = false;
|
mShowIPs = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLFloater::draw();
|
LLFloater::draw();
|
||||||
@@ -199,55 +190,38 @@ void SLFloaterMediaFilter::draw()
|
|||||||
|
|
||||||
void SLFloaterMediaFilter::setDirty()
|
void SLFloaterMediaFilter::setDirty()
|
||||||
{
|
{
|
||||||
if (sInstance)
|
mIsDirty = true;
|
||||||
{
|
|
||||||
sInstance->mIsDirty = true;
|
|
||||||
sInstance->draw();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SLFloaterMediaFilter::onClearLists(void* data)
|
void SLFloaterMediaFilter::onShowIPs()
|
||||||
{
|
{
|
||||||
LLViewerParcelMedia::clearDomainFilterList();
|
mShowIPs = true;
|
||||||
|
mIsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SLFloaterMediaFilter::onShowIPs(void* data)
|
void SLFloaterMediaFilter::onWhitelistAdd()
|
||||||
{
|
{
|
||||||
sShowIPs = true;
|
childDisable("clear_lists");
|
||||||
setDirty();
|
childDisable("show_ips");
|
||||||
|
childDisable("blacklist_list");
|
||||||
|
childDisable("whitelist_list");
|
||||||
|
childDisable("remove_whitelist");
|
||||||
|
childDisable("add_whitelist");
|
||||||
|
childDisable("remove_blacklist");
|
||||||
|
childDisable("add_blacklist");
|
||||||
|
childEnable("input_domain");
|
||||||
|
childEnable("commit_domain");
|
||||||
|
childSetText("add_text", std::string("Enter the domain/url to add to the white list:"));
|
||||||
|
mIsWhitelist = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SLFloaterMediaFilter::onWhitelistAdd(void* data)
|
void SLFloaterMediaFilter::onWhitelistRemove()
|
||||||
{
|
{
|
||||||
if (!sInstance)
|
LLScrollListItem* selected = mWhitelistSLC->getFirstSelected();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sInstance->childDisable("clear_lists");
|
|
||||||
sInstance->childDisable("show_ips");
|
|
||||||
sInstance->childDisable("blacklist_list");
|
|
||||||
sInstance->childDisable("whitelist_list");
|
|
||||||
sInstance->childDisable("remove_whitelist");
|
|
||||||
sInstance->childDisable("add_whitelist");
|
|
||||||
sInstance->childDisable("remove_blacklist");
|
|
||||||
sInstance->childDisable("add_blacklist");
|
|
||||||
sInstance->childEnable("input_domain");
|
|
||||||
sInstance->childEnable("commit_domain");
|
|
||||||
sInstance->childSetText("add_text", std::string("Enter the domain/url to add to the white list:"));
|
|
||||||
sIsWhitelist = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SLFloaterMediaFilter::onWhitelistRemove(void* data)
|
|
||||||
{
|
|
||||||
if (!sInstance)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LLScrollListItem* selected = sInstance->mWhitelistSLC->getFirstSelected();
|
|
||||||
|
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
std::string domain = sInstance->mWhitelistSLC->getSelectedItemLabel();
|
std::string domain = mWhitelistSLC->getSelectedItemLabel();
|
||||||
size_t pos = domain.find(' ');
|
size_t pos = domain.find(' ');
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
@@ -265,7 +239,7 @@ void SLFloaterMediaFilter::onWhitelistRemove(void* data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sInstance->childGetValue("match_ip") && domain.find('/') == std::string::npos)
|
if (childGetValue("match_ip") && domain.find('/') == std::string::npos)
|
||||||
{
|
{
|
||||||
LLHost host;
|
LLHost host;
|
||||||
host.setHostByName(domain);
|
host.setHostByName(domain);
|
||||||
@@ -291,37 +265,29 @@ void SLFloaterMediaFilter::onWhitelistRemove(void* data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SLFloaterMediaFilter::onBlacklistAdd(void* data)
|
void SLFloaterMediaFilter::onBlacklistAdd()
|
||||||
{
|
{
|
||||||
if (!sInstance)
|
childDisable("clear_lists");
|
||||||
{
|
childDisable("show_ips");
|
||||||
return;
|
childDisable("blacklist_list");
|
||||||
}
|
childDisable("whitelist_list");
|
||||||
sInstance->childDisable("clear_lists");
|
childDisable("remove_whitelist");
|
||||||
sInstance->childDisable("show_ips");
|
childDisable("add_whitelist");
|
||||||
sInstance->childDisable("blacklist_list");
|
childDisable("remove_blacklist");
|
||||||
sInstance->childDisable("whitelist_list");
|
childDisable("add_blacklist");
|
||||||
sInstance->childDisable("remove_whitelist");
|
childEnable("input_domain");
|
||||||
sInstance->childDisable("add_whitelist");
|
childEnable("commit_domain");
|
||||||
sInstance->childDisable("remove_blacklist");
|
childSetText("add_text", std::string("Enter the domain/url to add to the black list:"));
|
||||||
sInstance->childDisable("add_blacklist");
|
mIsWhitelist = false;
|
||||||
sInstance->childEnable("input_domain");
|
|
||||||
sInstance->childEnable("commit_domain");
|
|
||||||
sInstance->childSetText("add_text", std::string("Enter the domain/url to add to the black list:"));
|
|
||||||
sIsWhitelist = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SLFloaterMediaFilter::onBlacklistRemove(void* data)
|
void SLFloaterMediaFilter::onBlacklistRemove()
|
||||||
{
|
{
|
||||||
if (!sInstance)
|
LLScrollListItem* selected = mBlacklistSLC->getFirstSelected();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LLScrollListItem* selected = sInstance->mBlacklistSLC->getFirstSelected();
|
|
||||||
|
|
||||||
if (selected)
|
if (selected)
|
||||||
{
|
{
|
||||||
std::string domain = sInstance->mBlacklistSLC->getSelectedItemLabel();
|
std::string domain = mBlacklistSLC->getSelectedItemLabel();
|
||||||
size_t pos = domain.find(' ');
|
size_t pos = domain.find(' ');
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
@@ -339,7 +305,7 @@ void SLFloaterMediaFilter::onBlacklistRemove(void* data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sInstance->childGetValue("match_ip") && domain.find('/') == std::string::npos)
|
if (childGetValue("match_ip") && domain.find('/') == std::string::npos)
|
||||||
{
|
{
|
||||||
LLHost host;
|
LLHost host;
|
||||||
host.setHostByName(domain);
|
host.setHostByName(domain);
|
||||||
@@ -365,18 +331,14 @@ void SLFloaterMediaFilter::onBlacklistRemove(void* data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SLFloaterMediaFilter::onCommitDomain(void* data)
|
void SLFloaterMediaFilter::onCommitDomain()
|
||||||
{
|
{
|
||||||
if (!sInstance)
|
std::string domain = childGetText("input_domain");
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
std::string domain = sInstance->childGetText("input_domain");
|
|
||||||
domain = LLViewerParcelMedia::extractDomain(domain);
|
domain = LLViewerParcelMedia::extractDomain(domain);
|
||||||
LLHost host;
|
LLHost host;
|
||||||
host.setHostByName(domain);
|
host.setHostByName(domain);
|
||||||
std::string ip = host.getIPString();
|
std::string ip = host.getIPString();
|
||||||
bool match_ip = (sInstance->childGetValue("match_ip") && ip != domain && domain.find('/') == std::string::npos);
|
bool match_ip = (childGetValue("match_ip") && ip != domain && domain.find('/') == std::string::npos);
|
||||||
|
|
||||||
if (!domain.empty())
|
if (!domain.empty())
|
||||||
{
|
{
|
||||||
@@ -403,7 +365,7 @@ void SLFloaterMediaFilter::onCommitDomain(void* data)
|
|||||||
}
|
}
|
||||||
LLSD newmedia;
|
LLSD newmedia;
|
||||||
newmedia["domain"] = domain;
|
newmedia["domain"] = domain;
|
||||||
if (sIsWhitelist)
|
if (mIsWhitelist)
|
||||||
{
|
{
|
||||||
newmedia["action"] = "allow";
|
newmedia["action"] = "allow";
|
||||||
}
|
}
|
||||||
@@ -420,17 +382,17 @@ void SLFloaterMediaFilter::onCommitDomain(void* data)
|
|||||||
LLViewerParcelMedia::saveDomainFilterList();
|
LLViewerParcelMedia::saveDomainFilterList();
|
||||||
}
|
}
|
||||||
|
|
||||||
sInstance->childEnable("clear_lists");
|
childEnable("clear_lists");
|
||||||
sInstance->childEnable("show_ips");
|
childEnable("show_ips");
|
||||||
sInstance->childEnable("blacklist_list");
|
childEnable("blacklist_list");
|
||||||
sInstance->childEnable("whitelist_list");
|
childEnable("whitelist_list");
|
||||||
sInstance->childEnable("remove_whitelist");
|
childEnable("remove_whitelist");
|
||||||
sInstance->childEnable("add_whitelist");
|
childEnable("add_whitelist");
|
||||||
sInstance->childEnable("remove_blacklist");
|
childEnable("remove_blacklist");
|
||||||
sInstance->childEnable("add_blacklist");
|
childEnable("add_blacklist");
|
||||||
sInstance->childDisable("input_domain");
|
childDisable("input_domain");
|
||||||
sInstance->childDisable("commit_domain");
|
childDisable("commit_domain");
|
||||||
sInstance->childSetText("add_text", std::string("New domain:"));
|
childSetText("add_text", std::string("New domain:"));
|
||||||
sInstance->childSetText("input_domain", std::string(""));
|
childSetText("input_domain", std::string(""));
|
||||||
setDirty();
|
setDirty();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
|
|
||||||
class LLScrollListCtrl;
|
class LLScrollListCtrl;
|
||||||
class LLButton;
|
|
||||||
|
|
||||||
class SLFloaterMediaFilter : public LLFloater, public LLFloaterSingleton<SLFloaterMediaFilter>
|
class SLFloaterMediaFilter : public LLFloater, public LLFloaterSingleton<SLFloaterMediaFilter>
|
||||||
{
|
{
|
||||||
@@ -48,24 +47,20 @@ public:
|
|||||||
virtual void draw();
|
virtual void draw();
|
||||||
virtual ~SLFloaterMediaFilter();
|
virtual ~SLFloaterMediaFilter();
|
||||||
|
|
||||||
static void setDirty();
|
void setDirty();
|
||||||
|
|
||||||
static void onClearLists(void*);
|
void onShowIPs();
|
||||||
static void onShowIPs(void*);
|
void onWhitelistAdd();
|
||||||
static void onWhitelistAdd(void*);
|
void onWhitelistRemove();
|
||||||
static void onWhitelistRemove(void*);
|
void onBlacklistAdd();
|
||||||
static void onBlacklistAdd(void*);
|
void onBlacklistRemove();
|
||||||
static void onBlacklistRemove(void*);
|
void onCommitDomain();
|
||||||
static void onCommitDomain(void*);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool sIsWhitelist;
|
bool mIsWhitelist;
|
||||||
static bool sShowIPs;
|
bool mShowIPs;
|
||||||
LLScrollListCtrl* mWhitelistSLC;
|
LLScrollListCtrl* mWhitelistSLC;
|
||||||
LLScrollListCtrl* mBlacklistSLC;
|
LLScrollListCtrl* mBlacklistSLC;
|
||||||
bool mIsDirty;
|
bool mIsDirty;
|
||||||
|
|
||||||
static SLFloaterMediaFilter* sInstance;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user