From 17a41dc96ae74aa884336ab2c31393b1d80b4e71 Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 17 Mar 2017 17:22:58 +0100 Subject: [PATCH] Multiple Qml app improvements LibresapiLocalClient::request(...) return a meaningful value ChatView.qml uses a TextField for message input TrustedNodesView.qml improve aestetic main.qml use stack based navigation and tool/menubar --- .../src/libresapilocalclient.cpp | 6 +- retroshare-qml-app/src/main.cpp | 8 +- retroshare-qml-app/src/qml.qrc | 8 +- retroshare-qml-app/src/qml/ChatView.qml | 29 ++- retroshare-qml-app/src/qml/Contacts.qml | 30 ++- .../src/qml/TrustedNodesView.qml | 108 ++++++++-- .../src/qml/icons/remove-link.png | Bin 0 -> 2035 bytes .../src/qml/icons/retroshare06.png | 1 + .../src/qml/icons/state-offline.png | Bin 0 -> 4498 bytes retroshare-qml-app/src/qml/icons/state-ok.png | Bin 0 -> 5080 bytes retroshare-qml-app/src/qml/main.qml | 197 +++++++++++------- retroshare-qml-app/src/retroshare-qml-app.pro | 3 +- 12 files changed, 266 insertions(+), 124 deletions(-) create mode 100644 retroshare-qml-app/src/qml/icons/remove-link.png create mode 120000 retroshare-qml-app/src/qml/icons/retroshare06.png create mode 100644 retroshare-qml-app/src/qml/icons/state-offline.png create mode 100644 retroshare-qml-app/src/qml/icons/state-ok.png diff --git a/retroshare-qml-app/src/libresapilocalclient.cpp b/retroshare-qml-app/src/libresapilocalclient.cpp index f30b3373c..29b7e7014 100644 --- a/retroshare-qml-app/src/libresapilocalclient.cpp +++ b/retroshare-qml-app/src/libresapilocalclient.cpp @@ -1,6 +1,6 @@ /* * RetroShare Android QML App - * Copyright (C) 2016 Gioacchino Mazzurco + * Copyright (C) 2016-2017 Gioacchino Mazzurco * Copyright (C) 2016 Manu Pineda * * This program is free software: you can redistribute it and/or modify @@ -38,9 +38,7 @@ int LibresapiLocalClient::request( const QString& path, const QString& jsonData, data.append(path); data.append('\n'); data.append(jsonData); data.append('\n'); callbackQueue.enqueue(callback); - mLocalSocket.write(data); - - return 1; + return mLocalSocket.write(data); } void LibresapiLocalClient::socketError(QLocalSocket::LocalSocketError) diff --git a/retroshare-qml-app/src/main.cpp b/retroshare-qml-app/src/main.cpp index 0be8e7b15..9b7d9226b 100644 --- a/retroshare-qml-app/src/main.cpp +++ b/retroshare-qml-app/src/main.cpp @@ -1,6 +1,6 @@ /* * RetroShare Android QML App - * Copyright (C) 2016 Gioacchino Mazzurco + * Copyright (C) 2016-2017 Gioacchino Mazzurco * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -39,7 +39,8 @@ int main(int argc, char *argv[]) QQmlApplicationEngine engine; - /// @deprecated + /** When possible it is better to use +rsApi+ object directly instead of + * multiple instances of +LibresapiLocalClient+ in Qml */ qmlRegisterType( "org.retroshare.qml_components.LibresapiLocalClient", 1, 0, "LibresapiLocalClient"); @@ -55,7 +56,8 @@ int main(int argc, char *argv[]) engine.load(QUrl(QLatin1String("qrc:/qml/main.qml"))); QFileInfo fileInfo(sockPath); - qDebug() << "QML APP:" << sockPath << fileInfo.exists() << fileInfo.lastModified().toString(); + qDebug() << "QML APP:" << sockPath << fileInfo.exists() + << fileInfo.lastModified().toString(); return app.exec(); } diff --git a/retroshare-qml-app/src/qml.qrc b/retroshare-qml-app/src/qml.qrc index 594c556fd..ee37d10d5 100644 --- a/retroshare-qml-app/src/qml.qrc +++ b/retroshare-qml-app/src/qml.qrc @@ -1,10 +1,6 @@ qml/main.qml - qml/icons/star-2-128.png - qml/icons/settings-4-128.png - qml/icons/email-128.png - qml/icons/contacts-128.png qml/Locations.qml qml/jsonpath.js qml/JSONListModel.qml @@ -13,5 +9,9 @@ qml/RsLoginPassView.qml qml/TrustedNodesView.qml qml/ChatView.qml + qml/icons/retroshare06.png + qml/icons/remove-link.png + qml/icons/state-offline.png + qml/icons/state-ok.png diff --git a/retroshare-qml-app/src/qml/ChatView.qml b/retroshare-qml-app/src/qml/ChatView.qml index 4a06b6dd9..9a4c4314b 100644 --- a/retroshare-qml-app/src/qml/ChatView.qml +++ b/retroshare-qml-app/src/qml/ChatView.qml @@ -1,3 +1,21 @@ +/* + * RetroShare Android QML App + * Copyright (C) 2016-2017 Gioacchino Mazzurco + * + * 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 . + */ + import QtQuick 2.0 import QtQuick.Controls 1.4 import org.retroshare.qml_components.LibresapiLocalClient 1.0 @@ -43,16 +61,7 @@ Item delegate: chatMessageDelegate } - Rectangle - { - color: "green" - anchors.bottom: parent.bottom - anchors.left: parent.left - width: chatView.width - sendButton.width - height: Math.max(20, msgComposer.height) - } - - TextEdit + TextField { id: msgComposer anchors.bottom: parent.bottom diff --git a/retroshare-qml-app/src/qml/Contacts.qml b/retroshare-qml-app/src/qml/Contacts.qml index 4ecd267ef..6a00257f8 100644 --- a/retroshare-qml-app/src/qml/Contacts.qml +++ b/retroshare-qml-app/src/qml/Contacts.qml @@ -1,6 +1,6 @@ /* * RetroShare Android QML App - * Copyright (C) 2016 Gioacchino Mazzurco + * Copyright (C) 2016-2017 Gioacchino Mazzurco * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -29,7 +29,15 @@ Item Component.onCompleted: refreshOwn() - function refreshData() { rsApi.request("/identity/*/", "", function(par) { locationsModel.json = par.response; if(contactsView.own_gxs_id == "") refreshOwn() }) } + function refreshData() + { + function refreshCallback(par) + { + locationsModel.json = par.response + if(contactsView.own_gxs_id == "") refreshOwn() + } + rsApi.request("/identity/*/", "", refreshCallback) + } function refreshOwn() { rsApi.request("/identity/own", "", function(par) @@ -43,6 +51,14 @@ Item else createIdentityDialog.visible = true }) } + function startChatCallback(par) + { + var chId = JSON.parse(par.response).data.chat_id + stackView.push({ + item:"qrc:/qml/ChatView.qml", + properties: {chatId: chId} + }) + } onFocusChanged: focus && refreshData() @@ -68,12 +84,16 @@ Item anchors.fill: parent onClicked: { - console.log("Contacts view onclicked:", model.name, model.gxs_id) + console.log("Contacts view onclicked:", model.name, + model.gxs_id) if(model.own) contactsView.own_gxs_id = model.gxs_id else { - var jsonData = { "own_gxs_hex": contactsView.own_gxs_id, "remote_gxs_hex": model.gxs_id } - rsApi.request("/chat/initiate_distant_chat", JSON.stringify(jsonData), function (par) { mainWindow.activeChatId = JSON.parse(par.response).data.chat_id }) + var jsonData = { "own_gxs_hex": contactsView.own_gxs_id, + "remote_gxs_hex": model.gxs_id } + rsApi.request("/chat/initiate_distant_chat", + JSON.stringify(jsonData), + contactsView.startChatCallback) } } Text diff --git a/retroshare-qml-app/src/qml/TrustedNodesView.qml b/retroshare-qml-app/src/qml/TrustedNodesView.qml index 2971bb27f..7f9a3b691 100644 --- a/retroshare-qml-app/src/qml/TrustedNodesView.qml +++ b/retroshare-qml-app/src/qml/TrustedNodesView.qml @@ -1,6 +1,6 @@ /* * RetroShare Android QML App - * Copyright (C) 2016 Gioacchino Mazzurco + * Copyright (C) 2016-2017 Gioacchino Mazzurco * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -18,17 +18,31 @@ import QtQuick 2.0 import QtQuick.Controls 1.4 +import QtQuick.Dialogs 1.2 import "jsonpath.js" as JSONPath Item { - function refreshData() { rsApi.request("/peers/*", "", function(par) { jsonModel.json = par.response }) } + id: trustedNodesView + + function refreshData() + { + rsApi.request("/peers/*", "", + function(par) { jsonModel.json = par.response }) + } onFocusChanged: focus && refreshData() JSONListModel { id: jsonModel query: "$.data[*]" + + function isOnline(pgpId) + { + var qr = "$.data[?(@.pgp_id=='"+pgpId+"')].locations[*].is_online" + var locArr = JSONPath.jsonPath(JSON.parse(jsonModel.json), qr) + return locArr.reduce(function(cur,acc){return cur || acc}, false) + } } ListView @@ -39,38 +53,92 @@ Item model: jsonModel.model delegate: Item { - height: 50 - Row - { - height: 30 - Text - { - text: model.name - onTextChanged: color = JSONPath.jsonPath(JSON.parse(jsonModel.json), "$.data[?(@.pgp_id=='"+model.pgp_id+"')].locations[*].is_online").reduce(function(cur,acc){return cur || acc}, false) ? "lime" : "darkslategray" - } + height: 30 + width: parent.width - Rectangle + Image + { + id: statusImage + source: jsonModel.isOnline(model.pgp_id) ? + "icons/state-ok.png" : + "icons/state-offline.png" + + height: parent.height - 4 + fillMode: Image.PreserveAspectFit + anchors.leftMargin: 6 + anchors.verticalCenter: parent.verticalCenter + } + Text + { + text: model.name + anchors.verticalCenter: parent.verticalCenter + anchors.left: statusImage.right + anchors.leftMargin: 10 + } + Image + { + source: "icons/remove-link.png" + + height: parent.height - 6 + fillMode: Image.PreserveAspectFit + + anchors.right: parent.right + anchors.rightMargin: 2 + anchors.verticalCenter: parent.verticalCenter + + MouseArea { height: parent.height - width: parent.height - color: "red" - - MouseArea + width: parent.width + onClicked: { - height: parent.height - width: parent.height - onClicked: rsApi.request("/peers/"+model.pgp_id+"/delete") + deleteDialog.nodeName = model.name + deleteDialog.nodeId = model.pgp_id + deleteDialog.visible = true } } } } } + Dialog + { + id: deleteDialog + property string nodeName + property string nodeId + standardButtons: StandardButton.Yes | StandardButton.No + visible: false + onYes: + { + rsApi.request("/peers/"+nodeId+"/delete") + trustedNodesView.refreshData() + trustedNodesView.forceActiveFocus() + } + onNo: trustedNodesView.forceActiveFocus() + Text + { + text: "Are you sure to delete " + deleteDialog.nodeName + " ("+ + deleteDialog.nodeId +") ?" + + width: parent.width - 2 + wrapMode: Text.Wrap + } + } + Button { id: bottomButton text: "Add Trusted Node" anchors.bottom: parent.bottom - onClicked: swipeView.currentIndex = 3 + onClicked: stackView.push({item:"qrc:/qml/AddTrustedNode.qml"}) + width: parent.width + } + + Timer + { + interval: 800 + repeat: true + onTriggered: if(trustedNodesView.visible) trustedNodesView.refreshData() + Component.onCompleted: start() } } diff --git a/retroshare-qml-app/src/qml/icons/remove-link.png b/retroshare-qml-app/src/qml/icons/remove-link.png new file mode 100644 index 0000000000000000000000000000000000000000..ae3650562ef2585c6a9432667cbea246d15b0b54 GIT binary patch literal 2035 zcmZ`)c~sJg7XE=Eg8Q0F4faw|K}*Y(LL@B>21zXpCq;8?N+%a`$3!NTN*l{9LlTS3 z77eo`b)KT;mRh!$l_f~Ir6rZADdMC5X3lwY&$-_{_nz~8=evL0b5D^;yS3nEZ~y?b z{CvFwl$H4-)zy^Pfer6d7F9alFGyV(4E0F1vWLa_9-sq2;l&>blJ7*BDu<@WeS(h% z#zq}a4o~V!z=jZJelv4hY`*U6h#WY7uk3ni} zRQF!Dx>w`sm;RG`?#j^x1w6$JALe4Z7GzfhF<*#zx^MU{KBDuqk^UYpr>(F{1%6u# zQv%G|)toh+N6zwpR?$K;eF}St5i2JS=G9!>yMsR0IQf$I72EvAeUY;@4UxI{OE;F% z2I`FXoDA4G9L@Ez-FIZ0nTAWW@tMv!6}MycQHDhU-RAjSgoc@;Baq&;b%r9k4RewV zJgx*T?F4Pl1*d33Wb5G)_g+7Lob9;u?LAI|#_67PYV=LIk)D>shvR(3=?LgS=LpBa zE%C#1E1)#y#jT;E=`OCWNIPIN=$|TomoG#Y?>QW^&gk6XnBhG9^`JC}NEq|N@Z5w{ zDvfrD-X&i>Fmm8j&nlnY{~EpQ*-qIYKe$%+%Vs;BGd&$8(WCFI{>`f&u$Dw#1eiOt zKjh%Ou_sqsXBx)S_BKK#XU8vc9wvAJ=N6y^ot-|h&E&P6m5c3p;|kyb?C<9Ov3sE+ z&Fyrj)IVl8Xpg;%S-#R;$)2l6^xR|WCnhGM+M{+DSlctfGCDL-45jS@^uBw%=}){Y z)0epat0rj_rpc0+Fe{p>H{=A_CB97>uuv}n7#&G(1^fWpbrqx5Cw1}a8~-14ys|@S(?Hqh-6DRb*($|IfS-|n7F%}>q({H#>lLYn* zU?~q*bN3P|Gkql(PV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--git a/retroshare-qml-app/src/qml/icons/retroshare06.png b/retroshare-qml-app/src/qml/icons/retroshare06.png new file mode 120000 index 000000000..5a5721ef1 --- /dev/null +++ b/retroshare-qml-app/src/qml/icons/retroshare06.png @@ -0,0 +1 @@ +../../../../data/128x128/apps/retroshare06.png \ No newline at end of file diff --git a/retroshare-qml-app/src/qml/icons/state-offline.png b/retroshare-qml-app/src/qml/icons/state-offline.png new file mode 100644 index 0000000000000000000000000000000000000000..b8236bd29afd80ef3670b79269424a7e78bf53bc GIT binary patch literal 4498 zcmV;D5pC{?P)S1cQ35Pv`H{#EK_iS942B<) z$)u~3cns_6h>p7M97h*+XJmF=*J*KdcHQ~mjIMg(?ySz4almLGRr#?X*fE9xLIxQH zCe4opL?WvQ8caHLSKa+1fr+uJ(w%fwb$9rj!yoj!uim%2ZeG2*@4fp7Nrczy6}xxu zo~dctbY{*LLR`hnlL1^xM8lbR1b|ThIspU#d`?8CnE4119c5-efSs9{neSIrR0Qq( zE>=Ny3m7bJw|g3ZWkj?Xz)b)yi@{|B09pXltEyUCS6BC546YfMB%}kBm6cr<3Qc^O3 znWqAn$IN*E@&Jq(K>K@%=uTOdcMqVhEyR@rNRo6T5&fQ-Cqz-L1HcAm{v8oDD2mcC zSRG!kSG2UW&ah{~hXbB>4}l4ZGKusW0Fop<2H^1s%|Bq~AE&3Mzg}5c zshX*)FC`@<*Q=`fV#<+nnJ833m1*%8sT+1c4A{eJ&03*{MNsRI-h6^#@^Yyohkf!W@al#~KlmXBJc zD;69)cu*ZTZd_GbTG})KSL@jk(bAlpoO-|C-)5maT`Y~SJDtu77>}HfGIL>7RaIR4 zIMLG3&=AVZ%)ARgje(g9z&c5ihFK)b5X&4ulB7}qe`R3u2@w_6)YN=rl_oQ&sHh0K zT(0HJ+-zVrm597nX)?l+L12%!?*)*hW1u7Atl2#i}0QG3eiXF!P#Zy7>Sg%koK0({4leOkp^jLWpOq)D#ZW2Z53#O$6|& zL0fO9r>EbyZ{I#PTZ`2kIB?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9LM#BG&04Zx!G$D}hJ(4HqM`{- zr*kt5j)Cb75gpew?NuR!Ja+8ZcPlC?f`b%nD{nQuJCj-64da{%iNxbe@^A3={-EE{ zyd+7N1E>XHw1FfXX94U5;0JJmna>hY!Z}3gt;>tDCQnUr1XWBR3VeqP@3-jb~WlB0JE1ITd0=POR z>Josit^hu6JAv%0WLAc&o8_2@^dB zds52;8F)eM81_hE;hZm{t$fh|Vua7Hvk}eXS&0Dw5BaQ9=s1SpDJbcCk zA2F{Jp)RFwJby4;bO4Lk)YLT22~hyhOby5(ARCNJ(0%acC;%PkUYg$y;0S^J8nB<3 kw!M=-|Gh|F=?2381FW19DiPiw5&!@I07*qoM6N<$g3F;ve*gdg literal 0 HcmV?d00001 diff --git a/retroshare-qml-app/src/qml/icons/state-ok.png b/retroshare-qml-app/src/qml/icons/state-ok.png new file mode 100644 index 0000000000000000000000000000000000000000..d4e84fdc3791c147dc0de04815401d4d7d524e18 GIT binary patch literal 5080 zcmV;}6DRD6P)K~#90?VW3M6jipz|GT=A4j}|1f+8}5kf(qk%)$rg4Gt1R zx+-b3aR%in;PrubM1_0ra>mScWGN#$KE?++8bDq58YQHw69gTJf`}4S9%9lsf=>*B zARS1D?yh}5bb=64Ro$Jgev#i77O8#e>}3Dz)TwjMK8KLRNRpJTC`thl?mY|1A-XXXdK` z^pDW3_W{@hV2$7Juc@uA{UJj4jX4P~fTE(Jvr|%1eosWx09+b{DjC2QB3kM9`(LT4 zsW}vdIt?RX1z@#W#}Ls%03v|Y7`fqL=G8>>s4UA{V&p@YNH_slt=2*!`fmW&#M+k* ztRtca9S+BPv34XB5=HR9`tgOiyTIGxVjv34XF;$8rvD5f*>eMEFO zV%OA%%5i4?TaO++$}1}?TVm~u7I7^ANs`7g^UDARb>TLL0DKC-#mp{25WY|p+5S z>6Mk0%|`eZE^#G*($dm_ilVFqP!K|~w*WjS%ksMhxz#CcUn2_pgFfPa<-}wFh3AMGgE+hR4 zmbegrBuSSr^Ev?M1Yy3Ph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mHhnt8Uz+k4#64H zKS*!#!k2y`!BP`75qx}bH|B176i0m?BV7dnHT|;&P2an`uG4o{#D;Q9N=mW>L6`zS z0&o=qXWS<*0^$3sd!cz?aHrs%+%b$+@WI$*$?#9yUbIp*`^%8A{KCRQbMM~0$0&+2 zoQQInIS)W@BFbRqq&YQ=323^iSKlLpQ-fM3(Z`aB1w*gLgWF#*yxAw>w^=YvZY+IK z^RqkYCvyykLAk4DJV-?Ui8%Rt67YP_A5(ANddo81^t1}DOu{Gtl`(Q*ouFVuD8UE1TL44IubMHDnU(+;5ryhp z0Pbs?ToIP=x&>eq49c&XRl-mf0W>bsw(7aCsedz>{z{-ZQiXD;gty=(5X2_~({mdi;&J6_Rf;bPLECj|)dLyu5 uM>9Z&0d|3@k- + * Copyright (C) 2016-2017 Gioacchino Mazzurco * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -24,94 +24,137 @@ ApplicationWindow { id: mainWindow visible: true - title: qsTr("RSChat") + title: "RetroShare" width: 400 height: 400 - property string activeChatId; - - Rectangle + toolBar: ToolBar { - id: mainView - anchors.fill: parent - states: - [ - State - { - name: "waiting_account_select" - PropertyChanges { target: swipeView; currentIndex: 0 } - PropertyChanges { target: locationsTab; enabled: true } - }, - State - { - name: "running_ok" - PropertyChanges { target: swipeView; currentIndex: 1 } - PropertyChanges { target: locationsTab; enabled: false } - }, - State - { - name: "running_ok_no_full_control" - PropertyChanges { target: swipeView; currentIndex: 1 } - PropertyChanges { target: locationsTab; enabled: false } - } - ] - - LibresapiLocalClient + Image { - onGoodResponseReceived: - { - var jsonReponse = JSON.parse(msg) - mainView.state = jsonReponse.data.runstate - } - Component.onCompleted: - { - openConnection(apiSocketPath) - request("/control/runstate/", "") - } + id: rsIcon + fillMode: Image.PreserveAspectFit + height: Math.max(30, parent.height - 4) + anchors.verticalCenter: parent.verticalCenter + source: "icons/retroshare06.png" } - - TabView + Label { - id: swipeView - anchors.fill: parent - visible: true - currentIndex: 0 + text: "RetroShare" + anchors.verticalCenter: parent.verticalCenter + anchors.left: rsIcon.right + anchors.leftMargin: 20 + } + } - Tab + menuBar: MenuBar + { + Menu + { + MenuItem { - title:"Locations" - id: locationsTab - Locations { onVisibleChanged: focus = visible } + text: "Trusted Nodes" + onTriggered: + stackView.push({item:"qrc:/qml/TrustedNodesView.qml"}) } - - Tab + MenuItem { - title: "Trusted Nodes" - TrustedNodesView { onVisibleChanged: focus = visible } - } - - Tab - { - title: "Contacts" - Contacts { onVisibleChanged: focus = visible } - } - - Tab - { - title: "Add Node" - AddTrustedNode { onVisibleChanged: focus = visible } - } - - Tab - { - title: "Chat" - ChatView - { - id: chatView - chatId: mainWindow.activeChatId - onVisibleChanged: focus = visible - } + text: "StackView State" + onTriggered: console.log(stackView.state, stackView.enabled) } } } + + StackView + { + id: stackView + anchors.fill: parent + Keys.onReleased: + if (event.key === Qt.Key_Back && stackView.depth > 1) + { + stackView.pop(); + event.accepted = true; + } + + function checkCoreStatus() + { + function runStateCallback(par) + { + var jsonReponse = JSON.parse(par.response) + var runState = jsonReponse.data.runstate + if(typeof(runState) === 'string') stackView.state = runState + else + { + stackView.state = "core_down" + console.log("runStateCallback(...) core is down") + } + } + var ret = rsApi.request("/control/runstate/", "", runStateCallback) + if ( ret < 1 ) + { + console.log("checkCoreStatus() core is down") + stackView.state = "core_down" + } + } + + Timer + { + id: refreshTimer + interval: 800 + repeat: true + onTriggered: if(stackView.visible) stackView.checkCoreStatus() + Component.onCompleted: start() + } + + state: "core_down" + states: [ + State + { + name: "core_down" + PropertyChanges { target: stackView; enabled: false } + }, + State + { + name: "waiting_account_select" + PropertyChanges { target: stackView; enabled: true } + StateChangeScript + { + script: + { + console.log("StateChangeScript waiting_account_select") + stackView.clear() + stackView.push({item:"qrc:/qml/Locations.qml"}) + } + } + }, + State + { + name: "running_ok" + PropertyChanges { target: stackView; enabled: true } + StateChangeScript + { + script: + { + console.log("StateChangeScript waiting_account_select") + stackView.clear() + stackView.push({item: "qrc:/qml/Contacts.qml"}) + } + } + }, + State + { + name: "running_ok_no_full_control" + PropertyChanges { target: stackView; state: "running_ok" } + } + ] + + initialItem: Rectangle + { + anchors.fill: parent + color: "green" + border.color: "black" + + Text { text: "Connecting to core..." } + } + } } diff --git a/retroshare-qml-app/src/retroshare-qml-app.pro b/retroshare-qml-app/src/retroshare-qml-app.pro index c878a8b09..ecdb19346 100644 --- a/retroshare-qml-app/src/retroshare-qml-app.pro +++ b/retroshare-qml-app/src/retroshare-qml-app.pro @@ -23,7 +23,8 @@ DISTFILES += \ android/res/values/libs.xml \ android/build.gradle \ android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew.bat + android/gradlew.bat \ + qml/icons/retroshare06.png ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android