瀏覽代碼

GUI: cosmetic enhancement on key wizard

Herman Schoenfeld 7 年之前
父節點
當前提交
ebbf8f31aa

+ 1 - 1
src/gui/wizards/UWIZAddKey_SelectEncryption.lfm

@@ -7,7 +7,7 @@ object WIZAddKey_SelectEncryption: TWIZAddKey_SelectEncryption
   ClientHeight = 240
   ClientHeight = 240
   ClientWidth = 320
   ClientWidth = 320
   OnCreate = FormCreate
   OnCreate = FormCreate
-  LCLVersion = '1.6.4.0'
+  Visible = False
   object rgKeyType: TRadioGroup
   object rgKeyType: TRadioGroup
     Left = 24
     Left = 24
     Height = 209
     Height = 209

+ 28 - 9
src/gui/wizards/UWIZAddKey_SelectEncryption.pas

@@ -14,6 +14,7 @@ type
   TWIZAddKey_SelectEncryption = class(TWizardForm<TWIZAddKeyModel>)
   TWIZAddKey_SelectEncryption = class(TWizardForm<TWIZAddKeyModel>)
     rgKeyType: TRadioGroup;
     rgKeyType: TRadioGroup;
     procedure FormCreate(Sender: TObject);
     procedure FormCreate(Sender: TObject);
+    class function GetOptionText(const EC_OpenSSL_NID: Word): AnsiString;
   public
   public
     procedure OnNext; override;
     procedure OnNext; override;
     function Validate(out message : AnsiString) : boolean; override;
     function Validate(out message : AnsiString) : boolean; override;
@@ -23,24 +24,22 @@ implementation
 
 
 {$R *.lfm}
 {$R *.lfm}
 
 
-uses UAccounts;
+uses UAccounts, UConst, UAutoScope;
 
 
 { TWIZAddKey_SelectEncryption }
 { TWIZAddKey_SelectEncryption }
 
 
 procedure TWIZAddKey_SelectEncryption.FormCreate(Sender: TObject);
 procedure TWIZAddKey_SelectEncryption.FormCreate(Sender: TObject);
 var
 var
   i : Integer;
   i : Integer;
+  GC : TScoped;
   availableEncryptionTypes : TList;
   availableEncryptionTypes : TList;
+  name, desc : UTF8String;
 begin
 begin
   rgKeyType.Items.Clear;
   rgKeyType.Items.Clear;
-  availableEncryptionTypes := TList.Create;
-  try
-    TAccountComp.ValidsEC_OpenSSL_NID(availableEncryptionTypes);
-    for i := 0 to availableEncryptionTypes.Count - 1 do begin
-      rgKeyType.Items.AddObject(TAccountComp.GetECInfoTxt(PtrInt(availableEncryptionTypes[i])),availableEncryptionTypes[i]);
-    end;
-  finally
-    availableEncryptionTypes.free;
+  availableEncryptionTypes := GC.AddObject( TList.Create ) as TList;
+  TAccountComp.ValidsEC_OpenSSL_NID(availableEncryptionTypes);
+  for i := 0 to availableEncryptionTypes.Count - 1 do begin
+    rgKeyType.Items.AddObject(GetOptionText(PtrInt(availableEncryptionTypes[i])),availableEncryptionTypes[i]);
   end;
   end;
 end;
 end;
 
 
@@ -58,5 +57,25 @@ begin
   end;
   end;
 end;
 end;
 
 
+
+class function TWIZAddKey_SelectEncryption.GetOptionText(const EC_OpenSSL_NID: Word): AnsiString;
+begin
+  case EC_OpenSSL_NID of
+    CT_NID_secp256k1 : begin
+      Result := 'SECP256K1 - Cryptocurrency Standard (same as Bitcoin)';
+    end;
+    CT_NID_secp384r1 : begin
+      Result := 'SECP384R1 - Stronger, different algorithm (larger key) ';
+    end;
+    CT_NID_sect283k1 : Begin
+      Result := 'SECP283K1 - Even stronger (larger key)';
+    End;
+    CT_NID_secp521r1 : begin
+      Result := 'SECP521R1 - Quantum-resistant (largest key)';
+    end
+    else Result := '(Unknown ID:'+inttostr(EC_OpenSSL_NID)+')';
+  end;
+end;
+
 end.
 end.
 
 

+ 2 - 1
src/libraries/sphere10/UWizard.lfm

@@ -9,7 +9,8 @@ object WizardHostForm: TWizardHostForm
   ClientWidth = 360
   ClientWidth = 360
   OnCloseQuery = FormCloseQuery
   OnCloseQuery = FormCloseQuery
   Position = poOwnerFormCenter
   Position = poOwnerFormCenter
-  LCLVersion = '1.6.4.0'
+  LCLVersion = '1.8.2.0'
+  Visible = False
   object FHorizonalLine: TPanel
   object FHorizonalLine: TPanel
     Left = 0
     Left = 0
     Height = 1
     Height = 1

+ 1 - 1
src/libraries/sphere10/UWizard.pas

@@ -137,7 +137,7 @@ type
 
 
 
 
   { TActionWizard - a generic Wizard that can be used without subclassing }
   { TActionWizard - a generic Wizard that can be used without subclassing }
-  TActionWizard<T> = class(specialize TWizard<T>)
+  TActionWizard<T> = class(TWizard<T>)
     public type
     public type
       TActionWizardCancelFunc = function(screenIndex : Integer; constref model : T; out message : AnsiString) : boolean of object;
       TActionWizardCancelFunc = function(screenIndex : Integer; constref model : T; out message : AnsiString) : boolean of object;
       TActionWizardFinishFunc = function(constref  model : T; out message : AnsiString) : boolean of object;
       TActionWizardFinishFunc = function(constref  model : T; out message : AnsiString) : boolean of object;

+ 1 - 0
src/pascalcoin_wallet.lpi

@@ -346,6 +346,7 @@
         <Filename Value="gui\wizards\UWIZAddKey_SelectEncryption.pas"/>
         <Filename Value="gui\wizards\UWIZAddKey_SelectEncryption.pas"/>
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="WIZAddKey_SelectEncryption"/>
         <ComponentName Value="WIZAddKey_SelectEncryption"/>
+        <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
         <ResourceBaseClass Value="Form"/>
       </Unit60>
       </Unit60>
       <Unit61>
       <Unit61>