Skip to content

Commit

Permalink
refactored photo loading
Browse files Browse the repository at this point in the history
  • Loading branch information
gitjannes committed May 22, 2024
1 parent 0a2671d commit 2cd1963
Show file tree
Hide file tree
Showing 23 changed files with 112 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ addContent
self addUserList.
]
].
self addTestmorph.
self addTitle.
self addPhoto.

Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
as yet unclassified
addHiddenPhotoPage

self
photoPage: (TCUChatPhotoPage newFor: chat withBounds: self bounds andSize: (self width * 0.75));
addMorphFront: self photoPage.
self chat hasPhoto ifTrue: [
self
photoPage: (TCUChatPhotoPage newWithBounds: self bounds andPhoto: self photo andSize: (self width * 0.9));
addMorphFront: self photoPage.

self photoPage hide.
self photoPage hide
]
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
drawing
addPhoto

| promise morph |
| morph |
self chat hasPhoto ifTrue: [
promise := self chat core imageStore getFormPromiseFor: self chat photoId.
promise >>= [:aForm |
self photo: (self chat core imageStore getFormPromiseFor: self chat photoId).
photo >>= [:aForm |
morph := (aForm scaledToSize: self class defaultPhotoSize) asMorph.
morph position: self position.
morph on: #mouseDown send: #showPhotoPage to: self.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
as yet unclassified
addTitle

self createTitle.
self contentWrapper addMorph: self title.
self addTitleText.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
drawing
addTitleText

self title addMorph: (TextMorph new
contents: self chat title;
centered;
wrapFlag: true;
hResizing: #spaceFill;
lock;
yourself).
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
as yet unclassified
createTitle

self title: (RectangleMorph new
borderWidth: 0;
color: Color white;
layoutPolicy: TableLayout new;
listDirection: #topToBottom;
hResizing: #spaceFill;
vResizing: #shrinkWrap;
cellInset: self class defaultContentInset;
useRoundedCorners;
yourself).
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
photo: aPhoto

photo := aPhoto
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
photo

^ photo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
title: aRectangleMorph

title := aRectangleMorph
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
title

^ title
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
"defaultInfoBarHeight" : "RS 5/20/2021 21:30",
"defaultPhotoSize" : "jkon 5/15/2024 11:14",
"defaultSpacing" : "RS 5/20/2021 20:57",
"newFor:withBounds:" : "jkon 5/15/2024 15:08" },
"newFor:withBounds:" : "jkon 5/22/2024 10:39" },
"instance" : {
"addBackButton" : "ek 6/19/2022 19:13",
"addContent" : "jkon 5/15/2024 11:41",
"addContent" : "jkon 5/22/2024 10:53",
"addDescription" : "jkon 5/15/2024 11:36",
"addDescriptionText" : "RK 8/4/2021 12:05",
"addHiddenPhotoPage" : "jkon 5/15/2024 15:10",
"addHiddenPhotoPage" : "jkon 5/22/2024 10:41",
"addInfoBar" : "RS 5/20/2021 21:28",
"addInfoText" : "jkon 5/15/2024 11:04",
"addPhoto" : "jkon 5/15/2024 15:07",
"addTestmorph" : "jkon 5/15/2024 11:36",
"addPhoto" : "jkon 5/22/2024 10:26",
"addTitle" : "jkon 5/22/2024 10:55",
"addTitleText" : "jkon 5/22/2024 11:04",
"addUserList" : "jkon 5/15/2024 11:55",
"backButton" : "ek 6/19/2022 18:52",
"backButton:" : "ek 6/19/2022 18:52",
Expand All @@ -29,16 +30,18 @@
"createContentWrapper" : "jkon 5/15/2024 11:53",
"createDescription" : "RS 5/29/2021 18:32",
"createInfoBar" : "RS 5/20/2021 21:31",
"createTestMorph" : "jkon 5/15/2024 11:32",
"createTitle" : "jkon 5/22/2024 10:54",
"description" : "RS 5/29/2021 18:46",
"description:" : "RK 8/4/2021 10:26",
"infoBar" : "RS 5/20/2021 21:38",
"infoBar:" : "RK 8/4/2021 10:39",
"initialize" : "RS 5/20/2021 20:39",
"photo" : "jkon 5/22/2024 10:19",
"photo:" : "jkon 5/22/2024 10:19",
"photoPage" : "jkon 5/15/2024 15:05",
"photoPage:" : "jkon 5/15/2024 15:05",
"showPhotoPage" : "jkon 5/15/2024 15:07",
"testmorph" : "jkon 5/15/2024 11:34",
"testmorph:" : "jkon 5/15/2024 11:35",
"title" : "jkon 5/22/2024 10:50",
"title:" : "jkon 5/22/2024 10:50",
"userList" : "per 6/3/2021 17:27",
"userList:" : "RK 8/4/2021 10:40" } }
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"chat",
"userList",
"backButton",
"testmorph",
"photoPage" ],
"title",
"photoPage",
"photo" ],
"name" : "TCUChatInfoPage",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
drawing
addPhoto

