summaryrefslogtreecommitdiffstats
path: root/macosx/HBChapter.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2017-12-11 14:58:15 +0100
committerDamiano Galassi <[email protected]>2017-12-11 14:58:15 +0100
commitd55ae8e31f578e6ba254608e198c5931beba4084 (patch)
tree6329c4f913940860a463cb8fd56ac0f13b0b7a1d /macosx/HBChapter.m
parent05f181970d9c68c76ad9a686fee6f284412b5eb6 (diff)
MacGui: add a "Start" column in the chapters tableview.
Diffstat (limited to 'macosx/HBChapter.m')
-rw-r--r--macosx/HBChapter.m20
1 files changed, 10 insertions, 10 deletions
diff --git a/macosx/HBChapter.m b/macosx/HBChapter.m
index d33ec9427..807309e13 100644
--- a/macosx/HBChapter.m
+++ b/macosx/HBChapter.m
@@ -11,22 +11,19 @@
- (instancetype)init
{
- self = [self initWithTitle:@"No Value" index:0 duration:0];
+ self = [self initWithTitle:@"No Value" index:0 timestamp:0 duration:0];
return self;
}
-- (instancetype)initWithTitle:(NSString *)title index:(NSUInteger)idx duration:(uint64_t)duration
+- (instancetype)initWithTitle:(NSString *)title index:(NSUInteger)idx timestamp:(uint64_t)timestamp duration:(uint64_t)duration
{
NSParameterAssert(title);
self = [super init];
if (self)
{
- uint64_t hours = duration / 90000 / 3600;
- uint64_t minutes = ((duration / 90000 ) % 3600) / 60;
- uint64_t seconds = (duration / 90000 ) % 60;
-
- _duration = [NSString stringWithFormat:@"%02llu:%02llu:%02llu", hours, minutes, seconds];
+ _timestamp = timestamp;
+ _duration = duration;
_title = [title copy];
_index = idx;
@@ -54,7 +51,8 @@
if (copy)
{
copy->_title = [_title copy];
- copy->_duration = [_duration copy];
+ copy->_timestamp = _timestamp;
+ copy->_duration = _duration;
copy->_index = _index;
}
@@ -74,7 +72,8 @@
[coder encodeInt:1 forKey:@"HBChapterVersion"];
encodeObject(_title);
- encodeObject(_duration);
+ encodeInteger(_timestamp);
+ encodeInteger(_duration);
encodeInteger(_index);
}
@@ -85,7 +84,8 @@
if (version == 1 && (self = [self init]))
{
decodeObjectOrFail(_title, NSString);
- decodeObjectOrFail(_duration, NSString);
+ decodeInteger(_timestamp);
+ decodeInteger(_duration);
decodeInteger(_index);
return self;