DEV-38942 Eliminate startModal() from LLModalDialog

Also moved TOS and Critical floaters to login debug menu for testing
master
Steven Bennetts 2009-08-28 08:04:26 +00:00
parent 745845f799
commit 9e2cb2f4a0
8 changed files with 83 additions and 69 deletions

View File

@ -44,11 +44,10 @@
// static
std::list<LLModalDialog*> LLModalDialog::sModalStack;
LLModalDialog::LLModalDialog( const LLSD& key, S32 width, S32 height, BOOL modal )
LLModalDialog::LLModalDialog( const LLSD& key, BOOL modal )
: LLFloater(key),
mModal( modal )
{
setRect(LLRect( 0, height, width, 0 ));
if (modal)
{
setCanMinimize(FALSE);
@ -98,7 +97,8 @@ void LLModalDialog::reshape(S32 width, S32 height, BOOL called_from_parent)
centerOnScreen();
}
void LLModalDialog::startModal()
// virtual
void LLModalDialog::onOpen(const LLSD& key)
{
if (mModal)
{
@ -116,8 +116,6 @@ void LLModalDialog::startModal()
sModalStack.push_front( this );
}
setVisible( TRUE );
}
void LLModalDialog::stopModal()

View File

@ -45,18 +45,16 @@ class LLModalDialog;
class LLModalDialog : public LLFloater
{
public:
LLModalDialog( const LLSD& key, S32 width, S32 height, BOOL modal = true );
LLModalDialog( const LLSD& key, BOOL modal = true );
/*virtual*/ ~LLModalDialog();
/*virtual*/ BOOL postBuild();
/*virtual*/ void openFloater(const LLSD& key = LLSD());
/*virtual*/ void onOpen(const LLSD& key);
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
/*virtual*/ void startModal();
/*virtual*/ void stopModal();
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
@ -68,7 +66,8 @@ public:
/*virtual*/ void setVisible(BOOL visible);
/*virtual*/ void draw();
BOOL isModal() const { return mModal; }
BOOL isModal() const { return mModal; }
void stopModal();
static void onAppFocusLost();
static void onAppFocusGained();
@ -79,6 +78,7 @@ protected:
void centerOnScreen();
private:
LLFrameTimer mVisibleTime;
const BOOL mModal;

View File

@ -111,26 +111,38 @@ const F32 MIN_USER_FAR_CLIP = 64.f;
const S32 ASPECT_RATIO_STR_LEN = 100;
class LLVoiceSetKeyDialog : public LLModalDialog
{
public:
LLVoiceSetKeyDialog(LLFloaterPreference* parent);
~LLVoiceSetKeyDialog();
BOOL handleKeyHere(KEY key, MASK mask);
static void onCancel(void* user_data);
private:
LLFloaterPreference* mParent;
};
LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(LLFloaterPreference* parent)
: LLModalDialog(LLSD(), 240, 100), mParent(parent)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml", NULL);
public:
LLVoiceSetKeyDialog(const LLSD& key);
~LLVoiceSetKeyDialog();
/*virtual*/ BOOL postBuild();
void setParent(LLFloaterPreference* parent) { mParent = parent; }
BOOL handleKeyHere(KEY key, MASK mask);
static void onCancel(void* user_data);
private:
LLFloaterPreference* mParent;
};
LLVoiceSetKeyDialog::LLVoiceSetKeyDialog(const LLSD& key)
: LLModalDialog(key),
mParent(NULL)
{
// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_select_key.xml", NULL);
}
//virtual
BOOL LLVoiceSetKeyDialog::postBuild()
{
childSetAction("Cancel", onCancel, this);
childSetFocus("Cancel");
gFocusMgr.setKeystrokesOnly(TRUE);
return TRUE;
}
LLVoiceSetKeyDialog::~LLVoiceSetKeyDialog()
@ -145,7 +157,7 @@ BOOL LLVoiceSetKeyDialog::handleKeyHere(KEY key, MASK mask)
{
result = FALSE;
}
else
else if (mParent)
{
mParent->setKey(key);
}
@ -294,7 +306,14 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mOriginalIMViaEmail(false)
{
//Build Floater is now Called from LLFloaterReg::add("preferences", "floater_preferences.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterPreference>);
static bool registered_dialog = false;
if (!registered_dialog)
{
LLFloaterReg::add("voice_set_key", "floater_select_key.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLVoiceSetKeyDialog>);
registered_dialog = true;
}
mCommitCallbackRegistrar.add("Pref.Apply", boost::bind(&LLFloaterPreference::onBtnApply, this));
mCommitCallbackRegistrar.add("Pref.Cancel", boost::bind(&LLFloaterPreference::onBtnCancel, this));
mCommitCallbackRegistrar.add("Pref.OK", boost::bind(&LLFloaterPreference::onBtnOK, this));
@ -980,8 +999,11 @@ void LLFloaterPreference::cleanupBadSetting()
void LLFloaterPreference::onClickSetKey()
{
LLVoiceSetKeyDialog* dialog = new LLVoiceSetKeyDialog(this);
dialog->startModal();
LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE);
if (dialog)
{
dialog->setParent(this);
}
}
void LLFloaterPreference::setKey(KEY key)

View File

@ -53,7 +53,7 @@
LLFloaterTOS::LLFloaterTOS(const LLSD& message)
: LLModalDialog( message, 100, 100 ),
: LLModalDialog( message ),
mMessage(message.asString()),
mWebBrowserWindowId( 0 ),
mLoadCompleteCount( 0 )

View File

@ -840,10 +840,9 @@ BOOL LLFloaterIM::postBuild()
// Class LLIncomingCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
LLModalDialog(payload, 240, 200),
LLModalDialog(payload),
mPayload(payload)
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_incoming_call.xml", NULL);
}
BOOL LLIncomingCallDialog::postBuild()
@ -1134,6 +1133,13 @@ LLIMMgr::LLIMMgr() :
mFriendObserver(NULL),
mIMReceived(FALSE)
{
static bool registered_dialog = false;
if (!registered_dialog)
{
LLFloaterReg::add("incoming_call", "floater_incoming_call.xml.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLIncomingCallDialog>);
registered_dialog = true;
}
mFriendObserver = new LLIMViewFriendObserver(this);
LLAvatarTracker::instance().addObserver(mFriendObserver);
@ -1535,8 +1541,7 @@ void LLIMMgr::inviteToSession(
{
if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc")
{
LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload);
dialog->startModal();
LLFloaterReg::showInstance("incoming_call", payload, TRUE);
}
else
{
@ -1544,10 +1549,7 @@ void LLIMMgr::inviteToSession(
args["NAME"] = caller_name;
args["GROUP"] = session_name;
LLNotifications::instance().add(notify_box_type,
args,
payload,
&inviteUserResponse);
LLNotifications::instance().add(notify_box_type, args, payload, &inviteUserResponse);
}
}
mPendingInvitations[session_id.asString()] = LLSD();
@ -1563,8 +1565,7 @@ void LLIMMgr::onInviteNameLookup(LLSD payload, const LLUUID& id, const std::stri
if (notify_box_type == "VoiceInviteP2P" || notify_box_type == "VoiceInviteAdHoc")
{
LLIncomingCallDialog *dialog = new LLIncomingCallDialog(payload);
dialog->startModal();
LLFloaterReg::showInstance("incoming_call", payload, TRUE);
}
else
{

View File

@ -410,15 +410,6 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask)
return TRUE;
}
if (('T' == key) && (MASK_CONTROL == mask))
{ // previously was "Test Floater"
if(gSavedSettings.getBOOL("QAMode"))
{
LLFloaterReg::showInstance("ui_preview", LLSD(), TRUE);
return TRUE;
}
}
if ( KEY_F1 == key )
{
llinfos << "Spawning HTML help window" << llendl;
@ -426,21 +417,6 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask)
return TRUE;
}
# if !LL_RELEASE_FOR_DOWNLOAD
if ( KEY_F2 == key )
{
llinfos << "Spawning floater TOS window (TOS)" << llendl;
LLFloaterReg::showInstance("message_tos",LLSD(""));
return TRUE;
}
if ( KEY_F3 == key )
{
llinfos << "Spawning floater TOS window (critical message)" << llendl;
LLFloaterReg::showInstance("message_critical",LLSD(""));
return TRUE;
}
#endif
if (KEY_RETURN == key && MASK_NONE == mask)
{
// let the panel handle UICtrl processing: calls onClickConnect()

View File

@ -1686,6 +1686,10 @@ void LLViewerWindow::shutdownViews()
gMorphView->setVisible(FALSE);
}
// Delete Tool Tip
delete mToolTip;
mToolTip = NULL;
// Delete all child views.
delete mRootView;
mRootView = NULL;
@ -1695,15 +1699,12 @@ void LLViewerWindow::shutdownViews()
gIMMgr = NULL;
gHoverView = NULL;
gFloaterView = NULL;
gMorphView = NULL;
gFloaterView = NULL;
gMorphView = NULL;
gHUDView = NULL;
gNotifyBoxView = NULL;
delete mToolTip;
mToolTip = NULL;
}
void LLViewerWindow::shutdownGL()

View File

@ -109,5 +109,21 @@
function="ShowFloater"
parameter="test_list_view" />
</menu_item_call>
<menu_item_call
label="Show TOS"
layout="topleft"
name="TOS">
<menu_item_call.on_click
function="ShowFloater"
parameter="message_tos" />
</menu_item_call>
<menu_item_call
label="Show Critical Message"
layout="topleft"
name="TOS">
<menu_item_call.on_click
function="ShowFloater"
parameter="message_critical" />
</menu_item_call>
</menu>
</menu_bar>