From 962d701be6b18d1b55fc3a8c36c5f32587a3e4d6 Mon Sep 17 00:00:00 2001
From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com>
Date: Sun, 11 Feb 2024 11:52:20 -0600
Subject: [PATCH] Display a placeholder icon in profile-picture spot
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Now we can display an icon, since profile pictures
aren’t loaded (yet).
---
contact.scm | 11 +++++++++--
contact.ui | 28 +++++-----------------------
2 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/contact.scm b/contact.scm
index 418bdf3..83c8e87 100644
--- a/contact.scm
+++ b/contact.scm
@@ -126,6 +126,13 @@
;; Initialize the window.
(define (init-window window)
+ ;; Set the profile-picture label to a default theme icon.
+ (let [(default-profile-pic
+ (or (qt:theme-icon "person") (qt:theme-icon "contact-new")))]
+ (if default-profile-pic
+ (set! (qt:property (qt:find window "avatarLabel") "pixmap")
+ (qt:icon->pixmap default-profile-pic 100 100))))
+ ;; Now prepare callbacks and show the window.
(window-callbacks window)
(qt:show window))
@@ -176,7 +183,8 @@
menu-file-open "triggered()"
(qt:receiver
(lambda ()
- (let* [(contacts-dir (conc (get-environment-variable "HOME") "/Contacts"))
+ (let* [(contacts-dir (conc (get-environment-variable "HOME")
+ "/Contacts"))
(selected-file (qt:get-open-filename
"Select a contact file to open…"
contacts-dir))
@@ -187,7 +195,6 @@
program-args)))))))))
-
;; Parse a vCard file and populate the window’s forms with its contents.
(define (open-vcard-file window file)
(if (and (file-exists? file)
diff --git a/contact.ui b/contact.ui
index 9f6f3d8..702c94f 100644
--- a/contact.ui
+++ b/contact.ui
@@ -21,31 +21,13 @@
QLayout::SetMinimumSize
-
-
-
+
+
+ Profile picture
+
+
true
-
-
- 0
- 0
-
-
-
-
- 50
- 50
-
-
-
-
- 100
- 100
-
-
-
- QFrame::NoFrame
-
-