xui / panel format cleanup.

master
Tofu Linden 2010-09-30 12:01:36 +01:00
parent de84d95ba0
commit dd6a77c9e1
3 changed files with 18 additions and 74 deletions

View File

@ -31,8 +31,6 @@
#include "llfocusmgr.h"
#include "llbutton.h"
#include "lliconctrl.h"
#include "llinventoryfunctions.h"
#include "llnotifications.h"
#include "llviewertexteditor.h"
@ -44,59 +42,30 @@
#include "llglheaders.h"
#include "llagent.h"
#include "llavatariconctrl.h"
#include "llfloaterinventory.h"
#include "llinventorytype.h"
const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7;
const S32 LLToastScriptTextbox::DEFAULT_MESSAGE_MAX_LINE_COUNT= 7;
LLToastScriptTextbox::LLToastScriptTextbox(LLNotificationPtr& notification)
: LLToastNotifyPanel(notification),
mInventoryOffer(NULL)
: LLToastNotifyPanel(notification)
{
buildFromFile( "panel_notify_textbox.xml");
const LLSD& payload = notification->getPayload();
llwarns << "PAYLOAD " << payload << llendl;
llwarns << "TYPE " << notification->getType() << llendl;
llwarns << "MESSAGE " << notification->getMessage() << llendl;
llwarns << "LABEL " << notification->getLabel() << llendl;
llwarns << "URL " << notification->getURL() << llendl;
//message body
const std::string& message = payload["message"].asString();
std::string timeStr = "["+LLTrans::getString("UTCTimeWeek")+"],["
+LLTrans::getString("UTCTimeDay")+"] ["
+LLTrans::getString("UTCTimeMth")+"] ["
+LLTrans::getString("UTCTimeYr")+"] ["
+LLTrans::getString("UTCTimeHr")+"]:["
+LLTrans::getString("UTCTimeMin")+"]:["
+LLTrans::getString("UTCTimeSec")+"] ["
+LLTrans::getString("UTCTimeTimezone")+"]";
const LLDate timeStamp = notification->getDate();
LLDate notice_date = timeStamp.notNull() ? timeStamp : LLDate::now();
LLSD substitution;
substitution["datetime"] = (S32) notice_date.secondsSinceEpoch();
LLStringUtil::format(timeStr, substitution);
LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
pMessageText->clear();
LLStyle::Params style;
LLFontGL* date_font = LLFontGL::getFontByName(getString("date_font"));
if (date_font)
style.font = date_font;
pMessageText->appendText(timeStr + "\n", TRUE, style);
style.font = pMessageText->getDefaultFont();
pMessageText->appendText(message, TRUE, style);
//ok button
LLButton* pOkBtn = getChild<LLButton>("btn_ok");
pOkBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickOk, this)));
setDefaultBtn(pOkBtn);
//submit button
LLButton* pSubmitBtn = getChild<LLButton>("btn_submit");
pSubmitBtn->setClickedCallback((boost::bind(&LLToastScriptTextbox::onClickSubmit, this)));
setDefaultBtn(pSubmitBtn);
S32 maxLinesCount;
std::istringstream ss( getString("message_max_lines_count") );
@ -104,7 +73,7 @@ LLToastScriptTextbox::LLToastScriptTextbox(LLNotificationPtr& notification)
{
maxLinesCount = DEFAULT_MESSAGE_MAX_LINE_COUNT;
}
snapToMessageHeight(pMessageText, maxLinesCount);
//snapToMessageHeight(pMessageText, maxLinesCount);
}
// virtual
@ -118,14 +87,13 @@ void LLToastScriptTextbox::close()
}
#include "lllslconstants.h"
void LLToastScriptTextbox::onClickOk()
void LLToastScriptTextbox::onClickSubmit()
{
LLViewerTextEditor* pMessageText = getChild<LLViewerTextEditor>("message");
if (pMessageText)
{
LLSD response = mNotification->getResponseTemplate();
//response["OH MY GOD WHAT A HACK"] = "woot";
response[TEXTBOX_MAGIC_TOKEN] = pMessageText->getText();
if (response[TEXTBOX_MAGIC_TOKEN].asString().empty())
{

View File

@ -27,19 +27,13 @@
#ifndef LL_LLTOASTSCRIPTTEXTBOX_H
#define LL_LLTOASTSCRIPTTEXTBOX_H
#include "llfontgl.h"
#include "lltoastnotifypanel.h"
#include "lldarray.h"
#include "lltimer.h"
#include "llviewermessage.h"
#include "llnotificationptr.h"
class LLButton;
/**
* Toast panel for group notification.
*
* Replaces class LLGroupNotifyBox.
* Toast panel for scripted llTextbox notifications.
*/
class LLToastScriptTextbox
: public LLToastNotifyPanel
@ -49,7 +43,6 @@ public:
static bool onNewNotification(const LLSD& notification);
// Non-transient messages. You can specify non-default button
// layouts (like one for script dialogs) by passing various
// numbers in for "layout".
@ -57,23 +50,9 @@ public:
/*virtual*/ ~LLToastScriptTextbox();
protected:
void onClickOk();
void onClickAttachment();
void onClickSubmit();
private:
static bool isAttachmentOpenable(LLAssetType::EType);
static const S32 DEFAULT_MESSAGE_MAX_LINE_COUNT;
LLButton* mSaveInventoryBtn;
LLUUID mGroupID;
LLOfferInfo* mInventoryOffer;
};
// This view contains the stack of notification windows.
//extern LLView* gGroupNotifyBoxView;
const S32 GROUP_LAYOUT_DEFAULT = 0;
const S32 GROUP_LAYOUT_SCRIPT_DIALOG = 1;
#endif

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<panel
background_visible="true"
height="90"
height="150"
label="instant_message"
layout="topleft"
left="0"
@ -11,17 +11,14 @@
<string
name="message_max_lines_count"
value="7" />
<string
name="date_font"
value="SANSSERIF" />
<text_editor
parse_urls="true"
enabled="true"
follows="all"
height="0"
height="60"
layout="topleft"
left="25"
max_length="2147483647"
max_length="250"
name="message"
parse_highlights="true"
read_only="false"
@ -33,12 +30,12 @@
word_wrap="true" >
</text_editor>
<button
bottom="85"
follows="bottom"
top="110"
follows="top|left"
height="20"
label="OK"
label="Submit"
layout="topleft"
right="-10"
name="btn_ok"
left="25"
name="btn_submit"
width="70" />
</panel>