Link Previews
Uses Matrix's preview API to generate embedded link previews. Only title and description for now. 
This commit is contained in:
committed by
Tobias Fella
parent
53b9f42399
commit
37780c2e3b
46
src/linkpreviewer.h
Normal file
46
src/linkpreviewer.h
Normal file
@@ -0,0 +1,46 @@
|
||||
// SPDX-FileCopyrightText: 2022 Bharadwaj Raju <bharadwaj.raju777@protonmail.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-or-later OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <connection.h>
|
||||
#include <csapi/content-repo.h>
|
||||
|
||||
#include <QObject>
|
||||
|
||||
using namespace Quotient;
|
||||
|
||||
class LinkPreviewer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
|
||||
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
|
||||
Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
|
||||
Q_PROPERTY(QString imageSource READ imageSource NOTIFY imageSourceChanged)
|
||||
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
|
||||
|
||||
public:
|
||||
explicit LinkPreviewer(QObject *parent = nullptr);
|
||||
|
||||
[[nodiscard]] bool loaded() const;
|
||||
[[nodiscard]] QString title() const;
|
||||
[[nodiscard]] QString description() const;
|
||||
[[nodiscard]] QString imageSource() const;
|
||||
[[nodiscard]] QUrl url() const;
|
||||
|
||||
void setUrl(QUrl);
|
||||
|
||||
private:
|
||||
bool m_loaded;
|
||||
QString m_title;
|
||||
QString m_description;
|
||||
QString m_imageSource;
|
||||
QUrl m_url;
|
||||
|
||||
Q_SIGNALS:
|
||||
void loadedChanged();
|
||||
void titleChanged();
|
||||
void descriptionChanged();
|
||||
void imageSourceChanged();
|
||||
void urlChanged();
|
||||
};
|
||||
Reference in New Issue
Block a user