Display Current Time

This commit is contained in:
Matthias Neeracher 2011-08-15 04:47:48 +02:00
parent 93c55ad866
commit 571b804c57
4 changed files with 137 additions and 41 deletions

View File

@ -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

View File

@ -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];

View File

@ -7,6 +7,7 @@
//
#import "MAShortenQTTime.h"
#import <QTKit/QTKit.h>
@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

View File

@ -21,24 +21,26 @@
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSObjectController</string>
<string>NSScroller</string>
<string>NSSplitView</string>
<string>NSButton</string>
<string>NSCustomObject</string>
<string>NSArrayController</string>
<string>NSTableHeaderView</string>
<string>NSScrollView</string>
<string>QTMovieView</string>
<string>NSTextFieldCell</string>
<string>NSBox</string>
<string>NSSplitView</string>
<string>NSDateFormatter</string>
<string>NSTableView</string>
<string>NSTokenField</string>
<string>NSTokenFieldCell</string>
<string>NSCustomObject</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
<string>NSUserDefaultsController</string>
<string>NSTextFieldCell</string>
<string>NSButtonCell</string>
<string>NSTableColumn</string>
<string>NSBox</string>
<string>NSView</string>
<string>NSObjectController</string>
<string>NSScrollView</string>
<string>QTMovieView</string>
<string>NSTokenFieldCell</string>
<string>NSUserDefaultsController</string>
<string>NSScroller</string>
<string>NSTableHeaderView</string>
<string>NSTokenField</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -408,7 +410,7 @@
<string>QTMoviePasteboardType</string>
</object>
</object>
<string key="NSFrame">{{0, 581}, {1281, 16}}</string>
<string key="NSFrame">{{103, 583}, {1178, 18}}</string>
<reference key="NSSuperview" ref="1058980817"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1054473103"/>
@ -432,7 +434,7 @@
<object class="NSTableView" id="620291245">
<reference key="NSNextResponder" ref="51131752"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 564}</string>
<string key="NSFrameSize">{1278, 565}</string>
<reference key="NSSuperview" ref="51131752"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="715872882"/>
@ -441,7 +443,7 @@
<object class="NSTableHeaderView" key="NSHeaderView" id="995480265">
<reference key="NSNextResponder" ref="794153134"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 17}</string>
<string key="NSFrameSize">{1278, 17}</string>
<reference key="NSSuperview" ref="794153134"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="51131752"/>
@ -486,7 +488,7 @@
</object>
<object class="NSTableColumn" id="995592652">
<string key="NSIdentifier">tags</string>
<double key="NSWidth">550</double>
<double key="NSWidth">549</double>
<double key="NSMinWidth">200</double>
<double key="NSMaxWidth">2000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell">
@ -543,7 +545,7 @@
<reference key="NSBackgroundColor" ref="436396164"/>
<reference key="NSGridColor" ref="837522117"/>
<double key="NSRowHeight">19</double>
<int key="NSTvFlags">-2064384</int>
<int key="NSTvFlags">-71270400</int>
<reference key="NSDelegate"/>
<reference key="NSDataSource"/>
<int key="NSGridStyleMask">1</int>
@ -555,7 +557,7 @@
<int key="NSTableViewGroupRowStyle">1</int>
</object>
</object>
<string key="NSFrame">{{1, 17}, {1279, 564}}</string>
<string key="NSFrame">{{1, 17}, {1278, 565}}</string>
<reference key="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="620291245"/>
@ -596,7 +598,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="995480265"/>
</object>
<string key="NSFrame">{{1, 0}, {1279, 17}}</string>
<string key="NSFrame">{{1, 0}, {1278, 17}}</string>
<reference key="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="995480265"/>
@ -605,7 +607,7 @@
<int key="NScvFlags">4</int>
</object>
</object>
<string key="NSFrame">{{0, -1}, {1281, 582}}</string>
<string key="NSFrameSize">{1280, 583}</string>
<reference key="NSSuperview" ref="1058980817"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="794153134"/>
@ -617,11 +619,35 @@
<reference key="NSHeaderClipView" ref="794153134"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBqAAAQagAAA</bytes>
</object>
<object class="NSButton" id="777053201">
<reference key="NSNextResponder" ref="1058980817"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 582}, {103, 18}}</string>
<reference key="NSSuperview" ref="1058980817"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="56699403"/>
<string key="NSReuseIdentifierKey">_NS:161</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="9812246">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">67108864</int>
<string key="NSContents">Button</string>
<reference key="NSSupport" ref="23905036"/>
<string key="NSCellIdentifier">_NS:161</string>
<reference key="NSControlView" ref="777053201"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags2">162</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
</object>
<string key="NSFrameSize">{1281, 599}</string>
<reference key="NSSuperview" ref="475349496"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="56699403"/>
<reference key="NSNextKeyView" ref="777053201"/>
<string key="NSReuseIdentifierKey">_NS:11</string>
</object>
</object>
@ -662,7 +688,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="196617426"/>
</object>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSScreenRect">{{0, 0}, {1440, 878}}</string>
<string key="NSMinSize">{450, 422}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<int key="NSWindowCollectionBehavior">128</int>
@ -952,22 +978,6 @@
</object>
<int key="connectionID">100160</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: arrangedObjects.tagDescriptions</string>
<reference key="source" ref="995592652"/>
<reference key="destination" ref="603895450"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="995592652"/>
<reference key="NSDestination" ref="603895450"/>
<string key="NSLabel">value: arrangedObjects.tagDescriptions</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">arrangedObjects.tagDescriptions</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">100172</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">tokenFieldProto</string>
@ -1087,6 +1097,54 @@
</object>
<int key="connectionID">100183</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: arrangedObjects.tagDescriptions</string>
<reference key="source" ref="995592652"/>
<reference key="destination" ref="603895450"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="995592652"/>
<reference key="NSDestination" ref="603895450"/>
<string key="NSLabel">value: arrangedObjects.tagDescriptions</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">arrangedObjects.tagDescriptions</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSCreatesSortDescriptor</string>
<boolean value="NO" key="NS.object.0"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">100192</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">addAnnotation:</string>
<reference key="source" ref="512844837"/>
<reference key="destination" ref="777053201"/>
</object>
<int key="connectionID">100200</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">title: currentMovieTime</string>
<reference key="source" ref="777053201"/>
<reference key="destination" ref="512844837"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="777053201"/>
<reference key="NSDestination" ref="512844837"/>
<string key="NSLabel">title: currentMovieTime</string>
<string key="NSBinding">title</string>
<string key="NSKeyPath">currentMovieTime</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSValueTransformerName</string>
<string key="NS.object.0">MAShortenQTTime</string>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">100201</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -1174,6 +1232,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1054473103"/>
<reference ref="56699403"/>
<reference ref="777053201"/>
</object>
<reference key="parent" ref="196617426"/>
</object>
@ -1369,6 +1428,20 @@
<reference key="object" ref="194508126"/>
<reference key="parent" ref="398992771"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100197</int>
<reference key="object" ref="777053201"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="9812246"/>
</object>
<reference key="parent" ref="475349496"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100198</int>
<reference key="object" ref="9812246"/>
<reference key="parent" ref="777053201"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@ -1413,6 +1486,8 @@
<string>100148.IBPluginDependency</string>
<string>100161.IBPluginDependency</string>
<string>100162.IBPluginDependency</string>
<string>100197.IBPluginDependency</string>
<string>100198.IBPluginDependency</string>
<string>5.IBNSWindowAutoPositionCentersHorizontal</string>
<string>5.IBNSWindowAutoPositionCentersVertical</string>
<string>5.IBPluginDependency</string>
@ -1459,6 +1534,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -1478,7 +1555,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">100183</int>
<int key="maxID">100201</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">