sequential download support

pull/53/head
Zlatin Balevsky 2020-11-02 10:22:36 +00:00
parent 3518db63cc
commit 3550fa43c9
No known key found for this signature in database
GPG Key ID: A72832072D525E41
3 changed files with 32 additions and 4 deletions

View File

@ -37,7 +37,8 @@ class CollectionTabController {
items : collection.getFiles(), items : collection.getFiles(),
host : model.host, host : model.host,
infoHash : collection.getInfoHash(), infoHash : collection.getInfoHash(),
full : true full : true,
sequential : view.isSequentialCollection()
) )
model.eventBus.publish(e) model.eventBus.publish(e)
@ -59,7 +60,8 @@ class CollectionTabController {
items : new HashSet<>(items), items : new HashSet<>(items),
host : model.host, host : model.host,
infoHash : collection.getInfoHash(), infoHash : collection.getInfoHash(),
full : false full : false,
sequential : view.isSequentialItem()
) )
model.eventBus.publish(e) model.eventBus.publish(e)

View File

@ -46,6 +46,8 @@ class CollectionTabModel {
@Observable boolean viewCommentButtonEnabled @Observable boolean viewCommentButtonEnabled
@Observable boolean downloadItemButtonEnabled @Observable boolean downloadItemButtonEnabled
@Observable boolean downloadCollectionButtonEnabled @Observable boolean downloadCollectionButtonEnabled
@Observable boolean downloadSequentiallyCollection
@Observable boolean downloadSequentiallyItem
void mvcGroupInit(Map<String,String> args) { void mvcGroupInit(Map<String,String> args) {
root = new DefaultMutableTreeNode() root = new DefaultMutableTreeNode()

View File

@ -5,6 +5,7 @@ import griffon.core.artifact.GriffonView
import griffon.inject.MVCMember import griffon.inject.MVCMember
import griffon.metadata.ArtifactProviderFor import griffon.metadata.ArtifactProviderFor
import javax.swing.JCheckBox
import javax.swing.JLabel import javax.swing.JLabel
import javax.swing.JTable import javax.swing.JTable
import javax.swing.JTextArea import javax.swing.JTextArea
@ -38,6 +39,8 @@ class CollectionTabView {
JTable itemsTable JTable itemsTable
def lastItemsTableSortEvent def lastItemsTableSortEvent
JTree itemsTree JTree itemsTree
JCheckBox downloadSequentiallyCollectionCheckbox
JCheckBox downloadSequentiallyItemCheckbox
void initUI() { void initUI() {
int rowHeight = application.context.get("row-height") int rowHeight = application.context.get("row-height")
@ -62,7 +65,16 @@ class CollectionTabView {
} }
} }
panel(constraints : BorderLayout.SOUTH) { panel(constraints : BorderLayout.SOUTH) {
button(text : trans("COLLECTION_DOWNLOAD"), enabled : bind{model.downloadCollectionButtonEnabled}, downloadCollectionAction) gridLayout(rows : 1, cols : 3)
panel{}
panel {
button(text : trans("COLLECTION_DOWNLOAD"), enabled : bind{model.downloadCollectionButtonEnabled}, downloadCollectionAction)
}
panel {
label(text : trans("DOWNLOAD_SEQUENTIALLY"))
downloadSequentiallyCollectionCheckbox = checkBox(selected : bind {model.downloadSequentiallyCollection},
enabled : bind {model.downloadCollectionButtonEnabled})
}
} }
} }
panel { panel {
@ -114,12 +126,24 @@ class CollectionTabView {
button(text : trans("DOWNLOAD"), enabled : bind {model.downloadItemButtonEnabled}, downloadAction) button(text : trans("DOWNLOAD"), enabled : bind {model.downloadItemButtonEnabled}, downloadAction)
button(text : trans("VIEW_COMMENT"), enabled : bind{model.viewCommentButtonEnabled}, viewCommentAction) button(text : trans("VIEW_COMMENT"), enabled : bind{model.viewCommentButtonEnabled}, viewCommentAction)
} }
panel {} panel {
label(text : trans("DOWNLOAD_SEQUENTIALLY"))
downloadSequentiallyItemCheckbox = checkBox(selected : bind {model.downloadSequentiallyItem},
enabled : bind {model.downloadItemButtonEnabled})
}
} }
} }
} }
} }
boolean isSequentialCollection() {
downloadSequentiallyCollectionCheckbox.model.isSelected()
}
boolean isSequentialItem() {
downloadSequentiallyItemCheckbox.model.isSelected()
}
void mvcGroupInit(Map<String, String> args) { void mvcGroupInit(Map<String, String> args) {
def mainFrameGroup = application.mvcGroupManager.findGroup("MainFrame") def mainFrameGroup = application.mvcGroupManager.findGroup("MainFrame")
mainFrameGroup.model.collections.add(model.uuid.toString()) mainFrameGroup.model.collections.add(model.uuid.toString())