Skip to content

Commit

Permalink
[SVN版本:820]
Browse files Browse the repository at this point in the history
* 修正了 Unsubscribe 没有传送 QoS 级别造成部分服务器可能会断开连接的问题
+ 增加 PopupPosition/PopupMonitor 属性
* 优化 CustomDialog 显示效果
[SVN版本:819]
+ 增加示例
[SVN版本:818]
[QMQTT]
* Windows 平台启用 OpenSSL 编译选项
* 修正了 Windows 平台下编译错误的问题
[qrbtree]
* 移除 QWorker 的引用
[SVN版本:817]
[QMQTT]
+ 增加跨平台支持
[QString]
+ 修正了非 Windows 平台获取时区代码无法编译的问题
+ 修正了 ParseInt 在超过64位整数表示范围的数字时没有正确处理溢出的问题
[QJson]
+ 增加 jdtBcd 类型和 AsBcd
属性来处理超大数字的表示问题(如果超出BCD的表示范围,俺表示概不负责,您那个时候应该用字符串来表示了,感谢AK47反馈并测试验证)
  • Loading branch information
qdac committed Apr 15, 2019
1 parent ecfc986 commit eee7b74
Show file tree
Hide file tree
Showing 7 changed files with 950 additions and 791 deletions.
55 changes: 52 additions & 3 deletions Demos/Delphi/VCL/dialgBuilder/Unit1.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ object Form1: TForm1
Left = 0
Top = 0
Caption = 'Dialog Builder '#31034#20363
ClientHeight = 375
ClientHeight = 396
ClientWidth = 574
Color = clWindow
Font.Charset = DEFAULT_CHARSET
Expand All @@ -16,12 +16,12 @@ object Form1: TForm1
TextHeight = 13
object Label1: TLabel
Left = 24
Top = 354
Top = 370
Width = 3
Height = 13
end
object Button1: TButton
Left = 16
Left = 8
Top = 8
Width = 120
Height = 32
Expand Down Expand Up @@ -128,4 +128,53 @@ object Form1: TForm1
TabOrder = 11
OnClick = Button12Click
end
object GroupBox1: TGroupBox
Left = 24
Top = 160
Width = 521
Height = 201
Caption = 'Popup position'
TabOrder = 12
object RadioGroup1: TRadioGroup
AlignWithMargins = True
Left = 5
Top = 18
Width = 236
Height = 178
Align = alLeft
Caption = 'Position'
Columns = 2
ItemIndex = 0
Items.Strings = (
'dppDefault'
'dppLeftTop'
'dppCenterTop'
'dppRightTop'
'dppLeftCenter'
'dppCenter'
'dppRightCenter'
'dppLeftBottom'
'dppCenterBottom'
'dppRightBottom')
TabOrder = 0
end
object Button13: TButton
Left = 336
Top = 32
Width = 121
Height = 57
Caption = 'Popup on control'
TabOrder = 1
OnClick = Button13Click
end
object Button14: TButton
Left = 336
Top = 95
Width = 121
Height = 57
Caption = 'Popup on monitor'
TabOrder = 2
OnClick = Button14Click
end
end
end
85 changes: 48 additions & 37 deletions Demos/Delphi/VCL/dialgBuilder/Unit1.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ TForm1 = class(TForm)
Button10: TButton;
Button11: TButton;
Button12: TButton;
GroupBox1: TGroupBox;
RadioGroup1: TRadioGroup;
Button13: TButton;
Button14: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
Expand All @@ -35,11 +39,13 @@ TForm1 = class(TForm)
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
private
{ Private declarations }
FBuilder: IDialogBuilder;
FEditor: TEdit;
procedure DoDialogResult(FBuilder: IDialogBuilder);
procedure DoDialogResult(ABuilder: IDialogBuilder);
procedure ValidBuilder;
procedure LoadUser32Icon(APicture: TPicture; AResId: Integer);
public
Expand All @@ -55,8 +61,7 @@ implementation

procedure TForm1.Button10Click(Sender: TObject);
begin
CustomDialog('自动关闭窗口', '这个窗口将在5秒后关闭', 'AFlags 参数低16位为倒计时秒数', ['立即关闭'],
diInformation, CDF_DISPLAY_REMAIN_TIME or 5);
CustomDialog('自动关闭窗口', '这个窗口将在5秒后关闭', 'AFlags 参数低16位为倒计时秒数', ['立即关闭'], diInformation, CDF_DISPLAY_REMAIN_TIME or 5);
end;

