Changeset 123 for trunk/Forms


Ignore:
Timestamp:
Mar 16, 2022, 11:35:08 AM (2 years ago)
Author:
chronos
Message:
  • Added: QR code image visible in contact others tab. It can be saved as image to file.
Location:
trunk/Forms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormCompare.lfm

    r121 r123  
    10831083  end
    10841084  object OpenDialogSide: TOpenDialog
    1085     Left = 344
    1086     Top = 362
     1085    Left = 336
     1086    Top = 360
    10871087  end
    10881088  object MainMenu1: TMainMenu
  • trunk/Forms/UFormContact.lfm

    r112 r123  
    11object FormContact: TFormContact
    2   Left = 1063
    3   Height = 773
    4   Top = 449
    5   Width = 1032
     2  Left = 1043
     3  Height = 769
     4  Top = 446
     5  Width = 1033
    66  Caption = 'Contact'
    7   ClientHeight = 773
    8   ClientWidth = 1032
     7  ClientHeight = 769
     8  ClientWidth = 1033
    99  DesignTimePPI = 150
    1010  OnClose = FormClose
     
    1414  LCLVersion = '2.2.0.4'
    1515  object ButtonCancel: TButton
    16     Left = 900
     16    Left = 901
    1717    Height = 39
    18     Top = 720
     18    Top = 716
    1919    Width = 120
    2020    Anchors = [akRight, akBottom]
     
    2525  end
    2626  object ButtonOk: TButton
    27     Left = 759
     27    Left = 760
    2828    Height = 39
    29     Top = 720
     29    Top = 716
    3030    Width = 124
    3131    Anchors = [akRight, akBottom]
     
    3838    Left = 8
    3939    Height = 39
    40     Top = 720
     40    Top = 716
    4141    Width = 124
    4242    Anchors = [akLeft, akBottom]
     
    5050    Left = 150
    5151    Height = 39
    52     Top = 720
     52    Top = 716
    5353    Width = 120
    5454    Anchors = [akLeft, akBottom]
     
    6161  object PageControlContact: TPageControl
    6262    Left = 8
    63     Height = 696
     63    Height = 692
    6464    Top = 8
    65     Width = 1009
    66     ActivePage = TabSheetGeneral
     65    Width = 1010
     66    ActivePage = TabSheetOthers
    6767    Anchors = [akTop, akLeft, akRight, akBottom]
    6868    ParentFont = False
    69     TabIndex = 0
     69    TabIndex = 5
    7070    TabOrder = 4
    7171    object TabSheetGeneral: TTabSheet
    7272      Caption = 'General'
    73       ClientHeight = 655
    74       ClientWidth = 999
     73      ClientHeight = 651
     74      ClientWidth = 1000
    7575      OnHide = TabSheetGeneralHide
    7676      OnShow = TabSheetGeneralShow
     
    340340    object TabSheetHome: TTabSheet
    341341      Caption = 'Home'
    342       ClientHeight = 655
    343       ClientWidth = 999
     342      ClientHeight = 651
     343      ClientWidth = 1000
    344344      OnHide = TabSheetHomeHide
    345345      OnShow = TabSheetHomeShow
     
    429429        Height = 287
    430430        Top = 225
    431         Width = 897
     431        Width = 898
    432432        Anchors = [akTop, akLeft, akRight]
    433433        Caption = 'Address'
    434434        ClientHeight = 285
    435         ClientWidth = 895
     435        ClientWidth = 896
    436436        TabOrder = 6
    437437        object Label36: TLabel
     
    600600    object TabSheetWork: TTabSheet
    601601      Caption = 'Work'
    602       ClientHeight = 655
    603       ClientWidth = 999
     602      ClientHeight = 651
     603      ClientWidth = 1000
    604604      OnHide = TabSheetWorkHide
    605605      OnShow = TabSheetWorkShow
     
    906906    object TabSheetChat: TTabSheet
    907907      Caption = 'Chat'
    908       ClientHeight = 655
    909       ClientWidth = 999
     908      ClientHeight = 651
     909      ClientWidth = 1000
    910910      OnHide = TabSheetChatHide
    911911      OnShow = TabSheetChatShow
     
    11211121    object TabSheetSocial: TTabSheet
    11221122      Caption = 'Social'
    1123       ClientHeight = 655
    1124       ClientWidth = 999
     1123      ClientHeight = 651
     1124      ClientWidth = 1000
    11251125      OnHide = TabSheetSocialHide
    11261126      OnShow = TabSheetSocialShow
     
    12881288    object TabSheetOthers: TTabSheet
    12891289      Caption = 'Others'
    1290       ClientHeight = 655
    1291       ClientWidth = 999
     1290      ClientHeight = 651
     1291      ClientWidth = 1000
    12921292      OnHide = TabSheetOthersHide
    12931293      OnShow = TabSheetOthersShow
    12941294      object MemoNotes: TMemo
    12951295        Left = 17
    1296         Height = 293
     1296        Height = 289
    12971297        Top = 50
    1298         Width = 963
     1298        Width = 671
    12991299        Anchors = [akTop, akLeft, akRight, akBottom]
    13001300        ParentFont = False
     
    13101310        Caption = 'Notes:'
    13111311        ParentFont = False
     1312      end
     1313      object BarcodeQR1: TBarcodeQR
     1314        Left = 704
     1315        Height = 286
     1316        Top = 50
     1317        Width = 280
     1318        ParentColor = False
     1319        Text = 'TBarcodeQR'
     1320      end
     1321      object Label1: TLabel
     1322        Left = 704
     1323        Height = 27
     1324        Top = 16
     1325        Width = 80
     1326        Anchors = [akTop, akRight]
     1327        Caption = 'QR code:'
    13121328      end
    13131329    end
     
    13811397    Top = 608
    13821398  end
     1399  object PopupMenuQrCode: TPopupMenu
     1400    Left = 528
     1401    Top = 472
     1402    object MenuItemSaveQrToFile: TMenuItem
     1403      Caption = 'Save to file'
     1404      OnClick = MenuItemSaveQrToFileClick
     1405    end
     1406  end
    13831407end
  • trunk/Forms/UFormContact.lrj

    r110 r123  
    8989{"hash":90893459,"name":"tformcontact.tabsheetothers.caption","sourcebytes":[79,116,104,101,114,115],"value":"Others"},
    9090{"hash":89566314,"name":"tformcontact.label6.caption","sourcebytes":[78,111,116,101,115,58],"value":"Notes:"},
     91{"hash":144712418,"name":"tformcontact.barcodeqr1.text","sourcebytes":[84,66,97,114,99,111,100,101,81,82],"value":"TBarcodeQR"},
     92{"hash":74080234,"name":"tformcontact.label1.caption","sourcebytes":[81,82,32,99,111,100,101,58],"value":"QR code:"},
    9193{"hash":113983571,"name":"tformcontact.tabsheetall.caption","sourcebytes":[65,108,108,32,102,105,101,108,100,115],"value":"All fields"},
    9294{"hash":8431845,"name":"tformcontact.aphotoload.caption","sourcebytes":[76,111,97,100,32,102,114,111,109,32,102,105,108,101],"value":"Load from file"},
     
    99101{"hash":171928085,"name":"tformcontact.calendardialog1.title","sourcebytes":[83,101,108,101,99,116,32,100,97,116,101],"value":"Select date"},
    100102{"hash":11067,"name":"tformcontact.calendardialog1.okcaption","sourcebytes":[38,79,75],"value":"&OK"},
    101 {"hash":77089212,"name":"tformcontact.calendardialog1.cancelcaption","sourcebytes":[67,97,110,99,101,108],"value":"Cancel"}
     103{"hash":77089212,"name":"tformcontact.calendardialog1.cancelcaption","sourcebytes":[67,97,110,99,101,108],"value":"Cancel"},
     104{"hash":9308581,"name":"tformcontact.menuitemsaveqrtofile.caption","sourcebytes":[83,97,118,101,32,116,111,32,102,105,108,101],"value":"Save to file"}
    102105]}
  • trunk/Forms/UFormContact.pas

    r110 r123  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    99  ComCtrls, ActnList, Menus, ExtCtrls, ExtDlgs, Buttons, UContact, LCLIntf,
    10   UFormProperties, DateUtils{$IFDEF LCLGTK2}, Gtk2Globals{$ENDIF}, UContactImage;
     10  UFormProperties, DateUtils, Gtk2Globals, UContactImage, ubarcodes;
    1111
    1212type
     
    2121    APhotoLoad: TAction;
    2222    ActionList1: TActionList;
     23    BarcodeQR1: TBarcodeQR;
    2324    ButtonCancel: TButton;
    2425    ButtonHomeAddressShow: TButton;
     
    9697    GroupBox2: TGroupBox;
    9798    ImagePhoto: TImage;
     99    Label1: TLabel;
    98100    Label10: TLabel;
    99101    Label11: TLabel;
     
    167169    MenuItem4: TMenuItem;
    168170    MenuItem5: TMenuItem;
     171    MenuItemSaveQrToFile: TMenuItem;
    169172    OpenPictureDialog1: TOpenPictureDialog;
    170173    PageControlContact: TPageControl;
     174    PopupMenuQrCode: TPopupMenu;
    171175    PopupMenuPhoto: TPopupMenu;
    172176    SavePictureDialog1: TSavePictureDialog;
     
    202206    procedure FormShow(Sender: TObject);
    203207    procedure ImagePhotoClick(Sender: TObject);
     208    procedure MenuItemSaveQrToFileClick(Sender: TObject);
    204209    procedure SpeedButtonHomeWebClick(Sender: TObject);
    205210    procedure SpeedButtonAniversaryClick(Sender: TObject);
     
    249254
    250255uses
    251   UCore, UCommon, UFormImage, UFormNameDetails;
     256  UCore, UCommon, UFormImage, UFormNameDetails, UDataFile;
    252257
    253258resourcestring
     
    255260  SPhotoUrl = 'Photo URL';
    256261  SPhotoUrlQuery = 'Enter URL for profile photo';
     262  SImageTypeNotSupported = 'Image type not supported.';
    257263
    258264function DateToISO(Date: TDateTime): string;
     
    341347end;
    342348
     349procedure TFormContact.MenuItemSaveQrToFileClick(Sender: TObject);
     350var
     351  F: string;
     352begin
     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;
     379end;
     380
    343381procedure TFormContact.SpeedButtonHomeWebClick(Sender: TObject);
    344382begin
     
    528566begin
    529567  MemoNotes.Lines.Text := Contact.Fields[cfNote];
     568  BarcodeQR1.Text := Contact.AsString;
    530569end;
    531570
     
    641680procedure TFormContact.APhotoLoadExecute(Sender: TObject);
    642681begin
    643   OpenPictureDialog1.FileName := Core.LastPhotoFileName;
     682  OpenPictureDialog1.InitialDir := ExtractFileDir(Core.LastPhotoFileName);
     683  OpenPictureDialog1.FileName := ExtractFileName(Core.LastPhotoFileName);
    644684  if OpenPictureDialog1.Execute then begin
    645685    FPhoto.LoadFromFile(OpenPictureDialog1.FileName);
     
    655695procedure TFormContact.APhotoSaveExecute(Sender: TObject);
    656696begin
    657   SavePictureDialog1.FileName := Core.LastPhotoFileName;
     697  SavePictureDialog1.InitialDir := ExtractFileDir(Core.LastPhotoFileName);
     698  SavePictureDialog1.FileName := ExtractFileName(Core.LastPhotoFileName);
    658699  if SavePictureDialog1.Execute then begin
    659700    ImagePhoto.Picture.SaveToFile(SavePictureDialog1.FileName);
     
    777818  FPhoto.FieldIndex := cfPhoto;
    778819  FPhoto.OnChange := PhotoChange;
     820
     821  // Set Barcode unpublished properties
     822  BarcodeQR1.Anchors := [akTop, akRight];
     823  BarcodeQR1.PopupMenu := PopupMenuQrCode;
    779824end;
    780825
  • trunk/Forms/UFormImage.pas

    r103 r123  
    7373procedure TFormImage.ButtonLoadClick(Sender: TObject);
    7474begin
    75   OpenPictureDialog1.FileName := Core.LastPhotoFileName;
     75  OpenPictureDialog1.InitialDir := ExtractFileDir(Core.LastPhotoFileName);
     76  OpenPictureDialog1.FileName := ExtractFileName(Core.LastPhotoFileName);
    7677  if OpenPictureDialog1.Execute then begin
    7778    Image.LoadFromFile(OpenPictureDialog1.FileName);
     
    8788procedure TFormImage.ButtonSaveClick(Sender: TObject);
    8889begin
    89   SavePictureDialog1.FileName := Core.LastPhotoFileName;
     90  SavePictureDialog1.InitialDir := ExtractFileDir(Core.LastPhotoFileName);
     91  SavePictureDialog1.FileName := ExtractFileName(Core.LastPhotoFileName);
    9092  if SavePictureDialog1.Execute then begin
    9193    Image.SaveToFile(SavePictureDialog1.FileName);
  • trunk/Forms/UFormProperties.pas

    r108 r123  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
    9   ComCtrls, Menus, ActnList, UContact, UListViewSort, fgl, LazUTF8;
     9  ComCtrls, Menus, ActnList, UContact, UDataFile, UListViewSort, fgl, LazUTF8;
    1010
    1111type
     
    9494  SFiltered = 'Filtered';
    9595  SSelected = 'Selected';
    96   SAllFiles = 'All files';
    9796  STextFiles = 'Text files';
    9897  SValue = 'Value';
Note: See TracChangeset for help on using the changeset viewer.