summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterconversationpreview.cpp
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2013-10-25 11:48:43 -0700
committerGraham Linden <graham@lindenlab.com>2013-10-25 11:48:43 -0700
commit970ee73e9a9cd1c94c295c9decb4d632886c19e6 (patch)
tree18cc7f08bbc043252bea9a6f687807116585d286 /indra/newview/llfloaterconversationpreview.cpp
parentd4e622daf2775147c75a75389ffb9b55f8cef799 (diff)
Fix release merge issues (included upstream changes not yet in release from bear)
Diffstat (limited to 'indra/newview/llfloaterconversationpreview.cpp')
-rwxr-xr-xindra/newview/llfloaterconversationpreview.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp
index 5041f4689d..4a85160f95 100755
--- a/indra/newview/llfloaterconversationpreview.cpp
+++ b/indra/newview/llfloaterconversationpreview.cpp
@@ -44,8 +44,7 @@ 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),
- mShowHistory(false)
+ mMutex(NULL)
{
}
@@ -92,11 +91,12 @@ 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,30 +111,34 @@ 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);
- mShowHistory = true;
+ mChatHistoryLoaded = true;
}
}
void LLFloaterConversationPreview::draw()
{
- if(mShowHistory)
+ if(mChatHistoryLoaded)
{
showHistory();
- mShowHistory = false;
+ mChatHistoryLoaded = false;
}
LLFloater::draw();
}
void LLFloaterConversationPreview::onOpen(const LLSD& key)
{
- mShowHistory = true;
+ if(mChatHistoryLoaded)
+ {
+ showHistory();
+ }
}
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;
}
@@ -143,7 +147,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;
@@ -194,11 +198,10 @@ void LLFloaterConversationPreview::showHistory()
void LLFloaterConversationPreview::onMoreHistoryBtnClick()
{
mCurrentPage = (int)(mPageSpinner->getValueF32());
- if (!mCurrentPage)
+ if (--mCurrentPage < 0)
{
return;
}
- mCurrentPage--;
- mShowHistory = true;
+ showHistory();
}