Browse Source

Merge branch 'add-profile' of dan/ui into master

pull/246/head
Sarah Jamie Lewis 1 month ago
parent
commit
5ca2fa6332

+ 36
- 10
go/ui/gcd.go View File

@@ -41,6 +41,8 @@ type GrandCentralDispatcher struct {
_ func(handle, displayname, image string) `signal:"AddProfile"`
_ func() `signal:"ErrorLoaded0"`
_ func() `signal:"ResetProfile"`
_ func() `signal:"ResetProfileList"`
_ func(onion string) `signal:"deleteProfile"`

// contact list stuff
_ func(handle, displayName, image, server string, badge, status int, blocked bool, loading bool, lastMsgTime int) `signal:"AddContact"`
@@ -72,6 +74,16 @@ type GrandCentralDispatcher struct {
_ func(onion, nick string, blocked bool) `signal:"SupplyPeerSettings"`

// signals emitted from the ui (written in go, below)
// ui
_ func() `signal:"onActivate,auto"`
_ func(locale string) `signal:"setLocale,auto"`
// profile managemenet
_ func(onion, nick string) `signal:"updateNick,auto"`
_ func(handle string) `signal:"loadProfile,auto"`
_ func(nick, password string) `signal:"createProfile,auto"`
_ func(password string) `signal:"unlockProfiles,auto"`
_ func() `signal:"reloadProfileList,auto"`
// operating a profile
_ func(message string, mid string) `signal:"sendMessage,auto"`
_ func(onion string) `signal:"blockPeer,auto"`
_ func(onion string) `signal:"unblockPeer,auto"`
@@ -80,7 +92,6 @@ type GrandCentralDispatcher struct {
_ func(str string) `signal:"importString,auto"`
_ func(str string) `signal:"createContact,auto"`
_ func(str string) `signal:"popup,auto"`
_ func(nick string) `signal:"updateNick,auto"`
_ func(server, groupName string) `signal:"createGroup,auto"`
_ func(groupID string) `signal:"leaveGroup,auto"`
_ func(groupID string) `signal:"acceptGroup,auto"`
@@ -93,12 +104,8 @@ type GrandCentralDispatcher struct {
_ func(onion, groupID string) `signal:"inviteToGroup,auto"`
_ func(onion, key, nick string) `signal:"setAttribute,auto"`
_ func(onion string) `signal:"deleteContact,auto"`
_ func(locale string) `signal:"setLocale,auto"`
_ func() `signal:"allowUnknownPeers,auto"`
_ func() `signal:"blockUnknownPeers,auto"`
_ func() `signal:"onActivate,auto"`
_ func(password string) `signal:"unlockProfiles,auto"`
_ func(handle string) `signal:"loadProfile,auto"`

_ func() `constructor:"init"`
}
@@ -473,11 +480,14 @@ func (this *GrandCentralDispatcher) popup(str string) {
this.InvokePopup(str)
}

func (this *GrandCentralDispatcher) updateNick(nick string) {
the.Peer.GetProfile().Name = nick
the.EventBus.Publish(event.NewEvent(event.SetProfileName, map[event.Field]string{
event.ProfileName: nick,
}))
func (this *GrandCentralDispatcher) updateNick(onion, nick string) {
peer := the.CwtchApp.GetPeer(onion)
if peer != nil {
peer.GetProfile().Name = nick
the.CwtchApp.GetEventBus(onion).Publish(event.NewEvent(event.SetProfileName, map[event.Field]string{
event.ProfileName: nick,
}))
}
}

func (this *GrandCentralDispatcher) createGroup(server, groupName string) {
@@ -608,3 +618,19 @@ func (this *GrandCentralDispatcher) loadProfile(onion string) {
this.SetLocale_helper(locale)
}
}

func (this *GrandCentralDispatcher) createProfile(nick, password string) {
the.CwtchApp.CreatePeer(nick, password)
}

func (this *GrandCentralDispatcher) reloadProfileList() {
this.ResetProfileList()

for onion, _ := range the.CwtchApp.ListPeers() {
AddProfile(this, onion)
}
}

func (this *GrandCentralDispatcher) deleteProfile(onion string) {
//the.CwtchApp.
}

+ 90
- 5
i18n/translation_de.ts View File

@@ -164,25 +164,25 @@
<context>
<name>MyProfile</name>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="183"/>
<location filename="../qml/widgets/MyProfile.qml" line="185"/>
<source>copy-btn</source>
<extracomment>Button for copying profile onion address to clipboard</extracomment>
<translation>Kopieren</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="187"/>
<location filename="../qml/widgets/MyProfile.qml" line="189"/>
<source>copied-clipboard-notification</source>
<extracomment>Copied to clipboard</extracomment>
<translation>in die Zwischenablage kopiert</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="217"/>
<location filename="../qml/widgets/MyProfile.qml" line="219"/>
<source>new-group-btn</source>
<extracomment>create new group button</extracomment>
<translation>Neue Gruppe anlegen</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="227"/>
<location filename="../qml/widgets/MyProfile.qml" line="229"/>
<source>paste-address-to-add-contact</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<translation>Adresse hier hinzufügen, um einen Kontakt aufzunehmen</translation>
@@ -274,6 +274,91 @@
</message>
</context>
<context>
<name>ProfileAddEditPane</name>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>add-profile-title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>edit-profile-title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="80"/>
<source>profile-name</source>
<extracomment>Profile name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="27"/>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="88"/>
<source>default-profile-name</source>
<extracomment>default suggested profile name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="69"/>
<source>profile-onion-label</source>
<extracomment>Profile Onion</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="93"/>
<source>password1-label</source>
<extracomment>Password</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="107"/>
<source>password2-label</source>
<extracomment>Reenter password</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>create-profile-btn</source>
<extracomment>Create Profile || Save Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>save-profile-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="141"/>
<source>password-error-match</source>
<extracomment>Passwords do not match</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="148"/>
<source>delete-profile-btn</source>
<extracomment>Delete Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="162"/>
<source>delete-confirm-label</source>
<extracomment>Type DELETE to confirm</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="176"/>
<source>delete-profile-confirm-btn</source>
<extracomment>Really Delete Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="182"/>
<source>delete-confirm-text</source>
<extracomment>DELETE</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProfileManagerPane</name>
<message>
<location filename="../qml/panes/ProfileManagerPane.qml" line="26"/>
@@ -339,7 +424,7 @@
<context>
<name>StackToolbar</name>
<message>
<location filename="../qml/widgets/StackToolbar.qml" line="52"/>
<location filename="../qml/widgets/StackToolbar.qml" line="59"/>
<source>view-group-membership-tooltip</source>
<extracomment>View Group Membership</extracomment>
<translation type="unfinished"></translation>

BIN
i18n/translation_en.qm View File


+ 90
- 5
i18n/translation_en.ts View File

@@ -164,25 +164,25 @@
<context>
<name>MyProfile</name>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="183"/>
<location filename="../qml/widgets/MyProfile.qml" line="185"/>
<source>copy-btn</source>
<extracomment>Button for copying profile onion address to clipboard</extracomment>
<translation>Copy</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="187"/>
<location filename="../qml/widgets/MyProfile.qml" line="189"/>
<source>copied-clipboard-notification</source>
<extracomment>Copied to clipboard</extracomment>
<translation>Copied to clipboard</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="217"/>
<location filename="../qml/widgets/MyProfile.qml" line="219"/>
<source>new-group-btn</source>
<extracomment>create new group button</extracomment>
<translation>Create new group</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="227"/>
<location filename="../qml/widgets/MyProfile.qml" line="229"/>
<source>paste-address-to-add-contact</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<translation>... paste an address here to add a contact...</translation>
@@ -274,6 +274,91 @@
</message>
</context>
<context>
<name>ProfileAddEditPane</name>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>add-profile-title</source>
<translation>Add new profile</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>edit-profile-title</source>
<translation>Edit Profile</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="80"/>
<source>profile-name</source>
<extracomment>Profile name</extracomment>
<translation>Display name</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="27"/>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="88"/>
<source>default-profile-name</source>
<extracomment>default suggested profile name</extracomment>
<translation>Alice</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="69"/>
<source>profile-onion-label</source>
<extracomment>Profile Onion</extracomment>
<translation>Onion</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="93"/>
<source>password1-label</source>
<extracomment>Password</extracomment>
<translation>Password</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="107"/>
<source>password2-label</source>
<extracomment>Reenter password</extracomment>
<translation>Password</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>create-profile-btn</source>
<extracomment>Create Profile || Save Profile</extracomment>
<translation>Create Profile</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>save-profile-btn</source>
<translation>Save Profile</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="141"/>
<source>password-error-match</source>
<extracomment>Passwords do not match</extracomment>
<translation>Passwords do not match</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="148"/>
<source>delete-profile-btn</source>
<extracomment>Delete Profile</extracomment>
<translation>Delete Profile</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="162"/>
<source>delete-confirm-label</source>
<extracomment>Type DELETE to confirm</extracomment>
<translation>Type DELETE to confirm</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="176"/>
<source>delete-profile-confirm-btn</source>
<extracomment>Really Delete Profile</extracomment>
<translation>Really Delete Profile</translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="182"/>
<source>delete-confirm-text</source>
<extracomment>DELETE</extracomment>
<translation>DELETE</translation>
</message>
</context>
<context>
<name>ProfileManagerPane</name>
<message>
<location filename="../qml/panes/ProfileManagerPane.qml" line="26"/>
@@ -339,7 +424,7 @@
<context>
<name>StackToolbar</name>
<message>
<location filename="../qml/widgets/StackToolbar.qml" line="52"/>
<location filename="../qml/widgets/StackToolbar.qml" line="59"/>
<source>view-group-membership-tooltip</source>
<extracomment>View Group Membership</extracomment>
<translation>View Group Membership</translation>

+ 90
- 5
i18n/translation_fr.ts View File

@@ -164,25 +164,25 @@
<context>
<name>MyProfile</name>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="183"/>
<location filename="../qml/widgets/MyProfile.qml" line="185"/>
<source>copy-btn</source>
<extracomment>Button for copying profile onion address to clipboard</extracomment>
<translation>Copier</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="187"/>
<location filename="../qml/widgets/MyProfile.qml" line="189"/>
<source>copied-clipboard-notification</source>
<extracomment>Copied to clipboard</extracomment>
<translation>Copié dans le presse-papier</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="217"/>
<location filename="../qml/widgets/MyProfile.qml" line="219"/>
<source>new-group-btn</source>
<extracomment>create new group button</extracomment>
<translation>Créer un nouveau groupe</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="227"/>
<location filename="../qml/widgets/MyProfile.qml" line="229"/>
<source>paste-address-to-add-contact</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<translation>... coller une adresse ici pour ajouter un contact...</translation>
@@ -274,6 +274,91 @@
</message>
</context>
<context>
<name>ProfileAddEditPane</name>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>add-profile-title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>edit-profile-title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="80"/>
<source>profile-name</source>
<extracomment>Profile name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="27"/>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="88"/>
<source>default-profile-name</source>
<extracomment>default suggested profile name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="69"/>
<source>profile-onion-label</source>
<extracomment>Profile Onion</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="93"/>
<source>password1-label</source>
<extracomment>Password</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="107"/>
<source>password2-label</source>
<extracomment>Reenter password</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>create-profile-btn</source>
<extracomment>Create Profile || Save Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>save-profile-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="141"/>
<source>password-error-match</source>
<extracomment>Passwords do not match</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="148"/>
<source>delete-profile-btn</source>
<extracomment>Delete Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="162"/>
<source>delete-confirm-label</source>
<extracomment>Type DELETE to confirm</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="176"/>
<source>delete-profile-confirm-btn</source>
<extracomment>Really Delete Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="182"/>
<source>delete-confirm-text</source>
<extracomment>DELETE</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProfileManagerPane</name>
<message>
<location filename="../qml/panes/ProfileManagerPane.qml" line="26"/>
@@ -339,7 +424,7 @@
<context>
<name>StackToolbar</name>
<message>
<location filename="../qml/widgets/StackToolbar.qml" line="52"/>
<location filename="../qml/widgets/StackToolbar.qml" line="59"/>
<source>view-group-membership-tooltip</source>
<extracomment>View Group Membership</extracomment>
<translation type="unfinished"></translation>

+ 90
- 5
i18n/translation_pt.ts View File

@@ -164,25 +164,25 @@
<context>
<name>MyProfile</name>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="183"/>
<location filename="../qml/widgets/MyProfile.qml" line="185"/>
<source>copy-btn</source>
<extracomment>Button for copying profile onion address to clipboard</extracomment>
<translation>Copiar</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="187"/>
<location filename="../qml/widgets/MyProfile.qml" line="189"/>
<source>copied-clipboard-notification</source>
<extracomment>Copied to clipboard</extracomment>
<translation>Copiado</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="217"/>
<location filename="../qml/widgets/MyProfile.qml" line="219"/>
<source>new-group-btn</source>
<extracomment>create new group button</extracomment>
<translation>Criar novo grupo</translation>
</message>
<message>
<location filename="../qml/widgets/MyProfile.qml" line="227"/>
<location filename="../qml/widgets/MyProfile.qml" line="229"/>
<source>paste-address-to-add-contact</source>
<extracomment>ex: &quot;... paste an address here to add a contact ...&quot;</extracomment>
<translation>… cole um endereço aqui para adicionar um contato…</translation>
@@ -274,6 +274,91 @@
</message>
</context>
<context>
<name>ProfileAddEditPane</name>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>add-profile-title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="20"/>
<source>edit-profile-title</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="80"/>
<source>profile-name</source>
<extracomment>Profile name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="27"/>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="88"/>
<source>default-profile-name</source>
<extracomment>default suggested profile name</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="69"/>
<source>profile-onion-label</source>
<extracomment>Profile Onion</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="93"/>
<source>password1-label</source>
<extracomment>Password</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="107"/>
<source>password2-label</source>
<extracomment>Reenter password</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>create-profile-btn</source>
<extracomment>Create Profile || Save Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="121"/>
<source>save-profile-btn</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="141"/>
<source>password-error-match</source>
<extracomment>Passwords do not match</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="148"/>
<source>delete-profile-btn</source>
<extracomment>Delete Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="162"/>
<source>delete-confirm-label</source>
<extracomment>Type DELETE to confirm</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="176"/>
<source>delete-profile-confirm-btn</source>
<extracomment>Really Delete Profile</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/panes/ProfileAddEditPane.qml" line="182"/>
<source>delete-confirm-text</source>
<extracomment>DELETE</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ProfileManagerPane</name>
<message>
<location filename="../qml/panes/ProfileManagerPane.qml" line="26"/>
@@ -339,7 +424,7 @@
<context>
<name>StackToolbar</name>
<message>
<location filename="../qml/widgets/StackToolbar.qml" line="52"/>
<location filename="../qml/widgets/StackToolbar.qml" line="59"/>
<source>view-group-membership-tooltip</source>
<extracomment>View Group Membership</extracomment>
<translation type="unfinished"></translation>

+ 1
- 0
qml.qrc View File

@@ -14,6 +14,7 @@
<file>qml/panes/SettingsPane.qml</file>
<file>qml/panes/SplashPane.qml</file>
<file>qml/panes/ProfileManagerPane.qml</file>
<file>qml/panes/ProfileAddEditPane.qml</file>
<file>qml/styles/CwtchComboBoxStyle.qml</file>
<file>qml/styles/CwtchExpandingButton.qml</file>
<file>qml/styles/CwtchTextAreaStyle.qml</file>

+ 14
- 1
qml/main.qml View File

@@ -118,7 +118,8 @@ ApplicationWindow {
currentIndex: 0
readonly property int splashPane: 0
readonly property int managementPane: 1
readonly property int profilePane: 2
readonly property int addEditProfilePane: 2
readonly property int profilePane: 3
property alias pane: parentStack.currentIndex

Rectangle { // Splash pane
@@ -148,6 +149,18 @@ ApplicationWindow {
}
}

Rectangle { // Profile login/management pane
anchors.fill: parent
color: "#EEEEFF"


ProfileAddEditPane{
id: profileAddEditPane
anchors.fill: parent
}
}


RowLayout { // CONTAINS EVERYTHING EXCEPT THE TOOLBAR
/* anchors.left: ratio >= 0.92 ? parent.left : toolbar.right
anchors.top: ratio >= 0.92 ? toolbar.bottom : parent.top

+ 200
- 0
qml/panes/ProfileAddEditPane.qml View File

@@ -0,0 +1,200 @@
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
import QtQuick.Controls 1.4

import "../widgets"
import "../styles"

ColumnLayout { // Add Profile Pane
id: profileAddEditPane
anchors.fill: parent

property string mode // edit or add

StackToolbar {
id: stb
text: mode == "add" ? qsTr("add-profile-title") : qsTr("edit-profile-title")
aux.visible: false
membership.visible: false
stack: "management"
}

function reset() {
txtProfileName.text = qsTr("default-profile-name")
txtPassword1.text = ""
txtPassword2.text = ""
deleteReset()
}

function load(onion, name, pass) {
onionLabel.text = onion
txtProfileName.text = name
txtPassword1.text = pass
txtPassword2.text = pass

deleteReset()
}

function deleteReset() {
deleteConfirmLabel.visible = false
deleteConfirmLabel.visible = false
deleteConfirmLabel.color = "black"
confirmDeleteTxt.visible = false
confirmDeleteTxt.text = ""
confirmDeleteBtn.visible = false
}

Flickable {
anchors.top: stb.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
boundsBehavior: Flickable.StopAtBounds
clip:true
contentWidth: tehcol.width
contentHeight: tehcol.height

Column {
id: tehcol
leftPadding: 10
spacing: 5
width: profileAddEditPane.width

ScalingLabel {
//: Onion
text: qsTr("profile-onion-label") + ":"
visible: mode == "edit"
}

ScalingLabel {
id: onionLabel
visible: mode == "edit"
}

ScalingLabel {
//: Display name
text: qsTr("profile-name") + ":"
}

TextField {
id: txtProfileName
Layout.fillWidth: true
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
//: default suggested profile name
text: qsTr("default-profile-name")
}

ScalingLabel {
//: Password
text: qsTr("password1-label") + ":"
}

TextField {
id: txtPassword1
Layout.fillWidth: true
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
echoMode: TextInput.Password
readOnly: mode == "edit"
}


ScalingLabel {
//: Reenter password
text: qsTr("password2-label") + ":"
}

TextField {
id: txtPassword2
Layout.fillWidth: true
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
echoMode: TextInput.Password
readOnly: mode == "edit"

}

SimpleButton {
//: Create Profile || Save Profile
text: mode == "add" ? qsTr("create-profile-btn") : qsTr("save-profile-btn")

onClicked: {
if (txtPassword1.text != txtPassword2.text) {
passwordErrorLabel.visible = true
} else {
if (mode == "add") {
gcd.createProfile(txtProfileName.text, txtPassword1.text)
} else {
gcd.updateNick(onionLabel.text, txtProfileName.text)
}
gcd.reloadProfileList()
parentStack.pane = parentStack.managementPane
}
}
}

ScalingLabel {
id: passwordErrorLabel
//: Passwords do not match
text: qsTr("password-error-match")
visible: false
color: "red"
}

SimpleButton {
//: Delete Profile
text: qsTr("delete-profile-btn")
icon: "regular/trash-alt"
visible: mode == "edit"


onClicked: {
deleteConfirmLabel.visible = true
deleteConfirmLabel.visible = true
confirmDeleteTxt.visible = true
confirmDeleteBtn.visible = true
}
}

ScalingLabel {
id: deleteConfirmLabel
//: Type DELETE to confirm
text: qsTr("delete-confirm-label")+ ":"
visible: false
}

TextField {
id: confirmDeleteTxt
Layout.fillWidth: true
style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 }
visible: false
}

SimpleButton {
id: confirmDeleteBtn
icon: "regular/trash-alt"

//: Really Delete Profile
text: qsTr("delete-profile-confirm-btn")
color: "red"
visible: false

onClicked: {
//: DELETE
if (confirmDeleteTxt.text == qsTr("delete-confirm-text")) {
gcd.deleteProfile(onionLabel.text)
gcd.reloadProfileList()
parentStack.pane = parentStack.managementPane
} else {
deleteConfirmLabel.color = "red"
}

}
}


}//end of column with padding
}//end of flickable
}

+ 2
- 1
qml/widgets/ContactPicture.qml View File

@@ -17,6 +17,7 @@ Item {
property bool isGroup
property bool showStatus
property bool highlight
property bool button
property real logscale: 4 * Math.log10(gcd.themeScale + 1)
property int baseWidth: 48 * logscale

@@ -30,7 +31,7 @@ Item {
Rectangle {
width: highlight ? baseWidth - 4 : baseWidth
height: highlight ? baseWidth - 4 : baseWidth
color: "#FFFFFF"
color: button ? windowItem.cwtch_dark_color: "#FFFFFF"
radius: width / 2
anchors.centerIn:parent


+ 42
- 4
qml/widgets/ContactRow.qml View File

@@ -10,6 +10,7 @@ import QtQuick.Controls.Styles 1.4


Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
id: crItem
anchors.left: parent.left
anchors.right: parent.right
height: 48 * logscale + 3
@@ -22,12 +23,17 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
property int badge
property bool isActive
property bool isHover
property bool background: true
property string type // profile or contact or button

// Profile
property bool defaultPassword

// Contact
property bool blocked
property bool loading
property alias status: imgProfile.status
property string server
property bool background: true
property string type
property alias status: imgProfile.status
property string server


Rectangle { // CONTACT ENTRY BACKGROUND COLOR
@@ -41,6 +47,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
ContactPicture {
id: imgProfile
showStatus: type == "contact"
button: type == "button"
}

ColumnLayout {
@@ -105,6 +112,11 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
}
}

// Profile



// Contact
ProgressBar { // LOADING ?
id: loadingProgress
property bool running
@@ -153,6 +165,10 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
gcd.selectedProfile = handle
gcd.loadProfile(handle)
parentStack.pane = parentStack.profilePane
} else if (type == "button") { // Add profile button
profileAddEditPane.mode = "add"
profileAddEditPane.reset()
parentStack.pane = parentStack.addEditProfilePane
}
}

@@ -165,6 +181,28 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY
}
}

SimpleButton {// Edit BUTTON
id: btnEdit
icon: "solid/user-edit"

anchors.right: parent.right

//rectUnread.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 1 * gcd.themeScale
anchors.rightMargin: 20 * gcd.themeScale
height: parent.height * 0.75

visible: type == "profile"


onClicked: {
profileAddEditPane.mode = "edit"
profileAddEditPane.load(handle, displayName, "")
parentStack.pane = parentStack.addEditProfilePane
}
}

Connections { // UPDATE UNREAD MESSAGES COUNTER
target: gcd


+ 2
- 1
qml/widgets/MyProfile.qml View File

@@ -29,6 +29,7 @@ ColumnLayout {
anchors.topMargin: 2
onClicked: function() {
gcd.selectedProfile = "none"
gcd.reloadProfileList()
parentStack.pane = parentStack.managementPane
theStack.pane = theStack.emptyPane
}
@@ -120,7 +121,7 @@ ColumnLayout {
Layout.alignment: Qt.AlignHCenter

onUpdated: {
gcd.updateNick(lblNick.text)
gcd.updateNick(onion, lblNick.text)
}
}


+ 22
- 3
qml/widgets/ProfileList.qml View File

@@ -50,10 +50,12 @@ ColumnLayout {
}
}

profilesModel.append({
profilesModel.insert(profilesModel.count-1,
{
"_handle": handle,
"_displayName": displayName,
"_image": image
"_image": image,
"_type": "profile"
})
}

@@ -67,10 +69,27 @@ ColumnLayout {
}
}
}*/

onResetProfileList: function() {
profilesModel.clear()
profilesModel.append({
_handle: "",
_displayName: qsTr("add-new-profile-btn"),
_image: "qrc:/qml/images/fontawesome/solid/user-plus.svg",
_type: "button",
})
}
}

ListModel { // Profile OBJECTS ARE STORED HERE ...
id: profilesModel

ListElement {
_handle: ""
_displayName: qsTr("add-new-profile-btn")
_image: "qrc:/qml/images/fontawesome/solid/user-plus.svg"
_type: "button"
}
}

Repeater {
@@ -84,7 +103,7 @@ ColumnLayout {
status: 0
blocked: false
loading: false
type: "profile"
type: _type
}
}
}

+ 8
- 1
qml/widgets/StackToolbar.qml View File

@@ -21,6 +21,7 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
property alias aux: btnAux
property alias back: btnBack
property alias membership: btnMembership
property string stack: "profile" // profile(theStack) or management(parentStack)


SimpleButton {// BACK BUTTON
@@ -29,7 +30,13 @@ Rectangle { // OVERHEAD BAR ON STACK PANE
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: 6
onClicked: theStack.pane = theStack.emptyPane
onClicked: {
if (stack == "profile") {
theStack.pane = theStack.emptyPane
} else {
parentStack.pane = parentStack.managementPane
}
}
}

ScalingLabel { // TEXT

Loading…
Cancel
Save