• R/O
  • SSH
  • HTTPS

xspfqt: Commit


Commit MetaInfo

Révision384 (tree)
l'heure2013-06-20 21:35:29
Auteurmasakih

Message de Log

[Mod] 動画再生に掛かる機能を全てXspfQTMovieViewControllerに移動

Change Summary

Modification

--- branches/divideMovieViewController/XspfQTDocument.m (revision 383)
+++ branches/divideMovieViewController/XspfQTDocument.m (revision 384)
@@ -259,10 +259,6 @@
259259 }
260260
261261 #pragma mark### Actions ###
262-- (IBAction)togglePlayAndPause:(id)sender
263-{
264- [movieWindowController togglePlayAndPause:sender];
265-}
266262 - (IBAction)showPlayList:(id)sender
267263 {
268264 [playListWindowController showWindow:self];
--- branches/divideMovieViewController/XspfQTMovieWindowController.h (revision 383)
+++ branches/divideMovieViewController/XspfQTMovieWindowController.h (revision 384)
@@ -91,22 +91,12 @@
9191 }
9292 @property (retain)QTMovie *qtMovie;
9393
94-- (IBAction)turnUpVolume:(id)sender;
95-- (IBAction)turnDownVolume:(id)sender;
96-- (IBAction)togglePlayAndPause:(id)sender;
9794 - (IBAction)toggleFullScreenMode:(id)sender;
98-- (IBAction)forwardTagValueSecends:(id)sender;
99-- (IBAction)backwardTagValueSecends:(id)sender;
100-- (IBAction)nextTrack:(id)sender;
101-- (IBAction)previousTrack:(id)sender;
102-- (IBAction)gotoBeginningOrPreviousTrack:(id)sender;
10395 - (IBAction)normalSize:(id)sender;
10496 - (IBAction)halfSize:(id)sender;
10597 - (IBAction)doubleSize:(id)sender;
10698 - (IBAction)screenSize:(id)sender;
10799
108-- (IBAction)gotoThumbnailFrame:(id)sender;
109-
110100 @end
111101
112102 extern NSString *XspfQTMovieDidStartNotification;
--- branches/divideMovieViewController/XspfQTMovieViewController.h (revision 383)
+++ branches/divideMovieViewController/XspfQTMovieViewController.h (revision 384)
@@ -10,10 +10,14 @@
1010
1111 #import <QTKit/QTKit.h>
1212
13+@class XspfQTDocument;
14+
1315 @interface XspfQTMovieViewController : NSViewController
1416
1517 @property (readonly) QTMovieView *movieView;
1618
19+@property (retain) XspfQTDocument *qtDocument;
20+
1721 - (void)play;
1822 - (void)pause;
1923 - (void)stop;
--- branches/divideMovieViewController/XspfQTMovieWindowController.m (revision 383)
+++ branches/divideMovieViewController/XspfQTMovieWindowController.m (revision 384)
@@ -125,11 +125,9 @@
125125 @synthesize movieViewController = _movieViewController;
126126
127127 #pragma mark ### Static variables ###
128-static const float sVolumeDelta = 0.1;
129128 static const NSTimeInterval sUpdateTimeInterval = 0.5;
130129 static NSString *const kQTMovieKeyPath = @"playingMovie";
131130 static NSString *const kIsPlayedKeyPath = @"trackList.isPlayed";
132-static NSString *const kVolumeKeyPath = @"qtMovie.volume";
133131
134132 - (id)init
135133 {
@@ -156,6 +154,7 @@
156154 - (void)awakeFromNib
157155 {
158156 _movieViewController = [[XspfQTMovieViewController alloc] init];
157+ self.movieViewController.qtDocument = self.qtDocument;
159158 NSView *contentView = [movieViewPlaceholder superview];
160159 [self.movieViewController.movieView setFrame:[movieViewPlaceholder frame]];
161160 [contentView replaceSubview:movieViewPlaceholder with:self.movieViewController.movieView];
@@ -490,26 +489,6 @@
490489 currentPresentation & ~(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
491490 }
492491 #pragma mark ### Actions ###
493-- (IBAction)togglePlayAndPause:(id)sender
494-{
495- if([[self valueForKeyPath:@"document.trackList.isPlayed"] boolValue]) {
496- [self.movieViewController pause];
497- } else {
498- [self.movieViewController play];
499- }
500-}
501-- (IBAction)turnUpVolume:(id)sender
502-{
503- NSNumber *cv = [self valueForKeyPath:kVolumeKeyPath];
504- cv = [NSNumber numberWithFloat:[cv floatValue] + sVolumeDelta];
505- [self setValue:cv forKeyPath:kVolumeKeyPath];
506-}
507-- (IBAction)turnDownVolume:(id)sender
508-{
509- NSNumber *cv = [self valueForKeyPath:kVolumeKeyPath];
510- cv = [NSNumber numberWithFloat:[cv floatValue] - sVolumeDelta];
511- [self setValue:cv forKeyPath:kVolumeKeyPath];
512-}
513492 - (IBAction)toggleFullScreenMode:(id)sender
514493 {
515494 if([self.window respondsToSelector:@selector(toggleFullScreen:)]) {
@@ -525,77 +504,6 @@
525504 self.fullScreenMode = YES;
526505 }
527506 }
528-
529-- (IBAction)forwardTagValueSecends:(id)sender
530-{
531- if(![sender respondsToSelector:@selector(tag)]) return;
532-
533- int tag = [sender tag];
534- if(tag == 0) return;
535-
536- QTTime current = [self.qtMovie currentTime];
537- NSTimeInterval cur;
538- if(!QTGetTimeInterval(current, &cur)) return;
539-
540- QTTime new = QTMakeTimeWithTimeInterval(cur + tag);
541- [self.qtMovie setCurrentTime:new];
542-}
543-- (IBAction)backwardTagValueSecends:(id)sender
544-{
545- if(![sender respondsToSelector:@selector(tag)]) return;
546-
547- int tag = [sender tag];
548- if(tag == 0) return;
549-
550- QTTime current = [self.qtMovie currentTime];
551- NSTimeInterval cur;
552- if(!QTGetTimeInterval(current, &cur)) return;
553-
554- QTTime new = QTMakeTimeWithTimeInterval(cur - tag);
555- [self.qtMovie setCurrentTime:new];
556-}
557-- (IBAction)nextTrack:(id)sender
558-{
559- [self.movieViewController pause:sender];
560- [self.qtDocument.trackList next];
561-}
562-- (IBAction)previousTrack:(id)sender
563-{
564- [self.movieViewController pause:sender];
565- [self.qtDocument.trackList previous];
566-}
567-- (IBAction)gotoBeginningOrPreviousTrack:(id)sender
568-{
569- QTTime current = [self.qtMovie currentTime];
570- NSTimeInterval cur;
571- if(!QTGetTimeInterval(current, &cur)) return;
572-
573- QTTime duration = [self.qtMovie duration];
574- NSTimeInterval dur;
575- if(!QTGetTimeInterval(duration, &dur)) return;
576-
577- if(cur > (dur * 0.01)) {
578- [self.movieViewController gotoBeginning:sender];
579- } else {
580- [self previousTrack:sender];
581- }
582-}
583-
584-- (IBAction)gotoThumbnailFrame:(id)sender
585-{
586- HMXSPFComponent *trackList = self.qtDocument.trackList;
587- HMXSPFComponent *thumbnailTrack = trackList.thumbnailTrack;
588- NSTimeInterval time = trackList.thumbnailTimeInterval;
589-
590- NSUInteger num = [trackList indexOfChild:thumbnailTrack];
591- if(num == NSNotFound) return;
592-
593- trackList.selectionIndex = num;
594-
595- QTTime new = QTMakeTimeWithTimeInterval(time);
596- [self.qtMovie setCurrentTime:new];
597-}
598-
599507 - (IBAction)normalSize:(id)sender
600508 {
601509 if(self.fullScreenMode) return;
--- branches/divideMovieViewController/XspfQTMovieViewController.m (revision 383)
+++ branches/divideMovieViewController/XspfQTMovieViewController.m (revision 384)
@@ -7,11 +7,21 @@
77 //
88
99 #import "XspfQTMovieViewController.h"
10+#import "XspfQTDocument.h"
11+#import "HMXSPFComponent.h"
1012
13+
1114 @interface XspfQTMovieViewController ()
1215
1316 @end
1417
18+static const float sVolumeDelta = 0.1;
19+//static const NSTimeInterval sUpdateTimeInterval = 0.5;
20+//static NSString *const kQTMovieKeyPath = @"playingMovie";
21+//static NSString *const kIsPlayedKeyPath = @"trackList.isPlayed";
22+static NSString *const kVolumeKeyPath = @"qtMovie.volume";
23+
24+
1525 @implementation XspfQTMovieViewController
1626
1727 - (id)init
@@ -27,7 +37,20 @@
2737 return (QTMovieView *)[self view];
2838 }
2939
40+- (void)setQtDocument:(XspfQTDocument *)document
41+{
42+ [self setRepresentedObject:document];
43+}
44+- (XspfQTDocument *)qtDocument
45+{
46+ return (XspfQTDocument *)[self representedObject];
47+}
3048
49+- (QTMovie *)qtMovie
50+{
51+ return [self.movieView movie];
52+}
53+
3154 - (void)play
3255 {
3356 [self performSelectorOnMainThread:@selector(play:) withObject:self waitUntilDone:NO];
@@ -41,6 +64,14 @@
4164 [self performSelectorOnMainThread:@selector(pause:) withObject:self waitUntilDone:YES];
4265 }
4366
67+- (IBAction)togglePlayAndPause:(id)sender
68+{
69+ if([[self valueForKeyPath:@"qtDocument.trackList.isPlayed"] boolValue]) {
70+ [self pause];
71+ } else {
72+ [self play];
73+ }
74+}
4475 - (IBAction)play:(id)sender
4576 {
4677 [self.movieView play:sender];
@@ -57,4 +88,101 @@
5788 {
5889 [self.movieView gotoEnd:sender];
5990 }
91+- (IBAction)nextTrack:(id)sender
92+{
93+ [self pause:sender];
94+ [self.qtDocument.trackList next];
95+}
96+- (IBAction)previousTrack:(id)sender
97+{
98+ [self pause:sender];
99+ [self.qtDocument.trackList previous];
100+}
101+- (IBAction)gotoBeginningOrPreviousTrack:(id)sender
102+{
103+ QTTime current = [self.qtMovie currentTime];
104+ NSTimeInterval cur;
105+ if(!QTGetTimeInterval(current, &cur)) return;
106+
107+ QTTime duration = [self.qtMovie duration];
108+ NSTimeInterval dur;
109+ if(!QTGetTimeInterval(duration, &dur)) return;
110+
111+ if(cur > (dur * 0.01)) {
112+ [self gotoBeginning:sender];
113+ } else {
114+ [self previousTrack:sender];
115+ }
116+}
117+
118+- (IBAction)gotoThumbnailFrame:(id)sender
119+{
120+ HMXSPFComponent *trackList = self.qtDocument.trackList;
121+ HMXSPFComponent *thumbnailTrack = trackList.thumbnailTrack;
122+ NSTimeInterval time = trackList.thumbnailTimeInterval;
123+
124+ NSUInteger num = [trackList indexOfChild:thumbnailTrack];
125+ if(num == NSNotFound) return;
126+
127+ trackList.selectionIndex = num;
128+
129+ QTTime new = QTMakeTimeWithTimeInterval(time);
130+ [self.qtMovie setCurrentTime:new];
131+}
132+
133+
134+- (IBAction)turnUpVolume:(id)sender
135+{
136+ NSNumber *cv = [self valueForKeyPath:kVolumeKeyPath];
137+ cv = [NSNumber numberWithFloat:[cv floatValue] + sVolumeDelta];
138+ [self setValue:cv forKeyPath:kVolumeKeyPath];
139+}
140+- (IBAction)turnDownVolume:(id)sender
141+{
142+ NSNumber *cv = [self valueForKeyPath:kVolumeKeyPath];
143+ cv = [NSNumber numberWithFloat:[cv floatValue] - sVolumeDelta];
144+ [self setValue:cv forKeyPath:kVolumeKeyPath];
145+}
146+
147+- (IBAction)forwardTagValueSecends:(id)sender
148+{
149+ if(![sender respondsToSelector:@selector(tag)]) return;
150+
151+ int tag = [sender tag];
152+ if(tag == 0) return;
153+
154+ QTTime current = [self.qtMovie currentTime];
155+ NSTimeInterval cur;
156+ if(!QTGetTimeInterval(current, &cur)) return;
157+
158+ QTTime new = QTMakeTimeWithTimeInterval(cur + tag);
159+ [self.qtMovie setCurrentTime:new];
160+}
161+- (IBAction)backwardTagValueSecends:(id)sender
162+{
163+ if(![sender respondsToSelector:@selector(tag)]) return;
164+
165+ int tag = [sender tag];
166+ if(tag == 0) return;
167+
168+ QTTime current = [self.qtMovie currentTime];
169+ NSTimeInterval cur;
170+ if(!QTGetTimeInterval(current, &cur)) return;
171+
172+ QTTime new = QTMakeTimeWithTimeInterval(cur - tag);
173+ [self.qtMovie setCurrentTime:new];
174+}
175+
176+#pragma mark ### NSMenu valivation ###
177+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
178+{
179+ SEL action = [menuItem action];
180+
181+ if(action == @selector(gotoThumbnailFrame:)) {
182+ if(!self.qtDocument.trackList.thumbnailTrack) return NO;
183+ }
184+
185+ return YES;
186+}
187+
60188 @end
--- branches/divideMovieViewController/XspfQTDocument.h (revision 383)
+++ branches/divideMovieViewController/XspfQTDocument.h (revision 384)
@@ -87,7 +87,6 @@
8787 @property (readonly, retain) QTMovie *playingMovie;
8888
8989
90-- (IBAction)togglePlayAndPause:(id)sender;
9190 - (IBAction)showPlayList:(id)sender;
9291
9392 - (IBAction)setThumbnailFrame:(id)sender;
Afficher sur ancien navigateur de dépôt.