QML activity interacts with backend.

Test QML activity changed for a simplified version of drbob's rsqml-models.
It requests JSON documents from the libresapilocalserver and shows them raw.
Updated Android documentation.
Moved Android qmake section to the end of libretroshare.pro and openpgpsdk.pro
to avoid static linking errors.
This commit is contained in:
manu 2016-09-04 15:01:44 +02:00
parent 47944b30e6
commit 50fe3dd711
29 changed files with 886 additions and 128 deletions

View file

@ -0,0 +1,64 @@
/*
* libresapi local socket client
* Copyright (C) 2016 Manu Pineda <manu@cooperativa.cat>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBRESAPILOCALCLIENT_H
#define LIBRESAPILOCALCLIENT_H
#include <QLocalSocket>
#include <QDir>
#include <QJsonDocument>
#include <QVector>
class LibresapiLocalClient : public QObject
{
Q_OBJECT
public:
LibresapiLocalClient() {}
// LibresapiLocalClient(const LibresapiLocalClient & l);
LibresapiLocalClient(const QString & socketPath);
// potser abstreure el següent amb QUrl urlPath (path) i amb QJson jsonData.
Q_INVOKABLE int request(const QString & path, const QString & jsonData);
const QJsonDocument & getJson();
Q_INVOKABLE void openConnection();
private:
QString mSocketPath;
QLocalSocket mLocalSocket;
QByteArray receivedBytes;
QJsonDocument json;
//QVector<QJsonDocument> responses;
bool parseResponse(); //std::string msg);
private slots:
void socketError(QLocalSocket::LocalSocketError error);
void read();
signals:
void goodResponseReceived(const QString & msg);//, int requestId);
public slots:
};
#endif // LIBRESAPILOCALCLIENT_H