| promise morph |
| morph |
self chat hasPhoto ifTrue: [
promise := self chat core imageStore getFormPromiseFor: self chat photoId.
promise >>= [:aForm |
self photo: (self chat core imageStore getFormPromiseFor: self chat photoId).
photo >>= [:aForm |
morph := (aForm scaledToSize: self class defaultPhotoSize) asMorph.
morph position: self position.
self addMorphBack: morph.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
photo: aPhoto

photo := aPhoto
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
photo

^ photo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"instance" : {
"addBorder" : "RK 8/4/2021 12:05",
"addLastMessage" : "LR 7/14/2022 11:35",
"addPhoto" : "ek 8/4/2022 13:56",
"addPhoto" : "jkon 5/22/2024 10:25",
"addTitle" : "js 6/18/2022 10:55",
"chat" : "rs 6/17/2020 21:45",
"chat:" : "rs 6/17/2020 21:45",
Expand All @@ -28,4 +28,6 @@
"lastUserName" : "js 7/22/2022 09:53",
"mouseEnter:" : "ek 6/19/2022 18:49",
"mouseLeave:" : "ek 6/19/2022 18:55",
"photo" : "jkon 5/22/2024 10:10",
"photo:" : "jkon 5/22/2024 10:11",
"select" : "ek 6/19/2022 18:49" } }
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"commentStamp" : "js 6/13/2020 19:00",
"instvars" : [
"chat",
"isSelected" ],
"isSelected",
"photo" ],
"name" : "TCUChatListItem",
"pools" : [
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
as yet unclassified
newWithBounds: aRectangle andPhoto: aPhoto andSize: aSize

^ (super newBounds: aRectangle)
photo: aPhoto;
photoSize: aSize;
addPhoto;
yourself
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
as yet unclassified
addPhoto

| promise morph |
self chat hasPhoto ifTrue: [
promise := self chat core imageStore getFormPromiseFor: self chat photoId.
promise >>= [:aForm |
morph := (aForm scaledToSize: self photoSize) asMorph.
self addMorphCentered: morph.
]
] ifFalse: [
self addMorphBack: (TCUDefaultValues defaultProfilePhoto scaledToSize: self photoSize) asMorph.
].
| morph |
photo >>= [:aForm |
morph := (aForm scaledToSize: self photoSize) asMorph.
self addMorphCentered: morph.
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
photo: aPhoto

photo := aPhoto
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
as yet unclassified
photo

^ photo
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"class" : {
"newFor:withBounds:andSize:" : "jkon 5/15/2024 15:13" },
"newWithBounds:andPhoto:andSize:" : "jkon 5/22/2024 10:27" },
"instance" : {
"addPhoto" : "jkon 5/15/2024 17:08",
"chat" : "jkon 5/15/2024 15:00",
"chat:" : "jkon 5/15/2024 15:00",
"addPhoto" : "jkon 5/22/2024 10:21",
"initialize" : "jkon 5/15/2024 15:11",
"photo" : "jkon 5/22/2024 10:30",
"photo:" : "jkon 5/22/2024 10:31",
"photoSize" : "jkon 5/15/2024 15:00",
"photoSize:" : "jkon 5/15/2024 15:01" } }
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
],
"commentStamp" : "",
"instvars" : [
"chat",
"photoSize" ],
"photoSize",
"photo" ],
"name" : "TCUChatPhotoPage",
"pools" : [
],
Expand Down

0 comments on commit 2cd1963

Please sign in to comment.