Changeset 123 for trunk/Forms/UFormContact.pas
- Timestamp:
- Mar 16, 2022, 11:35:08 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormContact.pas
r110 r123 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 9 ComCtrls, ActnList, Menus, ExtCtrls, ExtDlgs, Buttons, UContact, LCLIntf, 10 UFormProperties, DateUtils {$IFDEF LCLGTK2}, Gtk2Globals{$ENDIF}, UContactImage;10 UFormProperties, DateUtils, Gtk2Globals, UContactImage, ubarcodes; 11 11 12 12 type … … 21 21 APhotoLoad: TAction; 22 22 ActionList1: TActionList; 23 BarcodeQR1: TBarcodeQR; 23 24 ButtonCancel: TButton; 24 25 ButtonHomeAddressShow: TButton; … … 96 97 GroupBox2: TGroupBox; 97 98 ImagePhoto: TImage; 99 Label1: TLabel; 98 100 Label10: TLabel; 99 101 Label11: TLabel; … … 167 169 MenuItem4: TMenuItem; 168 170 MenuItem5: TMenuItem; 171 MenuItemSaveQrToFile: TMenuItem; 169 172 OpenPictureDialog1: TOpenPictureDialog; 170 173 PageControlContact: TPageControl; 174 PopupMenuQrCode: TPopupMenu; 171 175 PopupMenuPhoto: TPopupMenu; 172 176 SavePictureDialog1: TSavePictureDialog; … … 202 206 procedure FormShow(Sender: TObject); 203 207 procedure ImagePhotoClick(Sender: TObject); 208 procedure MenuItemSaveQrToFileClick(Sender: TObject); 204 209 procedure SpeedButtonHomeWebClick(Sender: TObject); 205 210 procedure SpeedButtonAniversaryClick(Sender: TObject); … … 249 254 250 255 uses 251 UCore, UCommon, UFormImage, UFormNameDetails ;256 UCore, UCommon, UFormImage, UFormNameDetails, UDataFile; 252 257 253 258 resourcestring … … 255 260 SPhotoUrl = 'Photo URL'; 256 261 SPhotoUrlQuery = 'Enter URL for profile photo'; 262 SImageTypeNotSupported = 'Image type not supported.'; 257 263 258 264 function DateToISO(Date: TDateTime): string; … … 341 347 end; 342 348 349 procedure TFormContact.MenuItemSaveQrToFileClick(Sender: TObject); 350 var 351 F: string; 352 begin 353 SavePictureDialog1.Filter := 'Windows bitmap files (*.bmp)|*.bmp|' + 354 'Portable network graphic files (*.png)|*.png|' + 355 'JPEG image files (*.jpg;*.jpeg)|*.jpg;*.jpeg|' + 356 'TIFF image files (*.tiff; *.tif)|*.tiff;*.tif|'+ 357 'XPM image files (*.xpm)|*.xpm|' + 358 'Scalable vector graphics files (*.svg)|*.svg|'+ 359 'Encapsulated PostScript files (*.eps;*.ps)|*.eps;*.ps|'+ 360 SAllFiles + ' (*.*)|*.*'; 361 SavePictureDialog1.FilterIndex := 2; 362 SavePictureDialog1.DefaultExt := '.png'; 363 if Core.LastQrCodeFileName = '' then 364 Core.LastQrCodeFileName := 'QR code.png'; 365 SavePictureDialog1.InitialDir := ExtractFileDir(Core.LastQrCodeFileName); 366 SavePictureDialog1.FileName := ExtractFileName(Core.LastQrCodeFileName); 367 if SavePictureDialog1.Execute then begin 368 F := LowerCase(ExtractFileExt(SavePictureDialog1.FileName)); 369 if F = '.bmp' then BarcodeQR1.SaveToFile(SavePictureDialog1.FileName, TBitmap) 370 else if F = '.png' then BarcodeQR1.SaveToFile(SavePictureDialog1.FileName, TPortableNetworkGraphic) 371 else if (F = '.jpg') or (F = '.jpeg') then BarcodeQR1.SaveTofile(SavePictureDialog1.FileName, TJpegImage) 372 else if (F = '.tif') or (F = '.tiff') then BarcodeQR1.SaveToFile(SavePictureDialog1.FileName, TTiffImage) 373 else if F = '.xpm' then BarcodeQR1.SaveToFile(SavePictureDialog1.FileName, TPixmap) 374 else if F = '.svg' then BarcodeQR1.SaveToSvgFile(SavePictureDialog1.FileName) 375 else if (F = '.eps') or (F = '.ps') then BarcodeQR1.SaveToEpsFile(SavePictureDialog1.FileName) 376 else raise Exception.Create(SImageTypeNotSupported); 377 Core.LastQrCodeFileName := SavePictureDialog1.FileName; 378 end; 379 end; 380 343 381 procedure TFormContact.SpeedButtonHomeWebClick(Sender: TObject); 344 382 begin … … 528 566 begin 529 567 MemoNotes.Lines.Text := Contact.Fields[cfNote]; 568 BarcodeQR1.Text := Contact.AsString; 530 569 end; 531 570 … … 641 680 procedure TFormContact.APhotoLoadExecute(Sender: TObject); 642 681 begin 643 OpenPictureDialog1.FileName := Core.LastPhotoFileName; 682 OpenPictureDialog1.InitialDir := ExtractFileDir(Core.LastPhotoFileName); 683 OpenPictureDialog1.FileName := ExtractFileName(Core.LastPhotoFileName); 644 684 if OpenPictureDialog1.Execute then begin 645 685 FPhoto.LoadFromFile(OpenPictureDialog1.FileName); … … 655 695 procedure TFormContact.APhotoSaveExecute(Sender: TObject); 656 696 begin 657 SavePictureDialog1.FileName := Core.LastPhotoFileName; 697 SavePictureDialog1.InitialDir := ExtractFileDir(Core.LastPhotoFileName); 698 SavePictureDialog1.FileName := ExtractFileName(Core.LastPhotoFileName); 658 699 if SavePictureDialog1.Execute then begin 659 700 ImagePhoto.Picture.SaveToFile(SavePictureDialog1.FileName); … … 777 818 FPhoto.FieldIndex := cfPhoto; 778 819 FPhoto.OnChange := PhotoChange; 820 821 // Set Barcode unpublished properties 822 BarcodeQR1.Anchors := [akTop, akRight]; 823 BarcodeQR1.PopupMenu := PopupMenuQrCode; 779 824 end; 780 825
Note:
See TracChangeset
for help on using the changeset viewer.