From 2484e0c11874cac06a18ab64e9e02e375d93a6dd Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Thu, 4 Jul 2019 21:31:28 -0400 Subject: [PATCH] Fix formatting issues --- src/RoomInfoListItem.cpp | 3 ++- src/TypingDisplay.cpp | 3 ++- src/timeline/TimelineItem.cpp | 3 ++- src/timeline/TimelineItem.h | 4 ++-- src/timeline/widgets/AudioItem.cpp | 5 +++-- src/timeline/widgets/FileItem.cpp | 5 +++-- src/ui/DropShadow.h | 5 ++--- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/RoomInfoListItem.cpp b/src/RoomInfoListItem.cpp index d6a4f78f..c8924bed 100644 --- a/src/RoomInfoListItem.cpp +++ b/src/RoomInfoListItem.cpp @@ -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; diff --git a/src/TypingDisplay.cpp b/src/TypingDisplay.cpp index 97aeb268..fc5e2df4 100644 --- a/src/TypingDisplay.cpp +++ b/src/TypingDisplay.cpp @@ -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_); diff --git a/src/timeline/TimelineItem.cpp b/src/timeline/TimelineItem.cpp index 80153026..2ec6bd81 100644 --- a/src/timeline/TimelineItem.cpp +++ b/src/timeline/TimelineItem.cpp @@ -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. diff --git a/src/timeline/TimelineItem.h b/src/timeline/TimelineItem.h index 4db36c07..e2b1cda4 100644 --- a/src/timeline/TimelineItem.h +++ b/src/timeline/TimelineItem.h @@ -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); diff --git a/src/timeline/widgets/AudioItem.cpp b/src/timeline/widgets/AudioItem.cpp index 8cc2ba8f..7ce9bf9a 100644 --- a/src/timeline/widgets/AudioItem.cpp +++ b/src/timeline/widgets/AudioItem.cpp @@ -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); diff --git a/src/timeline/widgets/FileItem.cpp b/src/timeline/widgets/FileItem.cpp index 903fc4b2..3ae76913 100644 --- a/src/timeline/widgets/FileItem.cpp +++ b/src/timeline/widgets/FileItem.cpp @@ -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); diff --git a/src/ui/DropShadow.h b/src/ui/DropShadow.h index d322fb42..60fc697b 100644 --- a/src/ui/DropShadow.h +++ b/src/ui/DropShadow.h @@ -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,