Browse Source

Refactor: main form, sync dialog

Herman Schoenfeld 7 years ago
parent
commit
607268445f

+ 4 - 4
PascalCoinWallet.dpr

@@ -9,13 +9,13 @@ uses
   UOpenSSL,
   UCrypto,
   Forms,
-  UFRMWallet,
-  UUserInterface;
+  UUserInterface,
+  UFRMMainForm;
 
 {$R *.res}
 
 var
-   mainForm : TFRMWallet;
+   mainForm : TFRMMainForm;
 begin
   // Start OpenSSL dll
   if Not LoadSSLCrypt then
@@ -27,7 +27,7 @@ begin
   Application.MainFormOnTaskBar := True;
   {$Warnings ON}{$ENDIF}
   Application.Title := 'Pascal Coin Wallet, Miner & Explorer';
-  Application.CreateForm(TFRMWallet, mainForm);
+  Application.CreateForm(TFRMMainForm, mainForm);
   TUserInterface.StartApplication(mainForm);
   Application.Run;
 end.

+ 87 - 89
PascalCoinWallet.lpi

@@ -92,285 +92,283 @@
         <IsPartOfProject Value="True"/>
       </Unit12>
       <Unit13>
-        <Filename Value="Units\Forms\UFRMWallet.pas"/>
+        <Filename Value="Units\Utils\UFolderHelper.pas"/>
         <IsPartOfProject Value="True"/>
-        <ComponentName Value="FRMWallet"/>
-        <HasResources Value="True"/>
-        <ResourceBaseClass Value="Form"/>
       </Unit13>
       <Unit14>
-        <Filename Value="Units\Utils\UFolderHelper.pas"/>
+        <Filename Value="Units\Utils\UAppParams.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit14>
       <Unit15>
-        <Filename Value="Units\Utils\UAppParams.pas"/>
+        <Filename Value="Units\Utils\UGridUtils.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit15>
       <Unit16>
-        <Filename Value="Units\Utils\UGridUtils.pas"/>
-        <IsPartOfProject Value="True"/>
-      </Unit16>
-      <Unit17>
         <Filename Value="Units\Forms\UFRMPascalCoinWalletConfig.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMPascalCoinWalletConfig"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit17>
-      <Unit18>
+      </Unit16>
+      <Unit17>
         <Filename Value="Units\Forms\UFRMAbout.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMAbout"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit18>
-      <Unit19>
+      </Unit17>
+      <Unit18>
         <Filename Value="Units\Forms\UFRMOperation.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMOperation"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit19>
-      <Unit20>
+      </Unit18>
+      <Unit19>
         <Filename Value="Units\Forms\UFRMWalletKeys.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMWalletKeys"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit20>
-      <Unit21>
+      </Unit19>
+      <Unit20>
         <Filename Value="Units\Forms\UFRMNewPrivateKeyType.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMNewPrivateKeyType"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit21>
-      <Unit22>
+      </Unit20>
+      <Unit21>
         <Filename Value="Units\Forms\UFRMPayloadDecoder.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMPayloadDecoder"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit22>
-      <Unit23>
+      </Unit21>
+      <Unit22>
         <Filename Value="Units\Forms\UFRMNodesIp.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMNodesIp"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
+      </Unit22>
+      <Unit23>
+        <Filename Value="Units\PascalCoin\UTCPIP.pas"/>
+        <IsPartOfProject Value="True"/>
       </Unit23>
       <Unit24>
-        <Filename Value="Units\PascalCoin\UTCPIP.pas"/>
+        <Filename Value="Units\Utils\UJSONFunctions.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit24>
       <Unit25>
-        <Filename Value="Units\Utils\UJSONFunctions.pas"/>
+        <Filename Value="Units\PascalCoin\URPC.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit25>
       <Unit26>
-        <Filename Value="Units\PascalCoin\URPC.pas"/>
+        <Filename Value="Units\PascalCoin\UPoolMining.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit26>
       <Unit27>
-        <Filename Value="Units\PascalCoin\UPoolMining.pas"/>
+        <Filename Value="Units\PascalCoin\UOpenSSL.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit27>
       <Unit28>
-        <Filename Value="Units\PascalCoin\UOpenSSL.pas"/>
+        <Filename Value="Units\PascalCoin\UOpenSSLdef.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit28>
       <Unit29>
-        <Filename Value="Units\PascalCoin\UOpenSSLdef.pas"/>
+        <Filename Value="Units\PascalCoin\UFileStorage.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit29>
       <Unit30>
-        <Filename Value="Units\PascalCoin\UFileStorage.pas"/>
+        <Filename Value="Units\PascalCoin\config.inc"/>
         <IsPartOfProject Value="True"/>
       </Unit30>
       <Unit31>
-        <Filename Value="Units\PascalCoin\config.inc"/>
+        <Filename Value="Units\PascalCoin\UAES.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit31>
       <Unit32>
-        <Filename Value="Units\PascalCoin\UAES.pas"/>
+        <Filename Value="Units\PascalCoin\UChunk.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit32>
       <Unit33>
-        <Filename Value="Units\PascalCoin\UChunk.pas"/>
-        <IsPartOfProject Value="True"/>
-      </Unit33>
-      <Unit34>
         <Filename Value="Units\Forms\UFRMAccountSelect.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMAccountSelect"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit34>
-      <Unit35>
+      </Unit33>
+      <Unit34>
         <Filename Value="Units\PascalCoin\UBaseTypes.pas"/>
         <IsPartOfProject Value="True"/>
-      </Unit35>
-      <Unit36>
+      </Unit34>
+      <Unit35>
         <Filename Value="Units\Utils\UWizard.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="WizardHostForm"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit36>
-      <Unit37>
+      </Unit35>
+      <Unit36>
         <Filename Value="Units\Utils\generics.collections.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Generics.Collections"/>
-      </Unit37>
-      <Unit38>
+      </Unit36>
+      <Unit37>
         <Filename Value="Units\Utils\generics.defaults.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Generics.Defaults"/>
-      </Unit38>
-      <Unit39>
+      </Unit37>
+      <Unit38>
         <Filename Value="Units\Utils\generics.hashes.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Generics.Hashes"/>
-      </Unit39>
-      <Unit40>
+      </Unit38>
+      <Unit39>
         <Filename Value="Units\Utils\generics.helpers.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Generics.Helpers"/>
-      </Unit40>
-      <Unit41>
+      </Unit39>
+      <Unit40>
         <Filename Value="Units\Utils\generics.memoryexpanders.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Generics.MemoryExpanders"/>
-      </Unit41>
-      <Unit42>
+      </Unit40>
+      <Unit41>
         <Filename Value="Units\Utils\generics.strings.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Generics.Strings"/>
