Fix Qt5.15 issues

fixes #214
pull/218/head
Nicolas Werner 5 years ago
parent f8903f493f
commit 43d2ebc095
  1. 2
      src/LoginPage.cpp
  2. 8
      src/RegisterPage.cpp
  3. 10
      src/UserSettingsPage.cpp
  4. 4
      src/Utils.cpp
  5. 4
      src/dialogs/CreateRoom.cpp
  6. 10
      src/dialogs/ReadReceipts.cpp
  7. 1
      src/ui/Avatar.cpp
  8. 1
      src/ui/InfoMessage.cpp
  9. 3
      src/ui/Painter.h

@ -133,7 +133,7 @@ LoginPage::LoginPage(QWidget *parent)
form_layout_->addLayout(matrixidLayout_); form_layout_->addLayout(matrixidLayout_);
form_layout_->addWidget(password_input_); form_layout_->addWidget(password_input_);
form_layout_->addWidget(deviceName_, Qt::AlignHCenter, nullptr); form_layout_->addWidget(deviceName_, Qt::AlignHCenter);
form_layout_->addLayout(serverLayout_); form_layout_->addLayout(serverLayout_);
button_layout_ = new QHBoxLayout(); button_layout_ = new QHBoxLayout();

@ -107,10 +107,10 @@ RegisterPage::RegisterPage(QWidget *parent)
tr("A server that allows registration. Since matrix is decentralized, you need to first " 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.")); "find a server you can register on or host your own."));
form_layout_->addWidget(username_input_, Qt::AlignHCenter, nullptr); form_layout_->addWidget(username_input_, Qt::AlignHCenter);
form_layout_->addWidget(password_input_, Qt::AlignHCenter, nullptr); form_layout_->addWidget(password_input_, Qt::AlignHCenter);
form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter, nullptr); form_layout_->addWidget(password_confirmation_, Qt::AlignHCenter);
form_layout_->addWidget(server_input_, Qt::AlignHCenter, nullptr); form_layout_->addWidget(server_input_, Qt::AlignHCenter);
button_layout_ = new QHBoxLayout(); button_layout_ = new QHBoxLayout();
button_layout_->setSpacing(0); button_layout_->setSpacing(0);

@ -612,22 +612,22 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
topLayout_->addWidget(versionInfo); topLayout_->addWidget(versionInfo);
connect(themeCombo_, connect(themeCombo_,
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
[this](const QString &text) { [this](const QString &text) {
settings_->setTheme(text.toLower()); settings_->setTheme(text.toLower());
emit themeChanged(); emit themeChanged();
}); });
connect(scaleFactorCombo_, 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()); }); [](const QString &factor) { utils::setScaleFactor(factor.toFloat()); });
connect(fontSizeCombo_, 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()); }); [this](const QString &size) { settings_->setFontSize(size.trimmed().toDouble()); });
connect(fontSelectionCombo_, 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()); }); [this](const QString &family) { settings_->setFontFamily(family.trimmed()); });
connect(emojiFontSelectionCombo_, 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()); }); [this](const QString &family) { settings_->setEmojiFontFamily(family.trimmed()); });
connect(trayToggle_, &Toggle::toggled, this, [this](bool disabled) { connect(trayToggle_, &Toggle::toggled, this, [this](bool disabled) {
settings_->setTray(!disabled); settings_->setTray(!disabled);

@ -142,13 +142,13 @@ utils::descriptiveTime(const QDateTime &then)
const auto days = then.daysTo(now); const auto days = then.daysTo(now);
if (days == 0) if (days == 0)
return then.time().toString(Qt::DefaultLocaleShortDate); return QLocale::system().toString(then.time(), QLocale::ShortFormat);
else if (days < 2) else if (days < 2)
return QString(QCoreApplication::translate("descriptiveTime", "Yesterday")); return QString(QCoreApplication::translate("descriptiveTime", "Yesterday"));
else if (days < 7) else if (days < 7)
return then.toString("dddd"); return then.toString("dddd");
return then.date().toString(Qt::DefaultLocaleShortDate); return QLocale::system().toString(then.date(), QLocale::ShortFormat);
} }
DescInfo DescInfo

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

@ -75,15 +75,17 @@ ReceiptItem::dateFormat(const QDateTime &then) const
auto days = then.daysTo(now); auto days = then.daysTo(now);
if (days == 0) 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) 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) else if (days < 7)
return QString("%1 %2") return QString("%1 %2")
.arg(then.toString("dddd")) .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) ReadReceipts::ReadReceipts(QWidget *parent)

@ -1,4 +1,5 @@
#include <QPainter> #include <QPainter>
#include <QPainterPath>
#include <QSettings> #include <QSettings>
#include "AvatarProvider.h" #include "AvatarProvider.h"

@ -4,6 +4,7 @@
#include <QDateTime> #include <QDateTime>
#include <QLocale> #include <QLocale>
#include <QPainter> #include <QPainter>
#include <QPainterPath>
#include <QPen> #include <QPen>
#include <QtGlobal> #include <QtGlobal>

@ -3,6 +3,7 @@
#include <QFontMetrics> #include <QFontMetrics>
#include <QPaintDevice> #include <QPaintDevice>
#include <QPainter> #include <QPainter>
#include <QPainterPath>
#include <QtGlobal> #include <QtGlobal>
class Painter : public QPainter class Painter : public QPainter
@ -163,5 +164,5 @@ public:
private: private:
Painter &_painter; Painter &_painter;
QPainter::RenderHints hints_ = 0; QPainter::RenderHints hints_ = {};
}; };

Loading…
Cancel
Save