Build Improvements: Added button for copy keys to clipboard

meow-7.2.2
Kadah 2011-06-23 00:40:21 -07:00
parent 57b3a6789a
commit dd34b50fb5
4 changed files with 55 additions and 2 deletions

View File

@ -14225,6 +14225,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<string>Wood</string>
</map>
<key>PhoenixCopyObjKeySeparator</key>
<map>
<key>Comment</key>
<string>This chunk of text goes between keys when you use the Copy Key button with multiple objects selected.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>,</string>
</map>
</map>
</llsd>

View File

@ -384,6 +384,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
mCommitCallbackRegistrar.add("BuildTool.LinkObjects", boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance()));
mCommitCallbackRegistrar.add("BuildTool.UnlinkObjects", boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance()));
mCommitCallbackRegistrar.add("BuildTool.CopyKeys", boost::bind(&LLFloaterTools::onClickBtnCopyKeys,this));
}
LLFloaterTools::~LLFloaterTools()
@ -1938,3 +1939,31 @@ void LLFloaterTools::updateMediaSettings()
mMediaSettings[ base_key + std::string( LLPanelContents::TENTATIVE_SUFFIX ) ] = ! identical;
}
struct LLFloaterToolsCopyKeysFunctor : public LLSelectedObjectFunctor
{
LLFloaterToolsCopyKeysFunctor(std::string& strOut, std::string& strSep) : mOutput(strOut), mSep(strSep) {}
virtual bool apply(LLViewerObject* object)
{
if (!mOutput.empty())
mOutput.append(mSep);
mOutput.append(object->getID().asString());
return true;
}
private:
std::string& mOutput;
std::string& mSep;
};
void LLFloaterTools::onClickBtnCopyKeys()
{
std::string separator = gSavedSettings.getString("PhoenixCopyObjKeySeparator");
std::string stringKeys;
LLFloaterToolsCopyKeysFunctor copy_keys(stringKeys, separator);
bool copied = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&copy_keys);
if (copied)
{
LLView::getWindow()->copyTextToClipboard(utf8str_to_wstring(stringKeys));
}
}

View File

@ -105,6 +105,8 @@ public:
void navigateToTitleMedia( const std::string url );
bool selectedMediaEditable();
void onClickBtnCopyKeys();
private:
void refresh();
void refreshMedia();

View File

@ -1124,13 +1124,24 @@ even though the user gets a free copy.
min_val="0"
height="20"
max_val="999999999" />
<button
top_pad="5"
left="10"
follows="top|right"
height="20"
label="Copy Keys"
name="btnCopyKeys"
tool_tip="Copies the selected objects' keys to the clipboard."
width="80">
<button.commit_callback
function="BuildTool.CopyKeys"/>
</button>
<check_box
height="15"
width="110"
top_pad="5"
label="Show in search"
layout="topleft"
left="100"
left_pad="15"
name="search_check"
tool_tip="Let people see this object in search results" />
<panel