Changeset 48
- Timestamp:
- Dec 3, 2021, 2:07:27 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContact.lfm
r47 r48 137 137 Top = 16 138 138 Width = 207 139 Center = True 139 140 PopupMenu = PopupMenuPhoto 140 141 Proportional = True -
trunk/Forms/UFormContact.pas
r47 r48 147 147 FOnPrevious: TNotifyEvent; 148 148 FormProperties: TFormProperties; 149 ProfilePhotoActive: Boolean; 150 procedure DefaultPhoto; 149 151 procedure SetContact(AValue: TContact); 150 152 procedure ReloadAllPropertiesTab; … … 210 212 211 213 // Photo 212 if (ImagePhoto.Picture.Bitmap.Width <> 0) and (ImagePhoto.Picture.Bitmap.Height <> 0)then begin214 if ProfilePhotoActive then begin 213 215 PhotoProperty := Contact.GetProperty(cfPhoto); 214 216 if not Assigned(PhotoProperty) then begin … … 292 294 ImagePhoto.Picture.Bitmap.SetSize(JpegImage.Width, JpegImage.Height); 293 295 ImagePhoto.Picture.Bitmap.Canvas.Draw(0, 0, JpegImage); 296 ProfilePhotoActive := True; 294 297 except 298 DefaultPhoto; 295 299 end; 296 300 finally … … 300 304 try 301 305 ImagePhoto.Picture.LoadFromStream(Stream); 306 ProfilePhotoActive := True; 302 307 except 308 DefaultPhoto; 303 309 end; 304 310 end; … … 306 312 Stream.Free; 307 313 end; 308 end ;309 end ;314 end else DefaultPhoto; 315 end else DefaultPhoto; 310 316 end; 311 317 … … 400 406 end; 401 407 408 procedure TFormContact.DefaultPhoto; 409 begin 410 ProfilePhotoActive := False; 411 ImagePhoto.Picture.Assign(Core.GetProfileImage.Picture); 412 end; 413 402 414 procedure TFormContact.SetContact(AValue: TContact); 403 415 begin … … 458 470 procedure TFormContact.UpdateInterface; 459 471 begin 460 APhotoSave.Enabled := (ImagePhoto.Picture.Bitmap.Width <> 0) and 461 (ImagePhoto.Picture.Bitmap.Height <> 0); 472 APhotoSave.Enabled := ProfilePhotoActive; 462 473 end; 463 474 -
trunk/UCore.pas
r43 r48 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Controls, ActnList, Forms, Dialogs, 8 Classes, SysUtils, FileUtil, Controls, ActnList, Forms, Dialogs, ExtCtrls, 9 9 ULastOpenedList, UApplicationInfo, UPersistentForm, UScaleDPI, UCommon, 10 10 UTranslator, UDataFile, Menus, URegistry, UTheme, UAboutDialog, Registry; … … 69 69 InitializeFinished: Boolean; 70 70 LoadErrors: string; 71 ProfileImage: TImage; 71 72 procedure FileModified(Sender: TObject); 72 73 function FindFirstNonOption: string; … … 81 82 ReopenLastFileOnStart: Boolean; 82 83 ToolbarVisible: Boolean; 84 function GetProfileImage: TImage; 83 85 procedure FileNew; 84 86 procedure FileOpen(FileName: string); … … 294 296 FileClose; 295 297 SaveConfig; 298 if Assigned(ProfileImage) then 299 FreeAndNil(ProfileImage); 296 300 end; 297 301 … … 454 458 end; 455 459 460 function TCore.GetProfileImage: TImage; 461 const 462 ProfilePhotoFileName = 'Images/Profile.png'; 463 begin 464 if not Assigned(ProfileImage) then begin 465 ProfileImage := TImage.Create(nil); 466 ProfileImage.Picture.LoadFromFile(ProfilePhotoFileName); 467 if FileExists(ProfilePhotoFileName) then 468 ProfileImage.Picture.LoadFromFile(ProfilePhotoFileName); 469 end; 470 Result := ProfileImage; 471 end; 472 456 473 procedure TCore.UpdateInterface; 457 474 begin
Note:
See TracChangeset
for help on using the changeset viewer.