network: provide common HTTP GET functionality with js callbacks

This commit is contained in:
xiphon
2020-03-31 16:29:28 +00:00
parent d07da76383
commit 58987b2ec6
6 changed files with 86 additions and 109 deletions

20
src/qt/network.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include <QCoreApplication>
#include <QtNetwork>
#include "FutureScheduler.h"
class Network : public QObject
{
Q_OBJECT
public:
Network(QObject *parent = nullptr);
public:
Q_INVOKABLE void get(const QString &url, const QJSValue &callback, const QString &contentType = {}) const;
Q_INVOKABLE void getJSON(const QString &url, const QJSValue &callback) const;
private:
mutable FutureScheduler m_scheduler;
};