summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llimfloater.cpp160
-rw-r--r--indra/newview/llimfloater.h13
-rw-r--r--indra/newview/llstartup.cpp3
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_chat.xml33
5 files changed, 149 insertions, 71 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index b0f782622c..76def8120f 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1385,6 +1385,17 @@
<key>Value</key>
<integer>1</integer>
</map>
+ <key>ChatWindow</key>
+ <map>
+ <key>Comment</key>
+ <string>Show chat in multiple windows(by default) or in one multi-tabbed window(requires restart)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>S32</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>CheesyBeacon</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 5e9ffdf410..3315d5b18d 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -44,6 +44,7 @@
#include "llchiclet.h"
#include "llfloaterchat.h"
#include "llfloaterreg.h"
+#include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container
#include "lllineeditor.h"
#include "lllogchat.h"
#include "llpanelimcontrolpanel.h"
@@ -55,10 +56,6 @@
#include "lltransientfloatermgr.h"
#include "llinventorymodel.h"
-#ifdef USE_IM_CONTAINER
- #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container
-#endif
-
LLIMFloater::LLIMFloater(const LLUUID& session_id)
@@ -263,11 +260,14 @@ BOOL LLIMFloater::postBuild()
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
//see LLFloaterIMPanel for how it is done (IB)
-#ifdef USE_IM_CONTAINER
- return LLFloater::postBuild();
-#else
- return LLDockableFloater::postBuild();
-#endif
+ if(isChatMultiTab())
+ {
+ return LLFloater::postBuild();
+ }
+ else
+ {
+ return LLDockableFloater::postBuild();
+ }
}
// virtual
@@ -328,59 +328,72 @@ void LLIMFloater::onSlide()
//static
LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
{
-#ifdef USE_IM_CONTAINER
- LLIMFloater* target_floater = findInstance(session_id);
- bool not_existed = NULL == target_floater;
+ bool not_existed = true;
-#else
- //hide all
- LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
- for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
- iter != inst_list.end(); ++iter)
+ if(isChatMultiTab())
{
- LLIMFloater* floater = dynamic_cast<LLIMFloater*>(*iter);
- if (floater && floater->isDocked())
+ LLIMFloater* target_floater = findInstance(session_id);
+ not_existed = NULL == target_floater;
+ }
+ else
+ {
+ //hide all
+ LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
+ for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
+ iter != inst_list.end(); ++iter)
{
- floater->setVisible(false);
+ LLIMFloater* floater = dynamic_cast<LLIMFloater*>(*iter);
+ if (floater && floater->isDocked())
+ {
+ floater->setVisible(false);
+ }
}
}
-#endif
LLIMFloater* floater = LLFloaterReg::showTypedInstance<LLIMFloater>("impanel", session_id);
floater->updateMessages();
floater->mInputEditor->setFocus(TRUE);
-#ifdef USE_IM_CONTAINER
- // do not add existed floaters to avoid adding torn off instances
- if (not_existed)
+ if(isChatMultiTab())
{
- // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
- // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists
- LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
+ // do not add existed floaters to avoid adding torn off instances
+ if (not_existed)
+ {
+ // LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
+ // TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists
+ LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
- LLIMFloaterContainer* floater_container = LLFloaterReg::showTypedInstance<LLIMFloaterContainer>("im_container");
- floater_container->addFloater(floater, TRUE, i_pt);
+ LLIMFloaterContainer* floater_container = LLFloaterReg::showTypedInstance<LLIMFloaterContainer>("im_container");
+ floater_container->addFloater(floater, TRUE, i_pt);
+ }
}
-#else
- if (floater->getDockControl() == NULL)
+ else
{
- LLChiclet* chiclet =
- LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLChiclet>(
- session_id);
- if (chiclet == NULL)
- {
- llerror("Dock chiclet for LLIMFloater doesn't exists", 0);
- }
- else
+ // Docking may move chat window, hide it before moving, or user will see how window "jumps"
+ floater->setVisible(false);
+
+ if (floater->getDockControl() == NULL)
{
- LLBottomTray::getInstance()->getChicletPanel()->scrollToChiclet(chiclet);
+ LLChiclet* chiclet =
+ LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLChiclet>(
+ session_id);
+ if (chiclet == NULL)
+ {
+ llerror("Dock chiclet for LLIMFloater doesn't exists", 0);
+ }
+ else
+ {
+ LLBottomTray::getInstance()->getChicletPanel()->scrollToChiclet(chiclet);
+ }
+
+ floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(),
+ LLDockControl::TOP, boost::bind(&LLIMFloater::getAllowedRect, floater, _1)));
}
- floater->setDockControl(new LLDockControl(chiclet, floater, floater->getDockTongue(),
- LLDockControl::TOP, boost::bind(&LLIMFloater::getAllowedRect, floater, _1)));
+ // window is positioned, now we can show it.
+ floater->setVisible(true);
}
-#endif
return floater;
}
@@ -397,9 +410,10 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock)
(LLNotificationsUI::LLChannelManager::getInstance()->
findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
-#ifndef USE_IM_CONTAINER
- LLTransientDockableFloater::setDocked(docked, pop_on_undock);
-#endif
+ if(!isChatMultiTab())
+ {
+ LLTransientDockableFloater::setDocked(docked, pop_on_undock);
+ }
// update notification channel state
if(channel)
@@ -425,28 +439,27 @@ void LLIMFloater::setVisible(BOOL visible)
//static
bool LLIMFloater::toggle(const LLUUID& session_id)
{
-#ifndef USE_IM_CONTAINER
- LLIMFloater* floater = LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id);
- if (floater && floater->getVisible() && floater->isDocked())
+ if(!isChatMultiTab())
{
- // clicking on chiclet to close floater just hides it to maintain existing
- // scroll/text entry state
- floater->setVisible(false);
- return false;
- }
- else if(floater && !floater->isDocked())
- {
- floater->setVisible(TRUE);
- floater->setFocus(TRUE);
- return true;
- }
- else
-#endif
- {
- // ensure the list of messages is updated when floater is made visible
- show(session_id);
- return true;
+ LLIMFloater* floater = LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id);
+ if (floater && floater->getVisible() && floater->isDocked())
+ {
+ // clicking on chiclet to close floater just hides it to maintain existing
+ // scroll/text entry state
+ floater->setVisible(false);
+ return false;
+ }
+ else if(floater && !floater->isDocked())
+ {
+ floater->setVisible(TRUE);
+ floater->setFocus(TRUE);
+ return true;
+ }
}
+
+ // ensure the list of messages is updated when floater is made visible
+ show(session_id);
+ return true;
}
//static
@@ -892,3 +905,18 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info)
}
}
+// static
+bool LLIMFloater::isChatMultiTab()
+{
+ // Restart is required in order to change chat window type.
+ static bool is_single_window = gSavedSettings.getS32("ChatWindow") == 1;
+ return is_single_window;
+}
+
+// static
+void LLIMFloater::initIMFloater()
+{
+ // This is called on viewer start up
+ // init chat window type before user changed it in preferences
+ isChatMultiTab();
+}
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 9e1330ff49..2c762c4d9a 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -33,11 +33,6 @@
#ifndef LL_IMFLOATER_H
#define LL_IMFLOATER_H
-// This variable is used to show floaters related to chiclets in a Multi Floater Container
-// So, this functionality does not require to have IM Floaters as Dockable & Transient
-// See EXT-2640.
-#define USE_IM_CONTAINER
-
#include "lltransientdockablefloater.h"
#include "lllogchat.h"
#include "lltooldraganddrop.h"
@@ -105,6 +100,14 @@ public:
void *cargo_data, EAcceptance *accept,
std::string& tooltip_msg);
+ /**
+ * Returns true if chat is displayed in multi tabbed floater
+ * false if chat is displayed in multiple windows
+ */
+ static bool isChatMultiTab();
+
+ static void initIMFloater();
+
private:
// process focus events to set a currently active session
/* virtual */ void onFocusLost();
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index db8bda008e..7f68c2e8f4 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -59,6 +59,7 @@
#include "llfloaterreg.h"
#include "llfocusmgr.h"
#include "llhttpsender.h"
+#include "llimfloater.h"
#include "lllocationhistory.h"
#include "llimageworker.h"
#include "llloginflags.h"
@@ -2085,6 +2086,8 @@ bool idle_startup()
LLAgentPicksInfo::getInstance()->requestNumberOfPicks();
+ LLIMFloater::initIMFloater();
+
return TRUE;
}
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
index fac0d5c60f..3aa5d3fae4 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
@@ -318,4 +318,37 @@
name="plain_text_chat_history"
top_pad="5"
width="400" />
+ <text
+ left="30"
+ height="20"
+ width="300"
+ top_pad="20">
+ Show IMs in:
+ </text>
+ <radio_group
+ height="30"
+ layout="topleft"
+ left="30"
+ control_name="ChatWindow"
+ name="chat_window"
+ top_pad="10"
+ tool_tip="Show chat in multiple windows(by default) or in one multi-tabbed window (requires restart)"
+ width="331">
+ <radio_item
+ height="16"
+ label="Multiple windows"
+ layout="topleft"
+ left="0"
+ name="radio"
+ top="0"
+ width="150" />
+ <radio_item
+ height="16"
+ label="One window"
+ layout="topleft"
+ left_delta="145"
+ name="radio2"
+ top_delta="0"
+ width="150" />
+ </radio_group>
</panel>