@@ -44,6 +44,8 @@ interface AddCommonProps extends React.PropsWithChildren {
4444 setLabels : React . Dispatch < string [ ] > ,
4545 start : boolean ,
4646 setStart : ( b : boolean ) => void ,
47+ sequential : boolean ,
48+ setSequential : ( b : boolean ) => void ,
4749 priority : PriorityNumberType ,
4850 setPriority : ( p : PriorityNumberType ) => void ,
4951 disabled ?: boolean ,
@@ -64,6 +66,14 @@ function AddCommon(props: AddCommonProps) {
6466 onChange = { ( e ) => { props . setStart ( e . currentTarget . checked ) ; } }
6567 my = "xl"
6668 styles = { { root : { flexGrow : 1 } } } />
69+ { rpcVersion >= 18 &&
70+ < Checkbox
71+ label = "Sequential download"
72+ checked = { props . sequential }
73+ disabled = { props . disabled }
74+ onChange = { ( e ) => { props . setSequential ( e . currentTarget . checked ) ; } }
75+ my = "xl"
76+ styles = { { root : { flexGrow : 1 } } } /> }
6777 { props . children }
6878 < SegmentedControl
6979 color = { PriorityColors . get ( props . priority ) }
@@ -89,6 +99,7 @@ function useCommonProps(opened: boolean) {
8999 const location = useTorrentLocation ( ) ;
90100 const [ labels , setLabels ] = useState < string [ ] > ( [ ] ) ;
91101 const [ start , setStart ] = useState < boolean > ( true ) ;
102+ const [ sequential , setSequential ] = useState < boolean > ( false ) ;
92103 const [ priority , setPriority ] = useState < PriorityNumberType > ( 0 ) ;
93104
94105 useEffect ( ( ) => {
@@ -104,6 +115,7 @@ function useCommonProps(opened: boolean) {
104115 setPriority ( ( AddTorrentPriorityOptions . indexOf (
105116 config . values . interface . addTorrentPriority ) - 1 ) as PriorityNumberType ) ;
106117 }
118+ setSequential ( config . values . interface . addTorrentSequential ) ;
107119 }
108120 } , [ config , opened ] ) ;
109121
@@ -114,20 +126,20 @@ function useCommonProps(opened: boolean) {
114126 setLabels,
115127 start,
116128 setStart,
129+ sequential,
130+ setSequential,
117131 priority,
118132 setPriority,
119- } ) , [ opened , location , labels , start , priority ] ) ;
133+ } ) , [ opened , location , labels , start , sequential , priority ] ) ;
120134
121135 return useMemo ( ( ) => ( {
122- location,
123- start,
124- priority,
125136 props,
126137 onAdd : ( ) => {
127138 config . values . interface . addTorrentStartSelection = start ;
128139 config . values . interface . addTorrentPrioritySelection = priority ;
140+ config . values . interface . addTorrentSequential = sequential ;
129141 } ,
130- } ) , [ config , location , priority , props , start ] ) ;
142+ } ) , [ config , props , start , priority , sequential ] ) ;
131143}
132144
133145function TabSwitchDropdown ( { tabsRef } : { tabsRef : React . RefObject < ServerTabsRef > } ) {
@@ -233,13 +245,14 @@ export function AddMagnet(props: AddCommonModalProps) {
233245 addMutation . mutate (
234246 {
235247 url : magnet ,
236- downloadDir : common . location . path ,
248+ downloadDir : common . props . location . path ,
237249 labels : common . props . labels ,
238- paused : ! common . start ,
239- bandwidthPriority : common . priority ,
250+ paused : ! common . props . start ,
251+ sequential_download : common . props . sequential ,
252+ bandwidthPriority : common . props . priority ,
240253 } ,
241254 ) ;
242- common . location . addPath ( common . location . path ) ;
255+ common . props . location . addPath ( common . props . location . path ) ;
243256 } else {
244257 mutateAddTrackers (
245258 { torrentId : existingTorrent . id , trackers : magnetData ?. trackers ?? [ ] } ,
@@ -549,17 +562,18 @@ export function AddTorrent(props: AddCommonModalProps) {
549562 return await addMutation . mutateAsync (
550563 {
551564 metainfo : td . metadata ,
552- downloadDir : common . location . path ,
565+ downloadDir : common . props . location . path ,
553566 labels : common . props . labels ,
554- paused : ! common . start ,
555- bandwidthPriority : common . priority ,
567+ paused : ! common . props . start ,
568+ sequential_download : common . props . sequential ,
569+ bandwidthPriority : common . props . priority ,
556570 unwanted : ( td . files == null || torrentData . length > 1 ) ? undefined : fileTree . getUnwanted ( ) ,
557571 filePath : td . torrentPath ,
558572 } ,
559573 ) ;
560574 } ) ) ;
561575
562- common . location . addPath ( common . location . path ) ;
576+ common . props . location . addPath ( common . props . location . path ) ;
563577 } else {
564578 mutateAddTrackers (
565579 { torrentId : existingTorrent . id , trackers : torrentData [ 0 ] . trackers } ,
0 commit comments