Document linkpreviewer
This commit is contained in:
@@ -6,25 +6,52 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class LinkPreviewer
|
||||||
|
*
|
||||||
|
* A class to download the link preview info for a URL and provide a QML interface for it.
|
||||||
|
*
|
||||||
|
* To use set the URL property and then access the other parameters which will be
|
||||||
|
* populated once loaded is true.
|
||||||
|
*/
|
||||||
class LinkPreviewer : public QObject
|
class LinkPreviewer : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
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)
|
* @brief The URL to get the preview for.
|
||||||
Q_PROPERTY(QString imageSource READ imageSource NOTIFY imageSourceChanged)
|
*/
|
||||||
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
|
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Whether the preview information has been loaded.
|
||||||
|
*/
|
||||||
|
Q_PROPERTY(bool loaded READ loaded NOTIFY loadedChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The title of the preview.
|
||||||
|
*/
|
||||||
|
Q_PROPERTY(QString title READ title NOTIFY titleChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The description of the preview.
|
||||||
|
*/
|
||||||
|
Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The image source for the preview.
|
||||||
|
*/
|
||||||
|
Q_PROPERTY(QString imageSource READ imageSource NOTIFY imageSourceChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LinkPreviewer(QObject *parent = nullptr);
|
explicit LinkPreviewer(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
[[nodiscard]] QUrl url() const;
|
||||||
|
void setUrl(QUrl);
|
||||||
[[nodiscard]] bool loaded() const;
|
[[nodiscard]] bool loaded() const;
|
||||||
[[nodiscard]] QString title() const;
|
[[nodiscard]] QString title() const;
|
||||||
[[nodiscard]] QString description() const;
|
[[nodiscard]] QString description() const;
|
||||||
[[nodiscard]] QString imageSource() const;
|
[[nodiscard]] QString imageSource() const;
|
||||||
[[nodiscard]] QUrl url() const;
|
|
||||||
|
|
||||||
void setUrl(QUrl);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_loaded;
|
bool m_loaded;
|
||||||
|
|||||||
Reference in New Issue
Block a user