Qt World Summit Conference App
import QtQuick 2.0
import Felgo 4.0
SocialUserDelegate {
height: isLocalUser ? localUserCol.height : otherUserCol.height
property var userCustomData: gameNetworkUser.customData ? JSON.parse(gameNetworkUser.customData) : ({})
property bool isLocalUser: gameNetworkUser.userId === gameNetworkItem.user.userId
function updateCustomDataField(fieldName, newText) {
console.debug("updateCustomDataField", fieldName, "with new text:", newText)
var newUserData = JSON.parse(JSON.stringify(userCustomData))
newUserData[fieldName]= newText
gameNetworkItem.updateUserCustomData(JSON.stringify(newUserData))
}
function resetAllCustomDataFields() {
var newUserData = {}
gameNetworkItem.updateUserCustomData(JSON.stringify(newUserData))
}
property string dialogStatus: "none"
property var dialogValues
Connections {
target: nativeUtils
onAlertSheetFinished: {
if(dialogStatus == "none" || !dialogValues || index == -1) return
if(dialogStatus == "jobFunction" || dialogStatus == "qtInterest" || dialogStatus == "qtExperience") {
updateCustomDataField(dialogStatus, dialogValues[index])
}
dialogStatus = "none"
dialogValues = undefined
}
}
Column {
id: localUserCol
x: dp(Theme.navigationBar.defaultBarItemPadding)
width: parent.width - x
spacing: dp(Theme.navigationBar.defaultBarItemPadding)
visible: isLocalUser
Text {
text: qsTr("Enter these optional fields so other conference attendees can connect with you. The more infos you provide, the better others can find & connect with you.\n\nWith the Business Meet feature, you can search & filter the conference attendees. Simply enter one of the fields in the search bar of the business meet view, like the company name(e.g. 'Felgo'), the job function (e.g. 'developer'), the interest (e.g. 'mobile') or the experience level ('Qt Veteran').\n\nThe fields you enter will be displayed in the business meet view and also in the leaderboard.")
width: parent.width
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
}
Row {
spacing: dp(5)
AppIcon {
iconType: IconType.building
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Company") + ": " + userCustomData["companyName"]
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}
}
SocialViewButton {
text: qsTr("Set Company Name")
font.pixelSize: sp(13)
onClicked: {
NativeDialog.inputText(qsTr("What is your company name?"), "", qsTr("Your company name"), userCustomData["companyName"], function(ok, text) {
if(ok) {
updateCustomDataField("companyName", text)
amplitude.logEvent("Update Profile",{"field" : "companyName", "value" : text})
}
})
}
}
Row {
spacing: dp(5)
AppIcon {
iconType: IconType.suitcase
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Position: ") + userCustomData["jobFunction"] || ""
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}
}
SocialViewButton {
text: qsTr("Set Job Function")
font.pixelSize: sp(13)
onClicked: {
dialogStatus = "jobFunction"
if(system.desktopPlatform) {
var testIndex = 1
if(userCustomData["jobFunction"] == "Manager") {
testIndex = 0
}
nativeUtils.alertSheetFinished(testIndex)
} else {
dialogValues = ["Developer", "Manager", "Product Manager", "Designer", "Other"]
nativeUtils.displayAlertSheet("", ["Developer", "Manager", "Product Manager", "Designer", "Other"], true)
}
}
}
Row {
spacing: dp(5)
AppIcon {
iconType: IconType.tag
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Main Qt Interest: ") + userCustomData["qtInterest"] || ""
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}
}
SocialViewButton {
text: qsTr("Set Qt Interest")
font.pixelSize: sp(13)
onClicked: {
dialogStatus = "qtInterest"
if(system.desktopPlatform) {
var testIndex = 1
if(userCustomData["qtInterest"] == "Mobile") {
testIndex = 0
}
nativeUtils.alertSheetFinished(testIndex)
} else {
dialogValues = ["Desktop", "Mobile", "Automotive", "Automation", "Embedded", "Other"]
nativeUtils.displayAlertSheet("What is Your Main Qt Interest?", ["Desktop", "Mobile", "Automotive", "Automation", "Embedded", "Other"], true)
}
}
}
Row {
spacing: dp(5)
AppIcon {
iconType: IconType.graduationcap
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Qt XP Level: ") + userCustomData["qtExperience"] || ""
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}
}
SocialViewButton {
text: qsTr("Set Qt XP Level")
font.pixelSize: sp(13)
onClicked: {
dialogStatus = "qtExperience"
if(system.desktopPlatform) {
var testIndex = 1
if(userCustomData["qtExperience"] == "Qt Intermediate") {
testIndex = 0
}
nativeUtils.alertSheetFinished(testIndex)
} else {
dialogValues = ["Less than 1 year", "1-3 years", "More than 3 years"]
nativeUtils.displayAlertSheet("How long did you use Qt?", ["Less than 1 year", "1-3 years", "More than 3 years"], true)
}
}
}
SocialViewButton {
text: qsTr("Reset All Business Meet Fields")
font.pixelSize: sp(13)
onClicked: {
NativeDialog.confirm(qsTr("Reset Fields"), qsTr("Do you really want to reset all fields for businees meetings? You will probably get less connections at the conference if you do so."), function(ok) {
if(ok) {
resetAllCustomDataFields()
amplitude.logEvent("Reset Custom Fields")
}
})
}
}
}
Column {
id: otherUserCol
visible: !isLocalUser
x: dp(Theme.navigationBar.defaultBarItemPadding)
width: parent.width - x
spacing: dp(Theme.navigationBar.defaultBarItemPadding)
Row {
spacing: dp(5)
visible: !system.publishBuild || userCustomData["companyName"] !== undefined && userCustomData["companyName"] != ""
AppIcon {
iconType: IconType.building
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Company: ") + userCustomData["companyName"] || ""
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
spacing: dp(5)
visible: !system.publishBuild || (userCustomData["jobFunction"] !== undefined && userCustomData["jobFunction"] != "")
AppIcon {
iconType: IconType.suitcase
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Position: ") + userCustomData["jobFunction"] || ""
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
spacing: dp(5)
visible: !system.publishBuild || (userCustomData["qtInterest"] !== undefined && userCustomData["qtInterest"] != "")
AppIcon {
iconType: IconType.tag
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Main Qt Interest: ") + userCustomData["qtInterest"] || ""
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}
}
Row {
spacing: dp(5)
visible: !system.publishBuild || (userCustomData["qtExperience"] !== undefined && userCustomData["qtExperience"] != "")
AppIcon {
iconType: IconType.graduationcap
size: dp(12)
anchors.verticalCenter: parent.verticalCenter
width: dp(20)
}
Text {
text: qsTr("Qt XP Level: ") + userCustomData["qtExperience"] || ""
font.pixelSize: sp(13)
font.family: socialViewItem.bodyFontName
color: socialViewItem.bodyColor
anchors.verticalCenter: parent.verticalCenter
}