diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/app_settings/settings_per_account.xml | 14 | ||||
-rw-r--r-- | indra/newview/llfloatercamera.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llfloatercamera.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 57 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.h | 7 | ||||
-rw-r--r-- | indra/newview/lljoystickbutton.cpp | 153 | ||||
-rw-r--r-- | indra/newview/lljoystickbutton.h | 40 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_preferences_general.xml | 2 |
11 files changed, 89 insertions, 228 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index d4000e9253..dc76a4e518 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -1,26 +1,26 @@ <llsd> <map> - <key>BusyModeResponse</key> + <key>BusyResponseChanged</key> <map> <key>Comment</key> - <string>Auto response to instant messages while in busy mode.</string> + <string>Does user's busy mode message differ from default?</string> <key>Persist</key> <integer>1</integer> <key>Type</key> - <string>String</string> + <string>Boolean</string> <key>Value</key> - <string>The Resident you messaged is in 'busy mode' which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string> + <integer>0</integer> </map> - <key>BusyModeResponse2</key> + <key>BusyModeResponse</key> <map> <key>Comment</key> - <string>Auto response to instant messages while in busy mode, clean (unencoded) version of BusyModeResponse</string> + <string>Auto response to instant messages while in busy mode.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> <string>String</string> <key>Value</key> - <string>|TOKEN COPY BusyModeResponse|</string> + <string>The Resident you messaged is in 'busy mode' which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string> </map> <key>InstantMessageLogPath</key> <map> diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index ca346138fb..d6effb2b21 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -49,6 +49,9 @@ static LLDefaultChildRegistry::Register<LLPanelCameraItem> r("panel_camera_item"); +const F32 NUDGE_TIME = 0.25f; // in seconds +const F32 ORBIT_NUDGE_RATE = 0.05f; // fraction of normal speed + // Constants const F32 CAMERA_BUTTON_DELAY = 0.0f; @@ -75,6 +78,7 @@ protected: void onZoomPlusHeldDown(); void onZoomMinusHeldDown(); void onSliderValueChanged(); + F32 getOrbitRate(F32 time); private: LLButton* mPlusBtn; @@ -155,8 +159,8 @@ LLPanelCameraZoom::LLPanelCameraZoom() mMinusBtn( NULL ), mSlider( NULL ) { - mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this)); - mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this)); + mCommitCallbackRegistrar.add("Zoom.minus", boost::bind(&LLPanelCameraZoom::onZoomMinusHeldDown, this)); + mCommitCallbackRegistrar.add("Zoom.plus", boost::bind(&LLPanelCameraZoom::onZoomPlusHeldDown, this)); mCommitCallbackRegistrar.add("Slider.value_changed", boost::bind(&LLPanelCameraZoom::onSliderValueChanged, this)); } @@ -179,9 +183,9 @@ void LLPanelCameraZoom::onZoomPlusHeldDown() F32 val = mSlider->getValueF32(); F32 inc = mSlider->getIncrement(); mSlider->setValue(val - inc); - // commit only if value changed - if (val != mSlider->getValueF32()) - mSlider->onCommit(); + F32 time = mPlusBtn->getHeldDownTime(); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitInKey(getOrbitRate(time)); } void LLPanelCameraZoom::onZoomMinusHeldDown() @@ -189,9 +193,22 @@ void LLPanelCameraZoom::onZoomMinusHeldDown() F32 val = mSlider->getValueF32(); F32 inc = mSlider->getIncrement(); mSlider->setValue(val + inc); - // commit only if value changed - if (val != mSlider->getValueF32()) - mSlider->onCommit(); + F32 time = mMinusBtn->getHeldDownTime(); + gAgentCamera.unlockView(); + gAgentCamera.setOrbitOutKey(getOrbitRate(time)); +} + +F32 LLPanelCameraZoom::getOrbitRate(F32 time) +{ + if( time < NUDGE_TIME ) + { + F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; + return rate; + } + else + { + return 1; + } } void LLPanelCameraZoom::onSliderValueChanged() diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h index 8fa7a53996..564e38d02d 100644 --- a/indra/newview/llfloatercamera.h +++ b/indra/newview/llfloatercamera.h @@ -39,7 +39,6 @@ #include "llflatlistview.h" class LLJoystickCameraRotate; -class LLJoystickCameraZoom; class LLJoystickCameraTrack; class LLFloaterReg; class LLPanelCameraZoom; diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 5fbbb2c1a8..2299cd719c 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -330,9 +330,28 @@ BOOL LLFloaterPreference::postBuild() std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""); childSetText("cache_location", cache_location); + // if floater is opened before login set default localized busy message + if (LLStartUp::getStartupState() < STATE_STARTED) + { + gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault")); + } + return TRUE; } +void LLFloaterPreference::onBusyResponseChanged() +{ + // set "BusyResponseChanged" TRUE if user edited message differs from default, FALSE otherwise + if(LLTrans::getString("BusyModeResponseDefault") != getChild<LLUICtrl>("busy_response")->getValue().asString()) + { + gSavedPerAccountSettings.setBOOL("BusyResponseChanged", TRUE ); + } + else + { + gSavedPerAccountSettings.setBOOL("BusyResponseChanged", FALSE ); + } +} + LLFloaterPreference::~LLFloaterPreference() { // clean up user data @@ -487,6 +506,22 @@ void LLFloaterPreference::cancel() void LLFloaterPreference::onOpen(const LLSD& key) { + // this variable and if that follows it are used to properly handle busy mode response message + static bool initialized = FALSE; + // if user is logged in and we haven't initialized busy_response yet, do it + if (!initialized && LLStartUp::getStartupState() == STATE_STARTED) + { + // Special approach is used for busy response localization, because "BusyModeResponse" is + // in non-localizable xml, and also because it may be changed by user and in this case it shouldn't be localized. + // To keep track of whether busy response is default or changed by user additional setting BusyResponseChanged + // was added into per account settings. + + // initialization should happen once,so setting variable to TRUE + initialized = TRUE; + // this connection is needed to properly set "BusyResponseChanged" setting when user makes changes in + // busy response message. + gSavedPerAccountSettings.getControl("BusyModeResponse")->getSignal()->connect(boost::bind(&LLFloaterPreference::onBusyResponseChanged, this)); + } gAgent.sendAgentUserInfoRequest(); /////////////////////////// From LLPanelGeneral ////////////////////////// @@ -540,6 +575,16 @@ void LLFloaterPreference::onVertexShaderEnable() refreshEnabledGraphics(); } +//static +void LLFloaterPreference::initBusyResponse() + { + if (!gSavedPerAccountSettings.getBOOL("BusyResponseChanged")) + { + //LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885) + gSavedPerAccountSettings.setString("BusyModeResponse", LLTrans::getString("BusyModeResponseDefault")); + } + } + void LLFloaterPreference::setHardwareDefaults() { LLFeatureManager::getInstance()->applyRecommendedSettings(); @@ -960,18 +1005,6 @@ void LLFloaterPreference::onChangeQuality(const LLSD& data) refresh(); } -// static -// DEV-24146 - needs to be removed at a later date. jan-2009 -void LLFloaterPreference::cleanupBadSetting() -{ - if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|") - { - llinfos << "cleaning old BusyModeResponse" << llendl; - //LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885) - gSavedPerAccountSettings.setString("BusyModeResponse2", LLTrans::getString("BusyModeResponseDefault")); - } -} - void LLFloaterPreference::onClickSetKey() { LLVoiceSetKeyDialog* dialog = LLFloaterReg::showTypedInstance<LLVoiceSetKeyDialog>("voice_set_key", LLSD(), TRUE); diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index 71aa5d3189..b45e09db7d 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -80,6 +80,9 @@ public: // refresh all the graphics preferences menus static void refreshEnabledGraphics(); + // translate user's busy response message according to current locale if message is default, otherwise do nothing + static void initBusyResponse(); + protected: void onBtnOK(); void onBtnCancel(); @@ -87,6 +90,9 @@ protected: void onClickBrowserClearCache(); + // set value of "BusyResponseChanged" in account settings depending on whether busy response + // string differs from default after user changes. + void onBusyResponseChanged(); // if the custom settings box is clicked void onChangeCustom(); void updateMeterText(LLUICtrl* ctrl); @@ -140,7 +146,6 @@ public: void buildPopupLists(); static void refreshSkin(void* data); - static void cleanupBadSetting(); private: static std::string sSkin; bool mGotPersonalInfo; diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp index 9e1dc3a4b0..c2a1923dfe 100644 --- a/indra/newview/lljoystickbutton.cpp +++ b/indra/newview/lljoystickbutton.cpp @@ -53,7 +53,6 @@ static LLDefaultChildRegistry::Register<LLJoystickAgentSlide> r1("joystick_slide"); static LLDefaultChildRegistry::Register<LLJoystickAgentTurn> r2("joystick_turn"); static LLDefaultChildRegistry::Register<LLJoystickCameraRotate> r3("joystick_rotate"); -static LLDefaultChildRegistry::Register<LLJoystickCameraZoom> r4("joystick_zoom"); static LLDefaultChildRegistry::Register<LLJoystickCameraTrack> r5("joystick_track"); @@ -647,155 +646,3 @@ void LLJoystickCameraTrack::onHeldDown() gAgentCamera.setPanDownKey(getOrbitRate()); } } - - - -//------------------------------------------------------------------------------- -// LLJoystickCameraZoom -//------------------------------------------------------------------------------- - -LLJoystickCameraZoom::LLJoystickCameraZoom(const LLJoystickCameraZoom::Params& p) -: LLJoystick(p), - mInTop( FALSE ), - mInBottom( FALSE ), - mPlusInImage(p.plus_image), - mMinusInImage(p.minus_image) -{ -} - -BOOL LLJoystickCameraZoom::handleMouseDown(S32 x, S32 y, MASK mask) -{ - BOOL handled = LLJoystick::handleMouseDown(x, y, mask); - - if( handled ) - { - if (mFirstMouse.mY > getRect().getHeight() / 2) - { - mInitialQuadrant = JQ_UP; - } - else - { - mInitialQuadrant = JQ_DOWN; - } - } - return handled; -} - - -void LLJoystickCameraZoom::onHeldDown() -{ - updateSlop(); - - const F32 FAST_RATE = 2.5f; // two and a half times the normal rate - - S32 dy = mLastMouse.mY - mFirstMouse.mY + mInitialOffset.mY; - - if (dy > mVertSlopFar) - { - // Zoom in fast - gAgentCamera.unlockView(); - gAgentCamera.setOrbitInKey(FAST_RATE); - } - else if (dy > mVertSlopNear) - { - // Zoom in slow - gAgentCamera.unlockView(); - gAgentCamera.setOrbitInKey(getOrbitRate()); - } - else if (dy < -mVertSlopFar) - { - // Zoom out fast - gAgentCamera.unlockView(); - gAgentCamera.setOrbitOutKey(FAST_RATE); - } - else if (dy < -mVertSlopNear) - { - // Zoom out slow - gAgentCamera.unlockView(); - gAgentCamera.setOrbitOutKey(getOrbitRate()); - } -} - -// Only used for drawing -void LLJoystickCameraZoom::setToggleState( BOOL top, BOOL bottom ) -{ - mInTop = top; - mInBottom = bottom; -} - -void LLJoystickCameraZoom::draw() -{ - if( mInTop ) - { - mPlusInImage->draw(0,0); - } - else - if( mInBottom ) - { - mMinusInImage->draw(0,0); - } - else - { - getImageUnselected()->draw( 0, 0 ); - } -} - -void LLJoystickCameraZoom::updateSlop() -{ - mVertSlopNear = getRect().getHeight() / 4; - mVertSlopFar = getRect().getHeight() / 2; - - mHorizSlopNear = getRect().getWidth() / 4; - mHorizSlopFar = getRect().getWidth() / 2; - - // Compute initial mouse offset based on initial quadrant. - // Place the mouse evenly between the near and far zones. - switch (mInitialQuadrant) - { - case JQ_ORIGIN: - mInitialOffset.set(0, 0); - break; - - case JQ_UP: - mInitialOffset.mX = 0; - mInitialOffset.mY = (mVertSlopNear + mVertSlopFar) / 2; - break; - - case JQ_DOWN: - mInitialOffset.mX = 0; - mInitialOffset.mY = - (mVertSlopNear + mVertSlopFar) / 2; - break; - - case JQ_LEFT: - mInitialOffset.mX = - (mHorizSlopNear + mHorizSlopFar) / 2; - mInitialOffset.mY = 0; - break; - - case JQ_RIGHT: - mInitialOffset.mX = (mHorizSlopNear + mHorizSlopFar) / 2; - mInitialOffset.mY = 0; - break; - - default: - llerrs << "LLJoystick::LLJoystick() - bad switch case" << llendl; - break; - } - - return; -} - - -F32 LLJoystickCameraZoom::getOrbitRate() -{ - F32 time = getElapsedHeldDownTime(); - if( time < NUDGE_TIME ) - { - F32 rate = ORBIT_NUDGE_RATE + time * (1 - ORBIT_NUDGE_RATE)/ NUDGE_TIME; -// llinfos << "rate " << rate << " time " << time << llendl; - return rate; - } - else - { - return 1; - } -} diff --git a/indra/newview/lljoystickbutton.h b/indra/newview/lljoystickbutton.h index 2b071a8999..1dd30036ab 100644 --- a/indra/newview/lljoystickbutton.h +++ b/indra/newview/lljoystickbutton.h @@ -183,44 +183,4 @@ public: virtual void onHeldDown(); }; - -// Zoom the camera in and out -class LLJoystickCameraZoom -: public LLJoystick -{ -public: - struct Params - : public LLInitParam::Block<Params, LLJoystick::Params> - { - Optional<LLUIImage*> plus_image; - Optional<LLUIImage*> minus_image; - - Params() - : plus_image ("plus_image", NULL), - minus_image ("minus_image", NULL) - { - held_down_delay.seconds(0.0); - } - }; - LLJoystickCameraZoom(const Params&); - - virtual void setToggleState( BOOL top, BOOL bottom ); - - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual void onHeldDown(); - virtual void draw(); - -protected: - virtual void updateSlop(); - F32 getOrbitRate(); - -protected: - BOOL mInTop; - BOOL mInBottom; - LLUIImagePtr mPlusInImage; - LLUIImagePtr mMinusInImage; -}; - - - #endif // LL_LLJOYSTICKBUTTON_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index e51e6363dd..fff80e57dc 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -781,9 +781,6 @@ bool idle_startup() gViewerWindow->getWindow()->show(); display_startup(); - //DEV-10530. do cleanup. remove at some later date. jan-2009 - LLFloaterPreference::cleanupBadSetting(); - // DEV-16927. The following code removes errant keystrokes that happen while the window is being // first made visible. #ifdef _WIN32 diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5836aff4e7..b00fa39815 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2063,7 +2063,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // initiated by the other party) then... std::string my_name; LLAgentUI::buildFullname(my_name); - std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2"); + std::string response = gSavedPerAccountSettings.getString("BusyModeResponse"); pack_instant_message( gMessageSystem, gAgent.getID(), @@ -2736,7 +2736,7 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id) { std::string my_name; LLAgentUI::buildFullname(my_name); - std::string response = gSavedPerAccountSettings.getString("BusyModeResponse2"); + std::string response = gSavedPerAccountSettings.getString("BusyModeResponse"); pack_instant_message( gMessageSystem, gAgent.getID(), diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 83556452c0..0a65cb7330 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1591,6 +1591,9 @@ void LLViewerWindow::initBase() gDebugView->init(); gToolTipView = getRootView()->getChild<LLToolTipView>("tooltip view"); + // Initialize busy response message when logged in + LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLFloaterPreference::initBusyResponse)); + // Add the progress bar view (startup view), which overrides everything mProgressView = getRootView()->getChild<LLProgressView>("progress_view"); setShowProgress(FALSE); diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml index 1c68d59993..a69e8d29b0 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml @@ -348,7 +348,7 @@ Busy mode response: </text> <text_editor - control_name="BusyModeResponse2" + control_name="BusyModeResponse" text_readonly_color="LabelDisabledColor" bg_writeable_color="LtGray" use_ellipses="false" |