Reformated project's code
This commit is contained in:
parent
df48b40ce5
commit
e473d29167
@ -45,9 +45,9 @@ class TabState @Inject constructor(
|
||||
*/
|
||||
@set:Synchronized
|
||||
var operationRunning = false
|
||||
get() {
|
||||
return field || mutex.isLocked
|
||||
}
|
||||
get() {
|
||||
return field || mutex.isLocked
|
||||
}
|
||||
|
||||
private val _processing = MutableStateFlow(false)
|
||||
val processing: StateFlow<Boolean> = _processing
|
||||
|
@ -1,20 +1,8 @@
|
||||
package app.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.maxSidePanelHeight
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.ui.components.SideMenuEntry
|
||||
import app.ui.components.SideMenuPanel
|
||||
import app.ui.components.SideMenuSubentry
|
||||
import app.viewmodels.StashStatus
|
||||
|
@ -2,22 +2,10 @@ package app.ui
|
||||
|
||||
import androidx.compose.foundation.ContextMenuArea
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.extensions.simpleName
|
||||
import app.maxSidePanelHeight
|
||||
import app.ui.components.ScrollableLazyColumn
|
||||
import app.ui.components.SideMenuEntry
|
||||
import app.ui.components.SideMenuPanel
|
||||
import app.ui.components.SideMenuSubentry
|
||||
import app.ui.context_menu.tagContextMenuItems
|
||||
|
@ -1,11 +1,13 @@
|
||||
package app.ui.components
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.MutableState
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
|
||||
@OptIn(ExperimentalAnimationApi::class)
|
||||
@ -40,7 +42,7 @@ fun VerticalExpandable(
|
||||
header()
|
||||
}
|
||||
|
||||
if(isExpanded) {
|
||||
if (isExpanded) {
|
||||
child()
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
@ -30,7 +29,7 @@ fun SideMenuEntry(
|
||||
.background(color = MaterialTheme.colors.headerBackground),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
if(icon != null) {
|
||||
if (icon != null) {
|
||||
Icon(
|
||||
painter = icon,
|
||||
contentDescription = null,
|
||||
|
@ -2,7 +2,6 @@ package app.ui.components
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
|
@ -33,7 +33,7 @@ fun SideMenuSubentry(
|
||||
.height(ENTRY_HEIGHT.dp)
|
||||
.fillMaxWidth()
|
||||
.run {
|
||||
if(onClick != null)
|
||||
if (onClick != null)
|
||||
clickable(onClick = onClick)
|
||||
else
|
||||
this
|
||||
|
@ -25,7 +25,7 @@ class DiffViewModel @Inject constructor(
|
||||
)
|
||||
)
|
||||
|
||||
fun updateDiff(diffEntryType: DiffEntryType) = tabState.runOperation (
|
||||
fun updateDiff(diffEntryType: DiffEntryType) = tabState.runOperation(
|
||||
refreshType = RefreshType.NONE,
|
||||
) { git ->
|
||||
val oldDiffEntryType = _diffResult.value?.diffEntryType
|
||||
@ -54,13 +54,13 @@ class DiffViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun stageHunk(diffEntry: DiffEntry, hunk: Hunk) = tabState.runOperation (
|
||||
fun stageHunk(diffEntry: DiffEntry, hunk: Hunk) = tabState.runOperation(
|
||||
refreshType = RefreshType.UNCOMMITED_CHANGES,
|
||||
) { git ->
|
||||
statusManager.stageHunk(git, diffEntry, hunk)
|
||||
}
|
||||
|
||||
fun unstageHunk(diffEntry: DiffEntry, hunk: Hunk) = tabState.runOperation (
|
||||
fun unstageHunk(diffEntry: DiffEntry, hunk: Hunk) = tabState.runOperation(
|
||||
refreshType = RefreshType.UNCOMMITED_CHANGES,
|
||||
) { git ->
|
||||
statusManager.unstageHunk(git, diffEntry, hunk)
|
||||
|
@ -38,13 +38,13 @@ class LogViewModel @Inject constructor(
|
||||
logManager.checkoutCommit(git, revCommit)
|
||||
}
|
||||
|
||||
fun revertCommit(revCommit: RevCommit) = tabState.safeProcessing (
|
||||
fun revertCommit(revCommit: RevCommit) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
logManager.revertCommit(git, revCommit)
|
||||
}
|
||||
|
||||
fun resetToCommit(revCommit: RevCommit, resetType: ResetType) = tabState.safeProcessing (
|
||||
fun resetToCommit(revCommit: RevCommit, resetType: ResetType) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
logManager.resetToCommit(git, revCommit, resetType = resetType)
|
||||
@ -52,36 +52,36 @@ class LogViewModel @Inject constructor(
|
||||
|
||||
fun checkoutRef(ref: Ref) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
) { git ->
|
||||
branchesManager.checkoutRef(git, ref)
|
||||
}
|
||||
|
||||
|
||||
fun createBranchOnCommit(branch: String, revCommit: RevCommit) = tabState.safeProcessing (
|
||||
fun createBranchOnCommit(branch: String, revCommit: RevCommit) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
branchesManager.createBranchOnCommit(git, branch, revCommit)
|
||||
}
|
||||
|
||||
fun createTagOnCommit(tag: String, revCommit: RevCommit) = tabState.safeProcessing (
|
||||
fun createTagOnCommit(tag: String, revCommit: RevCommit) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
tagsManager.createTagOnCommit(git, tag, revCommit)
|
||||
}
|
||||
|
||||
fun mergeBranch(ref: Ref, fastForward: Boolean) = tabState.safeProcessing (
|
||||
fun mergeBranch(ref: Ref, fastForward: Boolean) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
mergeManager.mergeBranch(git, ref, fastForward)
|
||||
}
|
||||
|
||||
fun deleteBranch(branch: Ref) = tabState.safeProcessing (
|
||||
fun deleteBranch(branch: Ref) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
branchesManager.deleteBranch(git, branch)
|
||||
}
|
||||
|
||||
fun deleteTag(tag: Ref) = tabState.safeProcessing (
|
||||
fun deleteTag(tag: Ref) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
tagsManager.deleteTag(git, tag)
|
||||
@ -91,7 +91,7 @@ class LogViewModel @Inject constructor(
|
||||
loadLog(git)
|
||||
}
|
||||
|
||||
fun rebaseBranch(ref: Ref) = tabState.safeProcessing (
|
||||
fun rebaseBranch(ref: Ref) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
rebaseManager.rebaseBranch(git, ref)
|
||||
|
@ -12,34 +12,34 @@ class MenuViewModel @Inject constructor(
|
||||
private val remoteOperationsManager: RemoteOperationsManager,
|
||||
private val stashManager: StashManager,
|
||||
) {
|
||||
fun pull(rebase: Boolean = false) = tabState.safeProcessing (
|
||||
fun pull(rebase: Boolean = false) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
refreshEvenIfCrashes = true,
|
||||
) { git ->
|
||||
remoteOperationsManager.pull(git, rebase)
|
||||
}
|
||||
|
||||
fun fetchAll() = tabState.safeProcessing (
|
||||
fun fetchAll() = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
refreshEvenIfCrashes = true,
|
||||
) { git ->
|
||||
remoteOperationsManager.fetchAll(git)
|
||||
}
|
||||
|
||||
fun push(force: Boolean = false) = tabState.safeProcessing (
|
||||
fun push(force: Boolean = false) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
refreshEvenIfCrashes = true,
|
||||
) { git ->
|
||||
remoteOperationsManager.push(git, force)
|
||||
}
|
||||
|
||||
fun stash() = tabState.safeProcessing (
|
||||
fun stash() = tabState.safeProcessing(
|
||||
refreshType = RefreshType.UNCOMMITED_CHANGES,
|
||||
) { git ->
|
||||
stashManager.stash(git)
|
||||
}
|
||||
|
||||
fun popStash() = tabState.safeProcessing (
|
||||
fun popStash() = tabState.safeProcessing(
|
||||
refreshType = RefreshType.UNCOMMITED_CHANGES,
|
||||
) { git ->
|
||||
stashManager.popStash(git)
|
||||
@ -48,7 +48,7 @@ class MenuViewModel @Inject constructor(
|
||||
fun openFolderInFileExplorer() = tabState.runOperation(
|
||||
showError = true,
|
||||
refreshType = RefreshType.NONE,
|
||||
) { git ->
|
||||
) { git ->
|
||||
Desktop.getDesktop().open(git.repository.directory.parentFile)
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ class RemotesViewModel @Inject constructor(
|
||||
_remotes.value = remoteViewList
|
||||
}
|
||||
|
||||
fun deleteRemoteBranch(ref: Ref) = tabState.safeProcessing (
|
||||
fun deleteRemoteBranch(ref: Ref) = tabState.safeProcessing(
|
||||
refreshType = RefreshType.ALL_DATA,
|
||||
) { git ->
|
||||
remoteOperationsManager.deleteBranch(git, ref)
|
||||
|
@ -163,9 +163,9 @@ class TabViewModel @Inject constructor(
|
||||
stashesViewModel.refresh(git)
|
||||
}
|
||||
|
||||
private suspend fun refreshRepositoryInfo() = tabState.safeProcessing (
|
||||
private suspend fun refreshRepositoryInfo() = tabState.safeProcessing(
|
||||
refreshType = RefreshType.NONE,
|
||||
){ git ->
|
||||
) { git ->
|
||||
logViewModel.refresh(git)
|
||||
branchesViewModel.refresh(git)
|
||||
remotesViewModel.refresh(git)
|
||||
|
@ -1,14 +1,16 @@
|
||||
<svg width="325" height="325" viewBox="0 0 325 325" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_407_2)">
|
||||
<rect width="325" height="325" rx="73" fill="#D3EFFF"/>
|
||||
<rect x="150" width="26" height="325" fill="#4898F7"/>
|
||||
<path d="M300 0L300.086 72.671C300.151 126.998 256.009 171.011 201.682 170.786L158.86 170.61" stroke="#FF8888" stroke-width="24"/>
|
||||
<path d="M25 0L24.9137 72.671C24.8492 126.998 68.9913 171.011 123.318 170.786L166.14 170.61" stroke="#FF8888" stroke-width="24"/>
|
||||
<circle cx="163" cy="163" r="68.5" fill="white" stroke="#2775D1" stroke-width="13"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_407_2">
|
||||
<rect width="325" height="325" rx="73" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
<g clip-path="url(#clip0_407_2)">
|
||||
<rect width="325" height="325" rx="73" fill="#D3EFFF"/>
|
||||
<rect x="150" width="26" height="325" fill="#4898F7"/>
|
||||
<path d="M300 0L300.086 72.671C300.151 126.998 256.009 171.011 201.682 170.786L158.86 170.61" stroke="#FF8888"
|
||||
stroke-width="24"/>
|
||||
<path d="M25 0L24.9137 72.671C24.8492 126.998 68.9913 171.011 123.318 170.786L166.14 170.61" stroke="#FF8888"
|
||||
stroke-width="24"/>
|
||||
<circle cx="163" cy="163" r="68.5" fill="white" stroke="#2775D1" stroke-width="13"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_407_2">
|
||||
<rect width="325" height="325" rx="73" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 824 B |
Loading…
Reference in New Issue
Block a user