-      </Unit42>
-      <Unit43>
+      </Unit41>
+      <Unit42>
         <Filename Value="Units\Forms\UFRMMessages.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMMessages"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit43>
-      <Unit44>
+      </Unit42>
+      <Unit43>
         <Filename Value="Units\Forms\UFRMNodes.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMNodes"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit44>
-      <Unit45>
+      </Unit43>
+      <Unit44>
         <Filename Value="Units\Forms\UFRMLogs.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMLogs"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit45>
-      <Unit46>
+      </Unit44>
+      <Unit45>
         <Filename Value="Units\Forms\UFRMOperationExplorer.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMOperationExplorer"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit46>
-      <Unit47>
+      </Unit45>
+      <Unit46>
         <Filename Value="Units\Forms\UFRMBlockExplorer.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMBlockExplorer"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit47>
-      <Unit48>
+      </Unit46>
+      <Unit47>
         <Filename Value="Units\Forms\UFRMPendingOperations.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMPendingOperations"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
-      </Unit48>
-      <Unit49>
+      </Unit47>
+      <Unit48>
         <Filename Value="Units\Forms\UFRMAccountExplorer.pas"/>
         <IsPartOfProject Value="True"/>
         <ComponentName Value="FRMAccountExplorer"/>
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
+      </Unit48>
+      <Unit49>
+        <Filename Value="Units\Forms\UUserInterface.pas"/>
+        <IsPartOfProject Value="True"/>
       </Unit49>
       <Unit50>
-        <Filename Value="Units\Forms\UFRMSyncronizationDialog.pas"/>
+        <Filename Value="Units\Utils\UCommonUI.pas"/>
         <IsPartOfProject Value="True"/>
-        <ComponentName Value="FRMSyncronizationDialog"/>
-        <HasResources Value="True"/>
-        <ResourceBaseClass Value="Form"/>
       </Unit50>
       <Unit51>
-        <Filename Value="Units\Forms\UUserInterface.pas"/>
+        <Filename Value="Units\Utils\UCommon.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit51>
       <Unit52>
-        <Filename Value="Units\Utils\UCommonUI.pas"/>
+        <Filename Value="Units\PascalCoin\UGPUMining.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit52>
       <Unit53>
-        <Filename Value="Units\Utils\UCommon.pas"/>
+        <Filename Value="Units\PascalCoin\upcdaemon.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit53>
       <Unit54>
-        <Filename Value="Units\PascalCoin\UGPUMining.pas"/>
+        <Filename Value="Units\PascalCoin\UPoolMinerThreads.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit54>
       <Unit55>
-        <Filename Value="Units\PascalCoin\upcdaemon.pas"/>
+        <Filename Value="Units\PascalCoin\UServerApp.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit55>
       <Unit56>
-        <Filename Value="Units\PascalCoin\UPoolMinerThreads.pas"/>
+        <Filename Value="Units\PascalCoin\USha256.pas"/>
         <IsPartOfProject Value="True"/>
       </Unit56>
       <Unit57>
-        <Filename Value="Units\PascalCoin\UServerApp.pas"/>
+        <Filename Value="Units\Utils\generics.dictionaries.inc"/>
         <IsPartOfProject Value="True"/>
       </Unit57>
       <Unit58>
-        <Filename Value="Units\PascalCoin\USha256.pas"/>
+        <Filename Value="Units\Utils\generics.dictionariesh.inc"/>
         <IsPartOfProject Value="True"/>
       </Unit58>
       <Unit59>
-        <Filename Value="Units\Utils\generics.dictionaries.inc"/>
+        <Filename Value="Units\Utils\UWizard.lfm"/>
         <IsPartOfProject Value="True"/>
       </Unit59>
       <Unit60>
-        <Filename Value="Units\Utils\generics.dictionariesh.inc"/>
+        <Filename Value="Units\Forms\UFRMAccountInfo.pas"/>
         <IsPartOfProject Value="True"/>
+        <HasResources Value="True"/>
       </Unit60>
       <Unit61>
-        <Filename Value="Units\Utils\UWizard.lfm"/>
+        <Filename Value="Units\Forms\UFRMMemoText.pas"/>
         <IsPartOfProject Value="True"/>
+        <HasResources Value="True"/>
       </Unit61>
       <Unit62>
-        <Filename Value="Units\Forms\UFRMAccountInfo.pas"/>
+        <Filename Value="Units\Forms\UFRMSaleAccounts.pas"/>
         <IsPartOfProject Value="True"/>
-        <HasResources Value="True"/>
       </Unit62>
       <Unit63>
-        <Filename Value="Units\Forms\UFRMMemoText.pas"/>
+        <Filename Value="Units\Forms\UFRMWalletKeys2.pas"/>
         <IsPartOfProject Value="True"/>
-        <HasResources Value="True"/>
       </Unit63>
       <Unit64>
-        <Filename Value="Units\Forms\UFRMSaleAccounts.pas"/>
+        <Filename Value="Units\Forms\UCTRLBanner.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="CTRLBanner"/>
+        <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit64>
       <Unit65>
-        <Filename Value="Units\Forms\UFRMWalletKeys2.pas"/>
+        <Filename Value="Units\Forms\UFRMMainForm.pas"/>
         <IsPartOfProject Value="True"/>
+        <ComponentName Value="FRMMainForm"/>
+        <HasResources Value="True"/>
+        <ResourceBaseClass Value="Form"/>
       </Unit65>
       <Unit66>
-        <Filename Value="Units\Forms\UCTRLBanner.pas"/>
+        <Filename Value="Units\Forms\UFRMSyncronizationForm.pas"/>
         <IsPartOfProject Value="True"/>
-        <ComponentName Value="CTRLBanner"/>
         <HasResources Value="True"/>
-        <ResourceBaseClass Value="Form"/>
       </Unit66>
     </Units>
   </ProjectOptions>

+ 3 - 2
Units/Forms/UCTRLBanner.lfm

@@ -1,7 +1,7 @@
 object CTRLBanner: TCTRLBanner
-  Left = 30
+  Left = 736
   Height = 80
-  Top = 122
+  Top = 26
   Width = 992
   BorderIcons = []
   BorderStyle = bsNone
@@ -1757,6 +1757,7 @@ object CTRLBanner: TCTRLBanner
     Top = 32
     Width = 100
     Anchors = [akTop, akRight]