procedure TForm1.Button11Click(Sender: TObject);
Expand All @@ -70,6 +75,7 @@ procedure TForm1.Button11Click(Sender: TObject);
ABuilder := NewDialog('进度窗口');
ABuilder.ItemSpace := 10;
ABuilder.AutoSize := True;
ABuilder.Dialog.Padding.SetBounds(5, 5, 5, 5);
AHint := TLabel(ABuilder.AddControl(TLabel).Control);
AHint.Caption := '正在处理,已完成0%...';
AHint.AlignWithMargins := True;
Expand Down Expand Up @@ -111,10 +117,7 @@ procedure TForm1.Button12Click(Sender: TObject);
begin
ABuilder := NewDialog;
ABuilder.AutoSize := True;
ABuilder.Dialog.Padding.Left := 5;
ABuilder.Dialog.Padding.Top := 5;
ABuilder.Dialog.Padding.Right := 5;
ABuilder.Dialog.Padding.Bottom := 5;
ABuilder.Dialog.Padding.SetBounds(5, 5, 5, 5);
for I := 0 to 5 do
begin
with ABuilder.AddContainer(amHorizLeft) do
Expand Down Expand Up @@ -151,6 +154,20 @@ procedure TForm1.Button12Click(Sender: TObject);
end;
end;

procedure TForm1.Button13Click(Sender: TObject);
begin
ValidBuilder;
FBuilder.PopupPosition := TQDialogPopupPosition(RadioGroup1.ItemIndex);
FBuilder.Popup(GroupBox1);
end;

procedure TForm1.Button14Click(Sender: TObject);
begin
ValidBuilder;
FBuilder.PopupPosition := TQDialogPopupPosition(RadioGroup1.ItemIndex);
FBuilder.Popup(nil);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
ValidBuilder;
Expand All @@ -171,11 +188,10 @@ procedure TForm1.Button3Click(Sender: TObject);
begin
// 此示例演示通过PropText定义属性及用户定义大小单选列表处理的问题
ABuilder := NewDialog('单选项目');
ABuilder.Dialog.Padding.SetBounds(5, 5, 5, 5);
ABuilder.PropText := '{"Width":300,"Height":150}';
ABuilder.AddControl(TRadioButton,
'{"Caption":"这个是项目一","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}');
ABuilder.AddControl(TRadioButton,
'{"Caption":"这个是项目二","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}');
ABuilder.AddControl(TRadioButton, '{"Caption":"这个是项目一","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}');
ABuilder.AddControl(TRadioButton, '{"Caption":"这个是项目二","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}');
with ABuilder.AddContainer(amHorizRight) do
begin
Height := 32;
Expand All @@ -189,8 +205,7 @@ procedure TForm1.Button3Click(Sender: TObject);
begin
if Supports(ABuilder[I], IControlDialogItem, ACtrl) then
begin
if (ACtrl.Control is TRadioButton) and
(TRadioButton(ACtrl.Control).Checked) then
if (ACtrl.Control is TRadioButton) and (TRadioButton(ACtrl.Control).Checked) then
begin
ShowMessage(TRadioButton(ACtrl.Control).Caption + ' 被选择');
Break;
Expand All @@ -207,6 +222,7 @@ procedure TForm1.Button4Click(Sender: TObject);
ABuilder := NewDialog('下拉示例');
ABuilder.ItemSpace := 10;
ABuilder.AutoSize := True;
ABuilder.Dialog.Padding.SetBounds(5, 5, 5, 5);
with TLabel(ABuilder.AddControl(TLabel).Control) do
begin
Caption := '起床换衣服了!!!';
Expand Down Expand Up @@ -238,33 +254,28 @@ procedure TForm1.Button5Click(Sender: TObject);
// 本示例演示分组的用法
ABuilder := NewDialog('分组示例');
ABuilder.AutoSize := True;
ABuilder.Dialog.Padding.SetBounds(5, 5, 5, 5);
// 添加第一组RadioButton
with ABuilder.AddContainer(amVertTop) do
begin
ItemSpace := 10;
AutoSize := True;
AddControl(TLabel,
'{"Caption":"第一组","Color":"clGray","Transparent":False,"Font":{"Color":"clWhite","Size":11}}');
AddControl(TRadioButton,
'{"Caption":"这个是第一组的第一项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}')
.GroupName := 'Group1';
AddControl(TRadioButton,
'{"Caption":"这个是第一组的第二项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}')
.GroupName := 'Group1';
AddControl(TLabel, '{"Caption":"第一组","Color":"clGray","Transparent":False,"Font":{"Color":"clWhite","Size":11}}');
AddControl(TRadioButton, '{"Caption":"这个是第一组的第一项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}').GroupName
:= 'Group1';
AddControl(TRadioButton, '{"Caption":"这个是第一组的第二项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}').GroupName
:= 'Group1';
end;
// 添加第二组RadioButton
with ABuilder.AddContainer(amVertTop) do
begin
AutoSize := True;
ItemSpace := 10;
AddControl(TLabel,
'{"Caption":"第二组","Color":"clGray","Transparent":False,"Font":{"Color":"clWhite","Size":11}}');
AddControl(TRadioButton,
'{"Caption":"这个是第二组的第一项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}')
.GroupName := 'Group2';
AddControl(TRadioButton,
'{"Caption":"这个是第二组的第二项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}')
.GroupName := 'Group2';
AddControl(TLabel, '{"Caption":"第二组","Color":"clGray","Transparent":False,"Font":{"Color":"clWhite","Size":11}}');
AddControl(TRadioButton, '{"Caption":"这个是第二组的第一项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}').GroupName
:= 'Group2';
AddControl(TRadioButton, '{"Caption":"这个是第二组的第二项","AlignWithMargins":True,"Margins":{"Left":10},"Height":30}').GroupName
:= 'Group2';
end;
with ABuilder.AddContainer(amHorizRight) do
begin
Expand Down Expand Up @@ -304,6 +315,7 @@ procedure TForm1.Button7Click(Sender: TObject);
ABuilder := NewDialog('警告');
ABuilder.AutoSize := True;
ABuilder.ItemSpace := 5;
ABuilder.Dialog.Padding.SetBounds(5, 5, 5, 5);
with ABuilder.AddContainer(amHorizLeft) do
begin
AutoSize := True;
Expand Down Expand Up @@ -342,8 +354,7 @@ procedure TForm1.Button7Click(Sender: TObject);

