Skip to content

Commit

Permalink
Fix Qt5.15 issues
Browse files Browse the repository at this point in the history
fixes #214
  • Loading branch information
deepbluev7 committed Jun 5, 2020
1 parent f8903f4 commit 43d2ebc
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/LoginPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ LoginPage::LoginPage(QWidget *parent)

form_layout_->addLayout(matrixidLayout_);
form_layout_->addWidget(password_input_);
form_layout_->addWidget(deviceName_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(deviceName_, Qt::AlignHCenter);
form_layout_->addLayout(serverLayout_);

button_layout_ = new QHBoxLayout();
Expand Down
8 changes: 4 additions & 4 deletions src/RegisterPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ RegisterPage::RegisterPage(QWidget *parent)
tr("A server that allows registration. Since matrix is decentralized, you need to first "
"find a server you can register on or host your own."));

form_layout_->addWidget(username_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(password_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(server_input_, Qt::AlignHCenter, nullptr);
form_layout_->addWidget(username_input_, Qt::AlignHCenter);
form_layout_->addWidget(password_input_, Qt::AlignHCenter);
form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter);
form_layout_->addWidget(server_input_, Qt::AlignHCenter);

button_layout_ = new QHBoxLayout();
button_layout_->setSpacing(0);
Expand Down
10 changes: 5 additions & 5 deletions src/UserSettingsPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,22 +612,22 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
topLayout_->addWidget(versionInfo);

connect(themeCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &text) {
settings_->setTheme(text.toLower());
emit themeChanged();
});
connect(scaleFactorCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[](const QString &factor) { utils::setScaleFactor(factor.toFloat()); });
connect(fontSizeCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &size) { settings_->setFontSize(size.trimmed().toDouble()); });
connect(fontSelectionCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &family) { settings_->setFontFamily(family.trimmed()); });
connect(emojiFontSelectionCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &family) { settings_->setEmojiFontFamily(family.trimmed()); });
connect(trayToggle_, &Toggle::toggled, this, [this](bool disabled) {
settings_->setTray(!disabled);
Expand Down
4 changes: 2 additions & 2 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ utils::descriptiveTime(const QDateTime &then)
const auto days = then.daysTo(now);

if (days == 0)
return then.time().toString(Qt::DefaultLocaleShortDate);
return QLocale::system().toString(then.time(), QLocale::ShortFormat);
else if (days < 2)
return QString(QCoreApplication::translate("descriptiveTime", "Yesterday"));
else if (days < 7)
return then.toString("dddd");

return then.date().toString(Qt::DefaultLocaleShortDate);
return QLocale::system().toString(then.date(), QLocale::ShortFormat);
}

DescInfo
Expand Down
4 changes: 2 additions & 2 deletions src/dialogs/CreateRoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ CreateRoom::CreateRoom(QWidget *parent)
});

connect(visibilityCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &text) {
if (text == "Private") {
request_.visibility = mtx::requests::Visibility::Private;
Expand All @@ -122,7 +122,7 @@ CreateRoom::CreateRoom(QWidget *parent)
});

connect(presetCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &text) {
if (text == "Private Chat") {
request_.preset = mtx::requests::Preset::PrivateChat;
Expand Down
10 changes: 6 additions & 4 deletions src/dialogs/ReadReceipts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ ReceiptItem::dateFormat(const QDateTime &then) const
auto days = then.daysTo(now);

if (days == 0)
return tr("Today %1").arg(then.time().toString(Qt::DefaultLocaleShortDate));
return tr("Today %1")
.arg(QLocale::system().toString(then.time(), QLocale::ShortFormat));
else if (days < 2)
return tr("Yesterday %1").arg(then.time().toString(Qt::DefaultLocaleShortDate));
return tr("Yesterday %1")
.arg(QLocale::system().toString(then.time(), QLocale::ShortFormat));
else if (days < 7)
return QString("%1 %2")
.arg(then.toString("dddd"))
.arg(then.time().toString(Qt::DefaultLocaleShortDate));
.arg(QLocale::system().toString(then.time(), QLocale::ShortFormat));

return then.toString(Qt::DefaultLocaleShortDate);
return QLocale::system().toString(then.time(), QLocale::ShortFormat);
}

ReadReceipts::ReadReceipts(QWidget *parent)
Expand Down
1 change: 1 addition & 0 deletions src/ui/Avatar.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <QPainter>
#include <QPainterPath>
#include <QSettings>

#include "AvatarProvider.h"
Expand Down
1 change: 1 addition & 0 deletions src/ui/InfoMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QDateTime>
#include <QLocale>
#include <QPainter>
#include <QPainterPath>
#include <QPen>
#include <QtGlobal>

Expand Down
3 changes: 2 additions & 1 deletion src/ui/Painter.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QFontMetrics>
#include <QPaintDevice>
#include <QPainter>
#include <QPainterPath>
#include <QtGlobal>

class Painter : public QPainter
Expand Down Expand Up @@ -163,5 +164,5 @@ class PainterHighQualityEnabler

private:
Painter &_painter;
QPainter::RenderHints hints_ = 0;
QPainter::RenderHints hints_ = {};
};

0 comments on commit 43d2ebc

Please sign in to comment.