diff options
author | Kent Quirk <q@lindenlab.com> | 2009-01-05 18:59:12 +0000 |
---|---|---|
committer | Kent Quirk <q@lindenlab.com> | 2009-01-05 18:59:12 +0000 |
commit | 667ca55bad0108c4bdf8f007b89e1a52fc766aad (patch) | |
tree | 7bd62ac8d9af079c3994565f3f200ccc250bbc28 /indra/newview/llviewerwindow.cpp | |
parent | 95f365789f4cebc7bd97ccefd538f14d481a8373 (diff) |
svn merge -r106715:HEAD svn+ssh://svn.lindenlab.com/svn/linden/branches/q/notifications-merge-r106715 . QAR-1149 -- Final merge of notifications to trunk.
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 121 |
1 files changed, 33 insertions, 88 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 48b4a79afa..a129fac47b 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -182,6 +182,9 @@ #include "llviewerjoystick.h" #include "llviewernetwork.h" +#include "llfloatertest.h" // HACK! +#include "llfloaternotificationsconsole.h" + #if LL_WINDOWS #include <tchar.h> // For Unicode conversion methods #endif @@ -246,6 +249,7 @@ std::string LLViewerWindow::sMovieBaseName; extern void toggle_debug_menus(void*); + //////////////////////////////////////////////////////////////////////////// // // LLDebugText @@ -1421,6 +1425,13 @@ LLViewerWindow::LLViewerWindow( mIsFullscreenChecked(false), mCurrResolutionIndex(0) { + // these are self registering so they don't need to be retained here + new LLNotificationChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert")); + new LLNotificationChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal")); + + LLNotifications::instance().getChannel("VW_alerts")->connectChanged(&LLViewerWindow::onAlert); + LLNotifications::instance().getChannel("VW_alertmodal")->connectChanged(&LLViewerWindow::onAlert); + // Default to application directory. LLViewerWindow::sSnapshotBaseName = "Snapshot"; LLViewerWindow::sMovieBaseName = "SLmovie"; @@ -1532,8 +1543,6 @@ LLViewerWindow::LLViewerWindow( // Can't have spaces in settings.ini strings, so use underscores instead and convert them. LLStringUtil::replaceChar(mOverlayTitle, '_', ' '); - LLAlertDialog::setDisplayCallback(alertCallback); // call this before calling any modal dialogs - // sync the keyboard's setting with the saved setting gSavedSettings.getControl("NumpadControl")->firePropertyChanged(); @@ -2179,7 +2188,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible ) void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid) { - LLStringUtil::format_map_t args; + LLSD args; LLColor4 new_bg_color; if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid()) @@ -2232,12 +2241,6 @@ void LLViewerWindow::draw() stop_glerror(); LLUI::setLineWidth(1.f); - //popup alerts from the UI - LLAlertInfo alert; - while (LLPanel::nextAlert(alert)) - { - alertXml(alert.mLabel, alert.mArgs); - } LLUI::setLineWidth(1.f); // Reset any left-over transforms @@ -2421,6 +2424,15 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) } } + // Debugging view for unified notifications + if ((MASK_SHIFT & mask) + && (MASK_CONTROL & mask) + && ('N' == key || 'n' == key)) + { + LLFloaterNotificationConsole::showInstance(); + return TRUE; + } + // handle escape key //if (key == KEY_ESCAPE && mask == MASK_NONE) //{ @@ -4909,10 +4921,10 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size, if (!result_first_try) { - LLStringUtil::format_map_t args; - args["[RESX]"] = llformat("%d",size.mX); - args["[RESY]"] = llformat("%d",size.mY); - alertXml("ResolutionSwitchFail", args); + LLSD args; + args["RESX"] = llformat("%d",size.mX); + args["RESY"] = llformat("%d",size.mY); + LLNotifications::instance().add("ResolutionSwitchFail", args); size = old_size; // for reshape below } @@ -5027,72 +5039,18 @@ S32 LLViewerWindow::getChatConsoleBottomPad() //---------------------------------------------------------------------------- -// static -bool LLViewerWindow::alertCallback(S32 modal) -{ - if (gNoRender) - { - return false; - } - else - { -// if (modal) // we really always want to take you out of mouselook - { - // If we're in mouselook, the mouse is hidden and so the user can't click - // the dialog buttons. In that case, change to First Person instead. - if( gAgent.cameraMouselook() ) - { - gAgent.changeCameraToDefault(); - } - } - return true; - } -} - -LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, - LLAlertDialog::alert_callback_t callback, void* user_data) -{ - LLStringUtil::format_map_t args; - return alertXml( xml_filename, args, callback, user_data ); -} -LLAlertDialog* LLViewerWindow::alertXml(const std::string& xml_filename, const LLStringUtil::format_map_t& args, - LLAlertDialog::alert_callback_t callback, void* user_data) +//static +bool LLViewerWindow::onAlert(const LLSD& notify) { - if (gNoRender) - { - llinfos << "Alert: " << xml_filename << llendl; - if (callback) - { - callback(-1, user_data); - } - return NULL; - } + LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID()); - // If we're in mouselook, the mouse is hidden and so the user can't click - // the dialog buttons. In that case, change to First Person instead. - if( gAgent.cameraMouselook() ) - { - gAgent.changeCameraToDefault(); - } - - // Note: object adds, removes, and destroys itself. - return LLAlertDialog::showXml( xml_filename, args, callback, user_data ); -} - -LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, const LLStringUtil::format_map_t& args, - LLAlertDialog::alert_callback_t callback, void* user_data, - LLAlertDialog::alert_text_callback_t text_callback, void *text_data, - const LLStringUtil::format_map_t& edit_args, BOOL draw_asterixes) -{ if (gNoRender) { - llinfos << "Alert: " << xml_filename << llendl; - if (callback) - { - callback(-1, user_data); - } - return NULL; + llinfos << "Alert: " << notification->getName() << llendl; + notification->respond(LLSD::emptyMap()); + LLNotifications::instance().cancel(notification); + return false; } // If we're in mouselook, the mouse is hidden and so the user can't click @@ -5101,20 +5059,7 @@ LLAlertDialog* LLViewerWindow::alertXmlEditText(const std::string& xml_filename, { gAgent.changeCameraToDefault(); } - - // Note: object adds, removes, and destroys itself. - LLAlertDialog* alert = LLAlertDialog::createXml( xml_filename, args, callback, user_data ); - if (alert) - { - if (text_callback) - { - alert->setEditTextCallback(text_callback, text_data); - } - alert->setEditTextArgs(edit_args); - alert->setDrawAsterixes(draw_asterixes); - alert->show(); - } - return alert; + return false; } //////////////////////////////////////////////////////////////////////////// |