Fix formatting issues

remotes/origin/0.7.0-dev
Joseph Donofry 6 years ago
parent c0a010acbb
commit 2484e0c118
No known key found for this signature in database
GPG Key ID: E8A1D78EF044B0CB
  1. 3
      src/RoomInfoListItem.cpp
  2. 3
      src/TypingDisplay.cpp
  3. 3
      src/timeline/TimelineItem.cpp
  4. 4
      src/timeline/TimelineItem.h
  5. 5
      src/timeline/widgets/AudioItem.cpp
  6. 5
      src/timeline/widgets/FileItem.cpp
  7. 5
      src/ui/DropShadow.h

@ -182,7 +182,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
QFont tsFont;
tsFont.setPointSizeF(tsFont.pointSizeF() * 0.9);
const int msgStampWidth = QFontMetrics(tsFont).horizontalAdvance(lastMsgInfo_.timestamp) + 4;
const int msgStampWidth =
QFontMetrics(tsFont).horizontalAdvance(lastMsgInfo_.timestamp) + 4;
// We use the full width of the widget if there is no unread msg bubble.
const int bottomLineWidthLimit = (unreadMsgCount_ > 0) ? msgStampWidth : 0;

@ -69,7 +69,8 @@ TypingDisplay::paintEvent(QPaintEvent *)
text_ = fm.elidedText(text_, Qt::ElideRight, (double)(width() * 0.75));
QPainterPath path;
path.addRoundedRect(QRectF(0, 0, fm.horizontalAdvance(text_) + 2 * LEFT_PADDING, height()), 3, 3);
path.addRoundedRect(
QRectF(0, 0, fm.horizontalAdvance(text_) + 2 * LEFT_PADDING, height()), 3, 3);
p.fillPath(path, backgroundColor());
p.drawText(region, Qt::AlignVCenter, text_);

@ -733,7 +733,8 @@ TimelineItem::generateUserName(const QString &user_id, const QString &displaynam
userName_->setAlignment(Qt::AlignLeft | Qt::AlignTop);
// width deprecated in 5.13:
// userName_->setFixedWidth(QFontMetrics(userName_->font()).width(userName_->text()));
userName_->setFixedWidth(QFontMetrics(userName_->font()).horizontalAdvance(userName_->text()));
userName_->setFixedWidth(
QFontMetrics(userName_->font()).horizontalAdvance(userName_->text()));
// Set the user color asynchronously if it hasn't been generated yet,
// otherwise this will just set it.

@ -352,11 +352,11 @@ TimelineItem::setupWidgetLayout(Widget *widget, const Event &event, bool withSen
{
init();
//if (event.type == mtx::events::EventType::RoomMessage) {
// if (event.type == mtx::events::EventType::RoomMessage) {
// message_type_ = mtx::events::getMessageType(event.content.msgtype);
//}
// TODO: Fix this.
message_type_ = mtx::events::MessageType::Unknown;
message_type_ = mtx::events::MessageType::Unknown;
event_id_ = QString::fromStdString(event.event_id);
const auto sender = QString::fromStdString(event.sender);

@ -162,8 +162,9 @@ AudioItem::resizeEvent(QResizeEvent *event)
font.setWeight(QFont::Medium);
QFontMetrics fm(font);
const int computedWidth = std::min(
fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding, (double)MaxWidth);
const int computedWidth =
std::min(fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding,
(double)MaxWidth);
resize(computedWidth, Height);

@ -153,8 +153,9 @@ FileItem::resizeEvent(QResizeEvent *event)
font.setWeight(QFont::Medium);
QFontMetrics fm(font);
const int computedWidth = std::min(
fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding, (double)MaxWidth);
const int computedWidth =
std::min(fm.horizontalAdvance(text_) + 2 * IconRadius + VerticalPadding * 2 + TextPadding,
(double)MaxWidth);
resize(computedWidth, Height);

@ -31,9 +31,8 @@ public:
gradient.setFinalStop(right1);
painter.setBrush(QBrush(gradient));
// Deprecated in 5.13: painter.drawRoundRect(
// QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)),
// 0.0,
// 0.0);
// QRectF(QPointF(width - margin * radius, margin), QPointF(width, height -
// margin)), 0.0, 0.0);
painter.drawRoundedRect(
QRectF(QPointF(width - margin * radius, margin), QPointF(width, height - margin)),
0.0,

Loading…
Cancel
Save