2016-08-22 21:19:33 -04:00
|
|
|
/*
|
|
|
|
* RetroShare Android QML App
|
|
|
|
* Copyright (C) 2016 Gioacchino Mazzurco <gio@eigenlab.org>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
2016-09-04 09:01:44 -04:00
|
|
|
#include <QQmlContext>
|
|
|
|
#include <QQmlComponent>
|
2016-08-22 21:19:33 -04:00
|
|
|
#include <QDebug>
|
|
|
|
|
2016-09-15 07:07:13 -04:00
|
|
|
#ifdef __ANDROID__
|
|
|
|
# include <QtAndroidExtras>
|
|
|
|
#endif
|
|
|
|
|
2016-08-22 21:19:33 -04:00
|
|
|
#include <QFileInfo>
|
|
|
|
#include <QDateTime>
|
|
|
|
|
2016-09-04 09:01:44 -04:00
|
|
|
#include "libresapilocalclient.h"
|
2016-08-22 21:19:33 -04:00
|
|
|
#include "retroshare/rsinit.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2016-09-04 09:01:44 -04:00
|
|
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
|
|
QGuiApplication app(argc, argv);
|
2016-08-22 21:19:33 -04:00
|
|
|
|
2016-09-04 09:01:44 -04:00
|
|
|
QQmlApplicationEngine engine;
|
2016-09-15 07:07:13 -04:00
|
|
|
qmlRegisterType<LibresapiLocalClient>(
|
|
|
|
"org.retroshare.qml_components.LibresapiLocalClient", 1, 0,
|
|
|
|
"LibresapiLocalClient");
|
2016-08-22 21:19:33 -04:00
|
|
|
|
2016-09-04 09:01:44 -04:00
|
|
|
QString sockPath = QString::fromStdString(RsAccounts::ConfigDirectory());
|
|
|
|
sockPath.append("/libresapi.sock");
|
2016-08-22 21:19:33 -04:00
|
|
|
|
2016-09-15 07:07:13 -04:00
|
|
|
engine.rootContext()->setContextProperty("apiSocketPath", sockPath);
|
|
|
|
engine.load(QUrl(QLatin1String("qrc:/qml/main.qml")));
|
2016-08-22 21:19:33 -04:00
|
|
|
|
2016-09-15 07:07:13 -04:00
|
|
|
QFileInfo fileInfo(sockPath);
|
2016-08-22 21:19:33 -04:00
|
|
|
|
2016-09-15 07:07:13 -04:00
|
|
|
#ifdef __ANDROID__
|
2016-09-04 09:01:44 -04:00
|
|
|
qDebug() << "Is main.cpp running as a service?" << QtAndroid::androidService().isValid();
|
|
|
|
qDebug() << "Is main.cpp running as an activity?" << QtAndroid::androidActivity().isValid();
|
2016-09-15 07:07:13 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
qDebug() << "QML APP:" << sockPath << fileInfo.exists() << fileInfo.lastModified().toString();
|
2016-09-04 09:01:44 -04:00
|
|
|
|
|
|
|
return app.exec();
|
2016-08-22 21:19:33 -04:00
|
|
|
}
|