Remove pixel value from fonts
This commit is contained in:
parent
d1e08e0008
commit
9038c950ae
@ -84,7 +84,7 @@ CommunitiesListItem::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
if (avatar_.isNull()) {
|
if (avatar_.isNull()) {
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(conf::roomlist::fonts::communityBubble);
|
font.setPointSizeF(font.pointSizeF() * 1.3);
|
||||||
p.setFont(font);
|
p.setFont(font);
|
||||||
|
|
||||||
p.drawLetterAvatar(utils::firstChar(resolveName()),
|
p.drawLetterAvatar(utils::firstChar(resolveName()),
|
||||||
@ -142,4 +142,4 @@ CommunitiesListItem::updateTooltip()
|
|||||||
QString name = resolveName();
|
QString name = resolveName();
|
||||||
setToolTip(name + tr(" (community)"));
|
setToolTip(name + tr(" (community)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,6 @@ LoginPage::LoginPage(QWidget *parent)
|
|||||||
button_layout_->addStretch(1);
|
button_layout_->addStretch(1);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(conf::fontSize);
|
|
||||||
|
|
||||||
error_label_ = new QLabel(this);
|
error_label_ = new QLabel(this);
|
||||||
error_label_->setFont(font);
|
error_label_->setFont(font);
|
||||||
|
@ -58,8 +58,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
|
|
||||||
restoreWindowSize();
|
restoreWindowSize();
|
||||||
|
|
||||||
QFont font("Open Sans");
|
QFont font;
|
||||||
font.setPixelSize(conf::fontSize);
|
|
||||||
font.setStyleStrategy(QFont::PreferAntialias);
|
font.setStyleStrategy(QFont::PreferAntialias);
|
||||||
setFont(font);
|
setFont(font);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
|
|||||||
setMaximumWidth(450);
|
setMaximumWidth(450);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(20);
|
font.setPointSizeF(font.pointSizeF() * 1.5);
|
||||||
|
|
||||||
roomSearch_ = new RoomSearchInput(this);
|
roomSearch_ = new RoomSearchInput(this);
|
||||||
roomSearch_->setFont(font);
|
roomSearch_->setFont(font);
|
||||||
|
@ -97,7 +97,6 @@ RegisterPage::RegisterPage(QWidget *parent)
|
|||||||
button_layout_->setMargin(0);
|
button_layout_->setMargin(0);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(conf::fontSize);
|
|
||||||
|
|
||||||
error_label_ = new QLabel(this);
|
error_label_ = new QLabel(this);
|
||||||
error_label_->setFont(font);
|
error_label_->setFont(font);
|
||||||
|
@ -56,23 +56,19 @@ RoomInfoListItem::init(QWidget *parent)
|
|||||||
ripple_overlay_->setClipPath(path);
|
ripple_overlay_->setClipPath(path);
|
||||||
ripple_overlay_->setClipping(true);
|
ripple_overlay_->setClipping(true);
|
||||||
|
|
||||||
font_.setPixelSize(conf::fontSize - 1);
|
|
||||||
|
|
||||||
usernameFont_ = font_;
|
usernameFont_ = font_;
|
||||||
|
bubbleFont_ = font_;
|
||||||
|
bubbleFont_.setPointSizeF(font_.pointSizeF() * 1.3);
|
||||||
|
|
||||||
bubbleFont_ = font_;
|
unreadCountFont_.setPointSizeF(font_.pointSizeF() * 0.8);
|
||||||
bubbleFont_.setPixelSize(conf::roomlist::fonts::bubble);
|
|
||||||
|
|
||||||
unreadCountFont_.setPixelSize(conf::roomlist::fonts::badge);
|
|
||||||
unreadCountFont_.setBold(true);
|
unreadCountFont_.setBold(true);
|
||||||
|
|
||||||
bubbleDiameter_ = QFontMetrics(unreadCountFont_).averageCharWidth() * 3;
|
bubbleDiameter_ = QFontMetrics(unreadCountFont_).averageCharWidth() * 3;
|
||||||
|
|
||||||
timestampFont_ = font_;
|
timestampFont_ = font_;
|
||||||
timestampFont_.setPixelSize(conf::roomlist::fonts::timestamp);
|
|
||||||
timestampFont_.setBold(false);
|
timestampFont_.setBold(false);
|
||||||
|
|
||||||
headingFont_ = font_;
|
headingFont_ = font_;
|
||||||
headingFont_.setPixelSize(conf::roomlist::fonts::heading);
|
|
||||||
headingFont_.setWeight(60);
|
headingFont_.setWeight(60);
|
||||||
|
|
||||||
menu_ = new Menu(this);
|
menu_ = new Menu(this);
|
||||||
|
@ -42,9 +42,6 @@ UserItem::UserItem(QWidget *parent, const QString &user_id)
|
|||||||
: PopupItem(parent)
|
: PopupItem(parent)
|
||||||
, userId_{user_id}
|
, userId_{user_id}
|
||||||
{
|
{
|
||||||
QFont font;
|
|
||||||
font.setPixelSize(conf::popup::font);
|
|
||||||
|
|
||||||
auto displayName = Cache::displayName(ChatPage::instance()->currentRoom(), userId_);
|
auto displayName = Cache::displayName(ChatPage::instance()->currentRoom(), userId_);
|
||||||
|
|
||||||
avatar_->setSize(conf::popup::avatar);
|
avatar_->setSize(conf::popup::avatar);
|
||||||
@ -55,7 +52,6 @@ UserItem::UserItem(QWidget *parent, const QString &user_id)
|
|||||||
avatar_->setLetter(QChar(displayName.at(1)));
|
avatar_->setLetter(QChar(displayName.at(1)));
|
||||||
|
|
||||||
userName_ = new QLabel(displayName, this);
|
userName_ = new QLabel(displayName, this);
|
||||||
userName_->setFont(font);
|
|
||||||
|
|
||||||
topLayout_->addWidget(avatar_);
|
topLayout_->addWidget(avatar_);
|
||||||
topLayout_->addWidget(userName_, 1);
|
topLayout_->addWidget(userName_, 1);
|
||||||
|
@ -32,7 +32,7 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, buttonSize_{32}
|
, buttonSize_{32}
|
||||||
{
|
{
|
||||||
setFixedHeight(60);
|
setFixedHeight(56);
|
||||||
|
|
||||||
topLayout_ = new QHBoxLayout(this);
|
topLayout_ = new QHBoxLayout(this);
|
||||||
topLayout_->setSpacing(8);
|
topLayout_->setSpacing(8);
|
||||||
@ -46,15 +46,15 @@ TopRoomBar::TopRoomBar(QWidget *parent)
|
|||||||
textLayout_->setSpacing(0);
|
textLayout_->setSpacing(0);
|
||||||
textLayout_->setContentsMargins(0, 0, 0, 0);
|
textLayout_->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
QFont roomFont("Open Sans SemiBold");
|
QFont roomFont;
|
||||||
roomFont.setPixelSize(conf::topRoomBar::fonts::roomName);
|
roomFont.setPointSizeF(roomFont.pointSizeF() * 1.2);
|
||||||
|
roomFont.setWeight(QFont::Medium);
|
||||||
|
|
||||||
nameLabel_ = new QLabel(this);
|
nameLabel_ = new QLabel(this);
|
||||||
nameLabel_->setFont(roomFont);
|
nameLabel_->setFont(roomFont);
|
||||||
nameLabel_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
nameLabel_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||||
|
|
||||||
QFont descriptionFont("Open Sans");
|
QFont descriptionFont;
|
||||||
descriptionFont.setPixelSize(conf::topRoomBar::fonts::roomDescription);
|
|
||||||
|
|
||||||
topicLabel_ = new TextLabel(this);
|
topicLabel_ = new TextLabel(this);
|
||||||
topicLabel_->setLineWrapMode(QTextEdit::NoWrap);
|
topicLabel_->setLineWrapMode(QTextEdit::NoWrap);
|
||||||
|
@ -15,7 +15,6 @@ TypingDisplay::TypingDisplay(QWidget *parent)
|
|||||||
, offset_{conf::textInput::height}
|
, offset_{conf::textInput::height}
|
||||||
{
|
{
|
||||||
QFont f;
|
QFont f;
|
||||||
f.setPixelSize(conf::typingNotificationFontSize);
|
|
||||||
setFont(f);
|
setFont(f);
|
||||||
|
|
||||||
setFixedHeight(QFontMetrics(font()).height() + RECT_PADDING);
|
setFixedHeight(QFontMetrics(font()).height() + RECT_PADDING);
|
||||||
|
@ -30,7 +30,7 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
|||||||
, user_id_("@user:homeserver.org")
|
, user_id_("@user:homeserver.org")
|
||||||
, logoutButtonSize_{20}
|
, logoutButtonSize_{20}
|
||||||
{
|
{
|
||||||
setFixedHeight(60);
|
setFixedHeight(56);
|
||||||
|
|
||||||
topLayout_ = new QHBoxLayout(this);
|
topLayout_ = new QHBoxLayout(this);
|
||||||
topLayout_->setSpacing(0);
|
topLayout_->setSpacing(0);
|
||||||
@ -38,28 +38,25 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
|||||||
|
|
||||||
avatarLayout_ = new QHBoxLayout();
|
avatarLayout_ = new QHBoxLayout();
|
||||||
textLayout_ = new QVBoxLayout();
|
textLayout_ = new QVBoxLayout();
|
||||||
|
textLayout_->setSpacing(2);
|
||||||
|
textLayout_->setContentsMargins(10, 5, 10, 5);
|
||||||
|
|
||||||
userAvatar_ = new Avatar(this);
|
userAvatar_ = new Avatar(this);
|
||||||
userAvatar_->setObjectName("userAvatar");
|
userAvatar_->setObjectName("userAvatar");
|
||||||
userAvatar_->setLetter(QChar('?'));
|
userAvatar_->setLetter(QChar('?'));
|
||||||
userAvatar_->setSize(45);
|
userAvatar_->setSize(45);
|
||||||
|
|
||||||
QFont nameFont("Open Sans SemiBold");
|
QFont nameFont;
|
||||||
nameFont.setPixelSize(conf::userInfoWidget::fonts::displayName);
|
nameFont.setPointSizeF(nameFont.pointSizeF() * 1.2);
|
||||||
|
nameFont.setWeight(QFont::Medium);
|
||||||
|
|
||||||
displayNameLabel_ = new QLabel(this);
|
displayNameLabel_ = new QLabel(this);
|
||||||
displayNameLabel_->setFont(nameFont);
|
displayNameLabel_->setFont(nameFont);
|
||||||
displayNameLabel_->setObjectName("displayNameLabel");
|
displayNameLabel_->setObjectName("displayNameLabel");
|
||||||
displayNameLabel_->setStyleSheet("padding: 0 9px; margin-bottom: -10px;");
|
|
||||||
displayNameLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
|
displayNameLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
|
||||||
|
|
||||||
QFont useridFont("Open Sans");
|
|
||||||
useridFont.setPixelSize(conf::userInfoWidget::fonts::userid);
|
|
||||||
|
|
||||||
userIdLabel_ = new QLabel(this);
|
userIdLabel_ = new QLabel(this);
|
||||||
userIdLabel_->setFont(useridFont);
|
|
||||||
userIdLabel_->setObjectName("userIdLabel");
|
userIdLabel_->setObjectName("userIdLabel");
|
||||||
userIdLabel_->setStyleSheet("padding: 0 8px 8px 8px;");
|
|
||||||
userIdLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
userIdLabel_->setAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
avatarLayout_->addWidget(userAvatar_);
|
avatarLayout_->addWidget(userAvatar_);
|
||||||
|
@ -282,7 +282,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
|||||||
encryptionLayout_->addWidget(new HorizontalLine{this});
|
encryptionLayout_->addWidget(new HorizontalLine{this});
|
||||||
encryptionLayout_->addLayout(sessionKeysLayout);
|
encryptionLayout_->addLayout(sessionKeysLayout);
|
||||||
|
|
||||||
font.setWeight(65);
|
font.setWeight(QFont::Medium);
|
||||||
|
|
||||||
auto encryptionLabel_ = new QLabel(tr("ENCRYPTION"), this);
|
auto encryptionLabel_ = new QLabel(tr("ENCRYPTION"), this);
|
||||||
encryptionLabel_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
encryptionLabel_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||||
|
@ -19,12 +19,12 @@ CreateRoom::CreateRoom(QWidget *parent)
|
|||||||
setWindowModality(Qt::WindowModal);
|
setWindowModality(Qt::WindowModal);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont largeFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
largeFont.setPointSizeF(largeFont.pointSizeF() * 1.5);
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
setMinimumHeight(conf::modals::MIN_WIDGET_HEIGHT);
|
setMinimumHeight(conf::modals::MIN_WIDGET_HEIGHT);
|
||||||
setMinimumWidth(QFontMetrics(doubleFont).averageCharWidth() * 30 -
|
setMinimumWidth(QFontMetrics(largeFont).averageCharWidth() * 30 -
|
||||||
2 * conf::modals::WIDGET_MARGIN);
|
2 * conf::modals::WIDGET_MARGIN);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
@ -43,7 +43,7 @@ CreateRoom::CreateRoom(QWidget *parent)
|
|||||||
buttonLayout->addWidget(confirmBtn_);
|
buttonLayout->addWidget(confirmBtn_);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(conf::headerFontSize);
|
font.setPointSizeF(font.pointSizeF() * 1.3);
|
||||||
|
|
||||||
nameInput_ = new TextField(this);
|
nameInput_ = new TextField(this);
|
||||||
nameInput_->setLabel(tr("Name"));
|
nameInput_->setLabel(tr("Name"));
|
||||||
|
@ -81,13 +81,13 @@ MemberList::MemberList(const QString &room_id, QWidget *parent)
|
|||||||
list_->setSelectionMode(QAbstractItemView::NoSelection);
|
list_->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
list_->setSpacing(5);
|
list_->setSpacing(5);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont largeFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
largeFont.setPointSizeF(largeFont.pointSizeF() * 1.5);
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
setMinimumHeight(list_->sizeHint().height() * 2);
|
setMinimumHeight(list_->sizeHint().height() * 2);
|
||||||
setMinimumWidth(std::max(list_->sizeHint().width() + 4 * conf::modals::WIDGET_MARGIN,
|
setMinimumWidth(std::max(list_->sizeHint().width() + 4 * conf::modals::WIDGET_MARGIN,
|
||||||
QFontMetrics(doubleFont).averageCharWidth() * 30 -
|
QFontMetrics(largeFont).averageCharWidth() * 30 -
|
||||||
2 * conf::modals::WIDGET_MARGIN));
|
2 * conf::modals::WIDGET_MARGIN));
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
|
@ -104,13 +104,13 @@ ReadReceipts::ReadReceipts(QWidget *parent)
|
|||||||
userList_->setSelectionMode(QAbstractItemView::NoSelection);
|
userList_->setSelectionMode(QAbstractItemView::NoSelection);
|
||||||
userList_->setSpacing(conf::modals::TEXT_SPACING);
|
userList_->setSpacing(conf::modals::TEXT_SPACING);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont largeFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
largeFont.setPointSizeF(largeFont.pointSizeF() * 1.5);
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
setMinimumHeight(userList_->sizeHint().height() * 2);
|
setMinimumHeight(userList_->sizeHint().height() * 2);
|
||||||
setMinimumWidth(std::max(userList_->sizeHint().width() + 4 * conf::modals::WIDGET_MARGIN,
|
setMinimumWidth(std::max(userList_->sizeHint().width() + 4 * conf::modals::WIDGET_MARGIN,
|
||||||
QFontMetrics(doubleFont).averageCharWidth() * 30 -
|
QFontMetrics(largeFont).averageCharWidth() * 30 -
|
||||||
2 * conf::modals::WIDGET_MARGIN));
|
2 * conf::modals::WIDGET_MARGIN));
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
|
@ -48,9 +48,9 @@ EditModal::EditModal(const QString &roomId, QWidget *parent)
|
|||||||
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
setWindowModality(Qt::WindowModal);
|
setWindowModality(Qt::WindowModal);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont largeFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
largeFont.setPointSizeF(largeFont.pointSizeF() * 1.4);
|
||||||
setMinimumWidth(QFontMetrics(doubleFont).averageCharWidth() * 30 - 2 * WIDGET_MARGIN);
|
setMinimumWidth(QFontMetrics(largeFont).averageCharWidth() * 30 - 2 * WIDGET_MARGIN);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
@ -169,10 +169,10 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
|
|||||||
setWindowModality(Qt::WindowModal);
|
setWindowModality(Qt::WindowModal);
|
||||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont largeFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
largeFont.setPointSizeF(largeFont.pointSizeF() * 1.5);
|
||||||
|
|
||||||
setMinimumWidth(QFontMetrics(doubleFont).averageCharWidth() * 30 - 2 * WIDGET_MARGIN);
|
setMinimumWidth(QFontMetrics(largeFont).averageCharWidth() * 30 - 2 * WIDGET_MARGIN);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
@ -180,7 +180,7 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
|
|||||||
layout->setContentsMargins(WIDGET_MARGIN, TOP_WIDGET_MARGIN, WIDGET_MARGIN, WIDGET_MARGIN);
|
layout->setContentsMargins(WIDGET_MARGIN, TOP_WIDGET_MARGIN, WIDGET_MARGIN, WIDGET_MARGIN);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setWeight(65);
|
font.setWeight(QFont::Medium);
|
||||||
font.setPointSizeF(font.pointSizeF() * 1.2);
|
font.setPointSizeF(font.pointSizeF() * 1.2);
|
||||||
auto settingsLabel = new QLabel(tr("Settings").toUpper(), this);
|
auto settingsLabel = new QLabel(tr("Settings").toUpper(), this);
|
||||||
settingsLabel->setFont(font);
|
settingsLabel->setFont(font);
|
||||||
@ -356,7 +356,7 @@ RoomSettings::RoomSettings(const QString &room_id, QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
roomNameLabel_ = new QLabel(QString::fromStdString(info_.name), this);
|
roomNameLabel_ = new QLabel(QString::fromStdString(info_.name), this);
|
||||||
roomNameLabel_->setFont(doubleFont);
|
roomNameLabel_->setFont(largeFont);
|
||||||
|
|
||||||
auto membersLabel = new QLabel(tr("%n member(s)", "", info_.member_count), this);
|
auto membersLabel = new QLabel(tr("%n member(s)", "", info_.member_count), this);
|
||||||
|
|
||||||
|
@ -171,12 +171,12 @@ UserProfile::UserProfile(QWidget *parent)
|
|||||||
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||||
setWindowModality(Qt::WindowModal);
|
setWindowModality(Qt::WindowModal);
|
||||||
|
|
||||||
QFont doubleFont;
|
QFont largeFont;
|
||||||
doubleFont.setPointSizeF(doubleFont.pointSizeF() * 2);
|
largeFont.setPointSizeF(largeFont.pointSizeF() * 1.5);
|
||||||
|
|
||||||
setMinimumWidth(
|
setMinimumWidth(
|
||||||
std::max(devices_->sizeHint().width() + 4 * WIDGET_MARGIN,
|
std::max(devices_->sizeHint().width() + 4 * WIDGET_MARGIN,
|
||||||
QFontMetrics(doubleFont).averageCharWidth() * 30 - 2 * WIDGET_MARGIN));
|
QFontMetrics(largeFont).averageCharWidth() * 30 - 2 * WIDGET_MARGIN));
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
vlayout->setSpacing(WIDGET_SPACING);
|
vlayout->setSpacing(WIDGET_SPACING);
|
||||||
|
@ -67,8 +67,8 @@ Category::Category(QString category, std::vector<Emoji> emoji, QWidget *parent)
|
|||||||
itemModel_->appendRow(item);
|
itemModel_->appendRow(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont font("Open Sans SemiBold");
|
QFont font;
|
||||||
font.setPixelSize(conf::fontSize);
|
font.setWeight(QFont::Medium);
|
||||||
|
|
||||||
category_ = new QLabel(category, this);
|
category_ = new QLabel(category, this);
|
||||||
category_->setFont(font);
|
category_->setFont(font);
|
||||||
|
@ -42,7 +42,6 @@ ItemDelegate::paint(QPainter *painter,
|
|||||||
auto emoji = index.data(Qt::UserRole).toString();
|
auto emoji = index.data(Qt::UserRole).toString();
|
||||||
|
|
||||||
QFont font("Emoji One");
|
QFont font("Emoji One");
|
||||||
font.setPixelSize(19);
|
|
||||||
|
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
painter->drawText(viewOption.rect, Qt::AlignCenter, emoji);
|
painter->drawText(viewOption.rect, Qt::AlignCenter, emoji);
|
||||||
|
@ -155,9 +155,8 @@ TimelineItem::init()
|
|||||||
userName_ = nullptr;
|
userName_ = nullptr;
|
||||||
body_ = nullptr;
|
body_ = nullptr;
|
||||||
|
|
||||||
font_.setPixelSize(conf::fontSize);
|
|
||||||
usernameFont_ = font_;
|
usernameFont_ = font_;
|
||||||
usernameFont_.setWeight(60);
|
usernameFont_.setWeight(QFont::Medium);
|
||||||
|
|
||||||
QFontMetrics fm(font_);
|
QFontMetrics fm(font_);
|
||||||
|
|
||||||
@ -216,9 +215,11 @@ TimelineItem::init()
|
|||||||
mainLayout_->setContentsMargins(conf::timeline::headerLeftMargin, 0, 0, 0);
|
mainLayout_->setContentsMargins(conf::timeline::headerLeftMargin, 0, 0, 0);
|
||||||
mainLayout_->setSpacing(0);
|
mainLayout_->setSpacing(0);
|
||||||
|
|
||||||
QFont timestampFont;
|
timestampFont_.setPointSizeF(timestampFont_.pointSizeF() * 0.9);
|
||||||
timestampFont.setPixelSize(conf::timeline::fonts::indicator);
|
timestampFont_.setFamily("Monospace");
|
||||||
QFontMetrics tsFm(timestampFont);
|
timestampFont_.setStyleHint(QFont::Monospace);
|
||||||
|
|
||||||
|
QFontMetrics tsFm(timestampFont_);
|
||||||
|
|
||||||
statusIndicator_ = new StatusIndicator(this);
|
statusIndicator_ = new StatusIndicator(this);
|
||||||
statusIndicator_->setFixedWidth(tsFm.height() - tsFm.leading());
|
statusIndicator_->setFixedWidth(tsFm.height() - tsFm.leading());
|
||||||
@ -662,13 +663,8 @@ TimelineItem::generateUserName(const QString &user_id, const QString &displaynam
|
|||||||
void
|
void
|
||||||
TimelineItem::generateTimestamp(const QDateTime &time)
|
TimelineItem::generateTimestamp(const QDateTime &time)
|
||||||
{
|
{
|
||||||
QFont timestampFont;
|
|
||||||
timestampFont.setFamily("Monospace");
|
|
||||||
timestampFont.setStyleHint(QFont::Monospace);
|
|
||||||
timestampFont.setPixelSize(conf::timeline::fonts::timestamp);
|
|
||||||
|
|
||||||
timestamp_ = new QLabel(this);
|
timestamp_ = new QLabel(this);
|
||||||
timestamp_->setFont(timestampFont);
|
timestamp_->setFont(timestampFont_);
|
||||||
timestamp_->setText(
|
timestamp_->setText(
|
||||||
QString("<span style=\"color: #999\"> %1 </span>").arg(time.toString("HH:mm")));
|
QString("<span style=\"color: #999\"> %1 </span>").arg(time.toString("HH:mm")));
|
||||||
}
|
}
|
||||||
@ -683,9 +679,7 @@ TimelineItem::replaceEmoji(const QString &body)
|
|||||||
for (auto &code : utf32_string) {
|
for (auto &code : utf32_string) {
|
||||||
// TODO: Be more precise here.
|
// TODO: Be more precise here.
|
||||||
if (code > 9000)
|
if (code > 9000)
|
||||||
fmtBody += QString("<span style=\"font-family: Emoji "
|
fmtBody += QString("<span style=\"font-family: Emoji One;\">") +
|
||||||
"One; font-size: %1px\">")
|
|
||||||
.arg(conf::emojiSize) +
|
|
||||||
QString::fromUcs4(&code, 1) + "</span>";
|
QString::fromUcs4(&code, 1) + "</span>";
|
||||||
else
|
else
|
||||||
fmtBody += QString::fromUcs4(&code, 1);
|
fmtBody += QString::fromUcs4(&code, 1);
|
||||||
|
@ -278,6 +278,7 @@ private:
|
|||||||
|
|
||||||
QFont font_;
|
QFont font_;
|
||||||
QFont usernameFont_;
|
QFont usernameFont_;
|
||||||
|
QFont timestampFont_;
|
||||||
|
|
||||||
StatusIndicator *statusIndicator_;
|
StatusIndicator *statusIndicator_;
|
||||||
|
|
||||||
|
@ -519,7 +519,6 @@ TimelineView::init()
|
|||||||
|
|
||||||
// Height of the typing display.
|
// Height of the typing display.
|
||||||
QFont f;
|
QFont f;
|
||||||
f.setPixelSize(conf::typingNotificationFontSize);
|
|
||||||
const int bottomMargin = QFontMetrics(f).height() + 6;
|
const int bottomMargin = QFontMetrics(f).height() + 6;
|
||||||
|
|
||||||
scroll_layout_ = new QVBoxLayout(scroll_widget_);
|
scroll_layout_ = new QVBoxLayout(scroll_widget_);
|
||||||
|
@ -159,8 +159,7 @@ void
|
|||||||
AudioItem::resizeEvent(QResizeEvent *event)
|
AudioItem::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(12);
|
font.setWeight(QFont::Medium);
|
||||||
font.setWeight(80);
|
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
const int computedWidth = std::min(
|
const int computedWidth = std::min(
|
||||||
@ -180,8 +179,7 @@ AudioItem::paintEvent(QPaintEvent *event)
|
|||||||
painter.setRenderHint(QPainter::Antialiasing);
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(12);
|
font.setWeight(QFont::Medium);
|
||||||
font.setWeight(80);
|
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
|
|
||||||
@ -225,7 +223,7 @@ AudioItem::paintEvent(QPaintEvent *event)
|
|||||||
painter.drawText(QPoint(textStartX, textStartY), elidedText);
|
painter.drawText(QPoint(textStartX, textStartY), elidedText);
|
||||||
|
|
||||||
// Draw the filesize.
|
// Draw the filesize.
|
||||||
font.setWeight(50);
|
font.setWeight(QFont::Normal);
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(QPen(textColor_));
|
painter.setPen(QPen(textColor_));
|
||||||
painter.drawText(QPoint(textStartX, textStartY + 1.5 * fm.ascent()), readableFileSize_);
|
painter.drawText(QPoint(textStartX, textStartY + 1.5 * fm.ascent()), readableFileSize_);
|
||||||
|
@ -150,8 +150,7 @@ void
|
|||||||
FileItem::resizeEvent(QResizeEvent *event)
|
FileItem::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(12);
|
font.setWeight(QFont::Medium);
|
||||||
font.setWeight(80);
|
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
const int computedWidth = std::min(
|
const int computedWidth = std::min(
|
||||||
@ -171,8 +170,7 @@ FileItem::paintEvent(QPaintEvent *event)
|
|||||||
painter.setRenderHint(QPainter::Antialiasing);
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(12);
|
font.setWeight(QFont::Medium);
|
||||||
font.setWeight(80);
|
|
||||||
|
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
|
|
||||||
@ -210,7 +208,7 @@ FileItem::paintEvent(QPaintEvent *event)
|
|||||||
painter.drawText(QPoint(textStartX, textStartY), elidedText);
|
painter.drawText(QPoint(textStartX, textStartY), elidedText);
|
||||||
|
|
||||||
// Draw the filesize.
|
// Draw the filesize.
|
||||||
font.setWeight(50);
|
font.setWeight(QFont::Normal);
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(QPen(textColor_));
|
painter.setPen(QPen(textColor_));
|
||||||
painter.drawText(QPoint(textStartX, textStartY + 1.5 * fm.ascent()), readableFileSize_);
|
painter.drawText(QPoint(textStartX, textStartY + 1.5 * fm.ascent()), readableFileSize_);
|
||||||
|
@ -183,8 +183,7 @@ ImageItem::paintEvent(QPaintEvent *event)
|
|||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.setRenderHint(QPainter::Antialiasing);
|
painter.setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
QFont font("Open Sans");
|
QFont font;
|
||||||
font.setPixelSize(conf::fontSize);
|
|
||||||
|
|
||||||
QFontMetrics metrics(font);
|
QFontMetrics metrics(font);
|
||||||
const int fontHeight = metrics.height() + metrics.ascent();
|
const int fontHeight = metrics.height() + metrics.ascent();
|
||||||
@ -223,9 +222,9 @@ ImageItem::paintEvent(QPaintEvent *event)
|
|||||||
|
|
||||||
QString elidedText = metrics.elidedText(text_, Qt::ElideRight, width_ - 10);
|
QString elidedText = metrics.elidedText(text_, Qt::ElideRight, width_ - 10);
|
||||||
|
|
||||||
font.setWeight(80);
|
font.setWeight(QFont::Medium);
|
||||||
painter.setFont(font);
|
painter.setFont(font);
|
||||||
painter.setPen(QPen(QColor("white")));
|
painter.setPen(QPen(QColor(Qt::white)));
|
||||||
|
|
||||||
textRegion_.adjust(5, 0, 5, 0);
|
textRegion_.adjust(5, 0, 5, 0);
|
||||||
painter.drawText(textRegion_, Qt::AlignVCenter, elidedText);
|
painter.drawText(textRegion_, Qt::AlignVCenter, elidedText);
|
||||||
|
@ -50,7 +50,6 @@ VideoItem::VideoItem(const mtx::events::RoomEvent<mtx::events::msg::Video> &even
|
|||||||
label_->setMargin(0);
|
label_->setMargin(0);
|
||||||
label_->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
label_->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
||||||
label_->setOpenExternalLinks(true);
|
label_->setOpenExternalLinks(true);
|
||||||
label_->setStyleSheet(QString("font-size: %1px;").arg(conf::fontSize));
|
|
||||||
|
|
||||||
layout->addWidget(label_);
|
layout->addWidget(label_);
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ FlatButton::setFontSize(qreal size)
|
|||||||
font_size_ = size;
|
font_size_ = size;
|
||||||
|
|
||||||
QFont f(font());
|
QFont f(font());
|
||||||
f.setPixelSize(size);
|
f.setPointSizeF(size);
|
||||||
setFont(f);
|
setFont(f);
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "InfoMessage.h"
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "InfoMessage.h"
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@ -12,18 +12,16 @@ constexpr int HMargin = 20;
|
|||||||
InfoMessage::InfoMessage(QWidget *parent)
|
InfoMessage::InfoMessage(QWidget *parent)
|
||||||
: QWidget{parent}
|
: QWidget{parent}
|
||||||
{
|
{
|
||||||
font_.setWeight(60);
|
initFont();
|
||||||
font_.setPixelSize(conf::timeline::fonts::dateSeparator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoMessage::InfoMessage(QString msg, QWidget *parent)
|
InfoMessage::InfoMessage(QString msg, QWidget *parent)
|
||||||
: QWidget{parent}
|
: QWidget{parent}
|
||||||
, msg_{msg}
|
, msg_{msg}
|
||||||
{
|
{
|
||||||
font_.setWeight(60);
|
initFont();
|
||||||
font_.setPixelSize(conf::timeline::fonts::dateSeparator);
|
|
||||||
|
|
||||||
QFontMetrics fm{font_};
|
QFontMetrics fm{font()};
|
||||||
width_ = fm.width(msg_) + HPadding * 2;
|
width_ = fm.width(msg_) + HPadding * 2;
|
||||||
height_ = fm.ascent() + 2 * VPadding;
|
height_ = fm.ascent() + 2 * VPadding;
|
||||||
|
|
||||||
@ -35,7 +33,7 @@ InfoMessage::paintEvent(QPaintEvent *)
|
|||||||
{
|
{
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
p.setRenderHint(QPainter::Antialiasing);
|
p.setRenderHint(QPainter::Antialiasing);
|
||||||
p.setFont(font_);
|
p.setFont(font());
|
||||||
|
|
||||||
// Center the box horizontally & vertically.
|
// Center the box horizontally & vertically.
|
||||||
auto textRegion = QRectF(width() / 2 - width_ / 2, HMargin, width_, height_);
|
auto textRegion = QRectF(width() / 2 - width_ / 2, HMargin, width_, height_);
|
||||||
@ -54,8 +52,7 @@ InfoMessage::paintEvent(QPaintEvent *)
|
|||||||
DateSeparator::DateSeparator(QDateTime datetime, QWidget *parent)
|
DateSeparator::DateSeparator(QDateTime datetime, QWidget *parent)
|
||||||
: InfoMessage{parent}
|
: InfoMessage{parent}
|
||||||
{
|
{
|
||||||
auto now = QDateTime::currentDateTime();
|
auto now = QDateTime::currentDateTime();
|
||||||
auto days = now.daysTo(datetime);
|
|
||||||
|
|
||||||
QString fmt;
|
QString fmt;
|
||||||
|
|
||||||
@ -64,14 +61,9 @@ DateSeparator::DateSeparator(QDateTime datetime, QWidget *parent)
|
|||||||
else
|
else
|
||||||
fmt = QString("ddd d MMMM");
|
fmt = QString("ddd d MMMM");
|
||||||
|
|
||||||
if (days == 0)
|
msg_ = datetime.toString(fmt);
|
||||||
msg_ = tr("Today");
|
|
||||||
else if (std::abs(days) == 1)
|
|
||||||
msg_ = tr("Yesterday");
|
|
||||||
else
|
|
||||||
msg_ = datetime.toString(fmt);
|
|
||||||
|
|
||||||
QFontMetrics fm{font_};
|
QFontMetrics fm{font()};
|
||||||
width_ = fm.width(msg_) + HPadding * 2;
|
width_ = fm.width(msg_) + HPadding * 2;
|
||||||
height_ = fm.ascent() + 2 * VPadding;
|
height_ = fm.ascent() + 2 * VPadding;
|
||||||
|
|
||||||
|
@ -25,12 +25,17 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
void initFont()
|
||||||
|
{
|
||||||
|
QFont f;
|
||||||
|
f.setWeight(QFont::Medium);
|
||||||
|
setFont(f);
|
||||||
|
}
|
||||||
|
|
||||||
int width_;
|
int width_;
|
||||||
int height_;
|
int height_;
|
||||||
|
|
||||||
QString msg_;
|
QString msg_;
|
||||||
QFont font_;
|
|
||||||
|
|
||||||
QDateTime datetime_;
|
QDateTime datetime_;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ TextField::setLabelFontSize(qreal size)
|
|||||||
|
|
||||||
if (label_) {
|
if (label_) {
|
||||||
QFont font(label_->font());
|
QFont font(label_->font());
|
||||||
font.setPixelSize(size);
|
font.setPointSizeF(size);
|
||||||
label_->setFont(font);
|
label_->setFont(font);
|
||||||
label_->update();
|
label_->update();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user