Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

linker.h 603 Bytes
Newer Older
Camilo Higuita's avatar
Camilo Higuita committed
1 2 3 4
#ifndef LINKER_H
#define LINKER_H

#include <QObject>
Camilo Higuita's avatar
Camilo Higuita committed
5 6 7
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
8 9 10
#include "qgumbodocument.h"
#include "qgumbonode.h"

Camilo Higuita's avatar
Camilo Higuita committed
11 12 13
typedef QVariantMap LINK;

class Linker : public QObject
Camilo Higuita's avatar
Camilo Higuita committed
14 15 16
{
    Q_OBJECT
public:
Camilo Higuita's avatar
Camilo Higuita committed
17 18 19 20 21 22
    explicit Linker(QObject *parent = nullptr);

    Q_INVOKABLE void extract(const QString &url);

private:
    QByteArray getUrl(const QString &url);
23 24
    QStringList query(const QByteArray &array, const HtmlTag &tag, const QString &attribute = QString());

Camilo Higuita's avatar
Camilo Higuita committed
25
signals:
26
    void previewReady(QVariantMap link);
Camilo Higuita's avatar
Camilo Higuita committed
27 28

public slots:
Camilo Higuita's avatar
Camilo Higuita committed
29

Camilo Higuita's avatar
Camilo Higuita committed
30 31
};

Camilo Higuita's avatar
Camilo Higuita committed
32
#endif // LINKER_H