-
Notifications
You must be signed in to change notification settings - Fork 4
Data Model
To put it bluntly, there really isn't one. Data obtained from the Transmission daemon is stored directly inside TMainForm.gTorrents: TVarGrid
and TMainForm.FTorrents: TVarList
. If a column is deselected, its accompanying column in TMainForm.gTorrents.Items
is an empty variant. I moved the definitions of the column indices into torrentcolumns.pas
and renamed them so perhaps they're a bit easier to recognise.
The main function that processes the data fetched via RPC is TMainForm.FillTorrentsList
(all calls of this function come from rpc.pas
). The function operates on a parsed JSON object that comes straight from Transmission. Said processing includes :
- working out what's changed between this and the previous call,
- filtering shown torrents according to currently selected groups,
- counting torrents that belong to each of the available groups if tracker/label/path grouping is enabled,
- smoothing out the transfer rates (if enabled), as every torrent has a dedicated object keeping history of its download/upload rates for this,
- formatting the data for display where applicable - assigning icons to states, converting fractions to percentages, etc.
Since the RPC object and FillTorrentsList
don't really know about each other and there's no object in between, checks for either the RPC version or a field's existence are needed.