+    Enabled = False
     ItemHeight = 15
     ItemIndex = 0
     Items.Strings = (

+ 1 - 1
Units/Forms/UFRMBlockExplorer.pas

@@ -49,7 +49,7 @@ var
   FRMBlockExplorer: TFRMBlockExplorer = nil;
 
 implementation
-uses UFRMWallet, UUserInterface;
+uses UFRMMainForm, UUserInterface;
 
 {$R *.lfm}
 procedure TFRMBlockExplorer.ebBlockChainBlockStartExit(Sender: TObject);

+ 1 - 1
Units/Forms/UFRMWallet.lfm → Units/Forms/UFRMMainForm.lfm

@@ -1,4 +1,4 @@
-object FRMWallet: TFRMWallet
+object FRMMainForm: TFRMMainForm
   Left = 125
   Height = 600
   Top = 58

+ 51 - 57
Units/Forms/UFRMWallet.pas → Units/Forms/UFRMMainForm.pas

@@ -1,4 +1,4 @@
-unit UFRMWallet;
+unit UFRMMainForm;
 
 {$mode delphi}
 
@@ -21,9 +21,9 @@ uses
   ULog,
   UBlockChain, UNode, UGridUtils, UAccounts, Menus,
   UNetProtocol, UCrypto, Buttons, ActnList, UPoolMining,
-  UCTRLBanner, UCommon, UCommonUI;
+  UCTRLBanner, UFRMSyncronizationForm, UCommon, UCommonUI;
 
-Const
+const
   CM_PC_FinishedLoadingDatabase = WM_USER + 1;
   CM_PC_WalletKeysChanged = WM_USER + 2;
   CM_PC_ConnectivityChanged = WM_USER + 3;
@@ -31,13 +31,13 @@ Const
 
 type
 
-  { TFRMWalletMode }
+  { TFRMMainFormMode }
 
-  TFRMWalletMode = (wmWallet, wmSync);
+  TFRMMainFormMode = (wmWallet, wmSync);
 
-  { TFRMWallet }
+  { TFRMMainForm }
 
-  TFRMWallet = class(TApplicationForm)
+  TFRMMainForm = class(TApplicationForm)
     ilSmallIcons:TImageList;
     miSyncDialog:TMenuItem;
     miBlockExplorer: TMenuItem;
@@ -94,8 +94,8 @@ type
     procedure miSeedNodesClick(Sender: TObject);
   private
     __FLastFooterToolBarDrawRect : TRect;  // Required for FPC bug work-around
-    FMode : TFRMWalletMode;
-    FSyncPaneControl : TForm;
+    FMode : TFRMMainFormMode;
+    FSyncControl : TFRMSyncronizationForm;
     procedure CM_FinishedLoadingDatabase(var Msg: TMessage); message CM_PC_FinishedLoadingDatabase;
     procedure CM_WalletChanged(var Msg: TMessage); message CM_PC_WalletKeysChanged;
     procedure CM_ConnectivityChanged(var Msg: TMessage); message CM_PC_ConnectivityChanged;
@@ -103,14 +103,14 @@ type
     procedure OnConnectivityChanged(Sender: TObject);
     procedure OnWalletChanged(Sender: TObject);
   protected
-    property SyncPaneControl : TForm read FSyncPaneControl write FSyncPaneControl;
     procedure RefreshWalletLockIcon;
     procedure RefreshConnectivityIcon;
     procedure ActivateFirstTime; override;
     Function ForceMining : Boolean; virtual;
-    procedure SetMode(AMode: TFRMWalletMode);
+    procedure SetMode(AMode: TFRMMainFormMode);
   public
-    property Mode : TFRMWalletMode read FMode write SetMode;
+    property SyncControl : TFRMSyncronizationForm read FSyncControl;
+    property Mode : TFRMMainFormMode read FMode write SetMode;
     procedure OnFinishedLoadingDatabase;
   end;
 
@@ -118,7 +118,7 @@ implementation
 
 {$R *.lfm}
 
-uses LCLIntf, UUserInterface, UThread, UOpTransaction, UWizard, UFRMSyncronizationDialog;
+uses LCLIntf, UUserInterface, UThread, UOpTransaction, UWizard;
 
 const
   CT_FOOTER_TOOLBAR_LEFT_PADDING = 8;
@@ -128,16 +128,18 @@ const
 
 {%region Form life-cycle }
 
-procedure TFRMWallet.FormCreate(Sender: TObject);
+procedure TFRMMainForm.FormCreate(Sender: TObject);
 begin
   tbStatusToolBar.Parent := sbStatusBar;
   __FLastFooterToolBarDrawRect := TRect.Empty;
   CloseAction := caNone; // Will handle terminate in separate method
   FMode := wmSync;
+  FSyncControl := TFRMSyncronizationForm.Create(self);
   paLogoPanel.AddControlDockCenter(TCTRLBanner.Create(Self));
+  paSyncPanel.AddControlDockCenter(FSyncControl);
 end;
 
-procedure TFRMWallet.FormCloseQuery(Sender: TObject; var CanClose: boolean);
+procedure TFRMMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
 begin
   case TUserInterface.AskQuestion(Self, 'Quit PascalCoin', 'Are you sure you want to quit? Select ''No'' to run in background.', [mbCancel, mbNo, mbYes]) of
     mbYes: begin
@@ -152,16 +154,16 @@ begin
   end;
 end;
 
-procedure TFRMWallet.FormClose(Sender: TObject; var CloseAction: TCloseAction);
+procedure TFRMMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
 begin
 end;
 
-procedure TFRMWallet.CM_Terminate(var Msg: TMessage);
+procedure TFRMMainForm.CM_Terminate(var Msg: TMessage);
 begin
   TUserInterface.ExitApplication;
 end;
 
-procedure TFRMWallet.ActivateFirstTime;
+procedure TFRMMainForm.ActivateFirstTime;
 begin
   TUserInterface.WalletKeys.OnChanged.Add(OnWalletChanged);
   TNetData.NetData.OnConnectivityChanged.Add(OnConnectivityChanged);
@@ -169,7 +171,7 @@ begin
   RefreshConnectivityIcon;
 end;
 
-procedure TFRMWallet.FormDestroy(Sender: TObject);
+procedure TFRMMainForm.FormDestroy(Sender: TObject);
 begin
   TUserInterface.WalletKeys.OnChanged.Remove(OnWalletChanged);
   TNetData.NetData.OnConnectivityChanged.Remove(OnConnectivityChanged);
@@ -179,12 +181,12 @@ end;
 
 {%region Form methods}
 
-function TFRMWallet.ForceMining: Boolean;
+function TFRMMainForm.ForceMining: Boolean;
 begin
   Result := false;
 end;
 
-procedure TFRMWallet.RefreshWalletLockIcon;
+procedure TFRMMainForm.RefreshWalletLockIcon;
 begin
   if NOT TUserInterface.WalletKeys.HasPassword then begin
     { No password has been set }
@@ -204,7 +206,7 @@ begin
   end;
 end;
 
-procedure TFRMWallet.RefreshConnectivityIcon;
+procedure TFRMMainForm.RefreshConnectivityIcon;
 const
   ImageIndexConst : array[false..true] of integer=(1,0);
   HintConst : array[false..true] of String =('Network is inactive. Click activate.','Network is active. Click to deactivate.');
@@ -213,7 +215,7 @@ begin
   tbtnConnectivity.Hint :=  HintConst[TNetData.NetData.NetConnectionsActive];
 end;
 
-procedure TFRMWallet.SetMode(AMode: TFRMWalletMode);
+procedure TFRMMainForm.SetMode(AMode: TFRMMainFormMode);
 var nestedForm : TForm;
 begin
   case AMode of
@@ -223,19 +225,11 @@ begin
       FMode := AMode;
     end;
     wmSync: begin
-      if not paSyncPanel.ContainsControl(TUserInterface.SyncDialog) then begin
-        paSyncPanel.RemoveAllControls(false);
-        TUserInterface.SyncDialog.Top := 0;
-        TUserInterface.SyncDialog.Left := 0;
-        TUserInterface.SyncDialog.Width := paSyncPanel.Width;
-        TUserInterface.SyncDialog.Height := paSyncPanel.Height;
-        paSyncPanel.AddControlDockCenter(TUserInterface.SyncDialog);
-      end;
       paSyncPanel.Visible := true;
       paWalletPanel.Visible := false;;
       FMode := AMode;
     end;
-    else raise Exception.Create('[Internal Error] - TFRMWallet.SetMode: unsupported mode passed');
+    else raise Exception.Create('[Internal Error] - TFRMMainForm.SetMode: unsupported mode passed');
   end;
 end;
 
@@ -243,7 +237,7 @@ end;
 
 {%region Handlers: Form}
 
-procedure TFRMWallet.FormResize(Sender: TObject);
+procedure TFRMMainForm.FormResize(Sender: TObject);
 begin
   // Adjust status bar so that footer toolbar panel remains fixed size (by expanding out previous panel)
    sbStatusBar.Panels[2].Width := ClipValue(sbStatusBar.Width - (sbStatusBar.Panels[0].Width + sbStatusBar.Panels[1].Width + tbStatusToolBar.Width  + CT_FOOTER_TOOLBAR_RIGHT_PADDING) - CT_FOOTER_TOOLBAR_LEFT_PADDING, 0, sbStatusBar.Width);
@@ -253,34 +247,34 @@ end;
 
 {%region Handlers: Wallet, Network}
 
-procedure TFRMWallet.CM_FinishedLoadingDatabase(var Msg: TMessage);
+procedure TFRMMainForm.CM_FinishedLoadingDatabase(var Msg: TMessage);
 begin
   Self.Enabled:=true;
 end;
 
-procedure TFRMWallet.OnFinishedLoadingDatabase;
+procedure TFRMMainForm.OnFinishedLoadingDatabase;
 begin
   // Ensure handled in UI thread
   PostMessage(Self.Handle,CM_PC_FinishedLoadingDatabase,0,0);
 end;
 
-procedure TFRMWallet.CM_WalletChanged(var Msg: TMessage);
+procedure TFRMMainForm.CM_WalletChanged(var Msg: TMessage);
 begin
   RefreshWalletLockIcon;
 end;
 
-procedure TFRMWallet.OnWalletChanged(Sender: TObject);
+procedure TFRMMainForm.OnWalletChanged(Sender: TObject);
 begin
   // Ensure handled in UI thread
   PostMessage(Self.Handle,CM_PC_WalletKeysChanged,0,0);
 end;
 
-procedure TFRMWallet.CM_ConnectivityChanged(var Msg: TMessage);
+procedure TFRMMainForm.CM_ConnectivityChanged(var Msg: TMessage);
 begin
   RefreshConnectivityIcon;
 end;
 
-procedure TFRMWallet.OnConnectivityChanged(Sender: TObject);
+procedure TFRMMainForm.OnConnectivityChanged(Sender: TObject);
 begin
   // Ensure handled in UI thread
   PostMessage(Self.Handle,CM_PC_ConnectivityChanged,0,0);
@@ -290,72 +284,72 @@ end;
 
 {%region Handlers: Menu Items }
 
-procedure TFRMWallet.miMessagesClick(Sender: TObject);
+procedure TFRMMainForm.miMessagesClick(Sender: TObject);
 begin
   TUserInterface.ShowMessagesForm;
 end;
 
-procedure TFRMWallet.miSyncDialogClick(Sender:TObject);
+procedure TFRMMainForm.miSyncDialogClick(Sender:TObject);
 begin
   TUserInterface.ShowSyncDialog;
 end;
 
-procedure TFRMWallet.miNodesClick(Sender: TObject);
+procedure TFRMMainForm.miNodesClick(Sender: TObject);
 begin
   TUserInterface.ShowNodesForm;
 end;
 
-procedure TFRMWallet.miPendingOperationsClick(Sender: TObject);
+procedure TFRMMainForm.miPendingOperationsClick(Sender: TObject);
 begin
   TUserInterface.ShowPendingOperations
 end;
 
-procedure TFRMWallet.miLogsClick(Sender: TObject);
+procedure TFRMMainForm.miLogsClick(Sender: TObject);
 begin
   TUserInterface.ShowLogsForm;
 end;
 
-procedure TFRMWallet.miOperationsExplorerClick(Sender: TObject);
+procedure TFRMMainForm.miOperationsExplorerClick(Sender: TObject);
 begin
  TUserInterface.ShowOperationsExplorer;
 end;
 
-procedure TFRMWallet.miBlockExplorerClick(Sender: TObject);
+procedure TFRMMainForm.miBlockExplorerClick(Sender: TObject);
 begin
   TUserInterface.ShowBlockExplorer;
 end;
 
-procedure TFRMWallet.miAccountExplorerClick(Sender: TObject);
+procedure TFRMMainForm.miAccountExplorerClick(Sender: TObject);
 begin
   TUserInterface.ShowAccountExplorer
 end;
 
-procedure TFRMWallet.miSeedNodesClick(Sender: TObject);
+procedure TFRMMainForm.miSeedNodesClick(Sender: TObject);
 begin
   TUserInterface.ShowSeedNodesDialog(Self);
 end;
 
-procedure TFRMWallet.miAboutClick(Sender: TObject);
+procedure TFRMMainForm.miAboutClick(Sender: TObject);
 begin
   TUserInterface.ShowAboutBox(Self);
 end;
 
-procedure TFRMWallet.MiCloseClick(Sender: TObject);
+procedure TFRMMainForm.MiCloseClick(Sender: TObject);
 begin
   Close;
 end;
 
-procedure TFRMWallet.paLogoPanelClick(Sender: TObject);
+procedure TFRMMainForm.paLogoPanelClick(Sender: TObject);
 begin
 
 end;
 
-procedure TFRMWallet.miOptionsClick(Sender: TObject);
+procedure TFRMMainForm.miOptionsClick(Sender: TObject);
 begin
   TUserInterface.ShowOptionsDialog(Self);
 end;
 
-procedure TFRMWallet.miPrivateKeysClick(Sender: TObject);
+procedure TFRMMainForm.miPrivateKeysClick(Sender: TObject);
 begin
   TUserInterface.ShowPrivateKeysDialog(Self);
 end;
@@ -364,7 +358,7 @@ end;
 
 {%region Handlers: Footer Toolbar}
 
-procedure TFRMWallet.tbtnWalletLockClick(Sender:TObject);
+procedure TFRMMainForm.tbtnWalletLockClick(Sender:TObject);
 begin
   if NOT TUserInterface.WalletKeys.HasPassword then begin
      { no password has been set }
@@ -378,18 +372,18 @@ begin
    end;
 end;
 
-procedure TFRMWallet.tbtnConnectivityClick(Sender:TObject);
+procedure TFRMMainForm.tbtnConnectivityClick(Sender:TObject);
 begin
   // Toggle connectivity (icons update with event handler)
   TNetData.NetData.NetConnectionsActive := NOT TNetData.NetData.NetConnectionsActive;
 end;
 
-procedure TFRMWallet.tbtnSyncClick(Sender: TObject);
+procedure TFRMMainForm.tbtnSyncClick(Sender: TObject);
 begin
   TUserInterface.ShowSyncDialog;
 end;
 
-procedure TFRMWallet.sbStatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
+procedure TFRMMainForm.sbStatusBarDrawPanel(StatusBar: TStatusBar; Panel: TStatusPanel; const Rect: TRect);
 begin
   if __FLastFooterToolBarDrawRect = Rect then exit; // avoid FPC bug: triggers infinite draw refresh on windows
   if Panel = sbStatusBar.Panels[3] then

+ 1 - 1
Units/Forms/UFRMMessages.pas

@@ -19,7 +19,7 @@ uses
   LCLIntf, LCLType,
   SysUtils, Classes, Graphics, Controls, Forms,
   Dialogs, StdCtrls, Menus, UCommonUI,
-  UNode, UNetProtocol, UCrypto, UFRMWallet,UConst;
+  UNode, UNetProtocol, UCrypto, UFRMMainForm,UConst;
 
 type
 

+ 25 - 7
Units/Forms/UFRMSyncronizationDialog.lfm → Units/Forms/UFRMSyncronizationForm.lfm

@@ -1,12 +1,12 @@
-object FRMSyncronizationDialog: TFRMSyncronizationDialog
-  Left = 208
-  Height = 212
-  Top = 104
+object FRMSyncronizationForm: TFRMSyncronizationForm
+  Left = 322
+  Height = 240
+  Top = 5
   Width = 636
   BorderIcons = []
   BorderStyle = bsNone
   Caption = 'Synchronization'
-  ClientHeight = 212
+  ClientHeight = 240
   ClientWidth = 636
   LCLVersion = '1.6.4.0'
   object Label8: TLabel
@@ -230,10 +230,10 @@ object FRMSyncronizationDialog: TFRMSyncronizationDialog
     ShowHint = True
   end
   object lblCurrentDifficultyCaption1: TLabel
-    Left = 38
+    Left = 16
     Height = 15
     Top = 176
-    Width = 113
+    Width = 135
     Alignment = taRightJustify
     AutoSize = False
     Caption = 'Protocol Version'
@@ -247,4 +247,22 @@ object FRMSyncronizationDialog: TFRMSyncronizationDialog
     Caption = '000'
     ParentColor = False
   end
+  object lblCurrentDifficultyCaption2: TLabel
+    Left = 16
+    Height = 15
+    Top = 200
+    Width = 135
+    Alignment = taRightJustify
+    AutoSize = False
+    Caption = 'Net Protocol Version'
+    ParentColor = False
+  end
+  object lblNetProtocolVersion: TLabel
+    Left = 160
+    Height = 15
+    Top = 200
+    Width = 18
+    Caption = '000'
+    ParentColor = False
+  end
 end

+ 17 - 15
Units/Forms/UFRMSyncronizationDialog.pas → Units/Forms/UFRMSyncronizationForm.pas

@@ -1,4 +1,4 @@
-unit UFRMSyncronizationDialog;
+unit UFRMSyncronizationForm;
 
 {$mode delphi}
 
@@ -21,12 +21,14 @@ uses
 
 type
 
-  { TFRMSyncronizationDialog }
+  { TFRMSyncronizationForm }
 
-  TFRMSyncronizationDialog = class(TApplicationForm)
+  TFRMSyncronizationForm = class(TApplicationForm)
     btnOpenWallet: TButton;
     Label16: TLabel;
     Label4: TLabel;
+    lblCurrentDifficultyCaption2: TLabel;
+    lblNetProtocolVersion: TLabel;
     lblTotalAccountsLabel: TLabel;
     Label8: TLabel;
     lblBlocksFound: TLabel;
@@ -69,7 +71,7 @@ uses UNetProtocol,UTime,UConst, UUserInterface;
 
 {%region Methods}
 
-procedure TFRMSyncronizationDialog.UpdateNodeStatus;
+procedure TFRMSyncronizationForm.UpdateNodeStatus;
 Var status : AnsiString;
 begin
   if not TUserInterface.Started then exit;
@@ -96,15 +98,14 @@ begin
       lblNodeStatus.Caption := status;
     end;
   end;
-
-// this rewrite   -- TODO
-//  If Assigned(FBackgroundPanel) then begin
-//    FBackgroundPanel.Font.Color:=lblNodeStatus.Font.Color;
-//    FBackgroundPanel.Caption:='Please wait until finished: '+lblNodeStatus.Caption;
-  //end;
+  lblProtocolVersion.Caption := Format('%d (%d)', [TUserInterface.Node.Bank.SafeBox.CurrentProtocol,CT_BlockChain_Protocol_Available]);
+  lblNetProtocolVersion.Caption := Format('%d (%d)', [CT_NetProtocol_Version, CT_NetProtocol_Available]);
+  if NOT btnOpenWallet.Enabled then begin
+    lblNodeStatus.Caption := 'Please wait until finished - ' + lblNodeStatus.Caption;
+  end;
 end;
 
-procedure TFRMSyncronizationDialog.UpdateBlockChainState;
+procedure TFRMSyncronizationForm.UpdateBlockChainState;
 Var
   f, favg : real;
 begin
@@ -157,7 +158,7 @@ begin
   end;
 end;
 
-procedure TFRMSyncronizationDialog.SetMinersBlocksFound(const Value: Integer);
+procedure TFRMSyncronizationForm.SetMinersBlocksFound(const Value: Integer);
 begin
   FMinersBlocksFound := Value;
   lblBlocksFound.Caption := Inttostr(Value);
@@ -165,21 +166,22 @@ begin
   else lblBlocksFound.Font.Color := clDkGray;
 end;
 
-procedure TFRMSyncronizationDialog.OnFinishedLoadingDatabase;
+procedure TFRMSyncronizationForm.OnFinishedLoadingDatabase;
 begin
   btnOpenWallet.Enabled:=true;
+  TUserInterface.ShowWallet;
 end;
 
 {%endregion}
 
 {%region Handlers: widgets }
 
-procedure TFRMSyncronizationDialog.lblReceivedMessagesClick(Sender:TObject);
+procedure TFRMSyncronizationForm.lblReceivedMessagesClick(Sender:TObject);
 begin
   TUserInterface.ShowMessagesForm;
 end;
 
-procedure TFRMSyncronizationDialog.btnOpenWalletClick(Sender:TObject);
+procedure TFRMSyncronizationForm.btnOpenWalletClick(Sender:TObject);
 begin
   TUserInterface.ShowWallet;
 end;

+ 59 - 74
Units/Forms/UUserInterface.pas

@@ -19,7 +19,7 @@ uses
   SysUtils, Classes, Forms, Controls, Windows, ExtCtrls, Dialogs,
   UCommonUI, UBlockChain, UAccounts, UNode, UWalletKeys, UAppParams, UConst, UFolderHelper, UGridUtils, URPC, UPoolMining,
   ULog, UThread, UNetProtocol, UCrypto,
-  UFRMWallet, UFRMSyncronizationDialog, UFRMAccountExplorer, UFRMOperationExplorer, UFRMPendingOperations, UFRMOperation,
+  UFRMMainForm, UFRMSyncronizationForm, UFRMAccountExplorer, UFRMOperationExplorer, UFRMPendingOperations, UFRMOperation,
   UFRMLogs, UFRMMessages, UFRMNodes, UFRMBlockExplorer, UFRMWalletKeys;
 
 type
@@ -39,7 +39,6 @@ type
       FUILock : TPCCriticalSection; static;
 
       // Subforms
-      FSyncronizationDialog : TFRMSyncronizationDialog; static;
       FAccountExplorer : TFRMAccountExplorer; static;
       FPendingOperationForm : TFRMPendingOperations; static;
       FOperationsExplorerForm : TFRMOperationExplorer; static;
@@ -57,7 +56,7 @@ type
       // Local fields
       FStarted : boolean; static;
       FAppParams : TAppParams; static;
-      FWallet : TFRMWallet; static;
+      FMainForm : TFRMMainForm; static;
       FIsActivated : Boolean; static;
       FUpdating : Boolean; static;
       FLog : TLog; static;
@@ -80,8 +79,8 @@ type
       class procedure SetStatusBar1Text(const text : AnsiString); static;
       class procedure SetStatusBar2Text(const text : AnsiString); static;
       class procedure SetMessagesNotificationText(const text : AnsiString); static;
-      class procedure SetWalletMode(AMode: TFRMWalletMode); static;
-      class function GetWalletMode : TFRMWalletMode; static;
+      class procedure SetMainFormMode(AMode: TFRMMainFormMode); static;
+      class function GetMainFormMode : TFRMMainFormMode; static;
 
       // Aux methods
       class procedure FinishedLoadingDatabase;
@@ -114,8 +113,7 @@ type
       class property AppParams : TAppParams read FAppParams;
       class property PoolMiningServer : TPoolMiningServer read FPoolMiningServer;
       class property WalletKeys : TWalletKeysExt read FWalletKeys;
-      class property WalletMode : TFRMWalletMode read GetWalletMode write SetWalletMode;
-      class property SyncDialog : TFRMSyncronizationDialog read FSyncronizationDialog;
+      class property MainFormMode : TFRMMainFormMode read GetMainFormMode write SetMainFormMode;
       class property StatusBar0Text : AnsiString read FStatusBar0Text write SetStatusBar0Text;
       class property StatusBar1Text : AnsiString read FStatusBar1Text write SetStatusBar1Text;
       class property StatusBar2Text : AnsiString read FStatusBar2Text write SetStatusBar2Text;
@@ -195,21 +193,20 @@ begin
     FMessagesNotificationText := '';
 
     // Create root form and dependent components
-    FWallet := mainForm as TFRMWallet;
-    FWallet.CloseAction := caNone;     // wallet is destroyed on ExitApplication
-    if (FWallet = nil)
+    FMainForm := mainForm as TFRMMainForm;
+    FMainForm.CloseAction := caNone;     // wallet is destroyed on ExitApplication
+    if (FMainForm = nil)
       then raise Exception.Create('Main form is not TWallet');
-    FSyncronizationDialog := TFRMSyncronizationDialog.Create(FWallet);;
 
-    FTrayIcon := TTrayIcon.Create(FWallet);
+    FTrayIcon := TTrayIcon.Create(FMainForm);
     FTrayIcon.OnDblClick := OnTrayIconDblClick;
     FTrayIcon.Visible := true;
-    FTrayIcon.Hint := FWallet.Caption;
+    FTrayIcon.Hint := FMainForm.Caption;
     FTrayIcon.BalloonTitle := 'Restoring the window.';
     FTrayIcon.BalloonHint := 'Double click the system tray icon to restore Pascal Coin';
     FTrayIcon.BalloonFlags := bfInfo;
     FTrayIcon.Show;
-    FTimerUpdateStatus := TTimer.Create(FWallet);
+    FTimerUpdateStatus := TTimer.Create(FMainForm);
     FTimerUpdateStatus.Enabled := false;
     FDisplayedStartupSyncDialog:=false;
 
@@ -222,12 +219,12 @@ begin
       raise Exception.Create('Cannot create dir: '+TFolderHelper.GetPascalCoinDataFolder);
 
     // Open AppParams
-    TUserInterface.FAppParams := TAppParams.Create(FWallet);
+    TUserInterface.FAppParams := TAppParams.Create(FMainForm);
     TUserInterface.FAppParams.FileName := TFolderHelper.GetPascalCoinDataFolder+PathDelim+'AppParams.prm';
 
     // Open Wallet
     Try
-      FWalletKeys := TWalletKeysExt.Create(FWallet);  // On Activate, this will be populated
+      FWalletKeys := TWalletKeysExt.Create(FMainForm);  // On Activate, this will be populated
       FWalletKeys.WalletFileName := TFolderHelper.GetPascalCoinDataFolder+PathDelim+'WalletKeys.dat';
     Except
       On E:Exception do begin
@@ -248,7 +245,7 @@ begin
     FNode.PeerCache := FAppParams.ParamByName[CT_PARAM_PeerCache].GetAsString('')+';'+CT_Discover_IPs;
 
     // Subscribe to Node events (TODO refactor with FNotifyEvents)
-    FNodeNotifyEvents := TNodeNotifyEvents.Create(FWallet);
+    FNodeNotifyEvents := TNodeNotifyEvents.Create(FMainForm);
     FNodeNotifyEvents.OnBlocksChanged := OnBlocksChanged;
     FNodeNotifyEvents.OnNodeMessageEvent :=  OnNodeMessageEvent;
 
@@ -283,13 +280,13 @@ begin
     LoadAppParams;
 
     // open the sync dialog
-    FSyncronizationDialog.UpdateBlockChainState;   //TODO fix this work-flow
+    FMainForm.SyncControl.UpdateBlockChainState;   //TODO fix this work-flow
     RefreshConnectionStatusDisplay;
 
     // Setup tray icon
 
     // Disable wallet form
-    FWallet.Enabled:=false;
+    FMainForm.Enabled:=false;
     FStarted := true;
   Except
     On E:Exception do begin
@@ -301,7 +298,7 @@ begin
 
 
   // Notify accounts again?
-  OnAccountsChanged(FWallet);
+  OnAccountsChanged(FMainForm);
 
   // Refresh status bar since may not have been displayed
   SetStatusBar0Text(FStatusBar0Text);
@@ -332,9 +329,8 @@ begin
 
     // Destroys root form, non-modal forms and all their attached components
     step := 'Destroying UI graph';
-    FWallet.Destroy;
-    FWallet := nil;  // destroyed by FWallet
-    FSyncronizationDialog := nil;  // destroyed by FWallet
+    FMainForm.Destroy;
+    FMainForm := nil;  // destroyed by FWallet
     FAccountExplorer := nil;  // destroyed by FWallet
     FPendingOperationForm := nil;  // destroyed by FWallet
     FOperationsExplorerForm := nil;  // destroyed by FWallet
@@ -392,8 +388,8 @@ end;
 
 class procedure TUserInterface.RunInBackground;
 begin
-  FWallet.Hide();
-  FWallet.WindowState := wsMinimized;
+  FMainForm.Hide();
+  FMainForm.WindowState := wsMinimized;
   FTimerUpdateStatus.Enabled := false;
   FTrayIcon.Visible := True;
   FTrayIcon.ShowBalloonHint;
@@ -403,8 +399,8 @@ class procedure TUserInterface.RunInForeground;
 begin
   FTrayIcon.Visible := False;
   FTimerUpdateStatus.Enabled := true;
-  FWallet.Show();
-  FWallet.WindowState := wsNormal;
+  FMainForm.Show();
+  FMainForm.WindowState := wsNormal;
   Application.BringToFront();
 end;
 
@@ -417,10 +413,10 @@ begin
   FNode.Operations.AccountKey := GetAccountKeyForMiner;
   FPoolMiningServer.Active := FAppParams.ParamByName[CT_PARAM_JSONRPCMinerServerActive].GetAsBoolean(true);
   FPoolMiningServer.OnMiningServerNewBlockFound := OnMiningServerNewBlockFound;
-  FSyncronizationDialog.OnFinishedLoadingDatabase;
-  FWallet.OnFinishedLoadingDatabase;
+  FMainForm.SyncControl.OnFinishedLoadingDatabase;
+  FMainForm.OnFinishedLoadingDatabase;
   // Refresh UI
-  OnAccountsChanged(FWallet);
+  OnAccountsChanged(FMainForm);
 end;
 
 {%endregion}
@@ -604,7 +600,7 @@ begin
   try
     FUILock.Acquire;
     if not Assigned(FAccountExplorer) then begin
-       FAccountExplorer := TFRMAccountExplorer.Create(FWallet);
+       FAccountExplorer := TFRMAccountExplorer.Create(FMainForm);
        FAccountExplorer.CloseAction:= caFree;
        FAccountExplorer.OnDestroyed:= Self.OnSubFormDestroyed;
        FAccountExplorer.SetSubFormCoordinate(FAccountExplorer);
@@ -621,10 +617,10 @@ begin
   try
     FUILock.Acquire;
     if not Assigned(FBlockExplorerForm) then begin
-       FBlockExplorerForm := TFRMBlockExplorer.Create(FWallet);
+       FBlockExplorerForm := TFRMBlockExplorer.Create(FMainForm);
        FBlockExplorerForm.CloseAction:= caFree;
        FBlockExplorerForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FWallet.SetSubFormCoordinate(FBlockExplorerForm);
+       FMainForm.SetSubFormCoordinate(FBlockExplorerForm);
     end;
     FBlockExplorerForm.Show;
   finally
@@ -637,10 +633,10 @@ begin
   try
     FUILock.Acquire;
     if not Assigned(FOperationsExplorerForm) then begin
-      FOperationsExplorerForm := TFRMOperationExplorer.Create(FWallet);
+      FOperationsExplorerForm := TFRMOperationExplorer.Create(FMainForm);
       FOperationsExplorerForm.CloseAction:= caFree;
       FOperationsExplorerForm.OnDestroyed:= Self.OnSubFormDestroyed;
-      FWallet.SetSubFormCoordinate(FOperationsExplorerForm);
+      FMainForm.SetSubFormCoordinate(FOperationsExplorerForm);
     end;
     FOperationsExplorerForm.Show;
   finally
@@ -653,10 +649,10 @@ begin
   try
     FUILock.Acquire;
     if not Assigned(FPendingOperationForm) then begin
-      FPendingOperationForm := TFRMPendingOperations.Create(FWallet);
+      FPendingOperationForm := TFRMPendingOperations.Create(FMainForm);
       FPendingOperationForm.CloseAction:= caFree;
       FPendingOperationForm.OnDestroyed:= Self.OnSubFormDestroyed;
-      FWallet.SetSubFormCoordinate(FPendingOperationForm);
+      FMainForm.SetSubFormCoordinate(FPendingOperationForm);
     end;
     FPendingOperationForm.Show;
   finally
@@ -669,10 +665,10 @@ begin
   try
     FUILock.Acquire;
     if not Assigned(FMessagesForm) then begin
-       FMessagesForm := TFRMMessages.Create(FWallet);
+       FMessagesForm := TFRMMessages.Create(FMainForm);
        FMessagesForm.CloseAction:= caFree;
        FMessagesForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FWallet.SetSubFormCoordinate(FMessagesForm);
+       FMainForm.SetSubFormCoordinate(FMessagesForm);
     end;
     FMessagesForm.Show;
   finally
@@ -685,10 +681,10 @@ begin
   try
     FUILock.Acquire;
     if not Assigned(FNodesForm) then begin
-       FNodesForm := TFRMNodes.Create(FWallet);
+       FNodesForm := TFRMNodes.Create(FMainForm);
        FNodesForm.CloseAction:= caFree;
        FNodesForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FWallet.SetSubFormCoordinate(FNodesForm);
+       FMainForm.SetSubFormCoordinate(FNodesForm);
     end;
     FNodesForm.Show;
   finally
@@ -701,10 +697,10 @@ begin
   try
     FUILock.Acquire;
     if not Assigned(FLogsForm) then begin
-       FLogsForm := TFRMLogs.Create(FWallet);
+       FLogsForm := TFRMLogs.Create(FMainForm);
        FLogsForm.CloseAction:= caFree;
        FLogsForm.OnDestroyed:= Self.OnSubFormDestroyed;
-       FWallet.SetSubFormCoordinate(FLogsForm);
+       FMainForm.SetSubFormCoordinate(FLogsForm);
     end;
     FLogsForm.Show;
   finally
@@ -715,24 +711,13 @@ end;
 class procedure TUserInterface.ShowWallet;
 begin
   // TODO - VALIDATION HERE
-  FWallet.Mode := wmWallet;
+  FMainForm.Mode := wmWallet;
   // else ShowError('', 'Wallet is currently unavailable, please wait until processing is finished');
 end;
 
 class procedure TUserInterface.ShowSyncDialog;
 begin
-  try
-    FUILock.Acquire;
-    if not Assigned(FSyncronizationDialog) then
-      FSyncronizationDialog := TFRMSyncronizationDialog.Create(FWallet);
-
-    if FDisplayedStartupSyncDialog = true then begin
-       FDisplayedStartupSyncDialog := false;
-    end;
-    FWallet.Mode := wmSync;
-  finally
-    FUILock.Release;
-  end;
+  FMainForm.Mode := wmSync;
 end;
 
 {%endregion}
@@ -787,8 +772,8 @@ var errors : AnsiString;
 begin
   FUILock.Acquire;
   Try
-    FSyncronizationDialog.UpdateNodeStatus;
-    OnNetStatisticsChanged(FWallet);
+    FMainForm.SyncControl.UpdateNodeStatus;
+    OnNetStatisticsChanged(FMainForm);
     if Assigned(FNode) then begin
       if FNode.IsBlockChainValid(errors) then begin
         StatusBar2Text := Format('Last account time:%s',
@@ -850,9 +835,9 @@ begin
   NotifyConfigChanged;
 end;
 
-class procedure TUserInterface.SetWalletMode(AMode: TFRMWalletMode);
+class procedure TUserInterface.SetMainFormMode(AMode: TFRMMainFormMode);
 begin
-  if AMode <> FWallet.Mode then
+  if AMode <> FMainForm.Mode then
     case AMode of
       wmWallet: ShowWallet;
       wmSync: ShowSyncDialog;
@@ -860,9 +845,9 @@ begin
     end;
 end;
 
-class function TUserInterface.GetWalletMode : TFRMWalletMode;
+class function TUserInterface.GetMainFormMode : TFRMMainFormMode;
 begin
-  Result := FWallet.Mode;
+  Result := FMainForm.Mode;
 end;
 
 class procedure TUserInterface.NotifyConfigChanged;
@@ -904,31 +889,31 @@ end;
 class procedure TUserInterface.SetStatusBar0Text(const text : AnsiString); static;
 begin
   FStatusBar0Text := text;
-  if Assigned(FWallet) then
-    FWallet.sbStatusBar.Panels[0].Text := FStatusBar0Text;
+  if Assigned(FMainForm) then
+    FMainForm.sbStatusBar.Panels[0].Text := FStatusBar0Text;
 end;
 
 class procedure TUserInterface.SetStatusBar1Text(const text : AnsiString); static;
 begin
   FStatusBar1Text := text;
-  if Assigned(FWallet) then
-    FWallet.sbStatusBar.Panels[1].Text := text;
+  if Assigned(FMainForm) then
+    FMainForm.sbStatusBar.Panels[1].Text := text;
 end;
 
 class procedure TUserInterface.SetStatusBar2Text(const text : AnsiString); static;
 begin
   FStatusBar2Text := text;
-  if Assigned(FWallet) then
-    FWallet.sbStatusBar.Panels[2].Text := text;
+  if Assigned(FMainForm) then
+    FMainForm.sbStatusBar.Panels[2].Text := text;
 end;
 
 class procedure TUserInterface.SetMessagesNotificationText(const text : AnsiString); static;
 begin
   FMessagesNotificationText := text;
-  if Assigned(FSyncronizationDialog) then begin
+  if Assigned(FMainForm.SyncControl) then begin
     if (text = '') then
-      FSyncronizationDialog.lblReceivedMessages.Visible := false;
-    FSyncronizationDialog.lblReceivedMessages.Caption := text;
+      FMainForm.SyncControl.lblReceivedMessages.Visible := false;
+    FMainForm.SyncControl.lblReceivedMessages.Caption := text;
   end;
 end;
 
@@ -954,7 +939,7 @@ begin
     try
       if Assigned(FAccountExplorer) then
         FAccountExplorer.RefreshAccountsGrid(false);
-      FSyncronizationDialog.UpdateBlockChainState;
+      FMainForm.SyncControl.UpdateBlockChainState;
     except
       On E:Exception do begin
         E.Message := 'Error at OnNewAccount '+E.Message;
@@ -1060,8 +1045,8 @@ class procedure TUserInterface.OnTimerUpdateStatusTimer(Sender: TObject);
 begin
   Try
     RefreshConnectionStatusDisplay;
-    FSyncronizationDialog.UpdateBlockChainState;
-    FSyncronizationDialog.UpdateNodeStatus;
+    FMainForm.SyncControl.UpdateBlockChainState;
+    FMainForm.SyncControl.UpdateNodeStatus;
   Except
     On E:Exception do begin
       E.Message := 'Exception at TimerUpdate '+E.ClassName+': '+E.Message;

+ 2 - 0
Units/Utils/UCommonUI.pas

@@ -41,6 +41,8 @@ type
       property CloseAction : TCloseAction read FCloseAction write FCloseAction;
       property OnActivateFirstTime : TNotifyEvent read FActivateFirstTime write FActivateFirstTime;
       property OnDestroyed : TNotifyEvent read FDestroyed write FDestroyed;
+    public
+      property ActivationCount : UInt32 read FActivatedCount;
   end;
 
   { TWinControlHelper }