From 72af3dbeeb83a45471962c5315120c90346b3725 Mon Sep 17 00:00:00 2001 From: erinn Date: Wed, 16 Dec 2020 19:31:17 -0800 Subject: [PATCH] addressing comments on #457 --- Makefile | 2 +- qml/opaque | 2 +- qml/overlays/ListOverlay.qml | 332 ++++++++++++++++--------------- qml/panes/GroupSettingsPane.qml | 1 - qml/panes/OverlayPane.qml | 8 - qml/panes/ProfileAddEditPane.qml | 1 - qml/panes/ProfileManagerPane.qml | 6 - qml/panes/ServerAddEditPane.qml | 10 +- qml/panes/ServerInfoPane.qml | 5 - qml/widgets/Message.qml | 9 +- qml/widgets/Overlay.qml | 1 + qml/widgets/ProfileRow.qml | 4 - qml/widgets/ServerList.qml | 4 - 13 files changed, 175 insertions(+), 210 deletions(-) diff --git a/Makefile b/Makefile index 42393d15..dc5d3716 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ clean: linux: date - qtdeploy -qt_version $(QT_BUILD_VERSION) build linux 2>&1 | tee qtdeploy.log | pv + qtdeploy -docker -qt_version $(QT_BUILD_VERSION) build linux 2>&1 | tee qtdeploy.log | pv date cp -R assets deploy/linux/ diff --git a/qml/opaque b/qml/opaque index 6b285e4b..136e613a 160000 --- a/qml/opaque +++ b/qml/opaque @@ -1 +1 @@ -Subproject commit 6b285e4bbc2a673fceb1c0ffb0065d1dae9c5f8b +Subproject commit 136e613ab596ae70edfa73fc6019f5dde44e0a08 diff --git a/qml/overlays/ListOverlay.qml b/qml/overlays/ListOverlay.qml index 0f1e9063..e0094cb5 100644 --- a/qml/overlays/ListOverlay.qml +++ b/qml/overlays/ListOverlay.qml @@ -11,70 +11,77 @@ import "../opaque/controls" as Awesome import "../utils.js" as Utils import "../opaque/styles" import "../opaque/theme" +import "../widgets" as W ColumnLayout { + id: listpanel Layout.fillWidth: true - width: parent.width - id: listpanel + width:parent.width + // todo: margins don't seem to be getting applied to search/additem textboxes? not sure why + Layout.margins: Theme.paddingStandard + property bool online: false - Text { - Layout.fillWidth: true - } - Opaque.IconTextField { - id: filter - visible:listpanel.online - width: parent.width - 2 * Theme.paddingStandard + Item { + width: 1 + height: Theme.paddingStandard + } - //: ex: "Find..." - placeholderText: qsTr("search-list") - horizontalAlignment: TextInput.AlignHCenter - icon: gcd.assetPath + "core/search-24px.webp" + Opaque.IconTextField { + id: filter + visible:listpanel.online + Layout.fillWidth: true + + //: ex: "Find..." + placeholderText: qsTr("search-list") + horizontalAlignment: TextInput.AlignHCenter + icon: gcd.assetPath + "core/search-24px.webp" - onTextChanged: { - listView.filter = text - if (listView.model.get(listView.currentIndex).title.indexOf(text) == -1) { - listView.currentIndex = -1 - } - } - } + onTextChanged: { + listView.filter = text + if (listView.model.get(listView.currentIndex).title.indexOf(text) == -1) { + listView.currentIndex = -1 + } + } + } - Opaque.Icon { - visible:!listpanel.online - source: gcd.assetPath + "core/negative_heart_24px.webp" - iconColor: Theme.mainTextColor - backgroundColor: Theme.backgroundPaneColor - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - height: 150 - width: 150 - } -// Label { -// visible:!listpanel.online -// color: Theme.mainTextColor -// Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter -// elide: Text.ElideRight -// font.pixelSize: 18 * gcd.themeScale -// text: qsTr("peer-not-online") -// } + Opaque.Icon { + visible:!listpanel.online + source: gcd.assetPath + "core/negative_heart_24px.webp" + iconColor: Theme.mainTextColor + backgroundColor: Theme.backgroundPaneColor + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + height: 150 + width: 150 + } + + Opaque.Label { + visible:!listpanel.online + horizontalAlignment: Text.AlignHCenter + Layout.fillWidth: true + elide: Text.ElideRight + size: Theme.textMediumPt + text: qsTr("peer-not-online") + } - Flickable { // THE MESSAGE LIST ITSELF - id: sv - clip: true - visible:listpanel.online - Layout.alignment: Qt.AlignLeft | Qt.AlignTop - Layout.fillHeight: true - Layout.fillWidth: true - contentWidth: parent.width - contentHeight: parent.height - boundsBehavior: Flickable.StopAtBounds - maximumFlickVelocity: 800 + Flickable { // THE MESSAGE LIST ITSELF + id: sv + clip: true + visible:listpanel.online + Layout.alignment: Qt.AlignLeft | Qt.AlignTop + Layout.fillHeight: true + Layout.fillWidth: true + contentWidth: parent.width + contentHeight: parent.height + boundsBehavior: Flickable.StopAtBounds + maximumFlickVelocity: 800 Connections { @@ -87,143 +94,138 @@ ColumnLayout { } } - Connections { - id: cnxns2 - target: gcd + Connections { + id: cnxns2 + target: gcd - onClearMessages: function() { - jsonModel4.clear() - } + onClearMessages: function() { + jsonModel4.clear() + } - onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) { - handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) - } + onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) { + handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) + } - onPrependMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) { - handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) - } + onPrependMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) { + handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) + } - function handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) { - var msg - try { - msg = JSON.parse(message) - } catch (e) { - return - } - if (msg.o != 4) return + function handler(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) { + var msg + try { + msg = JSON.parse(message) + } catch (e) { + return + } + if (msg.o != 4) return - if (msg.t != undefined) { - jsonModel4.insert(0,{ - "title":msg.t, - "selected":false, - "from": from, - "displayName": displayName, - "timestamp": ts, - "complete": false - }) - } + if (msg.t != undefined) { + jsonModel4.insert(0,{ + "title":msg.t, + "selected":false, + "from": from, + "displayName": displayName, + "timestamp": ts, + "complete": false + }) + } - if(msg.c != undefined) { - jsonModel4.get(msg.c).complete = true - } - } + if(msg.c != undefined) { + jsonModel4.get(msg.c).complete = true + } + } - onUpdateContactStatus: function(_handle, _status, _loading) { - if (gcd.selectedConversation == _handle) { + onUpdateContactStatus: function(_handle, _status, _loading) { + if (gcd.selectedConversation == _handle) { - // Group is Synced OR p2p is Authenticated - if ( (_handle.length == 32 && _status == 4) || (_handle.length == 56 && _status == 3) ) { - newlistitem.readOnly = false - listpanel.online = true - } else { - newlistitem.readOnly = true - listpanel.online= false - } - } - } - } + // Group is Synced OR p2p is Authenticated + if ( (_handle.length == 32 && _status == 4) || (_handle.length == 56 && _status == 3) ) { + newlistitem.readOnly = false + listpanel.online = true + } else { + newlistitem.readOnly = true + listpanel.online= false + } + } + } + } - ScrollBar.vertical: ScrollBar{ - policy: ScrollBar.AlwaysOn - } + ScrollBar.vertical: ScrollBar{ + policy: ScrollBar.AlwaysOn + } - ListView { - id: listView - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.topMargin: 10 + ListView { + id: listView + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.topMargin: 10 - width: parent.width - 50 - height: parent.height - 20 - orientation: Qt.Vertical - spacing: 10 - model: jsonModel4 - property string filter: "" - delegate: + width: parent.width - 50 + height: parent.height - 20 + orientation: Qt.Vertical + spacing: 10 + model: jsonModel4 + property string filter: "" + delegate: - Item { - width: parent.width - height: title.indexOf(listView.filter) >= 0 ? texttitle.height : 0 - visible: title.indexOf(listView.filter) >= 0 + Item { + width: Listview.view.width + height: title.indexOf(listView.filter) >= 0 ? texttitle.height : 0 + visible: title.indexOf(listView.filter) >= 0 - Column { - width: parent.width + Column { + width: parent.width - RowLayout { - CheckBox { - checked: complete - onClicked: { - var msg = JSON.stringify({"o":4, "c":index}) - gcd.sendMessage(msg, newlistitem.nextMessageID++) - } - } + RowLayout { + CheckBox { + checked: complete + onClicked: { + var msg = JSON.stringify({"o":4, "c":index}) + gcd.sendMessage(msg, newlistitem.nextMessageID++) + } + } - RowLayout { - Text { - id: texttitle - text: '' + Utils.htmlEscaped(title) + ' by ' + displayName + "
" + Qt.formatDateTime(new Date(timestamp*1000), "MMMM d, h:mm ap") - leftPadding: 10 - topPadding: 5 - bottomPadding:5 - color: Theme.mainTextColor - } - } - } + RowLayout { + Text { + id: texttitle + text: '' + Utils.htmlEscaped(title) + ' by ' + displayName + "
" + Qt.formatDateTime(new Date(timestamp*1000), "MMMM d, h:mm ap") + leftPadding: 10 + topPadding: 5 + bottomPadding:5 + color: Theme.mainTextColor + } + } + } - Opaque.HLine{} - } + Opaque.HLine{} + } - } + } - focus: true - ListModel { - id: jsonModel4 - } - } - } - - Opaque.ButtonTextField { - id: newlistitem - visible:listpanel.online - readOnly: false - button_text: qsTr("add-list-item-btn") - dropShadowColor: Theme.dropShadowPaneColor - property int nextMessageID: 1 - width: parent.width - 2 * Theme.paddingStandard - - onClicked: { - if (newlistitem.text != "") { - var msg = JSON.stringify({"o":4, "t":newlistitem.text}) - gcd.sendMessage(msg, nextMessageID++) - } - newlistitem.text = "" - } - - } - - Opaque.HLine{} + focus: true + ListModel { + id: jsonModel4 + } + } + } + Opaque.ButtonTextField { + id: newlistitem + visible:listpanel.online + readOnly: false + button_text: qsTr("add-list-item-btn") + dropShadowColor: Theme.dropShadowPaneColor + property int nextMessageID: 1 + Layout.fillWidth: true + onClicked: { + if (newlistitem.text != "") { + var msg = JSON.stringify({"o":4, "t":newlistitem.text}) + gcd.sendMessage(msg, nextMessageID++) + } + newlistitem.text = "" + } + } } diff --git a/qml/panes/GroupSettingsPane.qml b/qml/panes/GroupSettingsPane.qml index 9a0f3f48..5627d3c4 100644 --- a/qml/panes/GroupSettingsPane.qml +++ b/qml/panes/GroupSettingsPane.qml @@ -76,7 +76,6 @@ Opaque.SettingsList { // groupSettingsPane } Opaque.Setting { - property color backgroundColor: "red"//parent.color inline: true label: qsTr("server-info") field: Column { diff --git a/qml/panes/OverlayPane.qml b/qml/panes/OverlayPane.qml index f81a9b14..af0f6f81 100644 --- a/qml/panes/OverlayPane.qml +++ b/qml/panes/OverlayPane.qml @@ -45,23 +45,15 @@ ColumnLayout { ChatOverlay { //0 -// Layout.maximumHeight: overlayStack.height -// Layout.maximumWidth: overlayStack.width } ListOverlay{ //1 -// Layout.maximumHeight: overlayStack.height -// Layout.maximumWidth: overlayStack.width } BulletinOverlay{ //2 -// Layout.maximumHeight: overlayStack.height -// Layout.maximumWidth: overlayStack.width } MembershipOverlay { //3 -// Layout.maximumHeight: overlayStack.height -// Layout.maximumWidth: overlayStack.width } } diff --git a/qml/panes/ProfileAddEditPane.qml b/qml/panes/ProfileAddEditPane.qml index 2ef17138..b343fb06 100644 --- a/qml/panes/ProfileAddEditPane.qml +++ b/qml/panes/ProfileAddEditPane.qml @@ -365,7 +365,6 @@ Opaque.Flickable { Opaque.Button { // ADD or SAVE button - //height: Theme.primaryTextSize * 1.5 anchors.horizontalCenter: parent.horizontalCenter diff --git a/qml/panes/ProfileManagerPane.qml b/qml/panes/ProfileManagerPane.qml index a44a83a4..ba6e053c 100644 --- a/qml/panes/ProfileManagerPane.qml +++ b/qml/panes/ProfileManagerPane.qml @@ -35,16 +35,10 @@ ColumnLayout { } RowLayout { - //width: 700 * gcd.themeScale Layout.alignment: Qt.AlignHCenter Opaque.UnderlineTextField { id: txtPassword - //anchors.horizontalCenter: parent.horizontalCenter - //Layout.fillWidth: true - //Layout.maximumWidth: 450 * gcd.themeScale - //Layout.minimumWidth: 450 * gcd.themeScale - Layout.rightMargin: 40 Layout.leftMargin: 40 placeholderText: qsTr("password") diff --git a/qml/panes/ServerAddEditPane.qml b/qml/panes/ServerAddEditPane.qml index 3058263b..885f6600 100644 --- a/qml/panes/ServerAddEditPane.qml +++ b/qml/panes/ServerAddEditPane.qml @@ -53,7 +53,7 @@ Opaque.SettingsList { // Add Profile Pane checked: serverAddEditPane.server_available onCheckedChanged: function() { - //serverAddEditPane.server_available = !serverAddEditPane.server_available + serverAddEditPane.server_available = checked if (serverAddEditPane.server_available) { gcd.startServer(serverAddEditPane.server_name) } else { @@ -63,12 +63,6 @@ Opaque.SettingsList { // Add Profile Pane } } - - - - - - Opaque.Setting { label: qsTr("server-autostart") @@ -77,7 +71,7 @@ Opaque.SettingsList { // Add Profile Pane checked: serverAddEditPane.autostart_server onCheckedChanged: function() { - //serverAddEditPane.autostart_server = !serverAddEditPane.autostart_server + serverAddEditPane.autostart_server = checked gcd.autostartServer(serverAddEditPane.server_name, serverAddEditPane.autostart_server) } } diff --git a/qml/panes/ServerInfoPane.qml b/qml/panes/ServerInfoPane.qml index fe313a2b..53bdeba5 100644 --- a/qml/panes/ServerInfoPane.qml +++ b/qml/panes/ServerInfoPane.qml @@ -65,11 +65,6 @@ Opaque.SettingsList { // groupSettingsPane onSupplyServerSettings: function(server, key_names, keys) { gsp.serverName = server; toolbar.setTitle(qsTr("server-settings")); -// console.log("Servers: " + key_names); -// for (let i=0; i