Skip to content

Commit

Permalink
Disable Category Path Auto-Fill if Automatic Torrent Management is En…
Browse files Browse the repository at this point in the history
…abled

#29
  • Loading branch information
Michael-128 committed Sep 14, 2024
1 parent dda2d98 commit b372958
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qBitControl/TorrentView/TorrentAddView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct TorrentAddView: View {
Text(category.name).tag(category.name)
}
}.onChange(of: viewModel.category) { category in
viewModel.savePath = category.savePath
if !viewModel.autoTmmEnabled { viewModel.savePath = category.savePath }
}

Picker("Tags", selection: $viewModel.tags) {
Expand Down
9 changes: 7 additions & 2 deletions qBitControl/TorrentView/TorrentAddViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TorrentAddViewModel: ObservableObject {

@Published var savePath = ""
@Published var defaultSavePath = ""
@Published var autoTmmEnabled = false

@Published var cookie = ""
@Published var category: Category = defaultCategory
Expand Down Expand Up @@ -112,8 +113,12 @@ class TorrentAddViewModel: ObservableObject {
func getSavePath() {
qBittorrent.getPreferences(completionHandler: { preferences in
DispatchQueue.main.async {
self.savePath = preferences.save_path ?? ""
self.defaultSavePath = preferences.save_path ?? ""
self.autoTmmEnabled = preferences.auto_tmm_enabled ?? false

if !self.autoTmmEnabled {
self.savePath = preferences.save_path ?? ""
self.defaultSavePath = preferences.save_path ?? ""
}
}
})
}
Expand Down

0 comments on commit b372958

Please sign in to comment.