summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewscript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewscript.cpp')
-rw-r--r--indra/newview/llpreviewscript.cpp87
1 files changed, 44 insertions, 43 deletions
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 2717c44415..42363079a4 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -608,27 +608,26 @@ BOOL LLScriptEdCore::canClose()
else
{
// Bring up view-modal dialog: Save changes? Yes, No, Cancel
- gViewerWindow->alertXml("SaveChanges", LLScriptEdCore::handleSaveChangesDialog, this);
+ LLNotifications::instance().add("SaveChanges", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleSaveChangesDialog, this, _1, _2));
return FALSE;
}
}
-// static
-void LLScriptEdCore::handleSaveChangesDialog( S32 option, void* userdata )
+bool LLScriptEdCore::handleSaveChangesDialog(const LLSD& notification, const LLSD& response )
{
- LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+ S32 option = LLNotification::getSelectedOption(notification, response);
switch( option )
{
case 0: // "Yes"
// close after saving
- LLScriptEdCore::doSave( self, TRUE );
+ LLScriptEdCore::doSave( this, TRUE );
break;
case 1: // "No"
- self->mForceClose = TRUE;
+ mForceClose = TRUE;
// This will close immediately because mForceClose is true, so we won't
// infinite loop with these dialogs. JC
- ((LLFloater*) self->getParent())->close();
+ ((LLFloater*) getParent())->close();
break;
case 2: // "Cancel"
@@ -637,29 +636,32 @@ void LLScriptEdCore::handleSaveChangesDialog( S32 option, void* userdata )
LLAppViewer::instance()->abortQuit();
break;
}
+ return false;
}
// static
-void LLScriptEdCore::onHelpWebDialog(S32 option, void* userdata)
+bool LLScriptEdCore::onHelpWebDialog(const LLSD& notification, const LLSD& response)
{
- LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
+ S32 option = LLNotification::getSelectedOption(notification, response);
switch(option)
{
case 0:
- LLWeb::loadURL(corep->mHelpURL);
+ LLWeb::loadURL(notification["payload"]["help_url"]);
break;
default:
break;
}
+ return false;
}
// static
void LLScriptEdCore::onBtnHelp(void* userdata)
{
- gViewerWindow->alertXml("WebLaunchLSLGuide",
- onHelpWebDialog,
- userdata);
+ LLScriptEdCore* corep = (LLScriptEdCore*)userdata;
+ LLSD payload;
+ payload["help_url"] = corep->mHelpURL;
+ LLNotifications::instance().add("WebLaunchLSLGuide", LLSD(), payload, onHelpWebDialog);
}
// static
@@ -818,8 +820,7 @@ void LLScriptEdCore::onBtnUndoChanges( void* userdata )
LLScriptEdCore* self = (LLScriptEdCore*) userdata;
if( !self->mEditor->tryToRevertToPristineState() )
{
- gViewerWindow->alertXml("ScriptCannotUndo",
- LLScriptEdCore::handleReloadFromServerDialog, self);
+ LLNotifications::instance().add("ScriptCannotUndo", LLSD(), LLSD(), boost::bind(&LLScriptEdCore::handleReloadFromServerDialog, self, _1, _2));
}
}
@@ -965,17 +966,16 @@ void LLScriptEdCore::onErrorList(LLUICtrl*, void* user_data)
}
}
-// static
-void LLScriptEdCore::handleReloadFromServerDialog( S32 option, void* userdata )
+bool LLScriptEdCore::handleReloadFromServerDialog(const LLSD& notification, const LLSD& response )
{
- LLScriptEdCore* self = (LLScriptEdCore*) userdata;
+ S32 option = LLNotification::getSelectedOption(notification, response);
switch( option )
{
case 0: // "Yes"
- if( self->mLoadCallback )
+ if( mLoadCallback )
{
- self->mEditor->setText( self->getString("loading") );
- self->mLoadCallback( self->mUserdata );
+ mEditor->setText( getString("loading") );
+ mLoadCallback( mUserdata );
}
break;
@@ -986,6 +986,7 @@ void LLScriptEdCore::handleReloadFromServerDialog( S32 option, void* userdata )
llassert(0);
break;
}
+ return false;
}
void LLScriptEdCore::selectFirstError()
@@ -1444,9 +1445,9 @@ void LLPreviewLSL::onSaveComplete(const LLUUID& asset_uuid, void* user_data, S32
else
{
llwarns << "Problem saving script: " << status << llendl;
- LLStringUtil::format_map_t args;
- args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status));
- gViewerWindow->alertXml("SaveScriptFailReason", args);
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotifications::instance().add("SaveScriptFailReason", args);
}
delete info;
}
@@ -1482,9 +1483,9 @@ void LLPreviewLSL::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* user_d
else
{
llwarns << "Problem saving LSL Bytecode (Preview)" << llendl;
- LLStringUtil::format_map_t args;
- args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status));
- gViewerWindow->alertXml("SaveBytecodeFailReason", args);
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotifications::instance().add("SaveBytecodeFailReason", args);
}
delete instance_uuid;
}
@@ -1530,15 +1531,15 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset
if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
LL_ERR_FILE_EMPTY == status)
{
- LLNotifyBox::showXml("ScriptMissing");
+ LLNotifications::instance().add("ScriptMissing");
}
else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
{
- LLNotifyBox::showXml("ScriptNoPermissions");
+ LLNotifications::instance().add("ScriptNoPermissions");
}
else
{
- LLNotifyBox::showXml("UnableToLoadScript");
+ LLNotifications::instance().add("UnableToLoadScript");
}
preview->mAssetStatus = PREVIEW_ASSET_ERROR;
@@ -1846,15 +1847,15 @@ void LLLiveLSLEditor::onLoadComplete(LLVFS *vfs, const LLUUID& asset_id,
if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
LL_ERR_FILE_EMPTY == status)
{
- LLNotifyBox::showXml("ScriptMissing");
+ LLNotifications::instance().add("ScriptMissing");
}
else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
{
- LLNotifyBox::showXml("ScriptNoPermissions");
+ LLNotifications::instance().add("ScriptNoPermissions");
}
else
{
- LLNotifyBox::showXml("UnableToLoadScript");
+ LLNotifications::instance().add("UnableToLoadScript");
}
instance->mAssetStatus = PREVIEW_ASSET_ERROR;
}
@@ -1941,7 +1942,7 @@ void LLLiveLSLEditor::onRunningCheckboxClicked( LLUICtrl*, void* userdata )
else
{
runningCheckbox->set(!running);
- gViewerWindow->alertXml("CouldNotStartStopScript");
+ LLNotifications::instance().add("CouldNotStartStopScript");
}
}
@@ -1964,7 +1965,7 @@ void LLLiveLSLEditor::onReset(void *userdata)
}
else
{
- gViewerWindow->alertXml("CouldNotStartStopScript");
+ LLNotifications::instance().add("CouldNotStartStopScript");
}
}
@@ -2058,7 +2059,7 @@ void LLLiveLSLEditor::saveIfNeeded()
LLViewerObject* object = gObjectList.findObject(mObjectID);
if(!object)
{
- gViewerWindow->alertXml("SaveScriptFailObjectNotFound");
+ LLNotifications::instance().add("SaveScriptFailObjectNotFound");
return;
}
@@ -2066,7 +2067,7 @@ void LLLiveLSLEditor::saveIfNeeded()
{
// $NOTE: While the error message may not be exactly correct,
// it's pretty close.
- gViewerWindow->alertXml("SaveScriptFailObjectNotFound");
+ LLNotifications::instance().add("SaveScriptFailObjectNotFound");
return;
}
@@ -2268,9 +2269,9 @@ void LLLiveLSLEditor::onSaveTextComplete(const LLUUID& asset_uuid, void* user_da
if (status)
{
llwarns << "Unable to save text for a script." << llendl;
- LLStringUtil::format_map_t args;
- args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status));
- gViewerWindow->alertXml("CompileQueueSaveText", args);
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotifications::instance().add("CompileQueueSaveText", args);
}
else
{
@@ -2329,9 +2330,9 @@ void LLLiveLSLEditor::onSaveBytecodeComplete(const LLUUID& asset_uuid, void* use
llinfos << "Problem saving LSL Bytecode (Live Editor)" << llendl;
llwarns << "Unable to save a compiled script." << llendl;
- LLStringUtil::format_map_t args;
- args["[REASON]"] = std::string(LLAssetStorage::getErrorString(status));
- gViewerWindow->alertXml("CompileQueueSaveBytecode", args);
+ LLSD args;
+ args["REASON"] = std::string(LLAssetStorage::getErrorString(status));
+ LLNotifications::instance().add("CompileQueueSaveBytecode", args);
}
std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,asset_uuid.asString());