diff --git a/go/constants/attributes.go b/go/constants/attributes.go index 0868de16..7471c265 100644 --- a/go/constants/attributes.go +++ b/go/constants/attributes.go @@ -4,3 +4,6 @@ const Nick = "nick" const LastRead = "last-read" const Picture = "picture" const DefaultPassword = "default-password" + +const ProfileTypeV1DefaultPassword = "v1-defaultPassword" +const ProfileTypeV1Password = "v1-userPassword" diff --git a/go/handlers/appHandler.go b/go/handlers/appHandler.go index f58a137a..a2085a21 100644 --- a/go/handlers/appHandler.go +++ b/go/handlers/appHandler.go @@ -1,6 +1,7 @@ package handlers import ( + "cwtch.im/cwtch/app" "cwtch.im/cwtch/app/plugins" "cwtch.im/cwtch/event" "cwtch.im/ui/go/constants" @@ -12,7 +13,7 @@ import ( "time" ) -func App(gcd *ui.GrandCentralDispatcher, subscribed chan bool, reloadingFirst bool) { +func App(gcd *ui.GrandCentralDispatcher, subscribed chan bool, reloadingAccounts bool) { q := event.NewQueue() the.AppBus.Subscribe(event.NewPeer, q) the.AppBus.Subscribe(event.PeerError, q) @@ -21,7 +22,6 @@ func App(gcd *ui.GrandCentralDispatcher, subscribed chan bool, reloadingFirst bo the.AppBus.Subscribe(event.NetworkStatus, q) the.AppBus.Subscribe(event.ReloadDone, q) subscribed <- true - loadingV1Accounts := !reloadingFirst networkOffline := false timeSinceLastSuccess := time.Unix(0, 0) @@ -77,35 +77,24 @@ func App(gcd *ui.GrandCentralDispatcher, subscribed chan bool, reloadingFirst bo case event.AppError: if e.Data[event.Error] == event.AppErrLoaded0 { - - if loadingV1Accounts { - loadingV1Accounts = false - // TODO: only an error if other profiles are not loaded - if len(the.CwtchApp.ListPeers()) == 0 { - log.Infoln("couldn't load your config file. attempting to create one now") - if gcd.Version() == "development" { - the.CwtchApp.CreatePeer("tester", the.AppPassword) - } else { - the.CwtchApp.CreatePeer("alice", the.AppPassword) - } - } + if reloadingAccounts { + reloadingAccounts = false } else { gcd.ErrorLoaded0() } } case event.ReloadDone: - if the.Peer == nil { - loadingV1Accounts = true + reloadingAccounts = false + if len(the.CwtchApp.ListPeers()) == 0 { the.CwtchApp.LoadProfiles(the.AppPassword) } case event.NewPeer: onion := e.Data[event.Identity] peer := the.CwtchApp.GetPeer(onion) - if loadingV1Accounts { - the.CwtchApp.GetPeer(onion).SetAttribute(constants.DefaultPassword, "true") - loadingV1Accounts = false + if tag, exists := peer.GetAttribute(app.AttributeTag); !exists || tag == "" { + peer.SetAttribute(app.AttributeTag, constants.ProfileTypeV1DefaultPassword) } log.Infof("NewPeer for %v\n", onion) diff --git a/go/handlers/peerHandler.go b/go/handlers/peerHandler.go index cefe3d23..9bef4364 100644 --- a/go/handlers/peerHandler.go +++ b/go/handlers/peerHandler.go @@ -9,6 +9,8 @@ import ( "time" ) +const ExitPeerHandlerEvent = 10000 + func PeerHandler(onion string, uiManager ui.Manager, subscribed chan bool) { peer := the.CwtchApp.GetPeer(onion) eventBus := the.CwtchApp.GetEventBus(onion) @@ -105,6 +107,10 @@ func PeerHandler(onion string, uiManager ui.Manager, subscribed chan bool) { log.Errorf("found group that is nil :/") } } + case event.DeletePeer: + log.Infof("PeerHandler got DeletePeer, SHUTTING down!\n") + uiManager.ReloadProfiles() + return } } } diff --git a/go/ui/gcd.go b/go/ui/gcd.go index 8e441618..a1c158ae 100644 --- a/go/ui/gcd.go +++ b/go/ui/gcd.go @@ -37,12 +37,11 @@ type GrandCentralDispatcher struct { _ string `property:"selectedConversation,auto"` // profile management stuff - _ func() `signal:"Loaded"` - _ func(handle, displayname, image string) `signal:"AddProfile"` - _ func() `signal:"ErrorLoaded0"` - _ func() `signal:"ResetProfile"` - _ func() `signal:"ResetProfileList"` - _ func(onion string) `signal:"deleteProfile"` + _ func() `signal:"Loaded"` + _ func(handle, displayname, image, tag string) `signal:"AddProfile"` + _ func() `signal:"ErrorLoaded0"` + _ func() `signal:"ResetProfile"` + _ func() `signal:"ResetProfileList"` // contact list stuff _ func(handle, displayName, image, server string, badge, status int, blocked bool, loading bool, lastMsgTime int) `signal:"AddContact"` @@ -78,11 +77,12 @@ type GrandCentralDispatcher struct { _ 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"` + _ func(onion, nick string) `signal:"updateNick,auto"` + _ func(handle string) `signal:"loadProfile,auto"` + _ func(nick string, defaultPass bool, password string) `signal:"createProfile,auto"` + _ func(password string) `signal:"unlockProfiles,auto"` + _ func() `signal:"reloadProfileList,auto"` + _ func(onion string) `signal:"deleteProfile,auto"` // operating a profile _ func(message string, mid string) `signal:"sendMessage,auto"` _ func(onion string) `signal:"blockPeer,auto"` @@ -619,8 +619,12 @@ func (this *GrandCentralDispatcher) loadProfile(onion string) { } } -func (this *GrandCentralDispatcher) createProfile(nick, password string) { - the.CwtchApp.CreatePeer(nick, password) +func (this *GrandCentralDispatcher) createProfile(nick string, defaultPass bool, password string) { + if defaultPass { + the.CwtchApp.CreateTaggedPeer(nick, the.AppPassword, constants.ProfileTypeV1DefaultPassword) + } else { + the.CwtchApp.CreateTaggedPeer(nick, password, constants.ProfileTypeV1Password) + } } func (this *GrandCentralDispatcher) reloadProfileList() { @@ -632,5 +636,6 @@ func (this *GrandCentralDispatcher) reloadProfileList() { } func (this *GrandCentralDispatcher) deleteProfile(onion string) { - //the.CwtchApp. + log.Infof("deleteProfile %v\n", onion) + the.CwtchApp.DeletePeer(onion) } diff --git a/go/ui/manager.go b/go/ui/manager.go index a23493dd..809bef72 100644 --- a/go/ui/manager.go +++ b/go/ui/manager.go @@ -1,6 +1,7 @@ package ui import ( + "cwtch.im/cwtch/app" "cwtch.im/cwtch/model" "cwtch.im/cwtch/protocol/connections" "cwtch.im/ui/go/constants" @@ -122,8 +123,10 @@ func AddProfile(gcd *GrandCentralDispatcher, handle string) { pic = RandomProfileImage(handle) peer.SetAttribute(constants.Picture, pic) } - log.Infof("AddProfile %v %v %v\n", handle, nick, pic) - gcd.AddProfile(handle, nick, pic) + + tag, _ := peer.GetAttribute(app.AttributeTag) + log.Infof("AddProfile %v %v %v %v\n", handle, nick, pic, tag) + gcd.AddProfile(handle, nick, pic, tag) } } @@ -143,6 +146,8 @@ type Manager interface { AddSendMessageError(peer string, signature string, err string) AddMessage(handle string, from string, message string, fromMe bool, messageID string, timestamp time.Time, Acknowledged bool) + ReloadProfiles() + UpdateContactDisplayName(handle string, name string) UpdateContactStatus(handle string, status int, loading bool) UpdateContactAttribute(handle, key, value string) @@ -244,6 +249,10 @@ func (this *manager) AddMessage(handle string, from string, message string, from }) } +func (this *manager) ReloadProfiles() { + this.gcd.reloadProfileList() +} + // UpdateContactDisplayName updates a contact's display name in the contact list and conversations func (this *manager) UpdateContactDisplayName(handle string, name string) { this.gcd.DoIfProfile(this.profile, func() { diff --git a/qml.qrc b/qml.qrc index f7d266c6..6713ce4b 100644 --- a/qml.qrc +++ b/qml.qrc @@ -29,9 +29,7 @@ qml/widgets/ScalingLabel.qml qml/widgets/SimpleButton.qml qml/widgets/StackToolbar.qml - qml/widgets/controls/Button.qml qml/widgets/controls/Loader.qml - qml/widgets/controls/Text.qml qml/widgets/controls/Variables.qml i18n/translation_de.qm i18n/translation_en.qm diff --git a/qml/overlays/BulletinOverlay.qml b/qml/overlays/BulletinOverlay.qml index 71e32c8d..47a4a64a 100644 --- a/qml/overlays/BulletinOverlay.qml +++ b/qml/overlays/BulletinOverlay.qml @@ -6,8 +6,7 @@ import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 -import "../widgets" -import "../widgets/controls" as Awesome +import "../widgets" as Widgets import "../fonts/Twemoji.js" as T import "../utils.js" as Utils import "../styles" @@ -176,7 +175,7 @@ ColumnLayout { width: parent.width - 50 } - SimpleButton { + Widgets.SimpleButton { id: replybtn visible: selected text: "reply" @@ -231,7 +230,7 @@ ColumnLayout { } - SimpleButton { // SEND MESSAGE BUTTON + Widgets.SimpleButton { // SEND MESSAGE BUTTON id: btnSend icon: "regular/paper-plane" text: "post" diff --git a/qml/overlays/ListOverlay.qml b/qml/overlays/ListOverlay.qml index 40c8acb8..3bfeebbd 100644 --- a/qml/overlays/ListOverlay.qml +++ b/qml/overlays/ListOverlay.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material 2.0 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 -import "../widgets" +import "../widgets" as Widgets import "../widgets/controls" as Awesome import "../fonts/Twemoji.js" as T import "../utils.js" as Utils @@ -204,7 +204,7 @@ ColumnLayout { style: CwtchTextFieldStyle{} } - SimpleButton { // SEND MESSAGE BUTTON + Widgets.SimpleButton { // SEND MESSAGE BUTTON id: btnSend icon: "regular/paper-plane" text: "add" diff --git a/qml/panes/AddGroupPane.qml b/qml/panes/AddGroupPane.qml index 048e8aaa..4a0e45de 100644 --- a/qml/panes/AddGroupPane.qml +++ b/qml/panes/AddGroupPane.qml @@ -6,7 +6,7 @@ import QtQuick.Layouts 1.3 import QtQuick.Window 2.11 import QtQuick.Controls 1.4 -import "../widgets" +import "../widgets" as Widgets import "../styles" ColumnLayout { // settingsPane @@ -14,7 +14,7 @@ ColumnLayout { // settingsPane anchors.fill: parent - StackToolbar { + Widgets.StackToolbar { id: stb text: qsTr("create-group-title") aux.visible: false @@ -37,7 +37,7 @@ ColumnLayout { // settingsPane spacing: 5 width: root.width - ScalingLabel { + Widgets.ScalingLabel { //: Server label text: qsTr("server-label") + ":" } @@ -48,7 +48,7 @@ ColumnLayout { // settingsPane text: "2c3kmoobnyghj2zw6pwv7d57yzld753auo3ugauezzpvfak3ahc4bdyd" } - ScalingLabel{ + Widgets.ScalingLabel{ //: Group name label text: qsTr("group-name-label") + ":" } @@ -60,7 +60,7 @@ ColumnLayout { // settingsPane text: qsTr("default-group-name") } - SimpleButton { + Widgets.SimpleButton { //: create group button text: qsTr("create-group-btn") diff --git a/qml/panes/GroupSettingsPane.qml b/qml/panes/GroupSettingsPane.qml index 7616158d..bb0499af 100644 --- a/qml/panes/GroupSettingsPane.qml +++ b/qml/panes/GroupSettingsPane.qml @@ -6,7 +6,7 @@ import QtQuick.Layouts 1.3 import QtQuick.Window 2.11 import QtQuick.Controls 1.4 -import "../widgets" +import "../widgets" as Widgets import "../styles" import "../utils.js" as Utils @@ -16,7 +16,7 @@ ColumnLayout { // groupSettingsPane property string groupID property variant addrbook - StackToolbar { + Widgets.StackToolbar { id: toolbar aux.visible: false back.onClicked: theStack.pane = theStack.messagePane @@ -38,7 +38,7 @@ ColumnLayout { // groupSettingsPane leftPadding: 10 spacing: 5 - ScalingLabel { + Widgets.ScalingLabel { text: qsTr("server-label") + ":" } @@ -48,7 +48,7 @@ ColumnLayout { // groupSettingsPane readOnly: true } - SimpleButton { + Widgets.SimpleButton { icon: "regular/clipboard" text: qsTr("copy-btn") @@ -59,7 +59,7 @@ ColumnLayout { // groupSettingsPane } } - ScalingLabel { + Widgets.ScalingLabel { text: qsTr("invitation-label") + ":" } @@ -69,7 +69,7 @@ ColumnLayout { // groupSettingsPane readOnly: true } - SimpleButton { + Widgets.SimpleButton { icon: "regular/clipboard" text: qsTr("copy-btn") @@ -80,7 +80,7 @@ ColumnLayout { // groupSettingsPane } } - ScalingLabel{ + Widgets.ScalingLabel{ text: qsTr("group-name-label") + ":" } @@ -89,7 +89,7 @@ ColumnLayout { // groupSettingsPane style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } } - SimpleButton { + Widgets.SimpleButton { text: qsTr("save-btn") onClicked: { @@ -100,7 +100,7 @@ ColumnLayout { // groupSettingsPane } //: Invite someone to the group - ScalingLabel { text: qsTr("invite-to-group-label") } + Widgets.ScalingLabel { text: qsTr("invite-to-group-label") } ComboBox { id: cbInvite @@ -110,7 +110,7 @@ ColumnLayout { // groupSettingsPane style: CwtchComboBoxStyle{} } - SimpleButton { + Widgets.SimpleButton { text: qsTr("invite-btn") onClicked: { @@ -118,7 +118,7 @@ ColumnLayout { // groupSettingsPane } } - SimpleButton { + Widgets.SimpleButton { icon: "regular/trash-alt" text: qsTr("delete-btn") diff --git a/qml/panes/PeerSettingsPane.qml b/qml/panes/PeerSettingsPane.qml index a48b8f02..3b7927e5 100644 --- a/qml/panes/PeerSettingsPane.qml +++ b/qml/panes/PeerSettingsPane.qml @@ -6,7 +6,7 @@ import QtQuick.Layouts 1.3 import QtQuick.Window 2.11 import QtQuick.Controls 1.4 -import "../widgets" +import "../widgets" as Widgets import "../styles" ColumnLayout { // peerSettingsPane @@ -14,7 +14,7 @@ ColumnLayout { // peerSettingsPane anchors.fill: parent property bool blocked - StackToolbar { + Widgets.StackToolbar { id: toolbar aux.visible: false @@ -38,7 +38,7 @@ ColumnLayout { // peerSettingsPane leftPadding: 10 spacing: 5 - ScalingLabel { + Widgets.ScalingLabel { text: qsTr("address-label") } @@ -48,7 +48,7 @@ ColumnLayout { // peerSettingsPane readOnly: true } - SimpleButton { + Widgets.SimpleButton { icon: "regular/clipboard" text: qsTr("copy-btn") @@ -60,7 +60,7 @@ ColumnLayout { // peerSettingsPane } } - ScalingLabel{ + Widgets.ScalingLabel{ text: qsTr("display-name-label") } @@ -69,7 +69,7 @@ ColumnLayout { // peerSettingsPane style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } } - SimpleButton { + Widgets.SimpleButton { text: qsTr("save-btn") onClicked: { @@ -80,7 +80,7 @@ ColumnLayout { // peerSettingsPane } - SimpleButton { + Widgets.SimpleButton { icon: "solid/hand-paper" text: root.blocked ? qsTr("unblock-btn") : qsTr("block-btn") @@ -94,7 +94,7 @@ ColumnLayout { // peerSettingsPane } } - SimpleButton { + Widgets.SimpleButton { icon: "regular/trash-alt" text: qsTr("delete-btn") diff --git a/qml/panes/ProfileAddEditPane.qml b/qml/panes/ProfileAddEditPane.qml index 97e371ef..b1ea05fa 100644 --- a/qml/panes/ProfileAddEditPane.qml +++ b/qml/panes/ProfileAddEditPane.qml @@ -1,13 +1,13 @@ import QtGraphicalEffects 1.0 import QtQuick 2.7 -import QtQuick.Controls 2.4 +import QtQuick.Controls 2.13 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" + +import "../widgets" as Widgets +// import "../styles" ColumnLayout { // Add Profile Pane id: profileAddEditPane @@ -15,7 +15,7 @@ ColumnLayout { // Add Profile Pane property string mode // edit or add - StackToolbar { + Widgets.StackToolbar { id: stb text: mode == "add" ? qsTr("add-profile-title") : qsTr("edit-profile-title") aux.visible: false @@ -28,6 +28,7 @@ ColumnLayout { // Add Profile Pane txtPassword1.text = "" txtPassword2.text = "" deleteReset() + radioUsePassword.checked = true } function load(onion, name, pass) { @@ -64,59 +65,90 @@ ColumnLayout { // Add Profile Pane spacing: 5 width: profileAddEditPane.width - ScalingLabel { + Widgets.ScalingLabel { //: Onion text: qsTr("profile-onion-label") + ":" visible: mode == "edit" } - ScalingLabel { + Widgets.ScalingLabel { id: onionLabel visible: mode == "edit" } - ScalingLabel { + Widgets.ScalingLabel { //: Display name text: qsTr("profile-name") + ":" } - TextField { + Widgets.TextField { id: txtProfileName Layout.fillWidth: true - style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } + //style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } //: default suggested profile name text: qsTr("default-profile-name") + + } - ScalingLabel { + RowLayout { + //id: radioButtons + + Widgets.RadioButton { + id: radioUsePassword + checked: true + //: Password + text: qsTr("radio-use-password") + } + + Widgets.RadioButton { + id: radioNoPassword + //: Unencrypted (No password) + text: qsTr("radio-no-password") + } + } + + Widgets.ScalingLabel { + id: noPasswordLabel + //: Not using a password on this account means that all data stored locally will not be encrypted + text: qsTr("no-password-warning") + visible: radioNoPassword.checked + } + + Widgets.ScalingLabel { + id: passwordLabel //: Password text: qsTr("password1-label") + ":" + visible: radioUsePassword.checked } - TextField { + Widgets.TextField { id: txtPassword1 Layout.fillWidth: true - style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } + //style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } echoMode: TextInput.Password readOnly: mode == "edit" + visible: radioUsePassword.checked } - ScalingLabel { + Widgets.ScalingLabel { + id: passwordReLabel //: Reenter password text: qsTr("password2-label") + ":" + visible: radioUsePassword.checked } - TextField { + Widgets.TextField { id: txtPassword2 Layout.fillWidth: true - style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } + //style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } echoMode: TextInput.Password readOnly: mode == "edit" - + visible: radioUsePassword.checked } - SimpleButton { + Widgets.SimpleButton { //: Create Profile || Save Profile text: mode == "add" ? qsTr("create-profile-btn") : qsTr("save-profile-btn") @@ -125,7 +157,7 @@ ColumnLayout { // Add Profile Pane passwordErrorLabel.visible = true } else { if (mode == "add") { - gcd.createProfile(txtProfileName.text, txtPassword1.text) + gcd.createProfile(txtProfileName.text, radioNoPassword .checked, txtPassword1.text) } else { gcd.updateNick(onionLabel.text, txtProfileName.text) } @@ -135,7 +167,7 @@ ColumnLayout { // Add Profile Pane } } - ScalingLabel { + Widgets.ScalingLabel { id: passwordErrorLabel //: Passwords do not match text: qsTr("password-error-match") @@ -143,7 +175,7 @@ ColumnLayout { // Add Profile Pane color: "red" } - SimpleButton { + Widgets.SimpleButton { //: Delete Profile text: qsTr("delete-profile-btn") icon: "regular/trash-alt" @@ -158,21 +190,21 @@ ColumnLayout { // Add Profile Pane } } - ScalingLabel { + Widgets.ScalingLabel { id: deleteConfirmLabel //: Type DELETE to confirm text: qsTr("delete-confirm-label")+ ":" visible: false } - TextField { + Widgets.TextField { id: confirmDeleteTxt Layout.fillWidth: true - style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } + //style: CwtchTextFieldStyle{ width: tehcol.width * 0.8 } visible: false } - SimpleButton { + Widgets.SimpleButton { id: confirmDeleteBtn icon: "regular/trash-alt" diff --git a/qml/panes/ProfileManagerPane.qml b/qml/panes/ProfileManagerPane.qml index cd0e1d0c..58c0be03 100644 --- a/qml/panes/ProfileManagerPane.qml +++ b/qml/panes/ProfileManagerPane.qml @@ -8,7 +8,7 @@ import QtQuick.Window 2.11 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 -import "../widgets" +import "../widgets" as Widgets import "../widgets/controls" import "../styles" @@ -19,7 +19,7 @@ ColumnLayout { //leftPadding: 10 //spacing: 5 - ScalingLabel { + Widgets.ScalingLabel { anchors.horizontalCenter: parent.horizontalCenter wrapMode: TextEdit.Wrap //: Please enter password: @@ -33,7 +33,7 @@ ColumnLayout { echoMode: TextInput.Password } - ScalingLabel { + Widgets.ScalingLabel { id: error anchors.horizontalCenter: parent.horizontalCenter color: "red" @@ -42,7 +42,7 @@ ColumnLayout { visible: false } - SimpleButton { + Widgets.SimpleButton { id: "button" anchors.horizontalCenter: parent.horizontalCenter @@ -75,7 +75,7 @@ ColumnLayout { Layout.minimumWidth: Layout.maximumWidth //Layout.maximumWidth: theStack.pane == theStack.emptyPane ? parent.width : 450 - ProfileList { + Widgets.ProfileList { anchors.fill: parent } } diff --git a/qml/widgets/ContactRow.qml b/qml/widgets/ContactRow.qml index 6e619d09..50700e51 100644 --- a/qml/widgets/ContactRow.qml +++ b/qml/widgets/ContactRow.qml @@ -25,6 +25,7 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY property bool isHover property bool background: true property string type // profile or contact or button + property string tag // profile version/type // Profile property bool defaultPassword @@ -114,6 +115,22 @@ Item { // LOTS OF NESTING TO DEAL WITH QT WEIRDNESS, SORRY // Profile + Image {// Profle Type + id: profiletype + + source: tag == "v1-userPassword" ? "qrc:/qml/images/fontawesome/solid/lock.svg" : "qrc:/qml/images/fontawesome/solid/lock-open.svg" + + anchors.right: parent.right + + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 1 * gcd.themeScale + anchors.rightMargin: (20 * gcd.themeScale) + parent.height + height: parent.height * 0.5 + width: height + + visible: type == "profile" + + } // Contact diff --git a/qml/widgets/ProfileList.qml b/qml/widgets/ProfileList.qml index f039416f..e435a65b 100644 --- a/qml/widgets/ProfileList.qml +++ b/qml/widgets/ProfileList.qml @@ -41,7 +41,7 @@ ColumnLayout { Connections { // ADD/REMOVE CONTACT ENTRIES target: gcd - onAddProfile: function(handle, displayName, image) { + onAddProfile: function(handle, displayName, image, tag) { console.log("ProfileList onAddProfile for: " + handle) for (var i = 0; i < profilesModel.count; i++) { @@ -55,7 +55,8 @@ ColumnLayout { "_handle": handle, "_displayName": displayName, "_image": image, - "_type": "profile" + "_type": "profile", + "_tag": tag }) } @@ -77,6 +78,7 @@ ColumnLayout { _displayName: qsTr("add-new-profile-btn"), _image: "qrc:/qml/images/fontawesome/solid/user-plus.svg", _type: "button", + _tag: "," }) } } @@ -89,6 +91,7 @@ ColumnLayout { _displayName: qsTr("add-new-profile-btn") _image: "qrc:/qml/images/fontawesome/solid/user-plus.svg" _type: "button" + _tag: "" } } @@ -104,6 +107,7 @@ ColumnLayout { blocked: false loading: false type: _type + tag: _tag } } } diff --git a/qml/widgets/RadioButton.qml b/qml/widgets/RadioButton.qml new file mode 100644 index 00000000..187822e6 --- /dev/null +++ b/qml/widgets/RadioButton.qml @@ -0,0 +1,27 @@ +import QtQuick 2.7 + +import QtQuick.Controls 2.13 + + +RadioButton { + id: control + + property real size: 12 + spacing: 0 + + indicator: Rectangle { + width: 16 * gcd.themeScale + height: 16 * gcd.themeScale + anchors.verticalCenter: parent.verticalCenter + radius: 9 + border.width: 1 + + Rectangle { + anchors.fill: parent + visible: control.checked + color: "black" + radius: 9 + anchors.margins: 4 + } + } +} \ No newline at end of file diff --git a/qml/widgets/SimpleButton.qml b/qml/widgets/SimpleButton.qml index 2b3b67e8..25c6736d 100644 --- a/qml/widgets/SimpleButton.qml +++ b/qml/widgets/SimpleButton.qml @@ -4,7 +4,6 @@ import QtQuick.Controls 2.4 import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.3 -import "controls" as Awesome import "../fonts/Twemoji.js" as T Rectangle { diff --git a/qml/widgets/StackToolbar.qml b/qml/widgets/StackToolbar.qml index 3b9f91e5..05ddc52e 100644 --- a/qml/widgets/StackToolbar.qml +++ b/qml/widgets/StackToolbar.qml @@ -4,7 +4,6 @@ import QtQuick.Controls 2.4 import QtQuick.Controls.Material 2.0 import QtQuick.Layouts 1.3 -import "controls" as Awesome import "../fonts/Twemoji.js" as T Rectangle { // OVERHEAD BAR ON STACK PANE diff --git a/qml/widgets/TextField.qml b/qml/widgets/TextField.qml new file mode 100644 index 00000000..6486f9d0 --- /dev/null +++ b/qml/widgets/TextField.qml @@ -0,0 +1,16 @@ +import QtQuick 2.7 + +import QtQuick.Controls 2.13 + + +TextField { + color: "black" + font.pointSize: 10 * gcd.themeScale + width: 100 + + background: Rectangle { + radius: 2 + color: windowItem.cwtch_background_color + border.color: windowItem.cwtch_color + } +} \ No newline at end of file diff --git a/qml/widgets/controls/Button.qml b/qml/widgets/controls/Button.qml deleted file mode 100644 index 1c120a50..00000000 --- a/qml/widgets/controls/Button.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** -** Copyright (c) 2014 Ricardo do Valle Flores de Oliveira -** -** $BEGIN_LICENSE:MIT$ -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and associated documentation files (the "Software"), to deal -** in the Software without restriction, including without limitation the rights -** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -** copies of the Software, and to permit persons to whom the Software is -** furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -** SOFTWARE. -** -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 -import QtQuick.Layouts 1.0 - -Button { - id: button - property string icon - property color color: "black" - property font font - - style: ButtonStyle { - id: buttonstyle - property font font: button.font - property color foregroundColor: button.color - - background: Item { - Rectangle { - id: baserect - anchors.fill: parent - color: "transparent" - } - } - - label: Item { - implicitWidth: row.implicitWidth - implicitHeight: row.implicitHeight - - RowLayout { - id: row - anchors.centerIn: parent - spacing: 15 - - Text { - color: buttonstyle.foregroundColor - font.pointSize: buttonstyle.font.pointSize * 2 - font.family: awesome.family - renderType: Text.NativeRendering - text: awesome.loaded ? icon : "" - visible: !(icon === "") - } - Text { - color: buttonstyle.foregroundColor - font: buttonstyle.font - renderType: Text.NativeRendering - text: control.text - visible: !(control.text === "") - - Layout.alignment: Qt.AlignBottom - } - } - } - } -} diff --git a/qml/widgets/controls/Text.qml b/qml/widgets/controls/Text.qml deleted file mode 100644 index 8931eb17..00000000 --- a/qml/widgets/controls/Text.qml +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** The MIT License (MIT) -** -** Copyright (c) 2014 Ricardo do Valle Flores de Oliveira -** -** $BEGIN_LICENSE:MIT$ -** Permission is hereby granted, free of charge, to any person obtaining a copy -** of this software and associated documentation files (the "Software"), to deal -** in the Software without restriction, including without limitation the rights -** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -** copies of the Software, and to permit persons to whom the Software is -** furnished to do so, subject to the following conditions: -** -** The above copyright notice and this permission notice shall be included in -** all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -** SOFTWARE. -** -** $END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Layouts 1.0 - -Text { - id: root - - property alias spacing: row.spacing - property alias text: content.text - property color color: "black" - property font font - property string icon - - RowLayout { - id: row - - Text { - color: root.color - font.pointSize: root.font.pointSize - font.family: awesome.family - renderType: Text.NativeRendering - text: awesome.loaded ? icon : "" - } - - Text { - id: content - color: root.color - font.pointSize: root.font.pointSize - renderType: Text.NativeRendering - } - } -}