You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8357 8e941d3f-bd1b-0410-a28a-d453659cc2b4
69 lines
1.2 KiB
ObjectPascal
69 lines
1.2 KiB
ObjectPascal
unit main;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ubarcodes;
|
|
|
|
type
|
|
|
|
{ TMainForm }
|
|
|
|
TMainForm = class(TForm)
|
|
Timer: TTimer;
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure TimerTimer(Sender: TObject);
|
|
private
|
|
BarcodeQR: TBarcodeQR;
|
|
function GetNowText: String;
|
|
|
|
public
|
|
|
|
end;
|
|
|
|
var
|
|
MainForm: TMainForm;
|
|
|
|
implementation
|
|
|
|
{$R *.lfm}
|
|
|
|
{ TMainForm }
|
|
|
|
procedure TMainForm.TimerTimer(Sender: TObject);
|
|
begin
|
|
BarcodeQR.Text := GetNowText;
|
|
Caption := 'QRClock: ' + StringReplace(BarcodeQR.Text, LineEnding, ' - ', []);
|
|
end;
|
|
|
|
procedure TMainForm.FormCreate(Sender: TObject);
|
|
var
|
|
w: Integer = 0;
|
|
h: Integer = 0;
|
|
begin
|
|
BarcodeQR := TBarcodeQR.Create(self);
|
|
BarcodeQR.Parent := self;
|
|
BarcodeQR.Scale := 16;
|
|
BarcodeQR.Text := GetNowText;
|
|
BarcodeQR.GetPreferredSize(w, h);
|
|
BarcodeQR.SetBounds(0, 0, w, h);
|
|
ClientWidth := w;
|
|
ClientHeight := h;
|
|
end;
|
|
|
|
function TMainForm.GetNowText: String;
|
|
var
|
|
dt: TDateTime;
|
|
sd, st: String;
|
|
begin
|
|
dt := Now();
|
|
sd := FormatDateTime('dddddd', dt);
|
|
st := FormatDateTime('hh:nn:ss', dt);
|
|
Result := sd + LineEnding + st;
|
|
end;
|
|
|
|
end.
|
|
|