mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 23:23:11 +02:00
now you can forget connections
This commit is contained in:
parent
384f404602
commit
61ece265f4
3 changed files with 112 additions and 6 deletions
|
@ -14,6 +14,7 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import "../styles-uit"
|
import "../styles-uit"
|
||||||
|
import "../controls-uit" as HifiControls
|
||||||
import "toolbars"
|
import "toolbars"
|
||||||
|
|
||||||
// references Users, UserActivityLogger, MyAvatar, Vec3, Quat, AddressManager from root context
|
// references Users, UserActivityLogger, MyAvatar, Vec3, Quat, AddressManager from root context
|
||||||
|
@ -42,6 +43,7 @@ Item {
|
||||||
property bool selected: false
|
property bool selected: false
|
||||||
property bool isAdmin: false
|
property bool isAdmin: false
|
||||||
property bool isPresent: true
|
property bool isPresent: true
|
||||||
|
property string placeName: ""
|
||||||
property string profilePicBorderColor: (connectionStatus == "connection" ? hifi.colors.indigoAccent : (connectionStatus == "friend" ? hifi.colors.greenHighlight : "transparent"))
|
property string profilePicBorderColor: (connectionStatus == "connection" ? hifi.colors.indigoAccent : (connectionStatus == "friend" ? hifi.colors.greenHighlight : "transparent"))
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -316,9 +318,10 @@ Item {
|
||||||
visible: thisNameCard.userName !== "";
|
visible: thisNameCard.userName !== "";
|
||||||
// Size
|
// Size
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: pal.activeTab == "nearbyTab" || isMyCard ? usernameTextPixelSize + 4 : parent.height;
|
height: usernameTextPixelSize + 4
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: isMyCard ? myDisplayName.bottom : (pal.activeTab == "nearbyTab" ? displayNameContainer.bottom : parent.top);
|
anchors.top: isMyCard ? myDisplayName.bottom : pal.activeTab == "nearbyTab" ? displayNameContainer.bottom : undefined //(parent.height - displayNameTextPixelSize/2));
|
||||||
|
anchors.verticalCenter: pal.activeTab == "connectionsTab" ? avatarImage.verticalCenter : undefined
|
||||||
anchors.left: avatarImage.right;
|
anchors.left: avatarImage.right;
|
||||||
anchors.leftMargin: avatarImage.visible ? 5 : 0;
|
anchors.leftMargin: avatarImage.visible ? 5 : 0;
|
||||||
anchors.rightMargin: 5;
|
anchors.rightMargin: 5;
|
||||||
|
@ -346,6 +349,93 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
StateImage {
|
||||||
|
id: nameCardConnectionInfoImage
|
||||||
|
visible: selected && !isMyCard && pal.activeTab == "connectionsTab"
|
||||||
|
imageURL: "../../images/info-icon-2-state.svg" // PLACEHOLDER!!!
|
||||||
|
size: 32;
|
||||||
|
buttonState: 0;
|
||||||
|
anchors.left: avatarImage.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill:nameCardConnectionInfoImage
|
||||||
|
enabled: selected
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: {
|
||||||
|
userInfoViewer.url = defaultBaseUrl + "/users/" + userName;
|
||||||
|
userInfoViewer.visible = true;
|
||||||
|
}
|
||||||
|
onEntered: {
|
||||||
|
nameCardConnectionInfoImage.buttonState = 1;
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
nameCardConnectionInfoImage.buttonState = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FiraSansRegular {
|
||||||
|
id: nameCardConnectionInfoText
|
||||||
|
visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard
|
||||||
|
width: parent.width
|
||||||
|
height: displayNameTextPixelSize
|
||||||
|
size: displayNameTextPixelSize - 4
|
||||||
|
anchors.left: nameCardConnectionInfoImage.right
|
||||||
|
anchors.verticalCenter: nameCardConnectionInfoImage.verticalCenter
|
||||||
|
anchors.leftMargin: 5
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: "Info"
|
||||||
|
color: hifi.colors.baseGray
|
||||||
|
}
|
||||||
|
StateImage {
|
||||||
|
id: nameCardRemoveConnectionImage
|
||||||
|
visible: selected && !isMyCard && pal.activeTab == "connectionsTab"
|
||||||
|
imageURL: "../../images/info-icon-2-state.svg" // PLACEHOLDER!!!
|
||||||
|
size: 32;
|
||||||
|
buttonState: 0;
|
||||||
|
x: 120
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill:nameCardRemoveConnectionImage
|
||||||
|
enabled: selected
|
||||||
|
hoverEnabled: true
|
||||||
|
onClicked: {
|
||||||
|
// send message to pal.js to forgetConnection
|
||||||
|
pal.sendToScript({method: 'removeConnection', params: thisNameCard.userName});
|
||||||
|
}
|
||||||
|
onEntered: {
|
||||||
|
nameCardRemoveConnectionImage.buttonState = 1;
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
nameCardRemoveConnectionImage.buttonState = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FiraSansRegular {
|
||||||
|
id: nameCardRemoveConnectionText
|
||||||
|
visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard
|
||||||
|
width: parent.width
|
||||||
|
height: displayNameTextPixelSize
|
||||||
|
size: displayNameTextPixelSize - 4
|
||||||
|
anchors.left: nameCardRemoveConnectionImage.right
|
||||||
|
anchors.verticalCenter: nameCardRemoveConnectionImage.verticalCenter
|
||||||
|
anchors.leftMargin: 5
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: "Forget"
|
||||||
|
color: hifi.colors.baseGray
|
||||||
|
}
|
||||||
|
HifiControls.Button {
|
||||||
|
id: visitConnectionButton
|
||||||
|
visible: selected && !isMyCard && pal.activeTab == "connectionsTab" && !isMyCard
|
||||||
|
text: "Visit"
|
||||||
|
enabled: thisNameCard.placeName !== ""
|
||||||
|
anchors.verticalCenter: nameCardRemoveConnectionImage.verticalCenter
|
||||||
|
x: 240
|
||||||
|
onClicked: {
|
||||||
|
AddressManager.goToUser(thisNameCard.userName);
|
||||||
|
UserActivityLogger.palAction("go_to_user", thisNameCard.userName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// VU Meter
|
// VU Meter
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: nameCardVUMeter
|
id: nameCardVUMeter
|
||||||
|
@ -484,7 +574,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateGainFromQML(avatarUuid, sliderValue, isReleased) {
|
function updateGainFromQML(avatarUuid, sliderValue, isReleased) {
|
||||||
Users.setAvatarGain(avatarUuid, sliderValue);
|
Users.setAvatarGain(avatarUuid, sliderValue);
|
||||||
if (isReleased) {
|
if (isReleased) {
|
||||||
|
|
|
@ -763,7 +763,7 @@ Rectangle {
|
||||||
// This Rectangle refers to each Row in the connectionsTable.
|
// This Rectangle refers to each Row in the connectionsTable.
|
||||||
rowDelegate: Rectangle {
|
rowDelegate: Rectangle {
|
||||||
// Size
|
// Size
|
||||||
height: rowHeight;
|
height: rowHeight + (styleData.selected ? 15 : 0);
|
||||||
color: rowColor(styleData.selected, styleData.alternate);
|
color: rowColor(styleData.selected, styleData.alternate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,6 +779,7 @@ Rectangle {
|
||||||
profileUrl: (model && model.profileUrl) || "";
|
profileUrl: (model && model.profileUrl) || "";
|
||||||
displayName: "";
|
displayName: "";
|
||||||
userName: model ? model.userName : "";
|
userName: model ? model.userName : "";
|
||||||
|
placeName: model ? model.placeName : ""
|
||||||
connectionStatus : model ? model.connection : "";
|
connectionStatus : model ? model.connection : "";
|
||||||
selected: styleData.selected;
|
selected: styleData.selected;
|
||||||
// Size
|
// Size
|
||||||
|
@ -792,7 +793,7 @@ Rectangle {
|
||||||
FiraSansRegular {
|
FiraSansRegular {
|
||||||
id: connectionsLocationData
|
id: connectionsLocationData
|
||||||
// Properties
|
// Properties
|
||||||
visible: styleData.role === "placeName";
|
visible: !connectionsNameCard.selected && styleData.role === "placeName";
|
||||||
text: (model && model.placeName) || "";
|
text: (model && model.placeName) || "";
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight;
|
||||||
// Size
|
// Size
|
||||||
|
@ -822,7 +823,7 @@ Rectangle {
|
||||||
// "Friends" checkbox
|
// "Friends" checkbox
|
||||||
HifiControlsUit.CheckBox {
|
HifiControlsUit.CheckBox {
|
||||||
id: friendsCheckBox;
|
id: friendsCheckBox;
|
||||||
visible: styleData.role === "friends" && model.userName !== myData.userName;
|
visible: styleData.role === "friends" && model && model.userName !== myData.userName;
|
||||||
anchors.centerIn: parent;
|
anchors.centerIn: parent;
|
||||||
checked: model ? (model["connection"] === "friend" ? true : false) : false;
|
checked: model ? (model["connection"] === "friend" ? true : false) : false;
|
||||||
boxSize: 24;
|
boxSize: 24;
|
||||||
|
|
|
@ -269,6 +269,21 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
||||||
getConnectionData();
|
getConnectionData();
|
||||||
UserActivityLogger.palAction("refresh_connections", "");
|
UserActivityLogger.palAction("refresh_connections", "");
|
||||||
break;
|
break;
|
||||||
|
case 'removeConnection':
|
||||||
|
connectionUserName = message.params;
|
||||||
|
request({
|
||||||
|
uri: METAVERSE_BASE + '/api/v1/user/connections/' + connectionUserName,
|
||||||
|
method: 'DELETE'
|
||||||
|
}, function (error, response) {
|
||||||
|
print(JSON.stringify(response));
|
||||||
|
if (error || (response.status !== 'success')) {
|
||||||
|
print("Error: unable to remove connection", connectionUserName, error || response.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
getConnectionData();
|
||||||
|
});
|
||||||
|
break
|
||||||
|
|
||||||
case 'removeFriend':
|
case 'removeFriend':
|
||||||
friendUserName = message.params;
|
friendUserName = message.params;
|
||||||
request({
|
request({
|
||||||
|
|
Loading…
Reference in a new issue