summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterconversationpreview.cpp
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2013-11-19 16:56:17 -0500
committerJonathan Yap <none@none>2013-11-19 16:56:17 -0500
commit410a084f9a2e030efda635f5a51280b599ab7f78 (patch)
tree2c2f095cee8cf0b233d59eee2c8d99ad68c44c70 /indra/newview/llfloaterconversationpreview.cpp
parentdad992ea31b6b823c316400e61d50d1aa9e52330 (diff)
parentfcc885d4fc5ef63dad33e89a9324edc39d466d37 (diff)
STORM-1980 Merge changes Oz made (new way of detecting an agent has changed regions)
Modify code to make use of the changed callback
Diffstat (limited to 'indra/newview/llfloaterconversationpreview.cpp')
-rwxr-xr-xindra/newview/llfloaterconversationpreview.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp
index 4a85160f95..5041f4689d 100755
--- a/indra/newview/llfloaterconversationpreview.cpp
+++ b/indra/newview/llfloaterconversationpreview.cpp
@@ -44,7 +44,8 @@ LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_i
mPageSize(gSavedSettings.getS32("ConversationHistoryPageSize")),
mAccountName(session_id[LL_FCP_ACCOUNT_NAME]),
mCompleteName(session_id[LL_FCP_COMPLETE_NAME]),
- mMutex(NULL)
+ mMutex(NULL),
+ mShowHistory(false)
{
}
@@ -91,12 +92,11 @@ BOOL LLFloaterConversationPreview::postBuild()
mPageSpinner->setMinValue(1);
mPageSpinner->set(1);
mPageSpinner->setEnabled(false);
- mChatHistoryLoaded = false;
LLLogChat::startChatHistoryThread(file, load_params);
return LLFloater::postBuild();
}
-void LLFloaterConversationPreview::setPages(std::list<LLSD>& messages,const std::string& file_name)
+void LLFloaterConversationPreview::setPages(std::list<LLSD>& messages, const std::string& file_name)
{
if(file_name == mChatHistoryFileName)
{
@@ -111,34 +111,30 @@ void LLFloaterConversationPreview::setPages(std::list<LLSD>& messages,const std:
std::string total_page_num = llformat("/ %d", mCurrentPage+1);
getChild<LLTextBox>("page_num_label")->setValue(total_page_num);
- mChatHistoryLoaded = true;
+ mShowHistory = true;
}
}
void LLFloaterConversationPreview::draw()
{
- if(mChatHistoryLoaded)
+ if(mShowHistory)
{
showHistory();
- mChatHistoryLoaded = false;
+ mShowHistory = false;
}
LLFloater::draw();
}
void LLFloaterConversationPreview::onOpen(const LLSD& key)
{
- if(mChatHistoryLoaded)
- {
- showHistory();
- }
+ mShowHistory = true;
}
void LLFloaterConversationPreview::showHistory()
{
- // additional protection to avoid changes of mMessages in setPages()
+ // additional protection to avoid changes of mMessages in setPages
LLMutexLock lock(&mMutex);
-
- if (!mMessages.size() || mCurrentPage * mPageSize >= mMessages.size())
+ if(!mMessages.size() || mCurrentPage * mPageSize >= mMessages.size())
{
return;
}
@@ -147,7 +143,7 @@ void LLFloaterConversationPreview::showHistory()
std::ostringstream message;
std::list<LLSD>::const_iterator iter = mMessages.begin();
std::advance(iter, mCurrentPage * mPageSize);
-
+
for (int msg_num = 0; iter != mMessages.end() && msg_num < mPageSize; ++iter, ++msg_num)
{
LLSD msg = *iter;
@@ -198,10 +194,11 @@ void LLFloaterConversationPreview::showHistory()
void LLFloaterConversationPreview::onMoreHistoryBtnClick()
{
mCurrentPage = (int)(mPageSpinner->getValueF32());
- if (--mCurrentPage < 0)
+ if (!mCurrentPage)
{
return;
}
- showHistory();
+ mCurrentPage--;
+ mShowHistory = true;
}