mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Style change again
This commit is contained in:
parent
ed36bdb037
commit
1bfe48de75
130 changed files with 6039 additions and 5940 deletions
|
@ -31,7 +31,9 @@ public:
|
|||
explicit EmojiItemDelegate(QObject *parent = nullptr);
|
||||
~EmojiItemDelegate();
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
private:
|
||||
Emoji *data_;
|
||||
|
|
|
@ -38,7 +38,10 @@ class RoomInfoListItem : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RoomInfoListItem(QSharedPointer<RoomSettings> settings, RoomState state, QString room_id, QWidget *parent = 0);
|
||||
RoomInfoListItem(QSharedPointer<RoomSettings> settings,
|
||||
RoomState state,
|
||||
QString room_id,
|
||||
QWidget *parent = 0);
|
||||
|
||||
~RoomInfoListItem();
|
||||
|
||||
|
@ -113,8 +116,8 @@ RoomInfoListItem::state() const
|
|||
inline void
|
||||
RoomInfoListItem::setAvatar(const QImage &img)
|
||||
{
|
||||
roomAvatar_ =
|
||||
QPixmap::fromImage(img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
roomAvatar_ = QPixmap::fromImage(
|
||||
img.scaled(IconSize, IconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,8 @@ protected slots:
|
|||
|
||||
protected:
|
||||
// The method that does the main work for the widget transition.
|
||||
void slideInWidget(QWidget *widget, AnimationDirection direction = AnimationDirection::AUTOMATIC);
|
||||
void slideInWidget(QWidget *widget,
|
||||
AnimationDirection direction = AnimationDirection::AUTOMATIC);
|
||||
|
||||
// Indicates whether or not the animation is active.
|
||||
bool active_;
|
||||
|
|
|
@ -31,7 +31,9 @@ public:
|
|||
gradient.setFinalStop(right1);
|
||||
painter.setBrush(QBrush(gradient));
|
||||
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);
|
||||
|
||||
// Left
|
||||
QPointF left0(margin, height / 2);
|
||||
|
@ -39,7 +41,8 @@ public:
|
|||
gradient.setStart(left0);
|
||||
gradient.setFinalStop(left1);
|
||||
painter.setBrush(QBrush(gradient));
|
||||
painter.drawRoundRect(QRectF(QPointF(margin * radius, margin), QPointF(0, height - margin)), 0.0, 0.0);
|
||||
painter.drawRoundRect(
|
||||
QRectF(QPointF(margin * radius, margin), QPointF(0, height - margin)), 0.0, 0.0);
|
||||
|
||||
// Top
|
||||
QPointF top0(width / 2, margin);
|
||||
|
@ -47,7 +50,8 @@ public:
|
|||
gradient.setStart(top0);
|
||||
gradient.setFinalStop(top1);
|
||||
painter.setBrush(QBrush(gradient));
|
||||
painter.drawRoundRect(QRectF(QPointF(width - margin, 0), QPointF(margin, margin)), 0.0, 0.0);
|
||||
painter.drawRoundRect(
|
||||
QRectF(QPointF(width - margin, 0), QPointF(margin, margin)), 0.0, 0.0);
|
||||
|
||||
// Bottom
|
||||
QPointF bottom0(width / 2, height - margin);
|
||||
|
@ -56,7 +60,9 @@ public:
|
|||
gradient.setFinalStop(bottom1);
|
||||
painter.setBrush(QBrush(gradient));
|
||||
painter.drawRoundRect(
|
||||
QRectF(QPointF(margin, height - margin), QPointF(width - margin, height)), 0.0, 0.0);
|
||||
QRectF(QPointF(margin, height - margin), QPointF(width - margin, height)),
|
||||
0.0,
|
||||
0.0);
|
||||
|
||||
// BottomRight
|
||||
QPointF bottomright0(width - margin, height - margin);
|
||||
|
@ -98,6 +104,8 @@ public:
|
|||
painter.setBrush(QBrush("#FFFFFF"));
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.drawRoundRect(
|
||||
QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)), radius, radius);
|
||||
QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)),
|
||||
radius,
|
||||
radius);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,7 +15,8 @@ class FlatButtonStateMachine : public QStateMachine
|
|||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(qreal overlayOpacity WRITE setOverlayOpacity READ overlayOpacity)
|
||||
Q_PROPERTY(qreal checkedOverlayProgress WRITE setCheckedOverlayProgress READ checkedOverlayProgress)
|
||||
Q_PROPERTY(
|
||||
qreal checkedOverlayProgress WRITE setCheckedOverlayProgress READ checkedOverlayProgress)
|
||||
|
||||
public:
|
||||
explicit FlatButtonStateMachine(FlatButton *parent);
|
||||
|
@ -41,7 +42,10 @@ protected:
|
|||
|
||||
private:
|
||||
void addTransition(QObject *object, const char *signal, QState *fromState, QState *toState);
|
||||
void addTransition(QObject *object, QEvent::Type eventType, QState *fromState, QState *toState);
|
||||
void addTransition(QObject *object,
|
||||
QEvent::Type eventType,
|
||||
QState *fromState,
|
||||
QState *toState);
|
||||
void addTransition(QAbstractTransition *transition, QState *fromState, QState *toState);
|
||||
|
||||
FlatButton *const button_;
|
||||
|
@ -82,12 +86,15 @@ class FlatButton : public QPushButton
|
|||
Q_PROPERTY(QColor foregroundColor WRITE setForegroundColor READ foregroundColor)
|
||||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
||||
Q_PROPERTY(QColor overlayColor WRITE setOverlayColor READ overlayColor)
|
||||
Q_PROPERTY(QColor disabledForegroundColor WRITE setDisabledForegroundColor READ disabledForegroundColor)
|
||||
Q_PROPERTY(QColor disabledBackgroundColor WRITE setDisabledBackgroundColor READ disabledBackgroundColor)
|
||||
Q_PROPERTY(QColor disabledForegroundColor WRITE setDisabledForegroundColor READ
|
||||
disabledForegroundColor)
|
||||
Q_PROPERTY(QColor disabledBackgroundColor WRITE setDisabledBackgroundColor READ
|
||||
disabledBackgroundColor)
|
||||
Q_PROPERTY(qreal fontSize WRITE setFontSize READ fontSize)
|
||||
|
||||
public:
|
||||
explicit FlatButton(QWidget *parent = 0, ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset);
|
||||
explicit FlatButton(QWidget *parent = 0,
|
||||
ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset);
|
||||
explicit FlatButton(const QString &text,
|
||||
QWidget *parent = 0,
|
||||
ui::ButtonPreset preset = ui::ButtonPreset::FlatPreset);
|
||||
|
|
|
@ -14,8 +14,10 @@ public:
|
|||
font.setPixelSize(conf::fontSize);
|
||||
|
||||
setFont(font);
|
||||
setStyleSheet("QMenu { color: black; background-color: white; margin: 0px;}"
|
||||
"QMenu::item { color: black; padding: 7px 20px; border: 1px solid transparent; margin: "
|
||||
setStyleSheet(
|
||||
"QMenu { color: black; background-color: white; margin: 0px;}"
|
||||
"QMenu::item { color: black; padding: 7px 20px; border: 1px solid transparent; "
|
||||
"margin: "
|
||||
"2px 0px; }"
|
||||
"QMenu::item:selected { color: black; background: rgba(180, 180, 180, 100); }");
|
||||
};
|
||||
|
|
|
@ -32,7 +32,9 @@ EmojiItemDelegate::~EmojiItemDelegate()
|
|||
}
|
||||
|
||||
void
|
||||
EmojiItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
EmojiItemDelegate::paint(QPainter *painter,
|
||||
const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index);
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
, animationDuration_{ 100 }
|
||||
, categoryIconSize_{ 20 }
|
||||
{
|
||||
setStyleSheet("QWidget {background: #f8fbfe; color: #e8e8e8; border: none;}"
|
||||
setStyleSheet(
|
||||
"QWidget {background: #f8fbfe; color: #e8e8e8; border: none;}"
|
||||
"QScrollBar:vertical { background-color: #f8fbfe; width: 8px; margin: 0px 2px 0 2px; }"
|
||||
"QScrollBar::handle:vertical { background-color: #d6dde3; min-height: 20px; }"
|
||||
"QScrollBar::add-line:vertical { border: none; background: none; }"
|
||||
|
@ -120,19 +121,23 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
scrollLayout->setMargin(0);
|
||||
scrollArea_->setWidget(scrollWidget);
|
||||
|
||||
auto peopleEmoji = new EmojiCategory(tr("Smileys & People"), emoji_provider_.people, scrollWidget);
|
||||
auto peopleEmoji =
|
||||
new EmojiCategory(tr("Smileys & People"), emoji_provider_.people, scrollWidget);
|
||||
scrollLayout->addWidget(peopleEmoji);
|
||||
|
||||
auto natureEmoji = new EmojiCategory(tr("Animals & Nature"), emoji_provider_.nature, scrollWidget);
|
||||
auto natureEmoji =
|
||||
new EmojiCategory(tr("Animals & Nature"), emoji_provider_.nature, scrollWidget);
|
||||
scrollLayout->addWidget(natureEmoji);
|
||||
|
||||
auto foodEmoji = new EmojiCategory(tr("Food & Drink"), emoji_provider_.food, scrollWidget);
|
||||
scrollLayout->addWidget(foodEmoji);
|
||||
|
||||
auto activityEmoji = new EmojiCategory(tr("Activity"), emoji_provider_.activity, scrollWidget);
|
||||
auto activityEmoji =
|
||||
new EmojiCategory(tr("Activity"), emoji_provider_.activity, scrollWidget);
|
||||
scrollLayout->addWidget(activityEmoji);
|
||||
|
||||
auto travelEmoji = new EmojiCategory(tr("Travel & Places"), emoji_provider_.travel, scrollWidget);
|
||||
auto travelEmoji =
|
||||
new EmojiCategory(tr("Travel & Places"), emoji_provider_.travel, scrollWidget);
|
||||
scrollLayout->addWidget(travelEmoji);
|
||||
|
||||
auto objectsEmoji = new EmojiCategory(tr("Objects"), emoji_provider_.objects, scrollWidget);
|
||||
|
@ -159,7 +164,9 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
animation_->setEndValue(0);
|
||||
|
||||
connect(peopleEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(peopleCategory, &QPushButton::clicked, [this, peopleEmoji]() { this->showEmojiCategory(peopleEmoji); });
|
||||
connect(peopleCategory, &QPushButton::clicked, [this, peopleEmoji]() {
|
||||
this->showEmojiCategory(peopleEmoji);
|
||||
});
|
||||
|
||||
connect(natureEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(natureCategory_, &QPushButton::clicked, [this, natureEmoji]() {
|
||||
|
@ -167,7 +174,9 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
});
|
||||
|
||||
connect(foodEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(foodCategory_, &QPushButton::clicked, [this, foodEmoji]() { this->showEmojiCategory(foodEmoji); });
|
||||
connect(foodCategory_, &QPushButton::clicked, [this, foodEmoji]() {
|
||||
this->showEmojiCategory(foodEmoji);
|
||||
});
|
||||
|
||||
connect(activityEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(activityCategory, &QPushButton::clicked, [this, activityEmoji]() {
|
||||
|
@ -175,7 +184,9 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
});
|
||||
|
||||
connect(travelEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(travelCategory, &QPushButton::clicked, [this, travelEmoji]() { this->showEmojiCategory(travelEmoji); });
|
||||
connect(travelCategory, &QPushButton::clicked, [this, travelEmoji]() {
|
||||
this->showEmojiCategory(travelEmoji);
|
||||
});
|
||||
|
||||
connect(objectsEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(objectsCategory, &QPushButton::clicked, [this, objectsEmoji]() {
|
||||
|
@ -188,7 +199,9 @@ EmojiPanel::EmojiPanel(QWidget *parent)
|
|||
});
|
||||
|
||||
connect(flagsEmoji, &EmojiCategory::emojiSelected, this, &EmojiPanel::emojiSelected);
|
||||
connect(flagsCategory, &QPushButton::clicked, [this, flagsEmoji]() { this->showEmojiCategory(flagsEmoji); });
|
||||
connect(flagsCategory, &QPushButton::clicked, [this, flagsEmoji]() {
|
||||
this->showEmojiCategory(flagsEmoji);
|
||||
});
|
||||
|
||||
connect(animation_, &QAbstractAnimation::finished, [this]() {
|
||||
if (animation_->direction() == QAbstractAnimation::Forward)
|
||||
|
|
|
@ -535,11 +535,16 @@ const QList<Emoji> EmojiProvider::activity = {
|
|||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb4\xf0\x9f\x8f\xbe"), ":bicyclist_tone4:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb4\xf0\x9f\x8f\xbf"), ":bicyclist_tone5:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5"), ":mountain_bicyclist:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbb"), ":mountain_bicyclist_tone1:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbc"), ":mountain_bicyclist_tone2:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbd"), ":mountain_bicyclist_tone3:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbe"), ":mountain_bicyclist_tone4:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbf"), ":mountain_bicyclist_tone5:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbb"),
|
||||
":mountain_bicyclist_tone1:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbc"),
|
||||
":mountain_bicyclist_tone2:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbd"),
|
||||
":mountain_bicyclist_tone3:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbe"),
|
||||
":mountain_bicyclist_tone4:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\x9a\xb5\xf0\x9f\x8f\xbf"),
|
||||
":mountain_bicyclist_tone5:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\xa4\xb8"), ":cartwheel:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\xa4\xb8\xf0\x9f\x8f\xbb"), ":cartwheel_tone1:" },
|
||||
Emoji{ QString::fromUtf8("\xf0\x9f\xa4\xb8\xf0\x9f\x8f\xbc"), ":cartwheel_tone2:" },
|
||||
|
|
|
@ -50,7 +50,8 @@ ImageItem::ImageItem(QSharedPointer<MatrixClient> client,
|
|||
}
|
||||
|
||||
QString media_params = url_parts[1];
|
||||
url_ = QString("%1/_matrix/media/r0/download/%2").arg(client_.data()->getHomeServer().toString(), media_params);
|
||||
url_ = QString("%1/_matrix/media/r0/download/%2")
|
||||
.arg(client_.data()->getHomeServer().toString(), media_params);
|
||||
|
||||
client_.data()->downloadImage(event.eventId(), url_);
|
||||
|
||||
|
@ -99,7 +100,8 @@ ImageItem::scaleImage()
|
|||
}
|
||||
|
||||
setFixedSize(width_, height_);
|
||||
scaled_image_ = image_.scaled(width_, height_, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
scaled_image_ =
|
||||
image_.scaled(width_, height_, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
QSize
|
||||
|
|
|
@ -71,7 +71,8 @@ ImageOverlayDialog::scaleImage(int max_width, int max_height)
|
|||
final_height = originalImage_.height() * min_aspect_ratio;
|
||||
}
|
||||
|
||||
image_ = originalImage_.scaled(final_width, final_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
image_ = originalImage_.scaled(
|
||||
final_width, final_height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -99,7 +100,8 @@ ImageOverlayDialog::paintEvent(QPaintEvent *event)
|
|||
int diff_y = max_height - image_.height();
|
||||
|
||||
content_ = QRect(outer_margin + diff_x / 2, diff_y / 2, image_.width(), image_.height());
|
||||
close_button_ = QRect(screen_.width() - margin - buttonSize, margin, buttonSize, buttonSize);
|
||||
close_button_ =
|
||||
QRect(screen_.width() - margin - buttonSize, margin, buttonSize, buttonSize);
|
||||
|
||||
// Draw main content_.
|
||||
painter.drawPixmap(content_, image_);
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
const QRegExp MXID_REGEX("@[A-Za-z0-9._%+-]+:[A-Za-z0-9.-]{1,126}\\.[A-Za-z]{1,63}");
|
||||
const QRegExp LOCALPART_REGEX("[A-za-z0-9._%+-]{3,}");
|
||||
const QRegExp PASSWORD_REGEX(".{8,}");
|
||||
const QRegExp DOMAIN_REGEX("(?!\\-)(?:[a-zA-Z\\d\\-]{0,62}[a-zA-Z\\d]\\.){1,126}(?!\\d+)[a-zA-Z\\d]{1,63}");
|
||||
const QRegExp DOMAIN_REGEX(
|
||||
"(?!\\-)(?:[a-zA-Z\\d\\-]{0,62}[a-zA-Z\\d]\\.){1,126}(?!\\d+)[a-zA-Z\\d]{1,63}");
|
||||
|
||||
QRegExpValidator InputValidator::Id(MXID_REGEX);
|
||||
QRegExpValidator InputValidator::Localpart(LOCALPART_REGEX);
|
||||
|
|
|
@ -223,11 +223,12 @@ void
|
|||
LoginPage::versionError(QString error)
|
||||
{
|
||||
// Matrix homeservers are often kept on a subdomain called 'matrix'
|
||||
// so let's try that next, unless the address was set explicitly or the domain part of the username already
|
||||
// points to this subdomain
|
||||
// so let's try that next, unless the address was set explicitly or the domain part of the
|
||||
// username already points to this subdomain
|
||||
QUrl currentServer = client_->getHomeServer();
|
||||
QString mxidAddress = matrixid_input_->text().split(":").at(1);
|
||||
if (currentServer.host() == inferredServerAddress_ && !currentServer.host().startsWith("matrix")) {
|
||||
if (currentServer.host() == inferredServerAddress_ &&
|
||||
!currentServer.host().startsWith("matrix")) {
|
||||
error_label_->setText("");
|
||||
currentServer.setHost(QString("matrix.") + currentServer.host());
|
||||
serverInput_->setText(currentServer.host());
|
||||
|
|
|
@ -68,7 +68,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(register_page_, SIGNAL(backButtonClicked()), this, SLOT(showWelcomePage()));
|
||||
|
||||
connect(chat_page_, SIGNAL(close()), this, SLOT(showWelcomePage()));
|
||||
connect(chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString)));
|
||||
connect(
|
||||
chat_page_, SIGNAL(changeWindowTitle(QString)), this, SLOT(setWindowTitle(QString)));
|
||||
connect(chat_page_, SIGNAL(unreadMessages(int)), trayIcon_, SLOT(setUnreadCount(int)));
|
||||
|
||||
connect(trayIcon_,
|
||||
|
@ -157,7 +158,8 @@ MainWindow::showChatPage(QString userid, QString homeserver, QString token)
|
|||
sliding_stack_->setCurrentIndex(index);
|
||||
modalOpacityDuration = 0;
|
||||
} else {
|
||||
sliding_stack_->slideInIndex(index, SlidingStackWidget::AnimationDirection::LEFT_TO_RIGHT);
|
||||
sliding_stack_->slideInIndex(index,
|
||||
SlidingStackWidget::AnimationDirection::LEFT_TO_RIGHT);
|
||||
}
|
||||
|
||||
if (spinner_ == nullptr) {
|
||||
|
@ -184,9 +186,11 @@ MainWindow::showWelcomePage()
|
|||
int index = sliding_stack_->getWidgetIndex(welcome_page_);
|
||||
|
||||
if (sliding_stack_->currentIndex() == sliding_stack_->getWidgetIndex(login_page_))
|
||||
sliding_stack_->slideInIndex(index, SlidingStackWidget::AnimationDirection::RIGHT_TO_LEFT);
|
||||
sliding_stack_->slideInIndex(index,
|
||||
SlidingStackWidget::AnimationDirection::RIGHT_TO_LEFT);
|
||||
else
|
||||
sliding_stack_->slideInIndex(index, SlidingStackWidget::AnimationDirection::LEFT_TO_RIGHT);
|
||||
sliding_stack_->slideInIndex(index,
|
||||
SlidingStackWidget::AnimationDirection::LEFT_TO_RIGHT);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -92,8 +92,8 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
|
|||
selection_ = -1;
|
||||
}
|
||||
|
||||
completer_->popup()->setWindowFlags(completer_->popup()->windowFlags() | Qt::ToolTip |
|
||||
Qt::NoDropShadowWindowHint);
|
||||
completer_->popup()->setWindowFlags(completer_->popup()->windowFlags() |
|
||||
Qt::ToolTip | Qt::NoDropShadowWindowHint);
|
||||
completer_->popup()->setAttribute(Qt::WA_ShowWithoutActivating);
|
||||
completer_->complete();
|
||||
});
|
||||
|
@ -120,7 +120,8 @@ QuickSwitcher::QuickSwitcher(QWidget *parent)
|
|||
completer_->popup()->setCurrentIndex(completer_->currentIndex());
|
||||
});
|
||||
|
||||
connect(roomSearch_, &RoomSearchInput::hiding, this, [=]() { completer_->popup()->hide(); });
|
||||
connect(
|
||||
roomSearch_, &RoomSearchInput::hiding, this, [=]() { completer_->popup()->hide(); });
|
||||
connect(roomSearch_, &QLineEdit::returnPressed, this, [=]() {
|
||||
emit closing();
|
||||
emit roomSelected(rooms_[this->roomSearch_->text().trimmed()]);
|
||||
|
|
|
@ -135,7 +135,10 @@ RegisterPage::RegisterPage(QSharedPointer<MatrixClient> client, QWidget *parent)
|
|||
connect(password_input_, SIGNAL(returnPressed()), register_button_, SLOT(click()));
|
||||
connect(password_confirmation_, SIGNAL(returnPressed()), register_button_, SLOT(click()));
|
||||
connect(server_input_, SIGNAL(returnPressed()), register_button_, SLOT(click()));
|
||||
connect(client_.data(), SIGNAL(registerError(const QString &)), this, SLOT(registerError(const QString &)));
|
||||
connect(client_.data(),
|
||||
SIGNAL(registerError(const QString &)),
|
||||
this,
|
||||
SLOT(registerError(const QString &)));
|
||||
|
||||
username_input_->setValidator(&InputValidator::Localpart);
|
||||
password_input_->setValidator(&InputValidator::Password);
|
||||
|
|
|
@ -54,7 +54,9 @@ RoomInfoListItem::RoomInfoListItem(QSharedPointer<RoomSettings> settings,
|
|||
|
||||
toggleNotifications_ = new QAction(notificationText(), this);
|
||||
|
||||
connect(toggleNotifications_, &QAction::triggered, this, [=]() { roomSettings_->toggleNotifications(); });
|
||||
connect(toggleNotifications_, &QAction::triggered, this, [=]() {
|
||||
roomSettings_->toggleNotifications();
|
||||
});
|
||||
|
||||
menu_->addAction(toggleNotifications_);
|
||||
}
|
||||
|
@ -120,8 +122,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
QFontMetrics fontNameMetrics(font);
|
||||
int top_y = 2 * Padding + fontNameMetrics.ascent() / 2;
|
||||
|
||||
auto name =
|
||||
metrics.elidedText(state_.getName(), Qt::ElideRight, (width() - IconSize - 2 * Padding) * 0.8);
|
||||
auto name = metrics.elidedText(
|
||||
state_.getName(), Qt::ElideRight, (width() - IconSize - 2 * Padding) * 0.8);
|
||||
p.drawText(QPoint(2 * Padding + IconSize, top_y), name);
|
||||
|
||||
if (!isPressed_) {
|
||||
|
@ -134,9 +136,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
|
||||
auto msgStampWidth = QFontMetrics(font).width(lastMsgInfo_.timestamp) + 5;
|
||||
|
||||
// The limit is the space between the end of the avatar and the start of the timestamp.
|
||||
int usernameLimit = std::max(0, width() - 3 * Padding - msgStampWidth - IconSize - 20);
|
||||
auto userName = metrics.elidedText(lastMsgInfo_.username, Qt::ElideRight, usernameLimit);
|
||||
// The limit is the space between the end of the avatar and the start of the
|
||||
// timestamp.
|
||||
int usernameLimit =
|
||||
std::max(0, width() - 3 * Padding - msgStampWidth - IconSize - 20);
|
||||
auto userName =
|
||||
metrics.elidedText(lastMsgInfo_.username, Qt::ElideRight, usernameLimit);
|
||||
|
||||
font.setBold(true);
|
||||
p.setFont(font);
|
||||
|
@ -147,15 +152,19 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
font.setBold(false);
|
||||
p.setFont(font);
|
||||
|
||||
// The limit is the space between the end of the username and the start of the timestamp.
|
||||
int descriptionLimit = std::max(0, width() - 3 * Padding - msgStampWidth - IconSize - nameWidth - 5);
|
||||
auto description = metrics.elidedText(lastMsgInfo_.body, Qt::ElideRight, descriptionLimit);
|
||||
// The limit is the space between the end of the username and the start of the
|
||||
// timestamp.
|
||||
int descriptionLimit =
|
||||
std::max(0, width() - 3 * Padding - msgStampWidth - IconSize - nameWidth - 5);
|
||||
auto description =
|
||||
metrics.elidedText(lastMsgInfo_.body, Qt::ElideRight, descriptionLimit);
|
||||
p.drawText(QPoint(2 * Padding + IconSize + nameWidth, bottom_y), description);
|
||||
|
||||
// We either show the bubble or the last message timestamp.
|
||||
if (unreadMsgCount_ == 0) {
|
||||
font.setBold(true);
|
||||
p.drawText(QPoint(width() - Padding - msgStampWidth, bottom_y), lastMsgInfo_.timestamp);
|
||||
p.drawText(QPoint(width() - Padding - msgStampWidth, bottom_y),
|
||||
lastMsgInfo_.timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,7 +186,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
p.setFont(font);
|
||||
p.setPen(QColor("#333"));
|
||||
p.setBrush(Qt::NoBrush);
|
||||
p.drawText(avatarRegion.translated(0, -1), Qt::AlignCenter, QChar(state_.getName()[0]));
|
||||
p.drawText(
|
||||
avatarRegion.translated(0, -1), Qt::AlignCenter, QChar(state_.getName()[0]));
|
||||
} else {
|
||||
p.save();
|
||||
|
||||
|
@ -210,10 +220,12 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
|
||||
int diameter = 20;
|
||||
|
||||
QRectF r(width() - diameter - Padding, bottom_y - diameter / 2 - 5, diameter, diameter);
|
||||
QRectF r(
|
||||
width() - diameter - Padding, bottom_y - diameter / 2 - 5, diameter, diameter);
|
||||
|
||||
if (width() == ui::sidebar::SmallSize)
|
||||
r = QRectF(width() - diameter - 5, height() - diameter - 5, diameter, diameter);
|
||||
r = QRectF(
|
||||
width() - diameter - 5, height() - diameter - 5, diameter, diameter);
|
||||
|
||||
p.setPen(Qt::NoPen);
|
||||
p.drawEllipse(r);
|
||||
|
@ -224,7 +236,8 @@ RoomInfoListItem::paintEvent(QPaintEvent *event)
|
|||
p.setPen(QPen(backgroundColor));
|
||||
|
||||
p.setBrush(Qt::NoBrush);
|
||||
p.drawText(r.translated(0, -0.5), Qt::AlignCenter, QString::number(unreadMsgCount_));
|
||||
p.drawText(
|
||||
r.translated(0, -0.5), Qt::AlignCenter, QString::number(unreadMsgCount_));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,8 +114,10 @@ RoomList::setInitialRooms(const QMap<QString, QSharedPointer<RoomSettings>> &set
|
|||
if (!state.getAvatar().toString().isEmpty())
|
||||
client_->fetchRoomAvatar(room_id, state.getAvatar());
|
||||
|
||||
RoomInfoListItem *room_item = new RoomInfoListItem(settings[room_id], state, room_id, scrollArea_);
|
||||
connect(room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom);
|
||||
RoomInfoListItem *room_item =
|
||||
new RoomInfoListItem(settings[room_id], state, room_id, scrollArea_);
|
||||
connect(
|
||||
room_item, &RoomInfoListItem::clicked, this, &RoomList::highlightSelectedRoom);
|
||||
|
||||
rooms_.insert(room_id, QSharedPointer<RoomInfoListItem>(room_item));
|
||||
|
||||
|
@ -176,7 +178,8 @@ RoomList::highlightSelectedRoom(const QString &room_id)
|
|||
it.value()->setPressedState(false);
|
||||
} else {
|
||||
it.value()->setPressedState(true);
|
||||
scrollArea_->ensureWidgetVisible(qobject_cast<QWidget *>(it.value().data()));
|
||||
scrollArea_->ensureWidgetVisible(
|
||||
qobject_cast<QWidget *>(it.value().data()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,10 @@ MsgCountComposedIcon::MsgCountComposedIcon(const QString &filename)
|
|||
}
|
||||
|
||||
void
|
||||
MsgCountComposedIcon::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
|
||||
MsgCountComposedIcon::paint(QPainter *painter,
|
||||
const QRect &rect,
|
||||
QIcon::Mode mode,
|
||||
QIcon::State state)
|
||||
{
|
||||
painter->setRenderHint(QPainter::TextAntialiasing);
|
||||
painter->setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
|
@ -53,7 +56,10 @@ MsgCountComposedIcon::paint(QPainter *painter, const QRect &rect, QIcon::Mode mo
|
|||
painter->setPen(Qt::NoPen);
|
||||
painter->setFont(QFont("Open Sans", 8, QFont::Black));
|
||||
|
||||
QRectF bubble(rect.width() - BubbleDiameter, rect.height() - BubbleDiameter, BubbleDiameter, BubbleDiameter);
|
||||
QRectF bubble(rect.width() - BubbleDiameter,
|
||||
rect.height() - BubbleDiameter,
|
||||
BubbleDiameter,
|
||||
BubbleDiameter);
|
||||
painter->drawEllipse(bubble);
|
||||
painter->setPen(QPen(textColor));
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
|
|
@ -95,7 +95,10 @@ UserInfoWidget::UserInfoWidget(QWidget *parent)
|
|||
connect(logoutButton_, &QPushButton::clicked, this, [=]() {
|
||||
if (logoutDialog_ == nullptr) {
|
||||
logoutDialog_ = new LogoutDialog(this);
|
||||
connect(logoutDialog_, SIGNAL(closing(bool)), this, SLOT(closeLogoutDialog(bool)));
|
||||
connect(logoutDialog_,
|
||||
SIGNAL(closing(bool)),
|
||||
this,
|
||||
SLOT(closeLogoutDialog(bool)));
|
||||
}
|
||||
|
||||
if (logoutModal_ == nullptr) {
|
||||
|
|
|
@ -41,7 +41,8 @@ VersionsResponse::deserialize(const QJsonDocument &data)
|
|||
QRegExp rx("r(\\d+)\\.(\\d+)\\.(\\d+)");
|
||||
|
||||
if (rx.indexIn(str) == -1)
|
||||
throw DeserializationException("Invalid version string in versions response");
|
||||
throw DeserializationException(
|
||||
"Invalid version string in versions response");
|
||||
|
||||
struct Version_ v;
|
||||
v.major_ = rx.cap(1).toUInt();
|
||||
|
|
|
@ -72,7 +72,8 @@ WelcomePage::WelcomePage(QWidget *parent)
|
|||
login_button_->setFontSize(conf::btn::fontSize);
|
||||
login_button_->setCornerRadius(conf::btn::cornerRadius);
|
||||
|
||||
button_spacer_ = new QSpacerItem(20, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
button_spacer_ =
|
||||
new QSpacerItem(20, 20, QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||
|
||||
button_layout_->addStretch(1);
|
||||
button_layout_->addWidget(register_button_);
|
||||
|
|
|
@ -69,8 +69,8 @@ matrix::events::isStateEvent(EventType type)
|
|||
return type == EventType::RoomAliases || type == EventType::RoomAvatar ||
|
||||
type == EventType::RoomCanonicalAlias || type == EventType::RoomCreate ||
|
||||
type == EventType::RoomHistoryVisibility || type == EventType::RoomJoinRules ||
|
||||
type == EventType::RoomMember || type == EventType::RoomName || type == EventType::RoomPowerLevels ||
|
||||
type == EventType::RoomTopic;
|
||||
type == EventType::RoomMember || type == EventType::RoomName ||
|
||||
type == EventType::RoomPowerLevels || type == EventType::RoomTopic;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -23,7 +23,8 @@ void
|
|||
HistoryVisibilityEventContent::deserialize(const QJsonValue &data)
|
||||
{
|
||||
if (!data.isObject())
|
||||
throw DeserializationException("HistoryVisibilityEventContent is not a JSON object");
|
||||
throw DeserializationException(
|
||||
"HistoryVisibilityEventContent is not a JSON object");
|
||||
|
||||
auto object = data.toObject();
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@ JoinRulesEventContent::deserialize(const QJsonValue &data)
|
|||
else if (value == "public")
|
||||
join_rule_ = JoinRule::Public;
|
||||
else
|
||||
throw DeserializationException(QString("Unknown join_rule value: %1").arg(value).toUtf8().constData());
|
||||
throw DeserializationException(
|
||||
QString("Unknown join_rule value: %1").arg(value).toUtf8().constData());
|
||||
}
|
||||
|
||||
QJsonObject
|
||||
|
|
|
@ -45,7 +45,8 @@ MemberEventContent::deserialize(const QJsonValue &data)
|
|||
else if (value == "leave")
|
||||
membership_state_ = Membership::Leave;
|
||||
else
|
||||
throw DeserializationException(QString("Unknown membership value: %1").arg(value).toUtf8().constData());
|
||||
throw DeserializationException(
|
||||
QString("Unknown membership value: %1").arg(value).toUtf8().constData());
|
||||
|
||||
if (object.contains("avatar_url"))
|
||||
avatar_url_ = QUrl(object.value("avatar_url").toString());
|
||||
|
|
|
@ -71,8 +71,8 @@ Avatar::setSize(int size)
|
|||
size_ = size;
|
||||
|
||||
if (!image_.isNull()) {
|
||||
pixmap_ =
|
||||
QPixmap::fromImage(image_.scaled(size_, size_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
pixmap_ = QPixmap::fromImage(
|
||||
image_.scaled(size_, size_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
QFont _font(font());
|
||||
|
@ -95,7 +95,8 @@ Avatar::setImage(const QImage &image)
|
|||
{
|
||||
image_ = image;
|
||||
type_ = ui::AvatarType::Image;
|
||||
pixmap_ = QPixmap::fromImage(image_.scaled(size_, size_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
pixmap_ = QPixmap::fromImage(
|
||||
image_.scaled(size_, size_, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
update();
|
||||
}
|
||||
|
||||
|
@ -138,7 +139,8 @@ Avatar::paintEvent(QPaintEvent *)
|
|||
QPainterPath ppath;
|
||||
ppath.addEllipse(width() / 2 - hs, height() / 2 - hs, size_, size_);
|
||||
painter.setClipPath(ppath);
|
||||
painter.drawPixmap(QRect(width() / 2 - hs, height() / 2 - hs, size_, size_), pixmap_);
|
||||
painter.drawPixmap(QRect(width() / 2 - hs, height() / 2 - hs, size_, size_),
|
||||
pixmap_);
|
||||
break;
|
||||
}
|
||||
case ui::AvatarType::Letter: {
|
||||
|
|
|
@ -484,7 +484,8 @@ FlatButton::paintForeground(QPainter *painter)
|
|||
|
||||
if (isCheckable() && progress > 0) {
|
||||
QColor source = foregroundColor();
|
||||
QColor dest = Qt::TransparentMode == bg_mode_ ? Qt::white : backgroundColor();
|
||||
QColor dest =
|
||||
Qt::TransparentMode == bg_mode_ ? Qt::white : backgroundColor();
|
||||
if (qFuzzyCompare(1, progress)) {
|
||||
painter->setPen(dest);
|
||||
} else {
|
||||
|
@ -672,19 +673,27 @@ FlatButtonStateMachine::eventFilter(QObject *watched, QEvent *event)
|
|||
}
|
||||
|
||||
void
|
||||
FlatButtonStateMachine::addTransition(QObject *object, const char *signal, QState *fromState, QState *toState)
|
||||
FlatButtonStateMachine::addTransition(QObject *object,
|
||||
const char *signal,
|
||||
QState *fromState,
|
||||
QState *toState)
|
||||
{
|
||||
addTransition(new QSignalTransition(object, signal), fromState, toState);
|
||||
}
|
||||
|
||||
void
|
||||
FlatButtonStateMachine::addTransition(QObject *object, QEvent::Type eventType, QState *fromState, QState *toState)
|
||||
FlatButtonStateMachine::addTransition(QObject *object,
|
||||
QEvent::Type eventType,
|
||||
QState *fromState,
|
||||
QState *toState)
|
||||
{
|
||||
addTransition(new QEventTransition(object, eventType), fromState, toState);
|
||||
}
|
||||
|
||||
void
|
||||
FlatButtonStateMachine::addTransition(QAbstractTransition *transition, QState *fromState, QState *toState)
|
||||
FlatButtonStateMachine::addTransition(QAbstractTransition *transition,
|
||||
QState *fromState,
|
||||
QState *toState)
|
||||
{
|
||||
transition->setTargetState(toState);
|
||||
|
||||
|
|
|
@ -328,7 +328,8 @@ TextFieldStateMachine::setupProperties()
|
|||
|
||||
if (0 != label_->offset().y() && !text_field_->text().isEmpty()) {
|
||||
label_->setOffset(QPointF(0, 0 - m));
|
||||
} else if (!text_field_->hasFocus() && label_->offset().y() <= 0 && text_field_->text().isEmpty()) {
|
||||
} else if (!text_field_->hasFocus() && label_->offset().y() <= 0 &&
|
||||
text_field_->text().isEmpty()) {
|
||||
label_->setOffset(QPointF(0, 26));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue