More image dialog fixes

pull/1082/head
Nicolas Werner 3 years ago
parent 8f6ed458a6
commit a6b2be112b
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 3
      resources/qml/Root.qml
  2. 2
      resources/qml/delegates/ImageMessage.qml
  3. 13
      resources/qml/dialogs/ImageOverlay.qml
  4. 2
      resources/qml/dialogs/UserProfile.qml
  5. 3
      src/BlurhashProvider.h
  6. 3
      src/CacheCryptoStructs.h
  7. 3
      src/ColorImageProvider.h
  8. 4
      src/EventAccessors.h
  9. 3
      src/InviteesModel.cpp
  10. 3
      src/JdenticonProvider.cpp
  11. 5
      src/MainWindow.h
  12. 3
      src/MxcImageProvider.h
  13. 6
      src/dbus/NhekoDBusApi.cpp
  14. 3
      src/dbus/NhekoDBusBackend.cpp
  15. 2
      src/encryption/DeviceVerificationFlow.cpp
  16. 3
      src/encryption/VerificationManager.cpp
  17. 3
      src/main.cpp
  18. 3
      src/notifications/ManagerWin.cpp
  19. 3
      src/timeline/CommunitiesModel.cpp
  20. 3
      src/timeline/DelegateChooser.h
  21. 3
      src/timeline/InputBar.h
  22. 3
      src/timeline/PresenceEmitter.h
  23. 6
      src/timeline/TimelineModel.cpp
  24. 3
      src/timeline/TimelineModel.h
  25. 8
      src/timeline/TimelineViewManager.cpp
  26. 12
      src/timeline/TimelineViewManager.h
  27. 3
      src/ui/HiddenEvents.h
  28. 3
      src/ui/MxcAnimatedImage.cpp
  29. 3
      src/ui/NhekoCursorShape.cpp
  30. 3
      src/ui/UIA.h
  31. 9
      src/ui/UserProfile.h
  32. 3
      src/voip/CallDevices.cpp
  33. 2
      src/voip/CallDevices.h
  34. 9
      src/voip/WebRTCSession.cpp
  35. 2
      src/voip/WebRTCSession.h

@ -284,7 +284,7 @@ Pane {
destroyOnClose(dialog);
}
function onShowImageOverlay(room, eventId, url, proportionalHeight, originalWidth) {
function onShowImageOverlay(room, eventId, url, originalWidth, proportionalHeight) {
var dialog = imageOverlay.createObject(timelineRoot, {
"room": room,
"eventId": eventId,
@ -292,6 +292,7 @@ Pane {
"originalWidth": originalWidth ?? 0,
"proportionalHeight": proportionalHeight ?? 0
});
dialog.showFullScreen();
destroyOnClose(dialog);
}

@ -67,7 +67,7 @@ AbstractButton {
eventId: parent.eventId
}
onClicked :Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId);
onClicked :Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId, originalWidth, proportionalHeight);
Item {
id: overlay

@ -29,18 +29,17 @@ Window {
}
Item {
id: imgContainer
property int imgSrcWidth: (originalWidth && originalWidth > 200) ? originalWidth : Screen.width
property int imgSrcHeight: proportionalHeight ? imgSrcWidth * proportionalHeight : Screen.height
property int imgSrcWidth: (imageOverlay.originalWidth && imageOverlay.originalWidth > 100) ? imageOverlay.originalWidth : Screen.width
property int imgSrcHeight: imageOverlay.proportionalHeight ? imgSrcWidth * imageOverlay.proportionalHeight : Screen.height
height: Math.min(parent.height, imgSrcHeight)
width: Math.min(parent.width, imgSrcWidth)
height: Math.min(parent.height || Screen.height, imgSrcHeight)
width: Math.min(parent.width || Screen.width, imgSrcWidth)
x: (parent.width - width)
y: (parent.height - height)
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Image {
id: img

@ -66,7 +66,7 @@ ApplicationWindow {
displayName: profile.displayName
userid: profile.userid
Layout.alignment: Qt.AlignHCenter
onClicked: TimelineManager.openImageOverlay(null, profile.avatarUrl, "")
onClicked: TimelineManager.openImageOverlay(null, profile.avatarUrl, "", 0, 0)
ImageButton {
hoverEnabled: true

@ -20,7 +20,8 @@ public:
BlurhashRunnable(const QString &id, const QSize &requestedSize)
: m_id(id)
, m_requestedSize(requestedSize)
{}
{
}
void run() override;
signals:

@ -96,7 +96,8 @@ struct MegolmSessionIndex
MegolmSessionIndex(std::string room_id_, const mtx::events::msg::Encrypted &e)
: room_id(std::move(room_id_))
, session_id(e.session_id)
{}
{
}
//! The room in which this session exists.
std::string room_id;

@ -10,7 +10,8 @@ class ColorImageProvider : public QQuickImageProvider
public:
ColorImageProvider()
: QQuickImageProvider(QQuickImageProvider::Pixmap)
{}
{
}
QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override;
};

@ -15,8 +15,8 @@
namespace nheko {
struct nonesuch
{
~nonesuch() = delete;
nonesuch(nonesuch const &) = delete;
~nonesuch() = delete;
nonesuch(nonesuch const &) = delete;
void operator=(nonesuch const &) = delete;
};

@ -12,7 +12,8 @@
InviteesModel::InviteesModel(QObject *parent)
: QAbstractListModel{parent}
{}
{
}
void
InviteesModel::addUser(QString mxid)

@ -83,7 +83,8 @@ JdenticonRunnable::JdenticonRunnable(const QString &key,
, m_crop{crop}
, m_radius{radius}
, m_requestedSize(requestedSize.isValid() ? requestedSize : QSize(100, 100))
{}
{
}
void
JdenticonRunnable::run()

@ -56,7 +56,10 @@ public:
void showChatPage();
#ifdef NHEKO_DBUS_SYS
bool dbusAvailable() const { return dbusAvailable_; }
bool dbusAvailable() const
{
return dbusAvailable_;
}
#endif
Q_INVOKABLE void addPerRoomWindow(const QString &room, QWindow *window);

@ -29,7 +29,8 @@ public:
, m_requestedSize(requestedSize)
, m_crop(crop)
, m_radius(radius)
{}
{
}
void run();

@ -44,7 +44,8 @@ RoomInfoItem::RoomInfoItem(const QString &roomId,
, roomName_{title}
, image_{image}
, unreadNotifications_{unreadNotifications}
{}
{
}
RoomInfoItem::RoomInfoItem(const RoomInfoItem &other)
: QObject{other.parent()}
@ -53,7 +54,8 @@ RoomInfoItem::RoomInfoItem(const RoomInfoItem &other)
, roomName_{other.roomName_}
, image_{other.image_}
, unreadNotifications_{other.unreadNotifications_}
{}
{
}
RoomInfoItem &
RoomInfoItem::operator=(const RoomInfoItem &other)

@ -16,7 +16,8 @@
NhekoDBusBackend::NhekoDBusBackend(RoomlistModel *parent)
: QObject{parent}
, m_parent{parent}
{}
{
}
QVector<nheko::dbus::RoomInfoItem>
NhekoDBusBackend::rooms(const QDBusMessage &message)

@ -631,7 +631,7 @@ DeviceVerificationFlow::startVerificationRequest()
req.hashes = {"sha256"};
req.message_authentication_codes = {"hkdf-hmac-sha256"};
req.short_authentication_string = {mtx::events::msg::SASMethods::Decimal,
mtx::events::msg::SASMethods::Emoji};
mtx::events::msg::SASMethods::Emoji};
if (this->type == DeviceVerificationFlow::Type::ToDevice) {
mtx::requests::ToDeviceMessages<mtx::events::msg::KeyVerificationStart> body;

@ -15,7 +15,8 @@
VerificationManager::VerificationManager(TimelineViewManager *o)
: QObject(o)
, rooms_(o->rooms())
{}
{
}
static bool
isValidTime(std::optional<uint64_t> t)

@ -102,7 +102,8 @@ registerSignalHandlers()
// No implementation for systems with no stacktrace support.
void
registerSignalHandlers()
{}
{
}
#endif

@ -44,7 +44,8 @@ init()
NotificationsManager::NotificationsManager(QObject *parent)
: QObject(parent)
{}
{
}
void
NotificationsManager::postNotification(const mtx::responses::Notification &notification,

@ -14,7 +14,8 @@
CommunitiesModel::CommunitiesModel(QObject *parent)
: QAbstractListModel(parent)
{}
{
}
QHash<int, QByteArray>
CommunitiesModel::roleNames() const

@ -74,7 +74,8 @@ private:
DelegateIncubator(DelegateChooser &parent)
: QQmlIncubator(QQmlIncubator::AsynchronousIfNested)
, chooser(parent)
{}
{
}
void statusChanged(QQmlIncubator::Status status) override;
DelegateChooser &chooser;

@ -39,7 +39,8 @@ class InputVideoSurface : public QAbstractVideoSurface
public:
InputVideoSurface(QObject *parent)
: QAbstractVideoSurface(parent)
{}
{
}
bool present(const QVideoFrame &frame) override;

@ -19,7 +19,8 @@ class PresenceEmitter : public QObject
public:
PresenceEmitter(QObject *p = nullptr)
: QObject(p)
{}
{
}
void sync(const std::vector<mtx::events::Event<mtx::events::presence::Presence>> &presences);

@ -1366,7 +1366,8 @@ struct SendMessageVisitor
{
explicit SendMessageVisitor(TimelineModel *model)
: model_(model)
{}
{
}
template<typename T, mtx::events::EventType Event>
void sendRoomEvent(mtx::events::RoomEvent<T> msg)
@ -1390,7 +1391,8 @@ struct SendMessageVisitor
// Do-nothing operator for all unhandled events
template<typename T>
void operator()(const mtx::events::Event<T> &)
{}
{
}
// Operator for m.room.message events that contain a msgtype in their content
template<typename T,

@ -147,7 +147,8 @@ class StateKeeper
public:
StateKeeper(std::function<void()> &&fn)
: fn_(std::move(fn))
{}
{
}
~StateKeeper() { fn_(); }

@ -242,13 +242,17 @@ TimelineViewManager::escapeEmoji(QString str) const
}
void
TimelineViewManager::openImageOverlay(TimelineModel *room, QString mxcUrl, QString eventId)
TimelineViewManager::openImageOverlay(TimelineModel *room,
QString mxcUrl,
QString eventId,
double originalWidth,
double proportionalHeight)
{
if (mxcUrl.isEmpty()) {
return;
}
emit showImageOverlay(room, eventId, mxcUrl);
emit showImageOverlay(room, eventId, mxcUrl, originalWidth, proportionalHeight);
}
void

@ -54,7 +54,11 @@ public:
Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; }
bool isConnected() const { return isConnected_; }
Q_INVOKABLE void openImageOverlay(TimelineModel *room, QString mxcUrl, QString eventId);
Q_INVOKABLE void openImageOverlay(TimelineModel *room,
QString mxcUrl,
QString eventId,
double originalWidth,
double proportionalHeight);
Q_INVOKABLE void openImagePackSettings(QString roomid);
Q_INVOKABLE void saveMedia(QString mxcUrl);
Q_INVOKABLE QColor userColor(QString id, QColor background);
@ -87,7 +91,11 @@ signals:
void openProfile(UserProfile *profile);
void showImagePackSettings(TimelineModel *room, ImagePackListModel *packlist);
void openLeaveRoomDialog(QString roomid, QString reason = "");
void showImageOverlay(TimelineModel *room, QString eventId, QString url);
void showImageOverlay(TimelineModel *room,
QString eventId,
QString url,
double originalWidth,
double proportionalHeight);
public slots:
void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids);

@ -18,7 +18,8 @@ class HiddenEvents : public QObject
public:
explicit HiddenEvents(QObject *p = nullptr)
: QObject(p)
{}
{
}
Q_INVOKABLE void toggle(int type);
Q_INVOKABLE void save();

@ -193,7 +193,8 @@ MxcAnimatedImage::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeD
}
QSizeF r = img.size();
r.scale(size(), Qt::KeepAspectRatio);
if (height() != 0 || width() != 0)
r.scale(size(), Qt::KeepAspectRatio);
n->setRect((width() - r.width()) / 2, (height() - r.height()) / 2, r.width(), r.height());
n->setFiltering(QSGTexture::Linear);

@ -10,7 +10,8 @@
NhekoCursorShape::NhekoCursorShape(QQuickItem *parent)
: QQuickItem(parent)
, currentShape_(Qt::CursorShape::ArrowCursor)
{}
{
}
Qt::CursorShape
NhekoCursorShape::cursorShape() const

@ -20,7 +20,8 @@ public:
UIA(QObject *parent = nullptr)
: QObject(parent)
{}
{
}
mtx::http::UIAHandler genericHandler(QString context);

@ -45,7 +45,8 @@ public:
, verification_status(verification_status_)
, lastIp(lastIp_)
, lastTs(lastTs_)
{}
{
}
DeviceInfo(const QString deviceID,
const QString displayName,
verification::Status verification_status_)
@ -53,10 +54,12 @@ public:
, display_name(displayName)
, verification_status(verification_status_)
, lastTs(0)
{}
{
}
DeviceInfo()
: verification_status(verification::UNVERIFIED)
{}
{
}
QString device_id;
QString display_name;

@ -20,7 +20,8 @@ extern "C"
CallDevices::CallDevices()
: QObject()
{}
{
}
#ifdef GSTREAMER_AVAILABLE
namespace {

@ -43,6 +43,6 @@ private:
GstDevice *videoDevice(std::pair<int, int> &resolution, std::pair<int, int> &frameRate) const;
public:
CallDevices(CallDevices const &) = delete;
CallDevices(CallDevices const &) = delete;
void operator=(CallDevices const &) = delete;
};

@ -1152,7 +1152,8 @@ WebRTCSession::acceptAnswer(const std::string &)
void
WebRTCSession::acceptICECandidates(const std::vector<mtx::events::msg::CallCandidates::Candidate> &)
{}
{
}
bool
WebRTCSession::isMicMuted() const
@ -1168,10 +1169,12 @@ WebRTCSession::toggleMicMute()
void
WebRTCSession::toggleLocalPiP()
{}
{
}
void
WebRTCSession::end()
{}
{
}
#endif

@ -113,6 +113,6 @@ private:
void clear();
public:
WebRTCSession(WebRTCSession const &) = delete;
WebRTCSession(WebRTCSession const &) = delete;
void operator=(WebRTCSession const &) = delete;
};

Loading…
Cancel
Save