2
* Copyright 2014 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Charles Kerr <charles.kerr@canonical.com>
20
#ifndef INDICATOR_TRANSFER_TRANSFER_H
21
#define INDICATOR_TRANSFER_TRANSFER_H
23
#include <core/property.h> // parent class
25
#include <gio/gio.h> // GIcon
27
#include <ctime> // time_t
37
* \brief Plain Old Data Structure representing a single Transfer
41
typedef enum { QUEUED, RUNNING, PAUSED, CANCELED,
42
HASHING, PROCESSING, FINISHED,
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; }
52
int seconds_left = -1;
54
time_t time_started = 0;
59
uint64_t speed_bps = 0;
61
uint64_t total_size = 0;
63
typedef std::string Id;
68
// meaningful iff state is ERROR
69
std::string error_string;
71
// meaningful iff state is FINISHED
72
std::string local_path;
75
} // namespace transfer
76
} // namespace indicator
79
#endif // INDICATOR_TRANSFER_TRANSFER_H