diff options
Diffstat (limited to 'indra/newview/llfloaterconversationpreview.cpp')
-rwxr-xr-x | indra/newview/llfloaterconversationpreview.cpp | 29 |
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; } |