From d69837264b5a2f33781d350701ae6c9609bf9f8f Mon Sep 17 00:00:00 2001 From: gambas Date: Mon, 4 Apr 2022 18:31:54 +0200 Subject: [PATCH] Version control: Add a rotating spinner while the git log history is loading. [DEVELOPMENT ENVIRONMENT] * NEW: Version control: Add a rotating spinner while the git log history is loading. --- .../gambas3/.src/Exported/TextEditor.class | 15 ++++++++++-- .../.src/VersionControl/FFileInfoVC.class | 8 +++---- .../.src/VersionControl/FFileInfoVC.form | 23 +++++++++++++------ .../.src/VersionControl/FVersionControl.class | 6 ++--- .../.src/VersionControl/FVersionControl.form | 18 +++++++++++---- 5 files changed, 49 insertions(+), 21 deletions(-) diff --git a/app/src/gambas3/.src/Exported/TextEditor.class b/app/src/gambas3/.src/Exported/TextEditor.class index d78321896..165c24125 100644 --- a/app/src/gambas3/.src/Exported/TextEditor.class +++ b/app/src/gambas3/.src/Exported/TextEditor.class @@ -21,7 +21,9 @@ Private $aFind As Integer[] Private $iLastLine As Integer Private $iLastLineOffset As Integer + Private $hTask As CVersionControlHistoryTask +Private $hSpinner As Spinner Public Sub _new() @@ -497,12 +499,15 @@ Public Sub StopFillWithHistory() End -Public Sub FillWithHistory(sPath As String, Optional sPath2 As String, Optional bFull As Boolean) +Public Sub FillWithHistory(sPath As String, hSpinner As Spinner, Optional sPath2 As String, Optional bFull As Boolean) StopFillWithHistory Me.Clear - + + $hSpinner = hSpinner + hSpinner.Show + hSpinner.Start $hTask = New CVersionControlHistoryTask(sPath, sPath2, bFull) As "TaskVCHistory" 'Me.Text = VersionControl.History(sPath, sPath2, bFull) @@ -528,6 +533,12 @@ End Public Sub TaskVCHistory_Kill() + If $hSpinner Then + $hSpinner.Stop + $hSpinner.Hide + $hSpinner = Null + Endif + If $hTask Then Me.SetFocus Me.Reset diff --git a/app/src/gambas3/.src/VersionControl/FFileInfoVC.class b/app/src/gambas3/.src/VersionControl/FFileInfoVC.class index 0fe3f721d..cc3b0c7cb 100644 --- a/app/src/gambas3/.src/VersionControl/FFileInfoVC.class +++ b/app/src/gambas3/.src/VersionControl/FFileInfoVC.class @@ -139,16 +139,16 @@ Public Sub tabInfo_Click() Case 0 btnRevert.Show - chkShowHistoryChanges.Hide + panChange.Hide btnLocateChange.Show LoadVersionControlInfo Case 1 btnRevert.Hide - chkShowHistoryChanges.Show + panChange.Show btnLocateChange.Hide - If edtHistory.IsVoid() Then edtHistory.FillWithHistory($sPath, $sPath2) + If edtHistory.IsVoid() Then edtHistory.FillWithHistory($sPath, spnChange, $sPath2) End Select @@ -174,7 +174,7 @@ End Public Sub chkShowHistoryChanges_Click() - edtHistory.FillWithHistory($sPath, $sPath2, chkShowHistoryChanges.Value) + edtHistory.FillWithHistory($sPath, spnChange, $sPath2, chkShowHistoryChanges.Value) End diff --git a/app/src/gambas3/.src/VersionControl/FFileInfoVC.form b/app/src/gambas3/.src/VersionControl/FFileInfoVC.form index 7b75be5b4..e74c327b0 100644 --- a/app/src/gambas3/.src/VersionControl/FFileInfoVC.form +++ b/app/src/gambas3/.src/VersionControl/FFileInfoVC.form @@ -39,7 +39,7 @@ Index = 0 } { HBox1 HBox - MoveScaled(4,54,96,4) + MoveScaled(4,54,108,4) Spacing = True { btnRevert Button MoveScaled(0,0,18,4) @@ -54,17 +54,26 @@ Text = ("Locate change") Picture = Picture["icon:/small/find"] } - { chkShowHistoryChanges CheckBox - MoveScaled(46,1,29,3) - AutoResize = True - Text = ("Display changes in history") + { panChange HBox + MoveScaled(44,0,37,4) + Expand = True + Spacing = True + { chkShowHistoryChanges CheckBox + MoveScaled(0,0,29,3) + AutoResize = True + Text = ("Display changes in history") + } + { spnChange Spinner + MoveScaled(32,0,4,4) + Type = Spinner.Circle + } } { Panel3 Panel - MoveScaled(76,0,1,4) + MoveScaled(86,0,1,4) Expand = True } { btnClose Button - MoveScaled(79,0,16,4) + MoveScaled(89,0,16,4) Text = ("Close") Picture = Picture["icon:/small/close"] Default = True diff --git a/app/src/gambas3/.src/VersionControl/FVersionControl.class b/app/src/gambas3/.src/VersionControl/FVersionControl.class index 034f4ca65..cbf78e026 100644 --- a/app/src/gambas3/.src/VersionControl/FVersionControl.class +++ b/app/src/gambas3/.src/VersionControl/FVersionControl.class @@ -174,7 +174,7 @@ Public Sub tabVersionControl_Click() Try edtDiff.SetFocus Case 2 - If edtHistory.IsVoid() Then edtHistory.FillWithHistory(Project.Dir) + If edtHistory.IsVoid() Then edtHistory.FillWithHistory(Project.Dir, spnChange) Case 3 Try trmShell.Exec(["bash"], ["PWD=" & Project.Dir]) @@ -183,7 +183,7 @@ Public Sub tabVersionControl_Click() End Select chkHideTrans.Visible = tabVersionControl.Index = 1 And edtDiff.Visible - chkShowHistoryChanges.Visible = tabVersionControl.Index = 2 + panChange.Visible = tabVersionControl.Index = 2 End @@ -215,6 +215,6 @@ End Public Sub chkShowHistoryChanges_Click() - edtHistory.FillWithHistory(Project.Dir,, chkShowHistoryChanges.Value) + edtHistory.FillWithHistory(Project.Dir, spnChange,, chkShowHistoryChanges.Value) End diff --git a/app/src/gambas3/.src/VersionControl/FVersionControl.form b/app/src/gambas3/.src/VersionControl/FVersionControl.form index 32ea51268..b9dcc8fa9 100644 --- a/app/src/gambas3/.src/VersionControl/FVersionControl.form +++ b/app/src/gambas3/.src/VersionControl/FVersionControl.form @@ -57,11 +57,19 @@ AutoResize = True Text = ("Hide translation changes") } - { chkShowHistoryChanges CheckBox - MoveScaled(0,0,29,3) - Visible = False - AutoResize = True - Text = ("Display changes in history") + { panChange HBox + MoveScaled(0,0,36,4) + Expand = True + { chkShowHistoryChanges CheckBox + MoveScaled(0,0,29,3) + Visible = False + AutoResize = True + Text = ("Display changes in history") + } + { spnChange Spinner + MoveScaled(29,0,4,4) + Type = Spinner.Circle + } } { panNothing Panel MoveScaled(9,0,31,4)