File indexing completed on 2024-05-05 05:28:20

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Dimitris Kardarakos <dimkard@posteo.net>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef DATAHANDLER_H
0008 #define DATAHANDLER_H
0009 
0010 #include <QObject>
0011 
0012 class QNetworkAccessManager;
0013 
0014 class DataHandler : public QObject
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     explicit DataHandler(QObject *parent = nullptr);
0020     ~DataHandler();
0021 
0022     Q_INVOKABLE void importFromUrl(const QUrl &url);
0023     void importData(const QByteArray &data);
0024 
0025     static DataHandler *instance();
0026 
0027 private:
0028     void importLocalFile(const QUrl &url);
0029 
0030     static DataHandler *s_instance;
0031 
0032     QNetworkAccessManager *m_network_manager;
0033 };
0034 #endif // DATAHANDLER_H
0035