Fix more warnings and remove dead code
This commit is contained in:
parent
409ff22d80
commit
bb290f9fec
50 changed files with 276 additions and 695 deletions
222
src/ui/Badge.cpp
222
src/ui/Badge.cpp
|
|
@ -1,222 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "Badge.h"
|
||||
|
||||
Badge::Badge(QWidget *parent)
|
||||
: OverlayWidget(parent)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
Badge::Badge(const QIcon &icon, QWidget *parent)
|
||||
: OverlayWidget(parent)
|
||||
{
|
||||
init();
|
||||
setIcon(icon);
|
||||
}
|
||||
|
||||
Badge::Badge(const QString &text, QWidget *parent)
|
||||
: OverlayWidget(parent)
|
||||
{
|
||||
init();
|
||||
setText(text);
|
||||
}
|
||||
|
||||
void
|
||||
Badge::init()
|
||||
{
|
||||
x_ = 0;
|
||||
y_ = 0;
|
||||
// TODO: Make padding configurable.
|
||||
padding_ = 5;
|
||||
diameter_ = 24;
|
||||
|
||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
QFont _font(font());
|
||||
_font.setPointSizeF(7.5);
|
||||
_font.setStyleName("Bold");
|
||||
|
||||
setFont(_font);
|
||||
setText("");
|
||||
}
|
||||
|
||||
QString
|
||||
Badge::text() const
|
||||
{
|
||||
return text_;
|
||||
}
|
||||
|
||||
QIcon
|
||||
Badge::icon() const
|
||||
{
|
||||
return icon_;
|
||||
}
|
||||
|
||||
QSize
|
||||
Badge::sizeHint() const
|
||||
{
|
||||
const int d = diameter();
|
||||
return QSize(d + 4, d + 4);
|
||||
}
|
||||
|
||||
qreal
|
||||
Badge::relativeYPosition() const
|
||||
{
|
||||
return y_;
|
||||
}
|
||||
|
||||
qreal
|
||||
Badge::relativeXPosition() const
|
||||
{
|
||||
return x_;
|
||||
}
|
||||
|
||||
QPointF
|
||||
Badge::relativePosition() const
|
||||
{
|
||||
return QPointF(x_, y_);
|
||||
}
|
||||
|
||||
QColor
|
||||
Badge::backgroundColor() const
|
||||
{
|
||||
if (!background_color_.isValid())
|
||||
return QColor("black");
|
||||
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
QColor
|
||||
Badge::textColor() const
|
||||
{
|
||||
if (!text_color_.isValid())
|
||||
return QColor("white");
|
||||
|
||||
return text_color_;
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setTextColor(const QColor &color)
|
||||
{
|
||||
text_color_ = color;
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
background_color_ = color;
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setRelativePosition(const QPointF &pos)
|
||||
{
|
||||
setRelativePosition(pos.x(), pos.y());
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setRelativePosition(qreal x, qreal y)
|
||||
{
|
||||
x_ = x;
|
||||
y_ = y;
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setRelativeXPosition(qreal x)
|
||||
{
|
||||
x_ = x;
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setRelativeYPosition(qreal y)
|
||||
{
|
||||
y_ = y;
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setIcon(const QIcon &icon)
|
||||
{
|
||||
icon_ = icon;
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setText(const QString &text)
|
||||
{
|
||||
text_ = text;
|
||||
|
||||
if (!icon_.isNull())
|
||||
icon_ = QIcon();
|
||||
|
||||
size_ = fontMetrics().size(Qt::TextShowMnemonic, text);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void
|
||||
Badge::setDiameter(int diameter)
|
||||
{
|
||||
if (diameter > 0) {
|
||||
diameter_ = diameter;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Badge::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.translate(x_, y_);
|
||||
|
||||
QBrush brush;
|
||||
brush.setStyle(Qt::SolidPattern);
|
||||
|
||||
painter.setBrush(brush);
|
||||
painter.setPen(Qt::NoPen);
|
||||
|
||||
const int d = diameter();
|
||||
|
||||
QRectF r(0, 0, d, d);
|
||||
r.translate(QPointF((width() - d), (height() - d)) / 2);
|
||||
|
||||
if (icon_.isNull()) {
|
||||
QPen pen;
|
||||
// TODO: Make badge width configurable.
|
||||
pen.setWidth(1);
|
||||
pen.setColor(textColor());
|
||||
|
||||
painter.setPen(pen);
|
||||
painter.drawEllipse(r);
|
||||
|
||||
painter.setPen(textColor());
|
||||
painter.setBrush(Qt::NoBrush);
|
||||
painter.drawText(r.translated(0, -0.5), Qt::AlignCenter, text_);
|
||||
} else {
|
||||
painter.drawEllipse(r);
|
||||
QRectF q(0, 0, 16, 16);
|
||||
q.moveCenter(r.center());
|
||||
QPixmap pixmap = icon().pixmap(16, 16);
|
||||
QPainter icon(&pixmap);
|
||||
icon.setCompositionMode(QPainter::CompositionMode_SourceIn);
|
||||
icon.fillRect(pixmap.rect(), textColor());
|
||||
painter.drawPixmap(q.toRect(), pixmap);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
Badge::diameter() const
|
||||
{
|
||||
if (icon_.isNull()) {
|
||||
return qMax(size_.width(), size_.height()) + padding_;
|
||||
}
|
||||
|
||||
return diameter_;
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QColor>
|
||||
#include <QIcon>
|
||||
#include <QWidget>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "OverlayWidget.h"
|
||||
|
||||
class Badge : public OverlayWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
|
||||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
||||
Q_PROPERTY(QPointF relativePosition WRITE setRelativePosition READ relativePosition)
|
||||
|
||||
public:
|
||||
explicit Badge(QWidget *parent = nullptr);
|
||||
explicit Badge(const QIcon &icon, QWidget *parent = nullptr);
|
||||
explicit Badge(const QString &text, QWidget *parent = nullptr);
|
||||
|
||||
void setBackgroundColor(const QColor &color);
|
||||
void setTextColor(const QColor &color);
|
||||
void setIcon(const QIcon &icon);
|
||||
void setRelativePosition(const QPointF &pos);
|
||||
void setRelativePosition(qreal x, qreal y);
|
||||
void setRelativeXPosition(qreal x);
|
||||
void setRelativeYPosition(qreal y);
|
||||
void setText(const QString &text);
|
||||
void setDiameter(int diameter);
|
||||
|
||||
QIcon icon() const;
|
||||
QString text() const;
|
||||
QColor backgroundColor() const;
|
||||
QColor textColor() const;
|
||||
QPointF relativePosition() const;
|
||||
QSize sizeHint() const override;
|
||||
qreal relativeXPosition() const;
|
||||
qreal relativeYPosition() const;
|
||||
|
||||
int diameter() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
QColor background_color_;
|
||||
QColor text_color_;
|
||||
|
||||
QIcon icon_;
|
||||
QSize size_;
|
||||
QString text_;
|
||||
|
||||
int padding_;
|
||||
int diameter_;
|
||||
|
||||
qreal x_;
|
||||
qreal y_;
|
||||
};
|
||||
|
|
@ -100,7 +100,7 @@ DropShadow::draw(QPainter &painter,
|
|||
painter.drawRoundedRect(QRectF(topright0, topright1), 0.0, 0.0);
|
||||
|
||||
// Widget
|
||||
painter.setBrush(QBrush("#FFFFFF"));
|
||||
painter.setBrush(QBrush(QColor(0xff, 0xff, 0xff)));
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.drawRoundedRect(
|
||||
QRectF(QPointF(margin, margin), QPointF(width - margin, height - margin)), radius, radius);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ void
|
|||
FlatButton::setForegroundColor(const QColor &color)
|
||||
{
|
||||
foreground_color_ = color;
|
||||
emit foregroundColorChanged();
|
||||
}
|
||||
|
||||
QColor
|
||||
|
|
@ -147,6 +148,7 @@ void
|
|||
FlatButton::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
background_color_ = color;
|
||||
emit backgroundColorChanged();
|
||||
}
|
||||
|
||||
QColor
|
||||
|
|
@ -172,6 +174,7 @@ FlatButton::setOverlayColor(const QColor &color)
|
|||
{
|
||||
overlay_color_ = color;
|
||||
setOverlayStyle(ui::OverlayStyle::TintedOverlay);
|
||||
emit overlayColorChanged();
|
||||
}
|
||||
|
||||
QColor
|
||||
|
|
@ -188,6 +191,7 @@ void
|
|||
FlatButton::setDisabledForegroundColor(const QColor &color)
|
||||
{
|
||||
disabled_color_ = color;
|
||||
emit disabledForegroundColorChanged();
|
||||
}
|
||||
|
||||
QColor
|
||||
|
|
@ -204,6 +208,7 @@ void
|
|||
FlatButton::setDisabledBackgroundColor(const QColor &color)
|
||||
{
|
||||
disabled_background_color_ = color;
|
||||
emit disabledBackgroundColorChanged();
|
||||
}
|
||||
|
||||
QColor
|
||||
|
|
@ -225,6 +230,8 @@ FlatButton::setFontSize(qreal size)
|
|||
f.setPointSizeF(size);
|
||||
setFont(f);
|
||||
|
||||
emit fontSizeChanged();
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
@ -617,6 +624,7 @@ void
|
|||
FlatButtonStateMachine::setOverlayOpacity(qreal opacity)
|
||||
{
|
||||
overlay_opacity_ = opacity;
|
||||
emit overlayOpacityChanged();
|
||||
button_->update();
|
||||
}
|
||||
|
||||
|
|
@ -624,6 +632,7 @@ void
|
|||
FlatButtonStateMachine::setCheckedOverlayProgress(qreal opacity)
|
||||
{
|
||||
checked_overlay_progress_ = opacity;
|
||||
emit checkedOverlayProgressChanged();
|
||||
button_->update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,10 @@ class FlatButtonStateMachine : public QStateMachine
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(qreal overlayOpacity WRITE setOverlayOpacity READ overlayOpacity)
|
||||
Q_PROPERTY(
|
||||
qreal checkedOverlayProgress WRITE setCheckedOverlayProgress READ checkedOverlayProgress)
|
||||
qreal overlayOpacity WRITE setOverlayOpacity READ overlayOpacity NOTIFY overlayOpacityChanged)
|
||||
Q_PROPERTY(qreal checkedOverlayProgress WRITE setCheckedOverlayProgress READ
|
||||
checkedOverlayProgress NOTIFY checkedOverlayProgressChanged)
|
||||
|
||||
public:
|
||||
explicit FlatButtonStateMachine(FlatButton *parent);
|
||||
|
|
@ -38,6 +39,9 @@ signals:
|
|||
void buttonChecked();
|
||||
void buttonUnchecked();
|
||||
|
||||
void overlayOpacityChanged();
|
||||
void checkedOverlayProgressChanged();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
|
|
@ -81,14 +85,17 @@ class FlatButton : public QPushButton
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
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 foregroundColor WRITE setForegroundColor READ foregroundColor NOTIFY
|
||||
foregroundColorChanged)
|
||||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor NOTIFY
|
||||
backgroundColorChanged)
|
||||
Q_PROPERTY(
|
||||
QColor disabledForegroundColor WRITE setDisabledForegroundColor READ disabledForegroundColor)
|
||||
Q_PROPERTY(
|
||||
QColor disabledBackgroundColor WRITE setDisabledBackgroundColor READ disabledBackgroundColor)
|
||||
Q_PROPERTY(qreal fontSize WRITE setFontSize READ fontSize)
|
||||
QColor overlayColor WRITE setOverlayColor READ overlayColor NOTIFY overlayColorChanged)
|
||||
Q_PROPERTY(QColor disabledForegroundColor WRITE setDisabledForegroundColor READ
|
||||
disabledForegroundColor NOTIFY disabledForegroundColorChanged)
|
||||
Q_PROPERTY(QColor disabledBackgroundColor WRITE setDisabledBackgroundColor READ
|
||||
disabledBackgroundColor NOTIFY disabledBackgroundColorChanged)
|
||||
Q_PROPERTY(qreal fontSize WRITE setFontSize READ fontSize NOTIFY fontSizeChanged)
|
||||
|
||||
public:
|
||||
explicit FlatButton(QWidget *parent = nullptr,
|
||||
|
|
@ -156,6 +163,14 @@ protected:
|
|||
|
||||
void init();
|
||||
|
||||
signals:
|
||||
void foregroundColorChanged();
|
||||
void backgroundColorChanged();
|
||||
void overlayColorChanged();
|
||||
void disabledForegroundColorChanged();
|
||||
void disabledBackgroundColorChanged();
|
||||
void fontSizeChanged();
|
||||
|
||||
private:
|
||||
RippleOverlay *ripple_overlay_;
|
||||
FlatButtonStateMachine *state_machine_;
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "InfoMessage.h"
|
||||
#include "Config.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QLocale>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QPen>
|
||||
#include <QtGlobal>
|
||||
|
||||
constexpr int VPadding = 6;
|
||||
constexpr int HPadding = 12;
|
||||
constexpr int HMargin = 20;
|
||||
|
||||
InfoMessage::InfoMessage(QWidget *parent)
|
||||
: QWidget{parent}
|
||||
{
|
||||
initFont();
|
||||
}
|
||||
|
||||
InfoMessage::InfoMessage(QString msg, QWidget *parent)
|
||||
: QWidget{parent}
|
||||
, msg_{msg}
|
||||
{
|
||||
initFont();
|
||||
|
||||
QFontMetrics fm{font()};
|
||||
width_ = fm.horizontalAdvance(msg_) + HPadding * 2;
|
||||
height_ = fm.ascent() + 2 * VPadding;
|
||||
|
||||
setFixedHeight(height_ + 2 * HMargin);
|
||||
}
|
||||
|
||||
void
|
||||
InfoMessage::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setFont(font());
|
||||
|
||||
// Center the box horizontally & vertically.
|
||||
auto textRegion = QRectF(width() / 2 - width_ / 2, HMargin, width_, height_);
|
||||
|
||||
QPainterPath ppath;
|
||||
ppath.addRoundedRect(textRegion, height_ / 2, height_ / 2);
|
||||
|
||||
p.setPen(Qt::NoPen);
|
||||
p.fillPath(ppath, boxColor());
|
||||
p.drawPath(ppath);
|
||||
|
||||
p.setPen(QPen(textColor()));
|
||||
p.drawText(textRegion, Qt::AlignCenter, msg_);
|
||||
}
|
||||
|
||||
DateSeparator::DateSeparator(QDateTime datetime, QWidget *parent)
|
||||
: InfoMessage{parent}
|
||||
{
|
||||
auto now = QDateTime::currentDateTime();
|
||||
|
||||
QString fmt = QLocale::system().dateFormat(QLocale::LongFormat);
|
||||
|
||||
if (now.date().year() == datetime.date().year()) {
|
||||
QRegularExpression rx("[^a-zA-Z]*y+[^a-zA-Z]*");
|
||||
fmt = fmt.remove(rx);
|
||||
}
|
||||
|
||||
msg_ = datetime.date().toString(fmt);
|
||||
|
||||
QFontMetrics fm{font()};
|
||||
width_ = fm.horizontalAdvance(msg_) + HPadding * 2;
|
||||
height_ = fm.ascent() + 2 * VPadding;
|
||||
|
||||
setFixedHeight(height_ + 2 * HMargin);
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QColor>
|
||||
#include <QDateTime>
|
||||
#include <QWidget>
|
||||
|
||||
class InfoMessage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor)
|
||||
Q_PROPERTY(QColor boxColor WRITE setBoxColor READ boxColor)
|
||||
|
||||
public:
|
||||
explicit InfoMessage(QWidget *parent = nullptr);
|
||||
InfoMessage(QString msg, QWidget *parent = nullptr);
|
||||
|
||||
void setTextColor(QColor color) { textColor_ = color; }
|
||||
void setBoxColor(QColor color) { boxColor_ = color; }
|
||||
void saveDatetime(QDateTime datetime) { datetime_ = datetime; }
|
||||
|
||||
QColor textColor() const { return textColor_; }
|
||||
QColor boxColor() const { return boxColor_; }
|
||||
QDateTime datetime() const { return datetime_; }
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void initFont()
|
||||
{
|
||||
QFont f;
|
||||
f.setWeight(QFont::Medium);
|
||||
setFont(f);
|
||||
}
|
||||
|
||||
int width_;
|
||||
int height_;
|
||||
|
||||
QString msg_;
|
||||
|
||||
QDateTime datetime_;
|
||||
|
||||
QColor textColor_ = QColor("black");
|
||||
QColor boxColor_ = QColor("white");
|
||||
};
|
||||
|
||||
class DateSeparator : public InfoMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DateSeparator(QDateTime datetime, QWidget *parent = nullptr);
|
||||
};
|
||||
|
|
@ -13,7 +13,7 @@ class QPaintEvent;
|
|||
class LoadingIndicator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
|
||||
|
||||
public:
|
||||
LoadingIndicator(QWidget *parent = nullptr);
|
||||
|
|
@ -24,7 +24,11 @@ public:
|
|||
void stop();
|
||||
|
||||
QColor color() { return color_; }
|
||||
void setColor(QColor color) { color_ = color; }
|
||||
void setColor(QColor color)
|
||||
{
|
||||
color_ = color;
|
||||
emit colorChanged();
|
||||
}
|
||||
|
||||
int interval() { return interval_; }
|
||||
void setInterval(int interval) { interval_ = interval; }
|
||||
|
|
@ -32,6 +36,9 @@ public:
|
|||
private slots:
|
||||
void onTimeout();
|
||||
|
||||
signals:
|
||||
void colorChanged();
|
||||
|
||||
private:
|
||||
int interval_;
|
||||
int angle_;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ MxcAnimatedImage::startDownload()
|
|||
if (!animatable_)
|
||||
return;
|
||||
|
||||
QString mxcUrl = QString::fromStdString(mtx::accessors::url(*event));
|
||||
QString originalFilename = QString::fromStdString(mtx::accessors::filename(*event));
|
||||
QString mxcUrl = QString::fromStdString(mtx::accessors::url(*event));
|
||||
|
||||
auto encryptionInfo = mtx::accessors::file(*event);
|
||||
|
||||
|
|
@ -53,10 +52,9 @@ MxcAnimatedImage::startDownload()
|
|||
|
||||
const auto url = mxcUrl.toStdString();
|
||||
const auto name = QString(mxcUrl).remove("mxc://");
|
||||
QFileInfo filename(QString("%1/media_cache/media/%2.%3")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
|
||||
.arg(name)
|
||||
.arg(suffix));
|
||||
QFileInfo filename(
|
||||
QStringLiteral("%1/media_cache/media/%2.%3")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation), name, suffix));
|
||||
if (QDir::cleanPath(name) != name) {
|
||||
nhlog::net()->warn("mxcUrl '{}' is not safe, not downloading file", url);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -49,9 +49,12 @@ MxcMediaProxy::MxcMediaProxy(QObject *parent)
|
|||
void
|
||||
MxcMediaProxy::setVideoSurface(QAbstractVideoSurface *surface)
|
||||
{
|
||||
qDebug() << "Changing surface";
|
||||
m_surface = surface;
|
||||
setVideoOutput(m_surface);
|
||||
if (surface != m_surface) {
|
||||
qDebug() << "Changing surface";
|
||||
m_surface = surface;
|
||||
setVideoOutput(m_surface);
|
||||
emit videoSurfaceChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QAbstractVideoSurface *
|
||||
|
|
@ -84,9 +87,8 @@ MxcMediaProxy::startDownload()
|
|||
return;
|
||||
}
|
||||
|
||||
QString mxcUrl = QString::fromStdString(mtx::accessors::url(*event));
|
||||
QString originalFilename = QString::fromStdString(mtx::accessors::filename(*event));
|
||||
QString mimeType = QString::fromStdString(mtx::accessors::mimetype(*event));
|
||||
QString mxcUrl = QString::fromStdString(mtx::accessors::url(*event));
|
||||
QString mimeType = QString::fromStdString(mtx::accessors::mimetype(*event));
|
||||
|
||||
auto encryptionInfo = mtx::accessors::file(*event);
|
||||
|
||||
|
|
@ -99,10 +101,9 @@ MxcMediaProxy::startDownload()
|
|||
|
||||
const auto url = mxcUrl.toStdString();
|
||||
const auto name = QString(mxcUrl).remove("mxc://");
|
||||
QFileInfo filename(QString("%1/media_cache/media/%2.%3")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation))
|
||||
.arg(name)
|
||||
.arg(suffix));
|
||||
QFileInfo filename(
|
||||
QString("%1/media_cache/media/%2.%3")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::CacheLocation), name, suffix));
|
||||
if (QDir::cleanPath(name) != name) {
|
||||
nhlog::net()->warn("mxcUrl '{}' is not safe, not downloading file", url);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ class MxcMediaProxy : public QMediaPlayer
|
|||
Q_OBJECT
|
||||
Q_PROPERTY(TimelineModel *roomm READ room WRITE setRoom NOTIFY roomChanged REQUIRED)
|
||||
Q_PROPERTY(QString eventId READ eventId WRITE setEventId NOTIFY eventIdChanged)
|
||||
Q_PROPERTY(QAbstractVideoSurface *videoSurface READ getVideoSurface WRITE setVideoSurface)
|
||||
Q_PROPERTY(QAbstractVideoSurface *videoSurface READ getVideoSurface WRITE setVideoSurface NOTIFY
|
||||
videoSurfaceChanged)
|
||||
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
|
||||
Q_PROPERTY(int orientation READ orientation NOTIFY orientationChanged)
|
||||
|
||||
|
|
@ -55,6 +56,7 @@ signals:
|
|||
void newBuffer(QMediaContent, QIODevice *buf);
|
||||
|
||||
void orientationChanged();
|
||||
void videoSurfaceChanged();
|
||||
|
||||
private slots:
|
||||
void startDownload();
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ Ripple::setRadius(qreal radius)
|
|||
|
||||
radius_ = radius;
|
||||
overlay_->update();
|
||||
|
||||
emit radiusChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -51,6 +53,8 @@ Ripple::setOpacity(qreal opacity)
|
|||
|
||||
opacity_ = opacity;
|
||||
overlay_->update();
|
||||
|
||||
emit opacityChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ class Ripple : public QParallelAnimationGroup
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(qreal radius WRITE setRadius READ radius)
|
||||
Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity)
|
||||
Q_PROPERTY(qreal radius WRITE setRadius READ radius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(qreal opacity WRITE setOpacity READ opacity NOTIFY opacityChanged)
|
||||
|
||||
public:
|
||||
explicit Ripple(const QPoint ¢er, QObject *parent = nullptr);
|
||||
|
|
@ -48,6 +48,10 @@ public:
|
|||
protected slots:
|
||||
void destroy();
|
||||
|
||||
signals:
|
||||
void radiusChanged();
|
||||
void opacityChanged();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(Ripple)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ class SnackBar : public OverlayWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor bgColor READ backgroundColor WRITE setBackgroundColor)
|
||||
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
|
||||
Q_PROPERTY(
|
||||
QColor bgColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged)
|
||||
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor NOTIFY textColorChanged)
|
||||
Q_PROPERTY(double offset READ offset WRITE setOffset NOTIFY offsetChanged)
|
||||
|
||||
public:
|
||||
|
|
@ -34,6 +35,7 @@ public:
|
|||
{
|
||||
bgColor_ = color;
|
||||
update();
|
||||
emit backgroundColorChanged();
|
||||
}
|
||||
|
||||
QColor textColor() const { return textColor_; }
|
||||
|
|
@ -41,6 +43,7 @@ public:
|
|||
{
|
||||
textColor_ = color;
|
||||
update();
|
||||
emit textColorChanged();
|
||||
}
|
||||
void setPosition(SnackBarPosition pos)
|
||||
{
|
||||
|
|
@ -62,6 +65,8 @@ public slots:
|
|||
|
||||
signals:
|
||||
void offsetChanged();
|
||||
void backgroundColorChanged();
|
||||
void textColorChanged();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ void
|
|||
TextField::setBackgroundColor(const QColor &color)
|
||||
{
|
||||
background_color_ = color;
|
||||
emit backgroundColorChanged();
|
||||
}
|
||||
|
||||
QColor
|
||||
|
|
@ -130,6 +131,7 @@ void
|
|||
TextField::setLabelColor(const QColor &color)
|
||||
{
|
||||
label_color_ = color;
|
||||
emit labelColorChanged();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +149,7 @@ void
|
|||
TextField::setInkColor(const QColor &color)
|
||||
{
|
||||
ink_color_ = color;
|
||||
emit inkColorChanged();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +167,7 @@ void
|
|||
TextField::setUnderlineColor(const QColor &color)
|
||||
{
|
||||
underline_color_ = color;
|
||||
emit underlineColorChanged();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ class TextField : public QLineEdit
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor)
|
||||
Q_PROPERTY(QColor labelColor WRITE setLabelColor READ labelColor)
|
||||
Q_PROPERTY(QColor underlineColor WRITE setUnderlineColor READ underlineColor)
|
||||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor)
|
||||
Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor NOTIFY inkColorChanged)
|
||||
Q_PROPERTY(QColor labelColor WRITE setLabelColor READ labelColor NOTIFY labelColorChanged)
|
||||
Q_PROPERTY(QColor underlineColor WRITE setUnderlineColor READ underlineColor NOTIFY
|
||||
underlineColorChanged)
|
||||
Q_PROPERTY(QColor backgroundColor WRITE setBackgroundColor READ backgroundColor NOTIFY
|
||||
backgroundColorChanged)
|
||||
|
||||
public:
|
||||
explicit TextField(QWidget *parent = nullptr);
|
||||
|
|
@ -51,6 +53,12 @@ protected:
|
|||
bool event(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void inkColorChanged();
|
||||
void labelColorChanged();
|
||||
void underlineColorChanged();
|
||||
void backgroundColorChanged();
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
|
|
@ -71,9 +79,9 @@ class TextFieldLabel : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(qreal scale WRITE setScale READ scale)
|
||||
Q_PROPERTY(QPointF offset WRITE setOffset READ offset)
|
||||
Q_PROPERTY(QColor color WRITE setColor READ color)
|
||||
Q_PROPERTY(qreal scale WRITE setScale READ scale NOTIFY scaleChanged)
|
||||
Q_PROPERTY(QPointF offset WRITE setOffset READ offset NOTIFY offsetChanged)
|
||||
Q_PROPERTY(QColor color WRITE setColor READ color NOTIFY colorChanged)
|
||||
|
||||
public:
|
||||
TextFieldLabel(TextField *parent);
|
||||
|
|
@ -89,6 +97,11 @@ public:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void scaleChanged();
|
||||
void offsetChanged();
|
||||
void colorChanged();
|
||||
|
||||
private:
|
||||
TextField *const text_field_;
|
||||
|
||||
|
|
@ -102,6 +115,7 @@ inline void
|
|||
TextFieldLabel::setColor(const QColor &color)
|
||||
{
|
||||
color_ = color;
|
||||
emit colorChanged();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
@ -110,6 +124,7 @@ TextFieldLabel::setOffset(const QPointF &pos)
|
|||
{
|
||||
x_ = pos.x();
|
||||
y_ = pos.y();
|
||||
emit offsetChanged();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +132,7 @@ inline void
|
|||
TextFieldLabel::setScale(qreal scale)
|
||||
{
|
||||
scale_ = scale;
|
||||
emit scaleChanged();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +156,7 @@ class TextFieldStateMachine : public QStateMachine
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(qreal progress WRITE setProgress READ progress)
|
||||
Q_PROPERTY(qreal progress WRITE setProgress READ progress NOTIFY progressChanged)
|
||||
|
||||
public:
|
||||
TextFieldStateMachine(TextField *parent);
|
||||
|
|
@ -153,6 +169,9 @@ public:
|
|||
public slots:
|
||||
void setupProperties();
|
||||
|
||||
signals:
|
||||
void progressChanged();
|
||||
|
||||
private:
|
||||
QPropertyAnimation *color_anim_;
|
||||
QPropertyAnimation *offset_anim_;
|
||||
|
|
@ -170,6 +189,7 @@ inline void
|
|||
TextFieldStateMachine::setProgress(qreal progress)
|
||||
{
|
||||
progress_ = progress;
|
||||
emit progressChanged();
|
||||
text_field_->update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,41 +13,41 @@ Theme::paletteFromTheme(std::string_view theme)
|
|||
static QPalette original;
|
||||
if (theme == "light") {
|
||||
QPalette lightActive(
|
||||
/*windowText*/ QColor("#333"),
|
||||
/*button*/ QColor("white"),
|
||||
/*windowText*/ QColor(0x33, 0x33, 0x33),
|
||||
/*button*/ QColor(Qt::GlobalColor::white),
|
||||
/*light*/ QColor(0xef, 0xef, 0xef),
|
||||
/*dark*/ QColor(70, 77, 93),
|
||||
/*mid*/ QColor(220, 220, 220),
|
||||
/*text*/ QColor("#333"),
|
||||
/*bright_text*/ QColor("#f2f5f8"),
|
||||
/*base*/ QColor("#fff"),
|
||||
/*window*/ QColor("white"));
|
||||
lightActive.setColor(QPalette::AlternateBase, QColor("#eee"));
|
||||
lightActive.setColor(QPalette::Highlight, QColor("#38a3d8"));
|
||||
lightActive.setColor(QPalette::HighlightedText, QColor("#f4f4f5"));
|
||||
/*text*/ QColor(0x33, 0x33, 0x33),
|
||||
/*bright_text*/ QColor(0xf2, 0xf5, 0xf8),
|
||||
/*base*/ QColor(Qt::GlobalColor::white),
|
||||
/*window*/ QColor(Qt::GlobalColor::white));
|
||||
lightActive.setColor(QPalette::AlternateBase, QColor(0xee, 0xee, 0xee));
|
||||
lightActive.setColor(QPalette::Highlight, QColor(0x38, 0xa3, 0xd8));
|
||||
lightActive.setColor(QPalette::HighlightedText, QColor(0xf4, 0xf4, 0xf5));
|
||||
lightActive.setColor(QPalette::ToolTipBase, lightActive.base().color());
|
||||
lightActive.setColor(QPalette::ToolTipText, lightActive.text().color());
|
||||
lightActive.setColor(QPalette::Link, QColor("#0077b5"));
|
||||
lightActive.setColor(QPalette::ButtonText, QColor("#555459"));
|
||||
lightActive.setColor(QPalette::Link, QColor(0x00, 0x77, 0xb5));
|
||||
lightActive.setColor(QPalette::ButtonText, QColor(0x55, 0x54, 0x59));
|
||||
return lightActive;
|
||||
} else if (theme == "dark") {
|
||||
QPalette darkActive(
|
||||
/*windowText*/ QColor("#caccd1"),
|
||||
/*button*/ QColor(0xff, 0xff, 0xff),
|
||||
/*light*/ QColor("#caccd1"),
|
||||
/*windowText*/ QColor(0xca, 0xcc, 0xd1),
|
||||
/*button*/ QColor(Qt::GlobalColor::white),
|
||||
/*light*/ QColor(0xca, 0xcc, 0xd1),
|
||||
/*dark*/ QColor(60, 70, 77),
|
||||
/*mid*/ QColor("#202228"),
|
||||
/*text*/ QColor("#caccd1"),
|
||||
/*bright_text*/ QColor("#f4f5f8"),
|
||||
/*base*/ QColor("#202228"),
|
||||
/*window*/ QColor("#2d3139"));
|
||||
darkActive.setColor(QPalette::AlternateBase, QColor("#2d3139"));
|
||||
darkActive.setColor(QPalette::Highlight, QColor("#38a3d8"));
|
||||
darkActive.setColor(QPalette::HighlightedText, QColor("#f4f5f8"));
|
||||
/*mid*/ QColor(0x20, 0x22, 0x28),
|
||||
/*text*/ QColor(0xca, 0xcc, 0xd1),
|
||||
/*bright_text*/ QColor(0xf4, 0xf5, 0xf8),
|
||||
/*base*/ QColor(0x20, 0x22, 0x28),
|
||||
/*window*/ QColor(0x2d, 0x31, 0x39));
|
||||
darkActive.setColor(QPalette::AlternateBase, QColor(0x2d, 0x31, 0x39));
|
||||
darkActive.setColor(QPalette::Highlight, QColor(0x38, 0xa3, 0xd8));
|
||||
darkActive.setColor(QPalette::HighlightedText, QColor(0xf4, 0xf5, 0xf8));
|
||||
darkActive.setColor(QPalette::ToolTipBase, darkActive.base().color());
|
||||
darkActive.setColor(QPalette::ToolTipText, darkActive.text().color());
|
||||
darkActive.setColor(QPalette::Link, QColor("#38a3d8"));
|
||||
darkActive.setColor(QPalette::ButtonText, "#828284");
|
||||
darkActive.setColor(QPalette::Link, QColor(0x38, 0xa3, 0xd8));
|
||||
darkActive.setColor(QPalette::ButtonText, QColor(0x82, 0x82, 0x84));
|
||||
return darkActive;
|
||||
} else {
|
||||
return original;
|
||||
|
|
@ -59,19 +59,19 @@ Theme::Theme(std::string_view theme)
|
|||
auto p = paletteFromTheme(theme);
|
||||
separator_ = p.mid().color();
|
||||
if (theme == "light") {
|
||||
sidebarBackground_ = QColor("#233649");
|
||||
alternateButton_ = QColor("#ccc");
|
||||
red_ = QColor("#a82353");
|
||||
orange_ = QColor("#fcbe05");
|
||||
sidebarBackground_ = QColor(0x23, 0x36, 0x49);
|
||||
alternateButton_ = QColor(0xcc, 0xcc, 0xcc);
|
||||
red_ = QColor(0xa8, 0x23, 0x53);
|
||||
orange_ = QColor(0xfc, 0xbe, 0x05);
|
||||
} else if (theme == "dark") {
|
||||
sidebarBackground_ = QColor("#2d3139");
|
||||
alternateButton_ = QColor("#414A59");
|
||||
red_ = QColor("#a82353");
|
||||
orange_ = QColor("#fcc53a");
|
||||
sidebarBackground_ = QColor(0x2d, 0x31, 0x39);
|
||||
alternateButton_ = QColor(0x41, 0x4A, 0x59);
|
||||
red_ = QColor(0xa8, 0x23, 0x53);
|
||||
orange_ = QColor(0xfc, 0xc5, 0x3a);
|
||||
} else {
|
||||
sidebarBackground_ = p.window().color();
|
||||
alternateButton_ = p.dark().color();
|
||||
red_ = QColor("red");
|
||||
orange_ = QColor("orange");
|
||||
red_ = QColor(Qt::GlobalColor::red);
|
||||
orange_ = QColor(0xff, 0xa5, 0x00); // SVG orange
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,28 +10,28 @@ QColor
|
|||
ThemeManager::themeColor(const QString &key) const
|
||||
{
|
||||
if (key == "Black")
|
||||
return QColor("#171919");
|
||||
return QColor(0x17, 0x19, 0x19);
|
||||
|
||||
else if (key == "BrightWhite")
|
||||
return QColor("#EBEBEB");
|
||||
return QColor(0xEB, 0xEB, 0xEB);
|
||||
else if (key == "FadedWhite")
|
||||
return QColor("#C9C9C9");
|
||||
return QColor(0xC9, 0xC9, 0xC9);
|
||||
else if (key == "MediumWhite")
|
||||
return QColor("#929292");
|
||||
return QColor(0x92, 0x92, 0x92);
|
||||
|
||||
else if (key == "BrightGreen")
|
||||
return QColor("#1C3133");
|
||||
return QColor(0x1C, 0x31, 0x33);
|
||||
else if (key == "DarkGreen")
|
||||
return QColor("#577275");
|
||||
return QColor(0x57, 0x72, 0x75);
|
||||
else if (key == "LightGreen")
|
||||
return QColor("#46A451");
|
||||
return QColor(0x46, 0xA4, 0x51);
|
||||
|
||||
else if (key == "Gray")
|
||||
return QColor("#5D6565");
|
||||
return QColor(0x5D, 0x65, 0x65);
|
||||
else if (key == "Red")
|
||||
return QColor("#E22826");
|
||||
return QColor(0xE2, 0x28, 0x26);
|
||||
else if (key == "Blue")
|
||||
return QColor("#81B3A9");
|
||||
return QColor(0x81, 0xB3, 0xA9);
|
||||
|
||||
else if (key == "Transparent")
|
||||
return QColor(0, 0, 0, 0);
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ Toggle::setDisabledColor(const QColor &color)
|
|||
{
|
||||
disabledColor_ = color;
|
||||
setupProperties();
|
||||
emit disabledColorChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -76,6 +77,7 @@ Toggle::setActiveColor(const QColor &color)
|
|||
{
|
||||
activeColor_ = color;
|
||||
setupProperties();
|
||||
emit activeColorChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -83,6 +85,7 @@ Toggle::setInactiveColor(const QColor &color)
|
|||
{
|
||||
inactiveColor_ = color;
|
||||
setupProperties();
|
||||
emit inactiveColorChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -90,6 +93,7 @@ Toggle::setTrackColor(const QColor &color)
|
|||
{
|
||||
trackColor_ = color;
|
||||
setupProperties();
|
||||
emit trackColorChanged();
|
||||
}
|
||||
|
||||
ToggleThumb::ToggleThumb(Toggle *parent)
|
||||
|
|
@ -174,6 +178,7 @@ void
|
|||
ToggleTrack::setTrackColor(const QColor &color)
|
||||
{
|
||||
trackColor_ = color;
|
||||
emit trackColorChanged();
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ class Toggle : public QAbstractButton
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor activeColor WRITE setActiveColor READ activeColor)
|
||||
Q_PROPERTY(QColor disabledColor WRITE setDisabledColor READ disabledColor)
|
||||
Q_PROPERTY(QColor inactiveColor WRITE setInactiveColor READ inactiveColor)
|
||||
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor)
|
||||
Q_PROPERTY(QColor activeColor WRITE setActiveColor READ activeColor NOTIFY activeColorChanged)
|
||||
Q_PROPERTY(
|
||||
QColor disabledColor WRITE setDisabledColor READ disabledColor NOTIFY disabledColorChanged)
|
||||
Q_PROPERTY(
|
||||
QColor inactiveColor WRITE setInactiveColor READ inactiveColor NOTIFY inactiveColorChanged)
|
||||
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor NOTIFY trackColorChanged)
|
||||
|
||||
public:
|
||||
Toggle(QWidget *parent = nullptr);
|
||||
|
|
@ -38,13 +40,22 @@ public:
|
|||
QColor activeColor() const { return activeColor_; };
|
||||
QColor disabledColor() const { return disabledColor_; };
|
||||
QColor inactiveColor() const { return inactiveColor_; };
|
||||
QColor trackColor() const { return trackColor_.isValid() ? trackColor_ : QColor("#eee"); };
|
||||
QColor trackColor() const
|
||||
{
|
||||
return trackColor_.isValid() ? trackColor_ : QColor(0xee, 0xee, 0xee);
|
||||
};
|
||||
|
||||
QSize sizeHint() const override { return QSize(64, 48); };
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void activeColorChanged();
|
||||
void disabledColorChanged();
|
||||
void inactiveColorChanged();
|
||||
void trackColorChanged();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void setupProperties();
|
||||
|
|
@ -62,7 +73,7 @@ class ToggleThumb : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor thumbColor WRITE setThumbColor READ thumbColor)
|
||||
Q_PROPERTY(QColor thumbColor WRITE setThumbColor READ thumbColor NOTIFY thumbColorChanged)
|
||||
|
||||
public:
|
||||
ToggleThumb(Toggle *parent);
|
||||
|
|
@ -75,6 +86,7 @@ public:
|
|||
void setThumbColor(const QColor &color)
|
||||
{
|
||||
thumbColor_ = color;
|
||||
emit thumbColorChanged();
|
||||
update();
|
||||
};
|
||||
|
||||
|
|
@ -82,6 +94,9 @@ protected:
|
|||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void thumbColorChanged();
|
||||
|
||||
private:
|
||||
void updateOffset();
|
||||
|
||||
|
|
@ -96,7 +111,7 @@ class ToggleTrack : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor)
|
||||
Q_PROPERTY(QColor trackColor WRITE setTrackColor READ trackColor NOTIFY trackColor)
|
||||
|
||||
public:
|
||||
ToggleTrack(Toggle *parent);
|
||||
|
|
@ -108,6 +123,9 @@ protected:
|
|||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
signals:
|
||||
void trackColorChanged();
|
||||
|
||||
private:
|
||||
Toggle *const toggle_;
|
||||
QColor trackColor_;
|
||||
|
|
|
|||
|
|
@ -175,8 +175,6 @@ UserProfile::refreshDevices()
|
|||
void
|
||||
UserProfile::fetchDeviceList(const QString &userID)
|
||||
{
|
||||
auto localUser = utils::localUser();
|
||||
|
||||
if (!cache::client() || !cache::client()->isDatabaseReady())
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue