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.
This commit is contained in:
gambas 2022-04-04 18:31:54 +02:00
parent 203a1789c7
commit d69837264b
5 changed files with 49 additions and 21 deletions

View file

@ -21,7 +21,9 @@ Private $aFind As Integer[]
Private $iLastLine As Integer Private $iLastLine As Integer
Private $iLastLineOffset As Integer Private $iLastLineOffset As Integer
Private $hTask As CVersionControlHistoryTask Private $hTask As CVersionControlHistoryTask
Private $hSpinner As Spinner
Public Sub _new() Public Sub _new()
@ -497,12 +499,15 @@ Public Sub StopFillWithHistory()
End 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 StopFillWithHistory
Me.Clear Me.Clear
$hSpinner = hSpinner
hSpinner.Show
hSpinner.Start
$hTask = New CVersionControlHistoryTask(sPath, sPath2, bFull) As "TaskVCHistory" $hTask = New CVersionControlHistoryTask(sPath, sPath2, bFull) As "TaskVCHistory"
'Me.Text = VersionControl.History(sPath, sPath2, bFull) 'Me.Text = VersionControl.History(sPath, sPath2, bFull)
@ -528,6 +533,12 @@ End
Public Sub TaskVCHistory_Kill() Public Sub TaskVCHistory_Kill()
If $hSpinner Then
$hSpinner.Stop
$hSpinner.Hide
$hSpinner = Null
Endif
If $hTask Then If $hTask Then
Me.SetFocus Me.SetFocus
Me.Reset Me.Reset

View file

@ -139,16 +139,16 @@ Public Sub tabInfo_Click()
Case 0 Case 0
btnRevert.Show btnRevert.Show
chkShowHistoryChanges.Hide panChange.Hide
btnLocateChange.Show btnLocateChange.Show
LoadVersionControlInfo LoadVersionControlInfo
Case 1 Case 1
btnRevert.Hide btnRevert.Hide
chkShowHistoryChanges.Show panChange.Show
btnLocateChange.Hide btnLocateChange.Hide
If edtHistory.IsVoid() Then edtHistory.FillWithHistory($sPath, $sPath2) If edtHistory.IsVoid() Then edtHistory.FillWithHistory($sPath, spnChange, $sPath2)
End Select End Select
@ -174,7 +174,7 @@ End
Public Sub chkShowHistoryChanges_Click() Public Sub chkShowHistoryChanges_Click()
edtHistory.FillWithHistory($sPath, $sPath2, chkShowHistoryChanges.Value) edtHistory.FillWithHistory($sPath, spnChange, $sPath2, chkShowHistoryChanges.Value)
End End

View file

@ -39,7 +39,7 @@
Index = 0 Index = 0
} }
{ HBox1 HBox { HBox1 HBox
MoveScaled(4,54,96,4) MoveScaled(4,54,108,4)
Spacing = True Spacing = True
{ btnRevert Button { btnRevert Button
MoveScaled(0,0,18,4) MoveScaled(0,0,18,4)
@ -54,17 +54,26 @@
Text = ("Locate change") Text = ("Locate change")
Picture = Picture["icon:/small/find"] Picture = Picture["icon:/small/find"]
} }
{ chkShowHistoryChanges CheckBox { panChange HBox
MoveScaled(46,1,29,3) MoveScaled(44,0,37,4)
AutoResize = True Expand = True
Text = ("Display changes in history") 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 { Panel3 Panel
MoveScaled(76,0,1,4) MoveScaled(86,0,1,4)
Expand = True Expand = True
} }
{ btnClose Button { btnClose Button
MoveScaled(79,0,16,4) MoveScaled(89,0,16,4)
Text = ("Close") Text = ("Close")
Picture = Picture["icon:/small/close"] Picture = Picture["icon:/small/close"]
Default = True Default = True

View file

@ -174,7 +174,7 @@ Public Sub tabVersionControl_Click()
Try edtDiff.SetFocus Try edtDiff.SetFocus
Case 2 Case 2
If edtHistory.IsVoid() Then edtHistory.FillWithHistory(Project.Dir) If edtHistory.IsVoid() Then edtHistory.FillWithHistory(Project.Dir, spnChange)
Case 3 Case 3
Try trmShell.Exec(["bash"], ["PWD=" & Project.Dir]) Try trmShell.Exec(["bash"], ["PWD=" & Project.Dir])
@ -183,7 +183,7 @@ Public Sub tabVersionControl_Click()
End Select End Select
chkHideTrans.Visible = tabVersionControl.Index = 1 And edtDiff.Visible chkHideTrans.Visible = tabVersionControl.Index = 1 And edtDiff.Visible
chkShowHistoryChanges.Visible = tabVersionControl.Index = 2 panChange.Visible = tabVersionControl.Index = 2
End End
@ -215,6 +215,6 @@ End
Public Sub chkShowHistoryChanges_Click() Public Sub chkShowHistoryChanges_Click()
edtHistory.FillWithHistory(Project.Dir,, chkShowHistoryChanges.Value) edtHistory.FillWithHistory(Project.Dir, spnChange,, chkShowHistoryChanges.Value)
End End

View file

@ -57,11 +57,19 @@
AutoResize = True AutoResize = True
Text = ("Hide translation changes") Text = ("Hide translation changes")
} }
{ chkShowHistoryChanges CheckBox { panChange HBox
MoveScaled(0,0,29,3) MoveScaled(0,0,36,4)
Visible = False Expand = True
AutoResize = True { chkShowHistoryChanges CheckBox
Text = ("Display changes in history") 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 { panNothing Panel
MoveScaled(9,0,31,4) MoveScaled(9,0,31,4)