~ubuntu-branches/ubuntu/utopic/indicator-transfer/utopic

« back to all changes in this revision

Viewing changes to include/transfer/transfer.h

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Charles Kerr
  • Date: 2014-07-07 22:22:32 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140707222232-ekghznemguwd1wbs
Tags: 0.1+14.10.20140707-0ubuntu1
[ Charles Kerr ]
Create per-transfer actions for simpler state lookup by renderers.
Previously this was done as a single action that contained a map of
unique transfer ids to states.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
namespace transfer {
35
35
 
36
36
/**
37
 
 * \brief Plain Old Data Structure representing a single Transfer
 
37
 * \brief A simple struct representing a single Transfer
38
38
 */
39
39
struct Transfer
40
40
{
42
42
                 HASHING, PROCESSING, FINISHED,
43
43
                 ERROR } State;
44
44
  State state = QUEUED;
45
 
  bool can_start() const { return state==QUEUED; }
46
 
  bool can_resume() const { return state==PAUSED || state==CANCELED || state==ERROR; }
47
 
  bool can_pause() const { return state==RUNNING || state==HASHING || state==PROCESSING; }
48
 
  bool can_cancel() const { return state!=FINISHED; }
49
 
  bool can_clear() const { return state==FINISHED; }
 
45
  bool can_start() const;
 
46
  bool can_resume() const;
 
47
  bool can_pause() const;
 
48
  bool can_cancel() const;
 
49
  bool can_clear() const;
50
50
 
51
51
  // -1 == unknown
52
52
  int seconds_left = -1;
70
70
 
71
71
  // meaningful iff state is FINISHED
72
72
  std::string local_path;
 
73
 
 
74
protected:
 
75
  static std::string next_unique_id();
73
76
};
74
77
    
75
78
} // namespace transfer