add pause/resume in header actions

This commit is contained in:
AmirHossein Abdolmotallebi 2024-10-10 11:10:00 +03:30
parent 7fb4c7f766
commit fc218b3322
2 changed files with 14 additions and 12 deletions

View File

@ -4,7 +4,6 @@ import com.abdownloadmanager.desktop.AppComponent
import com.abdownloadmanager.desktop.SharedConstants
import com.abdownloadmanager.desktop.di.Di
import com.abdownloadmanager.desktop.ui.icon.MyIcons
import com.abdownloadmanager.desktop.ui.widget.menu.SubMenu
import com.abdownloadmanager.desktop.utils.AppInfo
import com.abdownloadmanager.desktop.utils.ClipboardUtil
import ir.amirab.util.compose.action.AnAction
@ -87,7 +86,7 @@ val startQueueGroupAction = MenuItem.SubMenu(
}
val stopAction = simpleAction("Stop All", MyIcons.stop) {
val stopAllAction = simpleAction("Stop All", MyIcons.stop) {
scope.launch {
downloadSystem.stopAnything()
}

View File

@ -332,7 +332,7 @@ class HomeComponent(
+startQueueGroupAction
+stopQueueGroupAction
separator()
+stopAction
+stopAllAction
separator()
subMenu(
title = "Remove",
@ -370,15 +370,6 @@ class HomeComponent(
}.filterIsInstance<MenuItem.SubMenu>()
val headerActions = buildMenu {
separator()
+startQueueGroupAction
+stopQueueGroupAction
+stopAction
separator()
+openQueuesAction
+gotoSettingsAction
}
private val shouldShowOptions = MutableStateFlow(false)
val downloadOptions = combineStateFlows(
@ -663,6 +654,18 @@ class HomeComponent(
"DELETE" to downloadActions.deleteAction
"ctrl I" to downloadActions.openDownloadDialogAction
}
val headerActions = buildMenu {
separator()
+downloadActions.resumeAction
+downloadActions.pauseAction
separator()
+startQueueGroupAction
+stopQueueGroupAction
+stopAllAction
separator()
+openQueuesAction
+gotoSettingsAction
}
companion object {
val CATEGORIES_SIZE_RANGE = 0.dp..500.dp