From 571b804c57156389402f527c7f091f3038577581 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Mon, 15 Aug 2011 04:47:48 +0200 Subject: [PATCH] Display Current Time --- Medianno/MADocWindow.h | 2 + Medianno/MADocWindow.mm | 16 ++++ Medianno/MAShortenQTTime.mm | 3 +- Medianno/en.lproj/MADocument.xib | 157 +++++++++++++++++++++++-------- 4 files changed, 137 insertions(+), 41 deletions(-) diff --git a/Medianno/MADocWindow.h b/Medianno/MADocWindow.h index 739dbff..6e5a5f9 100644 --- a/Medianno/MADocWindow.h +++ b/Medianno/MADocWindow.h @@ -16,6 +16,7 @@ IBOutlet NSTableView * mediaTable; IBOutlet NSTableView * annotationTable; IBOutlet NSTableColumn * tokenColumn; + QTTime lastMovieTime; } - (IBAction)addMediaFiles:(id)sender; @@ -25,6 +26,7 @@ - (IBAction)mediaSkipBackward:(id)sender; - (IBAction)mediaSkipForward:(id)sender; - (IBAction)toggleMediaPlay:(id)sender; +- (QTTime)currentMovieTime; @end diff --git a/Medianno/MADocWindow.mm b/Medianno/MADocWindow.mm index 1dcac87..de3d7a9 100644 --- a/Medianno/MADocWindow.mm +++ b/Medianno/MADocWindow.mm @@ -34,6 +34,7 @@ [tokenCell setFont:[tokenCellProto font]]; [tokenCell setTokenizingCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@";"]]; [tokenColumn setDataCell:tokenCell]; + [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(updateMovieTime:) userInfo:nil repeats:YES]; } #pragma mark Media management @@ -43,6 +44,21 @@ return [movieView movie]; } +- (QTTime)currentMovieTime +{ + return [[movieView movie] currentTime]; +} + +- (void)updateMovieTime:(NSTimer *)timer +{ + QTTime currentTime = [self currentMovieTime]; + if (QTTimeCompare(currentTime, lastMovieTime)) { + [self willChangeValueForKey:@"currentMovieTime"]; + lastMovieTime = currentTime; + [self didChangeValueForKey:@"currentMovieTime"]; + } +} + - (IBAction)addMediaFiles:(id)sender { NSOpenPanel * openPanel = [NSOpenPanel openPanel]; diff --git a/Medianno/MAShortenQTTime.mm b/Medianno/MAShortenQTTime.mm index 6349626..51ab073 100644 --- a/Medianno/MAShortenQTTime.mm +++ b/Medianno/MAShortenQTTime.mm @@ -7,6 +7,7 @@ // #import "MAShortenQTTime.h" +#import @implementation MAShortenQTTime @@ -21,7 +22,7 @@ } - (id)transformedValue:(id)value { - NSString * fullTime = value; + NSString * fullTime = [value isKindOfClass:[NSString class]] ? value : QTStringFromTime([value QTTimeValue]); NSRange rangeToUse = {0,0}; // // Trim leading zeros, up to a point diff --git a/Medianno/en.lproj/MADocument.xib b/Medianno/en.lproj/MADocument.xib index 79a1f8d..096a9fe 100644 --- a/Medianno/en.lproj/MADocument.xib +++ b/Medianno/en.lproj/MADocument.xib @@ -21,24 +21,26 @@ YES - NSObjectController - NSScroller - NSSplitView + NSButton + NSCustomObject NSArrayController - NSTableHeaderView - NSScrollView - QTMovieView - NSTextFieldCell - NSBox + NSSplitView NSDateFormatter NSTableView - NSTokenField - NSTokenFieldCell - NSCustomObject - NSView NSWindowTemplate - NSUserDefaultsController + NSTextFieldCell + NSButtonCell NSTableColumn + NSBox + NSView + NSObjectController + NSScrollView + QTMovieView + NSTokenFieldCell + NSUserDefaultsController + NSScroller + NSTableHeaderView + NSTokenField YES @@ -408,7 +410,7 @@ QTMoviePasteboardType - {{0, 581}, {1281, 16}} + {{103, 583}, {1178, 18}} @@ -432,7 +434,7 @@ 256 - {1279, 564} + {1278, 565} @@ -441,7 +443,7 @@ 256 - {1279, 17} + {1278, 17} @@ -486,7 +488,7 @@ tags - 550 + 549 200 2000 @@ -543,7 +545,7 @@ 19 - -2064384 + -71270400 1 @@ -555,7 +557,7 @@ 1 - {{1, 17}, {1279, 564}} + {{1, 17}, {1278, 565}} @@ -596,7 +598,7 @@ YES - {{1, 0}, {1279, 17}} + {{1, 0}, {1278, 17}} @@ -605,7 +607,7 @@ 4 - {{0, -1}, {1281, 582}} + {1280, 583} @@ -617,11 +619,35 @@ QSAAAEEgAABBqAAAQagAAA + + + 268 + {{0, 582}, {103, 18}} + + + + _NS:161 + YES + + 67239424 + 67108864 + Button + + _NS:161 + + -2038284033 + 162 + + + 200 + 25 + + {1281, 599} - + _NS:11 @@ -662,7 +688,7 @@ - {{0, 0}, {2560, 1418}} + {{0, 0}, {1440, 878}} {450, 422} {10000000000000, 10000000000000} 128 @@ -952,22 +978,6 @@ 100160 - - - value: arrangedObjects.tagDescriptions - - - - - - value: arrangedObjects.tagDescriptions - value - arrangedObjects.tagDescriptions - 2 - - - 100172 - tokenFieldProto @@ -1087,6 +1097,54 @@ 100183 + + + value: arrangedObjects.tagDescriptions + + + + + + value: arrangedObjects.tagDescriptions + value + arrangedObjects.tagDescriptions + + NSCreatesSortDescriptor + + + 2 + + + 100192 + + + + addAnnotation: + + + + 100200 + + + + title: currentMovieTime + + + + + + title: currentMovieTime + title + currentMovieTime + + NSValueTransformerName + MAShortenQTTime + + 2 + + + 100201 + @@ -1174,6 +1232,7 @@ YES + @@ -1369,6 +1428,20 @@ + + 100197 + + + YES + + + + + + 100198 + + + @@ -1413,6 +1486,8 @@ 100148.IBPluginDependency 100161.IBPluginDependency 100162.IBPluginDependency + 100197.IBPluginDependency + 100198.IBPluginDependency 5.IBNSWindowAutoPositionCentersHorizontal 5.IBNSWindowAutoPositionCentersVertical 5.IBPluginDependency @@ -1459,6 +1534,8 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1478,7 +1555,7 @@ - 100183 + 100201