this is the main cwtch gui with the pretty interface https://cwtch.im
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.2KB

  1. import QtGraphicalEffects 1.0
  2. import QtQuick 2.7
  3. import QtQuick.Controls 2.4
  4. import QtQuick.Controls.Material 2.0
  5. import QtQuick.Controls 1.4
  6. import QtQuick.Layouts 1.3
  7. import "../widgets"
  8. import "../widgets/controls" as Awesome
  9. import "../fonts/Twemoji.js" as T
  10. import "../utils.js" as Utils
  11. import "../styles"
  12. ColumnLayout {
  13. Text {
  14. wrapMode: Text.Wrap
  15. Layout.maximumWidth: parent.width
  16. horizontalAlignment: Text.AlignHCenter
  17. padding: 1
  18. text: qsTr("Below is a list of users who have sent messages to the group. This list may not reflect all users who have access to the group.")
  19. }
  20. Flickable { // THE ACTUAL CONTACT LIST
  21. id: sv
  22. //Layout.alignment: Qt.AlignLeft | Qt.AlignTop
  23. clip: true
  24. Layout.minimumHeight: 100
  25. //Layout.maximumHeight: parent.height - 30
  26. Layout.fillHeight: true
  27. Layout.minimumWidth: parent.width
  28. Layout.maximumWidth: parent.width
  29. contentWidth: colContacts.width
  30. contentHeight: colContacts.height
  31. boundsBehavior: Flickable.StopAtBounds
  32. maximumFlickVelocity: 400
  33. ScrollBar.vertical: ScrollBar {
  34. policy: ScrollBar.AlwaysOn
  35. }
  36. ColumnLayout {
  37. id: colContacts
  38. width: sv.width
  39. spacing: 0
  40. Connections { // ADD/REMOVE CONTACT ENTRIES
  41. target: gcd
  42. onClearMessages: function() {
  43. contactsModel.clear()
  44. }
  45. onAppendMessage: function(handle, from, displayName, message, image, mid, fromMe, ts, ack, error) {
  46. var msg
  47. try {
  48. msg = JSON.parse(message)
  49. } catch (e) {
  50. return
  51. }
  52. for(var i = 0; i<contactsModel.count;i++){
  53. if(contactsModel.get(i)["_handle"] == handle) {
  54. return
  55. }
  56. }
  57. if (fromMe) {
  58. contactsModel.append({
  59. "_handle": handle,
  60. "_displayName": "me",
  61. "_image": image,
  62. })
  63. } else {
  64. contactsModel.append({
  65. "_handle": handle,
  66. "_displayName": displayName == "" ? handle : displayName,
  67. "_image": image,
  68. })
  69. }
  70. }
  71. }
  72. ListModel { // CONTACT OBJECTS ARE STORED HERE ...
  73. id: contactsModel
  74. }
  75. Repeater {
  76. model: contactsModel // ... AND DISPLAYED HERE
  77. delegate: ContactRow {
  78. handle: _handle
  79. displayName: _displayName
  80. image: _image
  81. trusted: true
  82. background: false
  83. }
  84. }
  85. }
  86. }
  87. }