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 * mediaTable;
IBOutlet NSTableView * annotationTable; IBOutlet NSTableView * annotationTable;
IBOutlet NSTableColumn * tokenColumn; IBOutlet NSTableColumn * tokenColumn;
QTTime lastMovieTime;
} }
- (IBAction)addMediaFiles:(id)sender; - (IBAction)addMediaFiles:(id)sender;
@ -25,6 +26,7 @@
- (IBAction)mediaSkipBackward:(id)sender; - (IBAction)mediaSkipBackward:(id)sender;
- (IBAction)mediaSkipForward:(id)sender; - (IBAction)mediaSkipForward:(id)sender;
- (IBAction)toggleMediaPlay:(id)sender; - (IBAction)toggleMediaPlay:(id)sender;
- (QTTime)currentMovieTime;
@end @end

View File

@ -34,6 +34,7 @@
[tokenCell setFont:[tokenCellProto font]]; [tokenCell setFont:[tokenCellProto font]];
[tokenCell setTokenizingCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@";"]]; [tokenCell setTokenizingCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@";"]];
[tokenColumn setDataCell:tokenCell]; [tokenColumn setDataCell:tokenCell];
[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(updateMovieTime:) userInfo:nil repeats:YES];
} }
#pragma mark Media management #pragma mark Media management
@ -43,6 +44,21 @@
return [movieView movie]; 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 - (IBAction)addMediaFiles:(id)sender
{ {
NSOpenPanel * openPanel = [NSOpenPanel openPanel]; NSOpenPanel * openPanel = [NSOpenPanel openPanel];

View File

@ -7,6 +7,7 @@
// //
#import "MAShortenQTTime.h" #import "MAShortenQTTime.h"
#import <QTKit/QTKit.h>
@implementation MAShortenQTTime @implementation MAShortenQTTime
@ -21,7 +22,7 @@
} }
- (id)transformedValue:(id)value { - (id)transformedValue:(id)value {
NSString * fullTime = value; NSString * fullTime = [value isKindOfClass:[NSString class]] ? value : QTStringFromTime([value QTTimeValue]);
NSRange rangeToUse = {0,0}; NSRange rangeToUse = {0,0};
// //
// Trim leading zeros, up to a point // Trim leading zeros, up to a point

View File

@ -21,24 +21,26 @@
</object> </object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies"> <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<string>NSObjectController</string> <string>NSButton</string>
<string>NSScroller</string> <string>NSCustomObject</string>
<string>NSSplitView</string>
<string>NSArrayController</string> <string>NSArrayController</string>
<string>NSTableHeaderView</string> <string>NSSplitView</string>
<string>NSScrollView</string>
<string>QTMovieView</string>
<string>NSTextFieldCell</string>
<string>NSBox</string>
<string>NSDateFormatter</string> <string>NSDateFormatter</string>
<string>NSTableView</string> <string>NSTableView</string>
<string>NSTokenField</string>
<string>NSTokenFieldCell</string>
<string>NSCustomObject</string>
<string>NSView</string>
<string>NSWindowTemplate</string> <string>NSWindowTemplate</string>
<string>NSUserDefaultsController</string> <string>NSTextFieldCell</string>
<string>NSButtonCell</string>
<string>NSTableColumn</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>
<object class="NSArray" key="IBDocument.PluginDependencies"> <object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
@ -408,7 +410,7 @@
<string>QTMoviePasteboardType</string> <string>QTMoviePasteboardType</string>
</object> </object>
</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="NSSuperview" ref="1058980817"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1054473103"/> <reference key="NSNextKeyView" ref="1054473103"/>
@ -432,7 +434,7 @@
<object class="NSTableView" id="620291245"> <object class="NSTableView" id="620291245">
<reference key="NSNextResponder" ref="51131752"/> <reference key="NSNextResponder" ref="51131752"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 564}</string> <string key="NSFrameSize">{1278, 565}</string>
<reference key="NSSuperview" ref="51131752"/> <reference key="NSSuperview" ref="51131752"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="715872882"/> <reference key="NSNextKeyView" ref="715872882"/>
@ -441,7 +443,7 @@
<object class="NSTableHeaderView" key="NSHeaderView" id="995480265"> <object class="NSTableHeaderView" key="NSHeaderView" id="995480265">
<reference key="NSNextResponder" ref="794153134"/> <reference key="NSNextResponder" ref="794153134"/>
<int key="NSvFlags">256</int> <int key="NSvFlags">256</int>
<string key="NSFrameSize">{1279, 17}</string> <string key="NSFrameSize">{1278, 17}</string>
<reference key="NSSuperview" ref="794153134"/> <reference key="NSSuperview" ref="794153134"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="51131752"/> <reference key="NSNextKeyView" ref="51131752"/>
@ -486,7 +488,7 @@
</object> </object>
<object class="NSTableColumn" id="995592652"> <object class="NSTableColumn" id="995592652">
<string key="NSIdentifier">tags</string> <string key="NSIdentifier">tags</string>
<double key="NSWidth">550</double> <double key="NSWidth">549</double>
<double key="NSMinWidth">200</double> <double key="NSMinWidth">200</double>
<double key="NSMaxWidth">2000</double> <double key="NSMaxWidth">2000</double>
<object class="NSTableHeaderCell" key="NSHeaderCell"> <object class="NSTableHeaderCell" key="NSHeaderCell">
@ -543,7 +545,7 @@
<reference key="NSBackgroundColor" ref="436396164"/> <reference key="NSBackgroundColor" ref="436396164"/>
<reference key="NSGridColor" ref="837522117"/> <reference key="NSGridColor" ref="837522117"/>
<double key="NSRowHeight">19</double> <double key="NSRowHeight">19</double>
<int key="NSTvFlags">-2064384</int> <int key="NSTvFlags">-71270400</int>
<reference key="NSDelegate"/> <reference key="NSDelegate"/>
<reference key="NSDataSource"/> <reference key="NSDataSource"/>
<int key="NSGridStyleMask">1</int> <int key="NSGridStyleMask">1</int>
@ -555,7 +557,7 @@
<int key="NSTableViewGroupRowStyle">1</int> <int key="NSTableViewGroupRowStyle">1</int>
</object> </object>
</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="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="620291245"/> <reference key="NSNextKeyView" ref="620291245"/>
@ -596,7 +598,7 @@
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="995480265"/> <reference ref="995480265"/>
</object> </object>
<string key="NSFrame">{{1, 0}, {1279, 17}}</string> <string key="NSFrame">{{1, 0}, {1278, 17}}</string>
<reference key="NSSuperview" ref="1054473103"/> <reference key="NSSuperview" ref="1054473103"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="995480265"/> <reference key="NSNextKeyView" ref="995480265"/>
@ -605,7 +607,7 @@
<int key="NScvFlags">4</int> <int key="NScvFlags">4</int>
</object> </object>
</object> </object>
<string key="NSFrame">{{0, -1}, {1281, 582}}</string> <string key="NSFrameSize">{1280, 583}</string>
<reference key="NSSuperview" ref="1058980817"/> <reference key="NSSuperview" ref="1058980817"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="794153134"/> <reference key="NSNextKeyView" ref="794153134"/>
@ -617,11 +619,35 @@
<reference key="NSHeaderClipView" ref="794153134"/> <reference key="NSHeaderClipView" ref="794153134"/>
<bytes key="NSScrollAmts">QSAAAEEgAABBqAAAQagAAA</bytes> <bytes key="NSScrollAmts">QSAAAEEgAABBqAAAQagAAA</bytes>
</object> </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> </object>
<string key="NSFrameSize">{1281, 599}</string> <string key="NSFrameSize">{1281, 599}</string>
<reference key="NSSuperview" ref="475349496"/> <reference key="NSSuperview" ref="475349496"/>
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="56699403"/> <reference key="NSNextKeyView" ref="777053201"/>
<string key="NSReuseIdentifierKey">_NS:11</string> <string key="NSReuseIdentifierKey">_NS:11</string>
</object> </object>
</object> </object>
@ -662,7 +688,7 @@
<reference key="NSWindow"/> <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="196617426"/> <reference key="NSNextKeyView" ref="196617426"/>
</object> </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="NSMinSize">{450, 422}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string> <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<int key="NSWindowCollectionBehavior">128</int> <int key="NSWindowCollectionBehavior">128</int>
@ -952,22 +978,6 @@
</object> </object>
<int key="connectionID">100160</int> <int key="connectionID">100160</int>
</object> </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="IBConnectionRecord">
<object class="IBOutletConnection" key="connection"> <object class="IBOutletConnection" key="connection">
<string key="label">tokenFieldProto</string> <string key="label">tokenFieldProto</string>
@ -1087,6 +1097,54 @@
</object> </object>
<int key="connectionID">100183</int> <int key="connectionID">100183</int>
</object> </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>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects"> <object class="NSArray" key="orderedObjects">
@ -1174,6 +1232,7 @@
<bool key="EncodedWithXMLCoder">YES</bool> <bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1054473103"/> <reference ref="1054473103"/>
<reference ref="56699403"/> <reference ref="56699403"/>
<reference ref="777053201"/>
</object> </object>
<reference key="parent" ref="196617426"/> <reference key="parent" ref="196617426"/>
</object> </object>
@ -1369,6 +1428,20 @@
<reference key="object" ref="194508126"/> <reference key="object" ref="194508126"/>
<reference key="parent" ref="398992771"/> <reference key="parent" ref="398992771"/>
</object> </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> </object>
<object class="NSMutableDictionary" key="flattenedProperties"> <object class="NSMutableDictionary" key="flattenedProperties">
@ -1413,6 +1486,8 @@
<string>100148.IBPluginDependency</string> <string>100148.IBPluginDependency</string>
<string>100161.IBPluginDependency</string> <string>100161.IBPluginDependency</string>
<string>100162.IBPluginDependency</string> <string>100162.IBPluginDependency</string>
<string>100197.IBPluginDependency</string>
<string>100198.IBPluginDependency</string>
<string>5.IBNSWindowAutoPositionCentersHorizontal</string> <string>5.IBNSWindowAutoPositionCentersHorizontal</string>
<string>5.IBNSWindowAutoPositionCentersVertical</string> <string>5.IBNSWindowAutoPositionCentersVertical</string>
<string>5.IBPluginDependency</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> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="NO"/> <boolean value="NO"/>
<boolean value="NO"/> <boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -1478,7 +1555,7 @@
<reference key="dict.values" ref="0"/> <reference key="dict.values" ref="0"/>
</object> </object>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">100183</int> <int key="maxID">100201</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions"> <object class="NSMutableArray" key="referencedPartialClassDescriptions">