mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Simplify QML to work better on both Desktop and Phone
- Set request method to GET by default in ApiLocalConnectionHandler to avoid /peers request fail randomly - Use TabView instead of SwipeView to not depend on Qt 5.7.0 (latest version) - AddTrustedNode simplified layout to avoid unexpected behaviour on some phones - Locations add sslid property to root Item to avoid unexpected behaviour when multiple locations are available - TrustedNodesView color connected friends with green and offline with grey - Ignore kdevelop 4 files
This commit is contained in:
parent
ea42d822c2
commit
10ec1144eb
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,3 +10,5 @@ Makefile*
|
||||
*~
|
||||
Thumbs.db
|
||||
*.pro.user
|
||||
.kdev4
|
||||
*.kdev4
|
||||
|
@ -73,13 +73,14 @@ void ApiLocalConnectionHandler::handlePendingRequests()
|
||||
{
|
||||
if(mLocalSocket->canReadLine())
|
||||
{
|
||||
readPath:
|
||||
readPath:
|
||||
QString rString(mLocalSocket->readLine());
|
||||
rString = rString.simplified();
|
||||
if (!rString.isEmpty())
|
||||
{
|
||||
if(rString.startsWith("PUT", Qt::CaseInsensitive)) reqMeth = resource_api::Request::PUT;
|
||||
else if (rString.startsWith("DELETE", Qt::CaseInsensitive)) reqMeth = resource_api::Request::DELETE_AA;
|
||||
else reqMeth = resource_api::Request::GET;
|
||||
if(rString.contains(' ')) rString = rString.split(' ')[1];
|
||||
|
||||
reqPath = rString.toStdString();
|
||||
|
@ -27,19 +27,30 @@ Item
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
id: colLayout
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: rowLayout.top
|
||||
anchors.fill: parent
|
||||
|
||||
|
||||
TextField { id: myKeyField }
|
||||
TextField { id: otherKeyField }
|
||||
}
|
||||
|
||||
RowLayout
|
||||
Button
|
||||
{
|
||||
id: rowLayout
|
||||
anchors.top: colLayout.bottom
|
||||
id: bottomButton
|
||||
text: "Add trusted node"
|
||||
onClicked:
|
||||
{
|
||||
console.log("retroshare addtrusted: ", otherKeyField.text)
|
||||
var jsonData =
|
||||
{
|
||||
cert_string: otherKeyField.text,
|
||||
flags:
|
||||
{
|
||||
allow_direct_download: true,
|
||||
allow_push: false,
|
||||
require_whitelist: false,
|
||||
}
|
||||
}
|
||||
console.log("retroshare addtrusted jsonData: ", JSON.stringify(jsonData))
|
||||
//rsApi.request("/peers/examine_cert/", JSON.stringify({ cert_string: otherKeyField.text }))
|
||||
rsApi.request("PUT /peers", JSON.stringify(jsonData))
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
@ -60,29 +71,8 @@ Item
|
||||
otherKeyField.paste()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: bottomButton
|
||||
text: "Add trusted node"
|
||||
anchors.bottom: parent.bottom
|
||||
onClicked:
|
||||
{
|
||||
console.log("retroshare addtrusted: ", otherKeyField.text)
|
||||
var jsonData =
|
||||
{
|
||||
cert_string: otherKeyField.text,
|
||||
flags:
|
||||
{
|
||||
allow_direct_download: true,
|
||||
allow_push: false,
|
||||
require_whitelist: false,
|
||||
}
|
||||
}
|
||||
console.log("retroshare addtrusted jsonData: ", JSON.stringify(jsonData))
|
||||
//rsApi.request("/peers/examine_cert/", JSON.stringify({ cert_string: otherKeyField.text }))
|
||||
rsApi.request("PUT /peers", JSON.stringify(jsonData))
|
||||
}
|
||||
TextField { id: myKeyField }
|
||||
TextField { id: otherKeyField }
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ Item
|
||||
property var qParent
|
||||
property bool attemptLogin: false
|
||||
property string password
|
||||
property string sslid
|
||||
|
||||
states:
|
||||
[
|
||||
@ -67,7 +68,8 @@ Item
|
||||
onSubmit:
|
||||
{
|
||||
locationView.password = password
|
||||
rsApi.request("/control/login/", JSON.stringify({id: locationsListView.currentItem.sslid}))
|
||||
console.log("locationView.sslid: ", locationView.sslid)
|
||||
rsApi.request("/control/login/", JSON.stringify({id: locationView.sslid}))
|
||||
locationView.attemptLogin = true
|
||||
busyIndicator.running = true
|
||||
attemptTimer.start()
|
||||
@ -148,10 +150,10 @@ Item
|
||||
delegate: Button
|
||||
{
|
||||
text: model.name
|
||||
property string sslid: model.id
|
||||
onClicked:
|
||||
{
|
||||
loginView.login = text
|
||||
locationView.sslid = model.id
|
||||
locationView.state = "login"
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,11 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
import org.retroshare.qml_components.LibresapiLocalClient 1.0
|
||||
import "jsonpath.js" as JSONPath
|
||||
|
||||
Item
|
||||
{
|
||||
function refreshData() { rsApi.request("/peers", "") }
|
||||
function refreshData() { rsApi.request("/peers/*", "") }
|
||||
|
||||
onFocusChanged: focus && refreshData()
|
||||
|
||||
@ -45,7 +46,11 @@ Item
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: bottomButton.top
|
||||
model: jsonModel.model
|
||||
delegate: Text { text: model.name }
|
||||
delegate: 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"
|
||||
}
|
||||
}
|
||||
|
||||
Button
|
||||
@ -53,6 +58,6 @@ Item
|
||||
id: bottomButton
|
||||
text: "Add Trusted Node"
|
||||
anchors.bottom: parent.bottom
|
||||
onClicked: swipeView.currentIndex = addTrustedNodeView.SwipeView.index
|
||||
onClicked: swipeView.currentIndex = 3
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
import org.retroshare.qml_components.LibresapiLocalClient 1.0
|
||||
|
||||
ApplicationWindow
|
||||
@ -25,28 +25,32 @@ ApplicationWindow
|
||||
id: mainWindow
|
||||
visible: true
|
||||
title: qsTr("RSChat")
|
||||
width: 400
|
||||
height: 400
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: mainView
|
||||
anchors.fill: parent;
|
||||
|
||||
anchors.fill: parent
|
||||
states:
|
||||
[
|
||||
State
|
||||
{
|
||||
name: "waiting_account_select";
|
||||
PropertyChanges { target: swipeView; currentIndex: locationsView.SwipeView.index }
|
||||
name: "waiting_account_select"
|
||||
PropertyChanges { target: swipeView; currentIndex: 0 }
|
||||
PropertyChanges { target: locationsTab; enabled: true }
|
||||
},
|
||||
State
|
||||
{
|
||||
name: "running_ok"
|
||||
//PropertyChanges { target: swipeView; currentIndex: contactsView.SwipeView.index }
|
||||
PropertyChanges { target: swipeView; currentIndex: 1 }
|
||||
PropertyChanges { target: locationsTab; enabled: false }
|
||||
},
|
||||
State
|
||||
{
|
||||
name: "running_ok_no_full_control"
|
||||
//PropertyChanges { target: swipeView; currentIndex: contactsView.SwipeView.index }
|
||||
PropertyChanges { target: swipeView; currentIndex: 1 }
|
||||
PropertyChanges { target: locationsTab; enabled: false }
|
||||
}
|
||||
]
|
||||
|
||||
@ -64,53 +68,42 @@ ApplicationWindow
|
||||
}
|
||||
}
|
||||
|
||||
SwipeView
|
||||
TabView
|
||||
{
|
||||
id: swipeView
|
||||
anchors.fill: parent
|
||||
visible: true
|
||||
currentIndex: 0
|
||||
|
||||
Locations
|
||||
Tab
|
||||
{
|
||||
id: locationsView
|
||||
visible: true
|
||||
qParent: swipeView
|
||||
title:"Locations"
|
||||
id: locationsTab
|
||||
Locations { onVisibleChanged: focus = visible }
|
||||
}
|
||||
|
||||
TrustedNodesView { id: trustedNodesView }
|
||||
|
||||
Contacts
|
||||
Tab
|
||||
{
|
||||
id: contactsView
|
||||
visible: true
|
||||
title: "Trusted Nodes"
|
||||
TrustedNodesView { onVisibleChanged: focus = visible }
|
||||
}
|
||||
|
||||
Rectangle
|
||||
Tab
|
||||
{
|
||||
color: "red"
|
||||
width: 100
|
||||
height: 100
|
||||
title: "Contacts"
|
||||
Contacts { onVisibleChanged: focus = visible }
|
||||
}
|
||||
|
||||
Rectangle
|
||||
Tab
|
||||
{
|
||||
color: "green"
|
||||
width: 100
|
||||
height: 100
|
||||
title: "Add Node"
|
||||
AddTrustedNode { onVisibleChanged: focus = visible }
|
||||
}
|
||||
|
||||
Rectangle
|
||||
Tab
|
||||
{
|
||||
color: "blue"
|
||||
width: 100
|
||||
height: 100
|
||||
}
|
||||
|
||||
AddTrustedNode
|
||||
{
|
||||
id: addTrustedNodeView
|
||||
visible: true
|
||||
title: "Blue"
|
||||
Rectangle { color: "blue"; anchors.fill: parent }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user