mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-30 09:07:32 -04:00
Implement Android intent handling in qml app
AndroidManifest.xml register activity as an handler for retroshare links RetroShareQmlActivity...NativeCalls.cpp bring the intent data from java to C++ and then to QML QMl mainWindow uses URI.js to parse the received uri Create a singleton for qml engine so it is reachable from NativeCalls
This commit is contained in:
parent
29a3d105c4
commit
533dbef0c7
15 changed files with 239 additions and 26 deletions
|
@ -22,23 +22,15 @@
|
|||
#include <QQmlComponent>
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
# include <QtAndroidExtras>
|
||||
#endif
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
|
||||
#include "libresapilocalclient.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
#include "singletonqmlengine.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
/** When possible it is better to use +rsApi+ object directly instead of
|
||||
* multiple instances of +LibresapiLocalClient+ in Qml */
|
||||
qmlRegisterType<LibresapiLocalClient>(
|
||||
|
@ -51,6 +43,8 @@ int main(int argc, char *argv[])
|
|||
LibresapiLocalClient rsApi;
|
||||
rsApi.openConnection(sockPath);
|
||||
|
||||
QQmlApplicationEngine& engine(SingletonQmlEngine::instance());
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
engine.rootContext()->setContextProperty("QT_DEBUG", true);
|
||||
#else
|
||||
|
@ -61,9 +55,5 @@ int main(int argc, char *argv[])
|
|||
engine.rootContext()->setContextProperty("rsApi", &rsApi);
|
||||
engine.load(QUrl(QLatin1String("qrc:/qml/main.qml")));
|
||||
|
||||
QFileInfo fileInfo(sockPath);
|
||||
qDebug() << "QML APP:" << sockPath << fileInfo.exists()
|
||||
<< fileInfo.lastModified().toString();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue