Browse Source

GUI: disable user input on splash init

Herman Schoenfeld 7 years ago
parent
commit
f4c4bc8b1d
3 changed files with 19 additions and 1 deletions
  1. 5 1
      src/gui/UCTRLSyncronization.pas
  2. 1 0
      src/gui/UFRMMainForm.lfm
  3. 13 0
      src/gui/UUserInterface.pas

+ 5 - 1
src/gui/UCTRLSyncronization.pas

@@ -81,7 +81,9 @@ uses UNetProtocol,UTime,UConst, UUserInterface;
 
 procedure TCTRLSyncronization.ActivateFirstTime;
 begin
-  SyncMode := smInitialising;
+  FMode := smInitialising;
+  paSplash.Visible:= true;
+  paSync.Visible := false;
 end;
 
 procedure TCTRLSyncronization.SetSyncMode(AMode : TSyncMode);
@@ -89,10 +91,12 @@ begin
   if FMode = AMode then exit;
   case AMode of
     smInitialising: begin
+      TUserInterface.Enabled := false;
       paSplash.Visible:= true;
       paSync.Visible := false;
     end;
     smReady: begin
+      TUserInterface.Enabled := true;
       paSplash.Visible:= false;
       paSync.Visible := true;
     end;

+ 1 - 0
src/gui/UFRMMainForm.lfm

@@ -10,6 +10,7 @@ object FRMMainForm: TFRMMainForm
   Constraints.MinHeight = 600
   Constraints.MinWidth = 865
   DockSite = True
+  Enabled = False
   Font.Color = clWindowText
   Font.Height = -11
   Font.Name = 'Tahoma'

+ 13 - 0
src/gui/UUserInterface.pas

@@ -67,6 +67,8 @@ type
       class procedure RefreshConnectionStatusDisplay;
 
       // Getters/Setters
+      class function GetEnabled : boolean; static;
+      class procedure SetEnabled(ABool: boolean); static;
       class procedure SetStatusBar0Text(const text : AnsiString); static;
       class procedure SetStatusBar1Text(const text : AnsiString); static;
       class procedure SetStatusBar2Text(const text : AnsiString); static;
@@ -95,6 +97,7 @@ type
       class procedure OnTrayIconDblClick(Sender: TObject);
     public
       // Properties
+      class property Enabled : boolean read GetEnabled write SetEnabled;
       class property Started : boolean read FStarted;
       class property Node : TNode read FNode;
       class property Log : TLog read FLog;
@@ -777,6 +780,16 @@ end;
 
 {%region Auxillary methods}
 
+class function TUserInterface.GetEnabled : boolean;
+begin
+  Result := FMainForm.Enabled;
+end;
+
+class procedure TUserInterface.SetEnabled(ABool: boolean);
+begin
+  FMainForm.Enabled:=ABool;
+end;
+
 class procedure TUserInterface.SetMainFormMode(AMode: TFRMMainFormMode);
 begin
   if AMode <> FMainForm.Mode then