procedure TForm1.Button8Click(Sender: TObject);
begin
case CustomDialog('定制提醒', '您定制的大衣已经被别人抢走了!',
'选择接下来您要进行的操作:'#13#10#13#10'抢回来 - 尝试抢回,也可能失败'#13#10'放弃 - 放弃吧,总可以,至少还可以相信命运',
case CustomDialog('定制提醒', '您定制的大衣已经被别人抢走了!', '选择接下来您要进行的操作:'#13#10#13#10'抢回来 - 尝试抢回,也可能失败'#13#10'放弃 - 放弃吧,总可以,至少还可以相信命运',
['抢回来', '放弃'], diWarning) of
0:
ShowMessage('勇士啊,可对方已经把大衣烧掉了');
Expand All @@ -356,13 +367,14 @@ procedure TForm1.Button8Click(Sender: TObject);

procedure TForm1.Button9Click(Sender: TObject);
begin
CustomDialog('定制图标', '这个图标来自于shell32.dll', '', ['确定'], 48, 'shell32',
TSize.Create(64, 64));
CustomDialog('定制图标', '这个图标来自于shell32.dll', '', ['确定'], 48, 'shell32', TSize.Create(64, 64));
end;

procedure TForm1.DoDialogResult(FBuilder: IDialogBuilder);
procedure TForm1.DoDialogResult(ABuilder: IDialogBuilder);
begin
Label1.Caption := '编辑结果:' + FEditor.Text;
if ABuilder=FBuilder then
FBuilder:=nil;
end;

procedure TForm1.LoadUser32Icon(APicture: TPicture; AResId: Integer);
Expand All @@ -379,12 +391,12 @@ procedure TForm1.LoadUser32Icon(APicture: TPicture; AResId: Integer);
end;

procedure TForm1.ValidBuilder;

begin
if not Assigned(FBuilder) then
begin
FBuilder := NewDialog('DialogBuilder 示例');
FBuilder.AutoSize := True;
FBuilder.Dialog.Padding.SetBounds(5, 5, 5, 5);
with FBuilder.AddContainer(amHorizLeft) do
begin
Height := 32;
Expand All @@ -405,8 +417,7 @@ procedure TForm1.ValidBuilder;
end;
end;
// 示例:使用基于 JSON 的属性定义
FBuilder.AddControl(TLabel,
'{"AlignWithMargins":True,"Caption":"请输入您的姓名.","Font":{"Color":"clGray"}}');
FBuilder.AddControl(TLabel, '{"AlignWithMargins":True,"Caption":"请输入您的姓名.","Font":{"Color":"clGray"}}');
with FBuilder.AddControl(TEdit, '{"AlignWithMargins":true}') do
begin
FEditor := TEdit(Control);
Expand Down
Loading

0 comments on commit eee7b74

Please sign in to comment.