struct TorrentState
{
+
+ enum torrent_action
+ {
+ action_add,
+ action_remove,
+ action_update
+ };
+
TorrentState()
: hash("")
, name("")
, leeches(0)
, ratio(0)
, total_size(0)
- { }
+ { }
QString hash;
QString name;
- bool is_new;
+ torrent_action action;
uint state;
uint progress;
uint down_rate;
{
std::cout << "serialize" << std::endl;
argument.beginStructure();
- argument << state.hash << state.name << state.is_new << state.state << state.progress
+ argument << state.hash << state.name << (uint)(state.action) << state.state << state.progress
<< state.down_rate << state.up_rate << state.seeds
<< state.leeches << state.ratio << state.total_size;
argument.endStructure();
{
std::cout << "deserialize" << std::endl;
argument.beginStructure();
- argument >> state.hash >> state.name >> state.is_new >> state.state >> state.progress
+ uint action;
+ argument >> state.hash >> state.name >> action >> state.state >> state.progress
>> state.down_rate >> state.up_rate >> state.seeds
>> state.leeches >> state.ratio >> state.total_size;
+ state.action = (TorrentState::torrent_action)action;
argument.endStructure();
return argument;
}