Retroshare android service now run and start at boot on android, the qml app is still disfunctional

This commit is contained in:
Gio 2016-08-23 03:19:33 +02:00
parent 68a00138d2
commit 279551fe8d
36 changed files with 1076 additions and 79 deletions

View file

@ -21,9 +21,9 @@
namespace resource_api{
ApiServerLocal::ApiServerLocal(ApiServer* server, QObject *parent) :
ApiServerLocal::ApiServerLocal(ApiServer* server, const QString &listenPath, QObject *parent) :
QObject(parent), serverThread(this),
localListener(server) // Must have no parent to be movable to other thread
localListener(server, listenPath) // Must have no parent to be movable to other thread
{
localListener.moveToThread(&serverThread);
serverThread.start();
@ -31,15 +31,17 @@ ApiServerLocal::ApiServerLocal(ApiServer* server, QObject *parent) :
ApiServerLocal::~ApiServerLocal() { serverThread.quit(); }
ApiLocalListener::ApiLocalListener(ApiServer *server, QObject *parent) :
ApiLocalListener::ApiLocalListener(ApiServer *server,
const QString &listenPath,
QObject *parent) :
QObject(parent), mApiServer(server), mLocalServer(this)
{
mLocalServer.removeServer(serverName());
mLocalServer.removeServer(listenPath);
#if QT_VERSION >= 0x050000
mLocalServer.setSocketOptions(QLocalServer::UserAccessOption);
#endif
connect(&mLocalServer, SIGNAL(newConnection()), this, SLOT(handleConnection()));
mLocalServer.listen(serverName());
mLocalServer.listen(listenPath);
}
void ApiLocalListener::handleConnection()

View file

@ -34,16 +34,9 @@ class ApiLocalListener : public QObject
Q_OBJECT
public:
ApiLocalListener(ApiServer* server, QObject *parent=0);
ApiLocalListener(ApiServer* server, const QString &listenPath, QObject *parent=0);
~ApiLocalListener() { mLocalServer.close(); }
const static QString& serverName()
{
const static QString sockPath(RsAccounts::AccountDirectory()
.append("/libresapi.sock").c_str());
return sockPath;
}
public slots:
void handleConnection();
@ -57,9 +50,23 @@ class ApiServerLocal : public QObject
Q_OBJECT
public:
ApiServerLocal(ApiServer* server, QObject *parent=0);
ApiServerLocal(ApiServer* server, const QString& listenPath, QObject *parent=0);
~ApiServerLocal();
const static QString& loginServerPath()
{
const static QString sockPath(RsAccounts::ConfigDirectory()
.append("/libresapi.sock").c_str());
return sockPath;
}
const static QString& serverPath()
{
const static QString sockPath(RsAccounts::AccountDirectory()
.append("/libresapi.sock").c_str());
return sockPath;
}
private:
QThread serverThread;
ApiLocalListener localListener;