2018-10-23 18:52:13 +00:00
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
import QtQuick 2.7
|
|
|
|
import QtQuick.Controls 2.4
|
|
|
|
import QtQuick.Controls.Material 2.0
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: root
|
|
|
|
anchors.fill: parent
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
property alias image: imgProfileImg.source
|
|
|
|
property alias nick: lblNick.text
|
|
|
|
property alias onion: lblOnion.text
|
|
|
|
|
|
|
|
|
|
|
|
Item{ height: 6 }
|
|
|
|
|
|
|
|
Item { // PROFILE IMAGE
|
|
|
|
id: imgProfile
|
|
|
|
implicitWidth: 96
|
|
|
|
implicitHeight: 96
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
2018-10-25 00:13:03 +00:00
|
|
|
Rectangle { // WHITE CIRCLE BORDER
|
|
|
|
width: 96
|
|
|
|
height: 96
|
|
|
|
color: "#FFFFFF"
|
|
|
|
radius: width / 2
|
|
|
|
|
|
|
|
Image { // ACTUAL IMAGE
|
|
|
|
id: imgProfileImg
|
|
|
|
anchors.fill: parent
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Image { // INNER CIRCLE MASK
|
|
|
|
id: mask
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
visible: false
|
|
|
|
source: "qrc:/qml/images/extra/clipcircle.png"
|
|
|
|
}
|
|
|
|
|
|
|
|
OpacityMask { // WE PUT IT ALL TOGETHER ANNND
|
|
|
|
anchors.fill: imgProfileImg
|
|
|
|
source: imgProfileImg
|
|
|
|
maskSource: mask
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle { // TOR STATUS INDICATOR
|
|
|
|
color: "#FFFFFF"
|
|
|
|
width: 12
|
|
|
|
height: 12
|
|
|
|
radius: 3
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.margins: 8
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle { //0: no tor, 1: progress 0%, 2: progress 1-99%, 3: DONE
|
|
|
|
id: rectTorStatus
|
|
|
|
color: code == 3 ? "green": code == 2 ? "orange" : code == 1 ? "yellow" : "red"
|
|
|
|
width: 8
|
|
|
|
height: 8
|
|
|
|
radius: 2
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.margins: 2
|
|
|
|
|
|
|
|
property int code
|
|
|
|
property string message
|
|
|
|
property bool hovered
|
2018-10-23 18:52:13 +00:00
|
|
|
|
2018-10-25 00:13:03 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
|
|
|
|
onEntered: rectTorStatus.hovered = true
|
|
|
|
|
|
|
|
onExited: rectTorStatus.hovered = false
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ToolTip.visible: hovered
|
|
|
|
ToolTip.delay: 400
|
|
|
|
ToolTip.timeout: 5000
|
|
|
|
ToolTip.text: message
|
|
|
|
}
|
|
|
|
}
|
2018-10-23 18:52:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
InplaceEditText { // USER NICKNAME
|
|
|
|
id: lblNick
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
onUpdated: {
|
|
|
|
gcd.updateNick(lblNick.text)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: this doesnt quite fit everything :{
|
|
|
|
Label { // ONION ADDRESS
|
|
|
|
id: lblOnion
|
|
|
|
font.pixelSize: 6
|
|
|
|
Layout.fillWidth: true
|
|
|
|
padding: 3
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout { // TOOLS FOR EDITING PROFILE
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
|
|
|
|
TextEdit { // USED TO POWER THE COPY/PASTE BUTTON
|
|
|
|
id: txtHidden
|
|
|
|
visible: false
|
|
|
|
}
|
|
|
|
|
2018-10-28 02:49:14 +00:00
|
|
|
IconButton {
|
|
|
|
icon: awesome.icons.fa_clipboard
|
|
|
|
label: "copy"
|
2018-10-23 18:52:13 +00:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
gcd.popup("copied to clipboard!")
|
|
|
|
txtHidden.text = nick.replace(" ", "~") + "~" + onion
|
|
|
|
txtHidden.selectAll();
|
|
|
|
txtHidden.copy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-28 02:49:14 +00:00
|
|
|
IconButton {
|
|
|
|
icon: awesome.icons.fa_cog
|
|
|
|
//label: "settings"
|
2018-10-23 18:52:13 +00:00
|
|
|
|
|
|
|
onClicked: gcd.popup("not yet implemented, sorry :(")
|
|
|
|
}
|
|
|
|
|
2018-10-28 02:49:14 +00:00
|
|
|
IconButton {
|
|
|
|
icon: awesome.icons.fa_sign_out
|
|
|
|
//label: "sign out"
|
2018-10-23 18:52:13 +00:00
|
|
|
|
2018-10-28 02:49:14 +00:00
|
|
|
onClicked: {
|
|
|
|
gcd.popup("not yet implemented, sorry :(")
|
|
|
|
console.log(parse("💜", 20))
|
|
|
|
}
|
2018-10-23 18:52:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle { // ADD CONTACTS TEXTFIELD
|
|
|
|
width: parent.width - 4
|
|
|
|
height: 20
|
|
|
|
color: "#EDEDED"
|
|
|
|
border.color: "#AAAAAA"
|
|
|
|
border.width: 1
|
|
|
|
radius: 10
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
property string hint: "... paste an address here to add a contact ..."
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
font.pixelSize: 9
|
|
|
|
color: "#888888"
|
|
|
|
padding: 2
|
|
|
|
text: hint
|
|
|
|
|
|
|
|
onTextChanged: {
|
|
|
|
if (text != hint && text != "") {
|
|
|
|
console.log("to handle: "+text)
|
|
|
|
gcd.importString(text)
|
|
|
|
text = hint
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onFocusChanged: {
|
|
|
|
text = focus ? "" : hint
|
|
|
|
}
|
|
|
|
|
|
|
|
onCursorPositionChanged: {
|
|
|
|
text = focus ? "" : hint
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: gcd
|
|
|
|
|
|
|
|
onUpdateMyProfile: function(_nick, _onion, _image) {
|
|
|
|
nick = _nick
|
2018-10-28 02:49:14 +00:00
|
|
|
onion = "This is your address. You should give it out to people!\n" + _onion
|
2018-10-23 18:52:13 +00:00
|
|
|
image = _image
|
|
|
|
}
|
2018-10-25 00:13:03 +00:00
|
|
|
|
|
|
|
onTorStatus: function(code, str) {
|
|
|
|
rectTorStatus.code = code
|
|
|
|
rectTorStatus.message = str
|
|
|
|
}
|
2018-10-23 18:52:13 +00:00
|
|
|
}
|
|
|
|
}
|