const QPainterPath& PreviewContentWidget::getTextBubble() const { const auto textBubbleEmpty = TextBubble_.isEmpty(); if (!textBubbleEmpty) { return TextBubble_; } const auto &textSize = getTextSize(); if (textSize.isEmpty()) { return TextBubble_; } const auto textBubbleSize = getTextBubbleSize(); TextBubble_ = Utils::renderMessageBubble( textBubbleSize, Ui::MessageStyle::getBorderRadius(), isOutgoing() ); assert(!TextBubble_.isEmpty()); return TextBubble_; }
QRect PreviewContentWidget::getPreviewScaledRect() const { QPoint topLeft(0, 0); if (TextControl_) { topLeft.ry() += getTextBubbleSize().height() + getTextBottomMargin(); } QRect result( QPoint(0, 0), getPreviewScaledSizeF().toSize() ); if (isOutgoing()) { result.moveTopLeft(QPoint(width() - result.width(), topLeft.y())); } else { result.moveTopLeft(topLeft); } return result; }
void MPIConnection::initialize(const std::string & fmuName) { if (!isOutgoing(fmuName)) { for (size_type i = 0; i < _numOpenConns; ++i) { // // Call recv, so the corresponding MPI_Isends aren't blocked MPI_Irecv(_buffer[i].data(), _buffer[i].dataSize(), MPI_BYTE, _plan.sourceRank, getStartTag() + i, MPI_COMM_WORLD, &_isFree[i]); } } }
void PreviewContentWidget::renderPreloaderBubble(QPainter &p) { p.save(); auto bodyBrush = ( isOutgoing() ? Ui::MessageStyle::getOutgoingBodyColorA(0.7) : Ui::MessageStyle::getIncomingBodyColorA(0.7) ); p.setBrush(bodyBrush); p.drawRoundedRect(getPreviewScaledRect(), Ui::MessageStyle::getBorderRadius(), Ui::MessageStyle::getBorderRadius()); p.restore(); }
void PreviewContentWidget::renderTextBubble(QPainter &p) { const auto &bubblePath = getTextBubble(); if (bubblePath.isEmpty()) { return; } p.save(); int theme_id = Ui::get_qt_theme_settings()->themeIdForContact(aimId_); QBrush b; p.fillPath( bubblePath, Ui::MessageStyle::getBodyBrush(isOutgoing(), isSelected(), theme_id) ); p.restore(); }
QPainterPath PreviewContentWidget::evaluateClippingPath() const { const auto pathSize = getPreviewScaledSizeF().toSize(); assert(pathSize.isValid()); auto path = Utils::renderMessageBubble(pathSize, Ui::MessageStyle::getBorderRadius(), isOutgoing()); if (isOutgoing()) { path.translate(QPoint(width() - pathSize.width(), 0)); } if (TextControl_) { path.translate( 0, getTextBubbleSize().height() + getTextBottomMargin() ); } return path; }
std::string LLFloaterMessageLogItem::getFull(BOOL show_header) { std::string full(""); if(mType == TEMPLATE) { BOOL decode_invalid = FALSE; S32 decode_len = mDataSize; std::vector<U8> DecodeBuffer(MAX_PACKET_LEN,0); memcpy(&(DecodeBuffer[0]),&(mData[0]),decode_len); U8* decodep = &(DecodeBuffer[0]); gMessageSystem->zeroCodeExpand(&decodep, &decode_len); if(decode_len < 7) decode_invalid = TRUE; else { sTemplateMessageReader->clearMessage(); if(!sTemplateMessageReader->validateMessage(decodep, decode_len, mFromHost, TRUE)) decode_invalid = TRUE; else { if(!sTemplateMessageReader->decodeData(decodep, mFromHost, TRUE)) decode_invalid = TRUE; else { LLMessageTemplate* temp = sTemplateMessageReader->mCurrentRMessageTemplate; full.append(isOutgoing() ? "out " : "in "); full.append(llformat("%s\n", temp->mName)); if(show_header) { full.append("[Header]\n"); full.append(llformat("SequenceID = %u\n", mSequenceID)); full.append(llformat("LL_ZERO_CODE_FLAG = %s\n", (mFlags & LL_ZERO_CODE_FLAG) ? "True" : "False")); full.append(llformat("LL_RELIABLE_FLAG = %s\n", (mFlags & LL_RELIABLE_FLAG) ? "True" : "False")); full.append(llformat("LL_RESENT_FLAG = %s\n", (mFlags & LL_RESENT_FLAG) ? "True" : "False")); full.append(llformat("LL_ACK_FLAG = %s\n", (mFlags & LL_ACK_FLAG) ? "True" : "False")); } LLMessageTemplate::message_block_map_t::iterator blocks_end = temp->mMemberBlocks.end(); for (LLMessageTemplate::message_block_map_t::iterator blocks_iter = temp->mMemberBlocks.begin(); blocks_iter != blocks_end; ++blocks_iter) { LLMessageBlock* block = (*blocks_iter); const char* block_name = block->mName; S32 num_blocks = sTemplateMessageReader->getNumberOfBlocks(block_name); for(S32 i = 0; i < num_blocks; i++) { full.append(llformat("[%s]\n", block->mName)); LLMessageBlock::message_variable_map_t::iterator var_end = block->mMemberVariables.end(); for (LLMessageBlock::message_variable_map_t::iterator var_iter = block->mMemberVariables.begin(); var_iter != var_end; ++var_iter) { LLMessageVariable* variable = (*var_iter); const char* var_name = variable->getName(); BOOL returned_hex; std::string value = getString(sTemplateMessageReader, block_name, i, var_name, variable->getType(), returned_hex); if(returned_hex) full.append(llformat("%s =| ", var_name)); else full.append(llformat("%s = ", var_name)); // llformat has a 1024 char limit!? full.append(value); full.append("\n"); } } } // blocks_iter } // decode_valid } } if(decode_invalid) { full = isOutgoing() ? "out" : "in"; full.append("\n"); for(S32 i = 0; i < mDataSize; i++) full.append(llformat("%02X ", mData[i])); } } else // not template { full = "FIXME"; } return full; }