Add sort File list by importance
This commit is contained in:
61
main.pb
61
main.pb
@@ -401,6 +401,7 @@ Structure listFilesGit
|
||||
statusDescription.s
|
||||
indexStatus.s
|
||||
workingTreeStatus.s
|
||||
importance.i
|
||||
EndStructure
|
||||
|
||||
Structure GitStatus
|
||||
@@ -451,6 +452,8 @@ UseModule Translate
|
||||
;-FUNCTION DECLARATIONS / DÉCLARATIONS DE FONCTIONS
|
||||
; =============================================================================
|
||||
Declare RefreshFileList(null.i)
|
||||
Declare.i StatusImportance(status.s)
|
||||
|
||||
|
||||
Procedure.i RunExe(*call.RunProgramCall)
|
||||
Protected prg.i, line$, lineError$, out$, err$
|
||||
@@ -507,6 +510,49 @@ EndProcedure
|
||||
|
||||
; ---- Helpers ---------------------------------------------------------------
|
||||
|
||||
; --- Importance par statut Gitpour le trie de
|
||||
Procedure.i StatusImportance(status.s)
|
||||
Protected x.s = Left(status, 1)
|
||||
Protected y.s = Mid(status, 2, 1)
|
||||
Protected score.i = 0
|
||||
|
||||
; Conflits d'abord
|
||||
Select status
|
||||
Case "DD","AU","UD","UA","DU","AA","UU"
|
||||
ProcedureReturn 1000
|
||||
EndSelect
|
||||
If x = "U" Or y = "U" : ProcedureReturn 1000 : EndIf
|
||||
|
||||
; Cas simples
|
||||
If status = "??" : ProcedureReturn 300 : EndIf ; Non suivis
|
||||
If status = "!!" : ProcedureReturn 50 : EndIf ; Ignorés
|
||||
If status = " " : ProcedureReturn 0 : EndIf ; Propres
|
||||
|
||||
; Index > Worktree
|
||||
If x <> " " : score + 700 : EndIf
|
||||
If y <> " " And y <> "?" And y <> "!" : score + 600 : EndIf
|
||||
|
||||
; Raffinement (X puis Y)
|
||||
Select x
|
||||
Case "D" : score + 80
|
||||
Case "R" : score + 70
|
||||
Case "A" : score + 60
|
||||
Case "M" : score + 50
|
||||
Case "C" : score + 40
|
||||
Case "T" : score + 30
|
||||
EndSelect
|
||||
Select y
|
||||
Case "D" : score + 40
|
||||
Case "R" : score + 35
|
||||
Case "A" : score + 30
|
||||
Case "M" : score + 25
|
||||
Case "C" : score + 20
|
||||
Case "T" : score + 15
|
||||
EndSelect
|
||||
|
||||
ProcedureReturn score
|
||||
EndProcedure
|
||||
|
||||
Procedure.s _SupTrim(text.s)
|
||||
If text = "" : ProcedureReturn "" : EndIf
|
||||
|
||||
@@ -1818,6 +1864,13 @@ Procedure RefreshFileList(null.i)
|
||||
|
||||
GetGitStatus()
|
||||
|
||||
ForEach main\listFilesGit()
|
||||
main\listFilesGit()\importance = StatusImportance(main\listFilesGit()\status)
|
||||
Next
|
||||
|
||||
; --- Tri par importance (du plus important au moins important)
|
||||
SortStructuredList(main\listFilesGit(), #PB_Sort_Descending, OffsetOf(listFilesGit\importance), #PB_Integer)
|
||||
|
||||
Protected n.l=n-1
|
||||
ForEach main\listFilesGit()
|
||||
n=n+1
|
||||
@@ -1826,6 +1879,8 @@ Procedure RefreshFileList(null.i)
|
||||
SetGadgetItemState(#GdtListStatus,n,#PB_ListIcon_Checked)
|
||||
EndIf
|
||||
Next
|
||||
|
||||
|
||||
DisableGadget(#GdtListStatus,#False)
|
||||
DisableGadget(#GdtBtnRefresh,#False)
|
||||
GetBranchesList()
|
||||
@@ -2196,6 +2251,8 @@ Procedure OpenGUI()
|
||||
Case #GdtBtnCommit
|
||||
Debug "Click>#GdtBtnCommit"
|
||||
DoCommit()
|
||||
SetGadgetText(#GdtFieldMessage,"")
|
||||
CreateThread(@RefreshFileList(),0)
|
||||
Case #GdtFieldRemote
|
||||
Debug "Click>#GdtFieldRemote"
|
||||
|
||||
@@ -2228,8 +2285,8 @@ OpenGUI()
|
||||
|
||||
|
||||
; IDE Options = PureBasic 6.21 (Windows - x64)
|
||||
; CursorPosition = 2191
|
||||
; FirstLine = 2180
|
||||
; CursorPosition = 1871
|
||||
; FirstLine = 1867
|
||||
; Folding = ----------
|
||||
; Optimizer
|
||||
; EnableThread
|
||||
|
Reference in New Issue
Block a user