Develop and Download Open Source Software

Browse Subversion Repository

Contents of /NNDDv2/trunk/src/org/mineap/nndd/view/VideoInfoView.as

Parent Directory Parent Directory | Revision Log Revision Log


Revision 487 - (show annotations) (download)
Sat Apr 9 13:16:04 2011 UTC (13 years ago) by mineap
File size: 50755 byte(s)
Info画面の設定でスムージングを切り替えられるようにした(FLV/MP4で有効)
1 /**
2 * VideoInfoView.as
3 *
4 * Copyright (c) 2008-2009 MAP - MineApplicationProject. All Rights Reserved.
5 *
6 * @author shiraminekeisuke
7 *
8 */
9
10 import flash.events.Event;
11 import flash.events.MouseEvent;
12 import flash.events.NativeWindowBoundsEvent;
13 import flash.events.TextEvent;
14 import flash.geom.Rectangle;
15 import flash.utils.Timer;
16
17 import mx.collections.ArrayCollection;
18 import mx.collections.Sort;
19 import mx.collections.SortField;
20 import mx.controls.Alert;
21 import mx.controls.CheckBox;
22 import mx.controls.DataGrid;
23 import mx.controls.HSlider;
24 import mx.controls.RadioButton;
25 import mx.core.Application;
26 import mx.core.DragSource;
27 import mx.events.AIREvent;
28 import mx.events.CloseEvent;
29 import mx.events.DataGridEvent;
30 import mx.events.DragEvent;
31 import mx.events.FlexEvent;
32 import mx.events.ListEvent;
33 import mx.events.SliderEvent;
34
35 import org.mineap.nicovideo4as.model.SearchType;
36 import org.mineap.nndd.LogManager;
37 import org.mineap.nndd.Message;
38 import org.mineap.nndd.model.NNDDVideo;
39 import org.mineap.nndd.model.PlayList;
40 import org.mineap.nndd.model.SearchItem;
41 import org.mineap.nndd.model.SearchSortString;
42 import org.mineap.nndd.playList.PlayListManager;
43 import org.mineap.nndd.player.PlayerController;
44 import org.mineap.nndd.util.PathMaker;
45 import org.mineap.util.config.ConfUtil;
46 import org.mineap.util.config.ConfigManager;
47 import org.mineap.util.font.FontUtil;
48
49 private var videoPlayer:VideoPlayer;
50 private var playerController:PlayerController;
51 private var logManager:LogManager;
52
53 public var isPlayListRepeat:Boolean = false;
54 public var isSyncComment:Boolean = true;
55 public var isPlayerFollow:Boolean = true;
56 public var isRenewCommentEachPlay:Boolean = false;
57 public var isRenewOtherCommentWithCommentEachPlay:Boolean = false;
58 public var isResizePlayerEachPlay:Boolean = true;
59 public var isHideUnderController:Boolean = false;
60 public var commentScale:Number = 1.0;
61 public var fps:Number = 15;
62 public var isShowOnlyPermissionComment:Boolean = false;
63 public var showCommentCount:int = 250;
64 public var showCommentSec:int = 3;
65 public var isAntiAlias:Boolean = true;
66 public var commentAlpha:int = 100;
67 public var isEnableJump:Boolean = true;
68 public var isAskToUserOnJump:Boolean = true;
69 public var isInfoViewAlwaysFront:Boolean = false;
70 public var isCommentFontBold:Boolean = true;
71 public var isShowAlwaysNicowariArea:Boolean = false;
72 public var selectedResizeType:int = RESIZE_TYPE_NICO;
73 public var isAlwaysEconomyForStreaming:Boolean = false;
74 public var isHideTagArea:Boolean = false;
75 public var isAppendComment:Boolean = false;
76 public var isHideSekaShinComment:Boolean = false;
77 public var isShowHTMLOwnerComment:Boolean = true;
78 public var isEnableWideMode:Boolean = true;
79 public var relationSortIndex:int = 0;
80 public var relationOrderIndex:int = 0;
81 public var isNgUpEnable:Boolean = true;
82 public var isSmoothing:Boolean = true;
83
84 public static const RESIZE_TYPE_NICO:int = 1;
85 public static const RESIZE_TYPE_VIDEO:int = 2;
86
87 public var videoUrlMap:Object = new Object();
88
89 public var myListMap:Object = new Object();
90
91 private var lastRect:Rectangle = new Rectangle();
92
93 private var seekTimer:Timer;
94 private var seekValue:Number = 0;
95
96 public var isActive:Boolean = false;
97
98 public var playListName:String = "";
99
100 [Bindable]
101 public var commentListProvider:ArrayCollection = new ArrayCollection();
102 [Bindable]
103 public var ownerCommentProvider:ArrayCollection = new ArrayCollection();
104 [Bindable]
105 private var playListProvider:ArrayCollection = new ArrayCollection();
106 [Bindable]
107 public var localTagProvider:Array = new Array();
108 [Bindable]
109 public var nicoTagProvider:Array = new Array();
110 [Bindable]
111 public var ichibaLocalProvider:ArrayCollection = new ArrayCollection();
112 [Bindable]
113 public var ichibaNicoProvider:ArrayCollection = new ArrayCollection();
114 [Bindable]
115 public var ngListProvider:ArrayCollection = new ArrayCollection();
116 [Bindable]
117 public var owner_text_nico:String = "";
118 [Bindable]
119 public var owner_text_local:String = "";
120 [Bindable]
121 private var myListDataProvider:Array = new Array();
122 [Bindable]
123 public var savedCommentListProvider:Array = new Array();
124 [Bindable]
125 public var owner_text_temp:String = "";
126 [Bindable]
127 public var relationDataProvider:ArrayCollection = new ArrayCollection();
128 [Bindable]
129 public var relationSortComboboxDataProvider:Array = new Array("���������������", "���������������", "���������", "���������");
130 [Bindable]
131 public var relationOrderComboboxDataProvider:Array = new Array("������", "������");
132 [Bindable]
133 private var label_playListTitle_dataProvider:String = "";
134 [Bindable]
135 public var videoType:String = "";
136 [Bindable]
137 public var connectionType:String = "";
138 [Bindable]
139 public var videoServerUrl:String = "";
140 [Bindable]
141 public var messageServerUrl:String = "";
142
143 public function init(playerController:PlayerController, videoPlayer:VideoPlayer, logManager:LogManager):void{
144 this.videoPlayer = videoPlayer;
145 this.playerController = playerController;
146 this.logManager = logManager;
147
148 this.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
149 stage.addEventListener(AIREvent.WINDOW_ACTIVATE, function(event:AIREvent):void{
150 isActive = true;
151 });
152 stage.addEventListener(AIREvent.WINDOW_DEACTIVATE, function(event:AIREvent):void{
153 isActive = false;
154 });
155
156 });
157
158 readStore();
159 }
160
161 public function resetInfo():void{
162 localTagProvider = new Array();
163 nicoTagProvider = new Array();
164 ichibaLocalProvider = new ArrayCollection();
165 ichibaNicoProvider = new ArrayCollection();
166
167 owner_text_local = "";
168 owner_text_nico = "";
169 owner_text_temp = "";
170 }
171
172 private function windowClosing(event:Event):void{
173
174 event.preventDefault();
175
176 // if(this.videoPlayer != null && !this.videoPlayer.closed){
177 // this.videoPlayer.close();
178 // }
179 //
180 // this.playerController.destructor();
181
182 this.visible = false;
183
184 }
185
186 private function play():void{
187 this.playerController.play();
188 }
189
190 private function stop():void{
191 this.playerController.stop();
192 }
193
194 private function checkBoxAppendCommentChanged(event:Event):void{
195 this.isAppendComment = event.target.selected;
196 Application.application.setAppendComment(this.isAppendComment);
197 }
198
199 public function setAppendComment(boolean:Boolean):void{
200 this.isAppendComment = boolean;
201 if(checkBox_isAppendComment != null){
202 checkBox_isAppendComment.selected = boolean;
203 }
204 }
205
206 public function relationItemDoubleClickHandler(event:ListEvent):void{
207 if(relationDataProvider.length > event.rowIndex){
208 var url:String = relationDataProvider[event.rowIndex].col_link;
209 if(url != null && url.length > 0){
210 var videoId:String = PathMaker.getVideoID(url);
211 if(videoId != null){
212 playerController.playMovie(url);
213 }
214 }
215 }
216 }
217
218 public function checkBoxNgUpChanged(event:Event):void{
219 this.isNgUpEnable = checkBox_isNgUpEnable.selected;
220 if(this.playerController != null){
221 this.playerController.reloadLocalComment();
222 }
223 }
224
225 public function checkBoxSmoothingChanged(event:Event):void{
226 this.isSmoothing = checkBox_isSmoothing.selected;
227 if(this.playerController != null){
228 this.playerController.setVideoSmoothing(this.isSmoothing);
229 }
230 }
231
232 private function checkBoxPlayerAlwaysFrontChanged(event:Event):void{
233 this.videoPlayer.isAlwaysFront = (event.currentTarget as CheckBox).selected;
234 this.videoPlayer.alwaysInFront = (event.currentTarget as CheckBox).selected;
235 }
236
237 private function checkBoxInfoViewAlwaysFrontChanged(event:Event):void{
238 this.isInfoViewAlwaysFront = (event.currentTarget as CheckBox).selected;
239 this.alwaysInFront = (event.currentTarget as CheckBox).selected;
240 }
241
242 private function checkBoxCommentFontBoldChanged(event:Event):void{
243 this.isCommentFontBold = this.checkBox_commentBold.selected;
244 playerController.setCommentFontBold(this.isCommentFontBold);
245 }
246
247 private function checkboxSyncCommentChanged():void{
248 this.isSyncComment = this.checkbox_SyncComment.selected;
249 this.commentListProvider.sort = new Sort();
250 this.commentListProvider.sort.fields = [new SortField("vpos_column",true)];
251 this.commentListProvider.refresh();
252 }
253
254 private function checkboxRepeatAllChanged():void{
255 this.isPlayListRepeat = this.checkBox_repeatAll.selected;
256 if(isPlayListRepeat){
257 videoPlayer.setIsRepeat(false);
258 }
259 }
260
261 private function checkboxPlayerFollowChanged(event:Event):void{
262 this.isPlayerFollow = this.checkbox_playerFollow.selected;
263 if((event.currentTarget as CheckBox).selected){
264 this.videoPlayer.followInfoView(this.videoPlayer.lastRect);
265 }
266 }
267
268 private function checkboxHideUnderControllerChanged(event:Event):void{
269 this.isHideUnderController = this.checkbox_hideUnderController.selected;
270 if(this.videoPlayer.stage.displayState != StageDisplayState.FULL_SCREEN_INTERACTIVE){
271 if((event.currentTarget as CheckBox).selected){
272 //������������������������������
273 this.videoPlayer.showUnderController(false, true);
274 }else{
275 //������������������������������
276 this.videoPlayer.showUnderController(true, true);
277 }
278 }
279 this.videoPlayer.videoController.resetAlpha(true);
280 }
281
282 private function checkboxHideTagAreaChanged(event:Event):void{
283 this.isHideTagArea = this.checkbox_hideTagArea.selected;
284 if(this.videoPlayer.stage.displayState != StageDisplayState.FULL_SCREEN_INTERACTIVE){
285 if((event.currentTarget as CheckBox).selected){
286 //���������������������������
287 this.videoPlayer.showTagArea(false, true);
288 }else{
289 //������������������������������������
290 this.videoPlayer.showTagArea(true, true);
291 }
292 }
293 this.videoPlayer.videoController.resetAlpha(true);
294 }
295
296 public function changeWideMode():void{
297 if(isResizePlayerEachPlay){
298 if(this.selectedResizeType == VideoInfoView.RESIZE_TYPE_NICO){
299 isEnableWideMode = !isEnableWideMode;
300 if(checkbox_enableWideMode != null){
301 checkbox_enableWideMode.selected = isEnableWideMode;
302 }
303 this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
304 }
305 }
306 }
307
308 private function checkboxResizePlayerEachPlay(event:Event):void{
309 this.isResizePlayerEachPlay = this.checkbox_resizePlayerEachPlay.selected;
310 radioGroup_resizeType.selectedValue = selectedResizeType;
311 if(this.isResizePlayerEachPlay){
312 this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
313 this.radioButton_resizeNicoDou.enabled = true;
314 this.radioButton_resizeVideo.enabled = true;
315 if(this.selectedResizeType == VideoInfoView.RESIZE_TYPE_NICO){
316 this.checkbox_enableWideMode.enabled = true;
317 }else{
318 this.checkbox_enableWideMode.enabled = false;
319 }
320 }else{
321 this.videoPlayer.nowRatio = -1;
322 this.radioButton_resizeNicoDou.enabled = false;
323 this.radioButton_resizeVideo.enabled = false;
324 this.checkbox_enableWideMode.enabled = false;
325 }
326
327 }
328
329 private function checkBoxAlwaysEconomyChanged(event:Event):void{
330 isAlwaysEconomyForStreaming = this.checkBox_isAlwaysEconomyForStreaming.selected;
331 }
332
333
334 private function checkBoxShowAlwaysNicowariAreaChanged(event:Event):void{
335 isShowAlwaysNicowariArea = this.checkBox_showAlwaysNicowariArea.selected;
336 videoPlayer.setShowAlwaysNicowariArea(isShowAlwaysNicowariArea);
337 }
338
339 public function setShowAlwaysNicowariArea(isShow:Boolean):void{
340 if(this.checkBox_showAlwaysNicowariArea != null){
341 this.checkBox_showAlwaysNicowariArea.selected = isShow;
342 }
343 isShowAlwaysNicowariArea = isShow;
344 }
345
346 private function checkBoxRenewCommentChanged():void{
347 isRenewCommentEachPlay = checkBox_renewComment.selected;
348 checkBox_renewTagAndNicowari.enabled = isRenewCommentEachPlay;
349 checkBox_isAppendComment.enabled = isRenewCommentEachPlay;
350 }
351
352 private function checkBoxCommentBoldChanged(event:Event):void{
353 this.isCommentFontBold = checkBox_commentBold.selected;
354 playerController.setCommentFontBold(this.isCommentFontBold);
355 }
356
357 public function setRelationComboboxEnable(enabled:Boolean):void{
358 if(combobox_relationSort != null){
359 (combobox_relationSort as ComboBox).enabled = enabled;
360 }
361 if(combobox_relationOrder != null){
362 (combobox_relationOrder as ComboBox).enabled = enabled;
363 }
364 }
365
366 private function thumbPress(event:SliderEvent):void{
367 this.playerController.sliderChanging = true;
368 }
369
370 private function thumbRelease(event:SliderEvent):void{
371 this.playerController.sliderChanging = false;
372 this.playerController.seek(event.value);
373 }
374
375 private function sliderVolumeChanged(evt:SliderEvent):void{
376 this.playerController.setVolume(evt.value);
377 }
378
379 private function sliderFpsChanged(event:SliderEvent):void{
380 this.fps = getFps(event.value);
381 this.playerController.changeFps(this.fps);
382 }
383
384 private function sliderShowCommentCountChanged(event:SliderEvent):void{
385 this.showCommentCount = event.value;
386 }
387
388 private function addNGListIdButtonClicked():void{
389 var index:int = -1;
390 if(tabNavigator_comment.selectedIndex == 0){
391 index = this.dataGrid_comment.selectedIndex;
392 }else if(tabNavigator_comment.selectedIndex == 1){
393 index = this.dataGrid_oldComment.selectedIndex;
394 }
395 if(index > -1){
396 this.playerController.ngListManager.addNgID(commentListProvider.getItemAt(index).user_id_column);
397 }
398 }
399
400 private function addNGListWordButtonClicked():void{
401 var index:int = -1;
402 if(tabNavigator_comment.selectedIndex == 0){
403 index = this.dataGrid_comment.selectedIndex;
404 }else if(tabNavigator_comment.selectedIndex == 1){
405 index = this.dataGrid_oldComment.selectedIndex;
406 }
407 if(index > -1){
408 this.playerController.ngListManager.addNgWord(commentListProvider.getItemAt(index).comment_column);
409 }
410 }
411
412 private function addPermissionIdButtonClicked():void{
413 var index:int = -1;
414 if(tabNavigator_comment.selectedIndex == 0){
415 index = this.dataGrid_comment.selectedIndex;
416 }else if(tabNavigator_comment.selectedIndex == 1){
417 index = this.dataGrid_oldComment.selectedIndex;
418 }
419 if(index > -1){
420 this.playerController.ngListManager.addPermissionId(commentListProvider.getItemAt(index).user_id_column);
421 }
422 }
423
424 private function headerReleaseHandler(event:DataGridEvent):void{
425 if(event.columnIndex == 1){
426 this.isSyncComment = false;
427 this.checkbox_SyncComment.selected = false;
428 }
429 }
430
431 /**
432 * TextInput������������������������ID���NG���������������������������
433 *
434 */
435 private function addItemToNgList():void{
436 playerController.ngListManager.addItemToNgList(textInput_ng.text, combobox_ngKind.selectedLabel);
437 }
438
439 private function ngListItemClicked(event:ListEvent):void{
440 playerController.ngListManager.ngListItemClicked(event);
441 }
442
443 /**
444 * ���������������������NG���������NG������������������������������������
445 *
446 */
447 private function removeItemFromNgList():void{
448 playerController.ngListManager.removeItemFromNgList();
449 }
450
451 private function ngTextInputEnter(event:FlexEvent):void{
452 playerController.ngListManager.addItemToNgList(textInput_ng.text, combobox_ngKind.selectedLabel);
453 }
454
455 private function fpsDataTipFormatFunction(value:Number):String{
456 return new String(getFps(value));
457 }
458
459 private function getFps(value:Number):Number{
460 switch(value){
461 case 1:
462 return 7.5;
463 case 2:
464 return 15;
465 case 3:
466 return 30;
467 case 4:
468 return 60;
469 case 5:
470 return 120;
471 default:
472 return 15;
473 }
474 }
475
476 private function getValueByFps(fps:Number):int{
477 switch(fps){
478 case 7.5:
479 return 1;
480 case 15:
481 return 2;
482 case 30:
483 return 3;
484 case 60:
485 return 4;
486 case 120:
487 return 5;
488 default:
489 return 2;
490 }
491 }
492
493 private function keyListener(event:KeyboardEvent):void{
494 if(event.keyCode == Keyboard.ESCAPE){
495 }else if(event.keyCode == Keyboard.F11 || (event.keyCode == Keyboard.F && (event.controlKey || event.commandKey))){
496 // trace("Ctrl + " + event.keyCode);
497 this.videoPlayer.changeFull();
498 }else if(event.keyCode == Keyboard.C){
499 // trace(event.keyCode);
500 this.stage.nativeWindow.activate();
501 }else if(event.keyCode == Keyboard.SPACE){
502 this.playerController.play();
503 }else if(event.keyCode == Keyboard.LEFT){
504 //���
505 if(seekTimer != null){
506 seekTimer.stop();
507 }
508 seekTimer = new Timer(100, 1);
509 seekTimer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:Event):void{
510 var newValue:Number = videoPlayer.videoController.slider_timeline.value + seekValue;
511 if(newValue <= (videoPlayer.videoController.slider_timeline as HSlider).minimum){
512 newValue = 0;
513 }else if(newValue >= (videoPlayer.videoController.slider_timeline as HSlider).maximum){
514 newValue = (videoPlayer.videoController.slider_timeline as HSlider).maximum;
515 }
516 trace(newValue +" = "+videoPlayer.videoController.slider_timeline.value +"+"+ seekValue);
517 playerController.seek(newValue);
518 seekValue = 0;
519 });
520 seekTimer.start();
521 this.seekValue -= 10;
522 }else if(event.keyCode == Keyboard.RIGHT){
523 //���
524 if(seekTimer != null){
525 seekTimer.stop();
526 }
527 seekTimer = new Timer(100, 1);
528 seekTimer.addEventListener(TimerEvent.TIMER_COMPLETE, function(event:Event):void{
529 var newValue:Number = videoPlayer.videoController.slider_timeline.value + seekValue;
530 if(newValue <= (videoPlayer.videoController.slider_timeline as HSlider).minimum){
531 newValue = 0;
532 }else if(newValue >= (videoPlayer.videoController.slider_timeline as HSlider).maximum){
533 newValue = (videoPlayer.videoController.slider_timeline as HSlider).maximum;
534 }
535 trace(newValue +" = "+videoPlayer.videoController.slider_timeline.value +"+"+ seekValue);
536 playerController.seek(newValue);
537 seekValue = 0;
538 });
539 seekTimer.start();
540 this.seekValue += 10;
541 }else if(event.keyCode == Keyboard.UP){
542 this.playerController.setVolume(this.videoPlayer.videoController.slider_volume.value + 0.05);
543 }else if(event.keyCode == Keyboard.DOWN){
544 this.playerController.setVolume(this.videoPlayer.videoController.slider_volume.value - 0.05);
545 }
546 }
547
548 private function radioButtonResizeTypeChanged(event:Event):void{
549 this.selectedResizeType = int(RadioButton(event.currentTarget).value);
550
551 if(this.selectedResizeType == VideoInfoView.RESIZE_TYPE_NICO){
552 this.checkbox_enableWideMode.enabled = true;
553 }else{
554 this.checkbox_enableWideMode.enabled = false;
555 }
556
557 this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
558 }
559
560 private function checkboxEnableWideModeChanged(event:Event):void{
561 this.isEnableWideMode = event.target.selected;
562 this.playerController.resizePlayerJustVideoSize(this.videoPlayer.nowRatio);
563 }
564
565 private function checkBox_repeatAllCompleteHandler(event:FlexEvent):void{
566 checkBox_repeatAll.selected = isPlayListRepeat;
567 }
568
569 private function checkBoxIsSOPCChanged(event:MouseEvent):void{
570 isShowOnlyPermissionComment = checkBox_isShowOnlyPermissionComment.selected;
571 if(this.playerController != null){
572 this.playerController.reloadLocalComment();
573 }
574 }
575
576 private function checkBoxRenewTagNicowariChanged():void{
577 isRenewOtherCommentWithCommentEachPlay = checkBox_renewTagAndNicowari.selected;
578 }
579
580 private function checkBoxIsEnableJump(event:MouseEvent):void{
581 isEnableJump = event.currentTarget.selected;
582 (checkBox_askToUserOnJump as CheckBox).enabled = isEnableJump;
583 }
584
585 private function checkBoxIsAskToUserOnJump(event:MouseEvent):void{
586 isAskToUserOnJump = event.currentTarget.selected;
587 }
588
589 private function checkBoxHideSekaShinComment(event:MouseEvent):void{
590 isHideSekaShinComment = event.currentTarget.selected;
591
592 if(this.playerController != null){
593 this.playerController.reloadLocalComment();
594 }
595 }
596
597 private function commentListDoubleClicked(event:ListEvent):void{
598 var time:String = event.target.selectedItem.vpos_column;
599
600 var min:int = int(time.substring(0,time.indexOf(":")));
601 var sec:int = int(time.substring(time.indexOf(":")+1));
602
603 if(playerController.windowType == PlayerController.WINDOW_TYPE_FLV){
604 this.playerController.seek(min*60 + sec);
605 }else{
606 this.playerController.seek((min*60 + sec)*playerController.swfFrameRate);
607 }
608 }
609
610 private function ichibaDataGridDoubleClicked(event:ListEvent):void{
611 trace((event.currentTarget as DataGrid).dataProvider[event.rowIndex].col_link);
612 var url:String = (event.currentTarget as DataGrid).dataProvider[event.rowIndex].col_link;
613 if(url != null){
614 navigateToURL(new URLRequest(url));
615 }
616 }
617
618 private function commentScaleSliderChanged(event:SliderEvent):void{
619 this.commentScale = event.value;
620 this.playerController.windowResized(true);
621 }
622
623 private function sliderShowCommentTimeChanged(event:SliderEvent):void{
624 this.showCommentSec = event.value;
625 }
626
627 private function sliderCommentAlphaChanged(event:SliderEvent):void{
628 this.commentAlpha = event.value;
629 playerController.getCommentManager().setCommentAlpha(this.commentAlpha/100);
630 }
631
632 private function myDataTipFormatFunction(value:Number):String{
633 var nowSec:String="00",nowMin:String="0";
634 nowSec = String(int(value%60));
635 nowMin = String(int(value/60));
636
637 if(nowSec.length == 1){
638 nowSec = "0" + nowSec;
639 }
640 if(nowMin.length == 1){
641 nowMin = "0" + nowMin;
642 }
643 return nowMin + ":" + nowSec;
644 }
645
646 private function windowCompleteHandler():void{
647
648 videoPlayer.alwaysInFront = videoPlayer.isAlwaysFront;
649 this.alwaysInFront = this.isInfoViewAlwaysFront;
650
651 // checkbox_repeat.selected = isRepeat;
652 // checkbox_showComment.selected = isShowComment;
653 checkbox_SyncComment.selected = isSyncComment;
654 checkBox_isShowOnlyPermissionComment.selected = isShowOnlyPermissionComment;
655 checkbox_showHtml.selected = isShowHTMLOwnerComment;
656
657 videoPlayer.setShowAlwaysNicowariArea(isShowAlwaysNicowariArea);
658 playerController.setCommentFontBold(this.isCommentFontBold);
659
660 videoPlayer.showUnderController(!isHideUnderController, true);
661 videoPlayer.showTagArea(!isHideTagArea, true);
662
663 this.setStyle("fontFamily", ConfigManager.getInstance().getItem("fontFamily"));
664 this.setStyle("fontSize", Number(ConfigManager.getInstance().getItem("fontSize")));
665 }
666
667 private function relationCanvasCreationCompleteHandler(event:FlexEvent):void{
668 combobox_relationOrder.selectedIndex = relationOrderIndex;
669 combobox_relationSort.selectedIndex = relationSortIndex;
670 }
671
672 private function relationSortComboboxChange(event:Event):void{
673 relationSortIndex = combobox_relationSort.selectedIndex;
674 playerController.setNicoRelationInfoForRelationSortTypeChange();
675 }
676
677 private function relationOrderComboboxChange(event:Event):void{
678 relationOrderIndex = combobox_relationOrder.selectedIndex;
679 playerController.setNicoRelationInfoForRelationSortTypeChange();
680 }
681
682 private function configCanvasCreationCompleteHandler(event:FlexEvent):void{
683 checkbox_PlayerAlwaysFront.selected = videoPlayer.isAlwaysFront;
684 checkbox_InfoViewAlwaysFront.selected = isInfoViewAlwaysFront;
685 checkbox_playerFollow.selected = isPlayerFollow;
686 radioGroup_resizeType.selectedValue = selectedResizeType;
687
688 checkbox_resizePlayerEachPlay.selected = isResizePlayerEachPlay;
689 if(isResizePlayerEachPlay){
690 // playerController.resizePlayerJustVideoSize();
691 radioButton_resizeNicoDou.enabled = true;
692 radioButton_resizeVideo.enabled = true;
693 }else{
694 radioButton_resizeNicoDou.enabled = false;
695 radioButton_resizeVideo.enabled = false;
696 }
697
698 checkBox_showAlwaysNicowariArea.selected = isShowAlwaysNicowariArea;
699
700 checkBox_commentBold.selected = isCommentFontBold;
701
702 checkbox_hideUnderController.selected = isHideUnderController;
703 slider_commentScale.value = commentScale;
704 slider_fps.value = getValueByFps(fps);
705
706 checkBox_renewComment.selected = isRenewCommentEachPlay;
707 slider_showCommentCount.value = showCommentCount;
708 slider_showCommentTime.value = showCommentSec;
709 slider_commentAlpha.value = commentAlpha;
710 checkBox_renewTagAndNicowari.selected = isRenewOtherCommentWithCommentEachPlay;
711 checkBox_renewTagAndNicowari.enabled = isRenewCommentEachPlay;
712
713 checkBox_enableJump.selected = isEnableJump;
714 checkBox_askToUserOnJump.selected = isAskToUserOnJump;
715 checkBox_askToUserOnJump.enabled = isEnableJump;
716
717 checkBox_isAlwaysEconomyForStreaming.selected = isAlwaysEconomyForStreaming;
718
719 checkbox_hideTagArea.selected = isHideTagArea;
720
721 isAppendComment = Application.application.getAppendComment();
722 checkBox_isAppendComment.selected = isAppendComment;
723 checkBox_isAppendComment.enabled = isRenewCommentEachPlay;
724 checkBox_hideSekaShinComment.selected = isHideSekaShinComment;
725
726 checkBox_isNgUpEnable.selected = isNgUpEnable;
727 checkBox_isSmoothing.selected = isSmoothing;
728
729 if(playerController.getCommentManager() != null){
730 playerController.getCommentManager().setAntiAlias(isAntiAlias);
731 }
732 }
733
734 public function isRepeatAll():Boolean{
735 return this.isPlayListRepeat;
736 }
737
738 private function windowResized(event:NativeWindowBoundsEvent):void{
739 lastRect = event.afterBounds;
740 }
741
742 private function windowMove(event:NativeWindowBoundsEvent):void{
743 lastRect = event.afterBounds;
744 }
745
746 public function playListDoubleClicked():void{
747 if(playListProvider.length > 0){
748 var url:String = videoUrlMap[playListProvider[dataGrid_playList.selectedIndex]];
749 playerController.initForVideoPlayer(url, dataGrid_playList.selectedIndex);
750 }
751 }
752
753 /**
754 * ���������������������������������������������������������������������������������������������������
755 *
756 */
757 public function selectComment(no:Number):void{
758
759 for(var i:int = 0; i<commentListProvider.length; i++){
760 if(commentListProvider[i].no_column == no){
761 (dataGrid_comment as DataGrid).selectedIndex = i;
762
763 return;
764 }
765 }
766
767 }
768
769 private function readStore():void{
770
771 try{
772 /*���������������������������������������������*/
773
774 var confValue:String = null;
775 confValue = ConfigManager.getInstance().getItem("isPlayListRepeat");
776 if (confValue == null) {
777 //���������������
778 }else{
779 isPlayListRepeat = ConfUtil.parseBoolean(confValue);
780 }
781
782 confValue = ConfigManager.getInstance().getItem("isSyncComment");
783 if (confValue == null) {
784 //���������������
785 }else{
786 isSyncComment = ConfUtil.parseBoolean(confValue);
787 }
788
789 confValue = ConfigManager.getInstance().getItem("isPlayerFollow");
790 if (confValue == null) {
791 //���������������
792 }else{
793 isPlayerFollow = ConfUtil.parseBoolean(confValue);
794 }
795
796 confValue = ConfigManager.getInstance().getItem("isRenewCommentEachPlay");
797 if (confValue == null) {
798 //���������������
799 }else{
800 isRenewCommentEachPlay = ConfUtil.parseBoolean(confValue);
801 }
802
803 confValue = ConfigManager.getInstance().getItem("isResizePlayerEachPlay");
804 if (confValue == null) {
805 //���������������
806 }else{
807 isResizePlayerEachPlay = ConfUtil.parseBoolean(confValue);
808 }
809
810 confValue = ConfigManager.getInstance().getItem("isHideUnderController");
811 if (confValue == null) {
812 //���������������
813 }else{
814 isHideUnderController = ConfUtil.parseBoolean(confValue);
815 }
816
817 confValue = ConfigManager.getInstance().getItem("commentScale");
818 if (confValue == null) {
819 //���������������
820 }else{
821 commentScale = Number(confValue);
822 }
823
824 confValue = ConfigManager.getInstance().getItem("commentFps");
825 if (confValue == null) {
826 //���������������
827 }else{
828 this.fps = Number(confValue);
829 this.playerController.changeFps(this.fps);
830 }
831
832 confValue = ConfigManager.getInstance().getItem("isShowOnlyPermissionComment");
833 if (confValue == null) {
834 //���������������
835 }else{
836 isShowOnlyPermissionComment = ConfUtil.parseBoolean(confValue);
837 }
838
839 confValue = ConfigManager.getInstance().getItem("showCommentCount");
840 if (confValue == null) {
841 //���������������
842 }else{
843 showCommentCount = int(confValue);
844 }
845
846 confValue = ConfigManager.getInstance().getItem("showCommentSec");
847 if (confValue == null) {
848 //���������������
849 }else{
850 showCommentSec = int(confValue);
851 }
852
853 confValue = ConfigManager.getInstance().getItem("isRenewOtherCommentWithCommentEachPlay");
854 if (confValue == null) {
855 //���������������
856 }else{
857 isRenewOtherCommentWithCommentEachPlay = ConfUtil.parseBoolean(confValue);
858 }
859
860 confValue = ConfigManager.getInstance().getItem("isAntiAlias");
861 if (confValue == null) {
862 //���������������
863 }else{
864 isAntiAlias = ConfUtil.parseBoolean(confValue);
865 }
866
867 confValue = ConfigManager.getInstance().getItem("commentAlpha");
868 if (confValue == null) {
869 //���������������
870 }else{
871 commentAlpha = int(confValue);
872 }
873
874 confValue = ConfigManager.getInstance().getItem("isEnableJump");
875 if (confValue == null) {
876 //���������������
877 }else{
878 isEnableJump = ConfUtil.parseBoolean(confValue);
879 }
880
881 confValue = ConfigManager.getInstance().getItem("isAskToUserOnJump");
882 if (confValue == null) {
883 //���������������
884 }else{
885 isAskToUserOnJump = ConfUtil.parseBoolean(confValue);
886 }
887
888 confValue = ConfigManager.getInstance().getItem("isInfoViewAlwaysFront");
889 if (confValue == null) {
890 //���������������
891 }else{
892 isInfoViewAlwaysFront = ConfUtil.parseBoolean(confValue);
893 }
894
895 confValue = ConfigManager.getInstance().getItem("selectedResizeType");
896 if (confValue == null) {
897 //���������������
898 }else{
899 selectedResizeType = int(confValue);
900 }
901
902 confValue = ConfigManager.getInstance().getItem("isCommentFontBold");
903 if (confValue == null) {
904 //���������������
905 }else{
906 isCommentFontBold = ConfUtil.parseBoolean(confValue);
907 }
908
909 confValue = ConfigManager.getInstance().getItem("isShowAlwaysNicowariArea");
910 if (confValue == null) {
911 //���������������
912 }else{
913 isShowAlwaysNicowariArea = ConfUtil.parseBoolean(confValue);
914 }
915
916 confValue = ConfigManager.getInstance().getItem("isHideTagArea");
917 if (confValue == null) {
918 //���������������
919 }else{
920 isHideTagArea = ConfUtil.parseBoolean(confValue);
921 }
922
923 confValue = ConfigManager.getInstance().getItem("isAlwaysEconomyForStreaming");
924 if (confValue == null) {
925 //���������������
926 }else{
927 isAlwaysEconomyForStreaming = ConfUtil.parseBoolean(confValue);
928 }
929
930 confValue = ConfigManager.getInstance().getItem("isAppendComment");
931 if (confValue == null) {
932 //���������������
933 }else{
934 isAppendComment = ConfUtil.parseBoolean(confValue);
935 }
936
937 confValue = ConfigManager.getInstance().getItem("isHideSekaShinComment");
938 if (confValue == null) {
939 //���������������
940 }else{
941 isHideSekaShinComment = ConfUtil.parseBoolean(confValue);
942 }
943
944 confValue = ConfigManager.getInstance().getItem("isShowHTMLOwnerComment");
945 if (confValue == null) {
946 //���������������
947 }else{
948 isShowHTMLOwnerComment = ConfUtil.parseBoolean(confValue);
949 }
950
951 //x,y,w,h
952 confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_x");
953 var controllerPosition_x:Number = 0;
954 if (confValue == null) {
955 //���������������
956 }else{
957 controllerPosition_x = Number(confValue);
958 this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
959 nativeWindow.x = lastRect.x = controllerPosition_x;
960 });
961 }
962
963 confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_y");
964 var controllerPosition_y:Number = 0;
965 if (confValue == null) {
966 //���������������
967 }else{
968 controllerPosition_y = Number(confValue);
969 this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
970 nativeWindow.y = lastRect.y = controllerPosition_y;
971 });
972 }
973
974 confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_w");
975 var controllerPosition_w:Number = 380;
976 if (confValue == null) {
977 //���������������
978 }else{
979 controllerPosition_w = Number(confValue);
980 this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
981 nativeWindow.width = lastRect.width = controllerPosition_w;
982 });
983 }
984
985 confValue = ConfigManager.getInstance().getItem("controllerWindowPosition_h");
986 var controllerPosition_h:Number = 520;
987 if (confValue == null) {
988 //���������������
989 }else{
990 controllerPosition_h = Number(confValue);
991 this.addEventListener(FlexEvent.CREATION_COMPLETE, function():void{
992 nativeWindow.height = lastRect.height = controllerPosition_h;
993 });
994 }
995
996 confValue = ConfigManager.getInstance().getItem("isEnableWideMode");
997 if(confValue == null){
998 //���������������
999 isEnableWideMode = true;
1000 }else{
1001 isEnableWideMode = ConfUtil.parseBoolean(confValue);
1002 }
1003
1004 confValue = ConfigManager.getInstance().getItem("relationSortIndex");
1005 if(confValue == null){
1006 //���������������
1007 }else{
1008 relationSortIndex = int(confValue);
1009 }
1010
1011 confValue = ConfigManager.getInstance().getItem("relationOrderIndex");
1012 if(confValue == null){
1013 //���������������
1014 }else{
1015 relationOrderIndex = int(confValue);
1016 }
1017
1018 confValue = ConfigManager.getInstance().getItem("isNgUpEnable");
1019 if(confValue == null){
1020 // ���������������
1021 }else{
1022 isNgUpEnable = ConfUtil.parseBoolean(confValue);
1023 }
1024
1025 confValue = ConfigManager.getInstance().getItem("isSmoothing");
1026 if(confValue != null){
1027 isSmoothing = ConfUtil.parseBoolean(confValue);
1028 }
1029 if(playerController != null){
1030 playerController.setVideoSmoothing(this.isSmoothing);
1031 }
1032
1033
1034 }catch(error:Error){
1035 trace(error.getStackTrace());
1036 Alert.show(Message.M_CONF_FILE_IS_BROKEN, Message.M_ERROR);
1037 logManager.addLog(Message.FAIL_LOAD_CONF_FILE_FOR_VIDEO_INFO_VIEW + ":" + Message.M_CONF_FILE_IS_BROKEN + ":" + ConfigManager.getInstance().confFileNativePath + ":" + error);
1038 }
1039
1040 }
1041
1042 public function saveStore():void{
1043
1044 try{
1045
1046 trace("saveStore_videoInfoView");
1047
1048 /*������������������������������������*/
1049 ConfigManager.getInstance().removeItem("isPlayListRepeat");
1050 ConfigManager.getInstance().setItem("isPlayListRepeat", isPlayListRepeat);
1051
1052 ConfigManager.getInstance().removeItem("isSyncComment");
1053 ConfigManager.getInstance().setItem("isSyncComment", isSyncComment);
1054
1055 ConfigManager.getInstance().removeItem("isPlayerFollow");
1056 ConfigManager.getInstance().setItem("isPlayerFollow", isPlayerFollow);
1057
1058 ConfigManager.getInstance().removeItem("isRenewCommentEachPlay");
1059 ConfigManager.getInstance().setItem("isRenewCommentEachPlay", isRenewCommentEachPlay);
1060
1061 ConfigManager.getInstance().removeItem("isResizePlayerEachPlay");
1062 ConfigManager.getInstance().setItem("isResizePlayerEachPlay", isResizePlayerEachPlay);
1063
1064 ConfigManager.getInstance().removeItem("isHideUnderController");
1065 ConfigManager.getInstance().setItem("isHideUnderController", isHideUnderController);
1066
1067 // ������������������������������������
1068 ConfigManager.getInstance().removeItem("controllerWindowPosition_x");
1069 ConfigManager.getInstance().setItem("controllerWindowPosition_x", lastRect.x);
1070
1071 ConfigManager.getInstance().removeItem("controllerWindowPosition_y");
1072 ConfigManager.getInstance().setItem("controllerWindowPosition_y", lastRect.y);
1073
1074 ConfigManager.getInstance().removeItem("controllerWindowPosition_w");
1075 ConfigManager.getInstance().setItem("controllerWindowPosition_w", lastRect.width);
1076
1077 ConfigManager.getInstance().removeItem("controllerWindowPosition_h");
1078 ConfigManager.getInstance().setItem("controllerWindowPosition_h", lastRect.height);
1079
1080 ConfigManager.getInstance().removeItem("commentScale");
1081 ConfigManager.getInstance().setItem("commentScale", commentScale);
1082
1083 ConfigManager.getInstance().removeItem("commentFps");
1084 ConfigManager.getInstance().setItem("commentFps", fps);
1085
1086 ConfigManager.getInstance().removeItem("isShowOnlyPermissionComment");
1087 ConfigManager.getInstance().setItem("isShowOnlyPermissionComment", isShowOnlyPermissionComment);
1088
1089 ConfigManager.getInstance().removeItem("showCommentCount");
1090 ConfigManager.getInstance().setItem("showCommentCount", showCommentCount);
1091
1092 ConfigManager.getInstance().removeItem("showCommentSec");
1093 ConfigManager.getInstance().setItem("showCommentSec", showCommentSec);
1094
1095 ConfigManager.getInstance().removeItem("isRenewOtherCommentWithCommentEachPlay");
1096 ConfigManager.getInstance().setItem("isRenewOtherCommentWithCommentEachPlay", isRenewOtherCommentWithCommentEachPlay);
1097
1098 ConfigManager.getInstance().removeItem("isAntiAlias");
1099 ConfigManager.getInstance().setItem("isAntiAlias", isAntiAlias);
1100
1101 ConfigManager.getInstance().removeItem("commentAlpha");
1102 ConfigManager.getInstance().setItem("commentAlpha", commentAlpha);
1103
1104 ConfigManager.getInstance().removeItem("isEnableJump");
1105 ConfigManager.getInstance().setItem("isEnableJump", isEnableJump);
1106
1107 ConfigManager.getInstance().removeItem("isAskToUserOnJump");
1108 ConfigManager.getInstance().setItem("isAskToUserOnJump", isAskToUserOnJump);
1109
1110 ConfigManager.getInstance().removeItem("isInfoViewAlwaysFront");
1111 ConfigManager.getInstance().setItem("isInfoViewAlwaysFront", isInfoViewAlwaysFront);
1112
1113 ConfigManager.getInstance().removeItem("selectedResizeType");
1114 ConfigManager.getInstance().setItem("selectedResizeType", selectedResizeType);
1115
1116 ConfigManager.getInstance().removeItem("isCommentFontBold");
1117 ConfigManager.getInstance().setItem("isCommentFontBold", isCommentFontBold);
1118
1119 ConfigManager.getInstance().removeItem("isShowAlwaysNicowariArea");
1120 ConfigManager.getInstance().setItem("isShowAlwaysNicowariArea", isShowAlwaysNicowariArea);
1121
1122 ConfigManager.getInstance().removeItem("isAlwaysEconomyForStreaming");
1123 ConfigManager.getInstance().setItem("isAlwaysEconomyForStreaming", isAlwaysEconomyForStreaming);
1124
1125 ConfigManager.getInstance().removeItem("isHideTagArea");
1126 ConfigManager.getInstance().setItem("isHideTagArea", isHideTagArea);
1127
1128 ConfigManager.getInstance().removeItem("isAppendComment");
1129 ConfigManager.getInstance().setItem("isAppendComment", isAppendComment);
1130
1131 ConfigManager.getInstance().removeItem("isHideSekaShinComment");
1132 ConfigManager.getInstance().setItem("isHideSekaShinComment", isHideSekaShinComment);
1133
1134 ConfigManager.getInstance().removeItem("isShowHTMLOwnerComment");
1135 ConfigManager.getInstance().setItem("isShowHTMLOwnerComment", isShowHTMLOwnerComment);
1136
1137 ConfigManager.getInstance().removeItem("isEnableWideMode");
1138 ConfigManager.getInstance().setItem("isEnableWideMode", isEnableWideMode);
1139
1140 ConfigManager.getInstance().removeItem("relationSortIndex");
1141 ConfigManager.getInstance().setItem("relationSortIndex", relationSortIndex);
1142
1143 ConfigManager.getInstance().removeItem("relationOrderIndex");
1144 ConfigManager.getInstance().setItem("relationSortIndex", relationSortIndex);
1145
1146 ConfigManager.getInstance().removeItem("isNgUpEnable");
1147 ConfigManager.getInstance().setItem("isNgUpEnable", isNgUpEnable);
1148
1149 ConfigManager.getInstance().removeItem("isSmoothing");
1150 ConfigManager.getInstance().setItem("isSmoothing",isSmoothing);
1151
1152 ConfigManager.getInstance().save();
1153
1154 }catch(error:Error){
1155 Alert.show(Message.M_CONF_FILE_IS_BROKEN, Message.M_ERROR);
1156 logManager.addLog(Message.FAIL_SAVE_CONF_FILE_FOR_VIDEO_INFO_VIEW + ":" + Message.M_CONF_FILE_IS_BROKEN + ":" + ConfigManager.getInstance().confFileNativePath + ":" + error);
1157 trace(error.getStackTrace());
1158 }
1159
1160 }
1161
1162 public function resetWindowPosition():void{
1163 // ������������������������������������
1164 try{
1165
1166 // ������������������������������������������������������������
1167 ConfigManager.getInstance().removeItem("controllerWindowPosition_x");
1168 ConfigManager.getInstance().setItem("controllerWindowPosition_x", 0);
1169
1170 ConfigManager.getInstance().removeItem("controllerWindowPosition_y");
1171 ConfigManager.getInstance().setItem("controllerWindowPosition_y", 0);
1172
1173 ConfigManager.getInstance().removeItem("controllerWindowPosition_w");
1174 ConfigManager.getInstance().setItem("controllerWindowPosition_w", 400);
1175
1176 ConfigManager.getInstance().removeItem("controllerWindowPosition_h");
1177 ConfigManager.getInstance().setItem("controllerWindowPosition_h", 580);
1178
1179 ConfigManager.getInstance().save();
1180
1181 this.readStore();
1182
1183 }catch(error:Error){
1184 Alert.show(Message.M_CONF_FILE_IS_BROKEN, Message.M_ERROR);
1185 logManager.addLog(Message.FAIL_SAVE_CONF_FILE_FOR_VIDEO_INFO_VIEW + ":" + Message.M_CONF_FILE_IS_BROKEN + ":" + ConfigManager.getInstance().confFileNativePath + ":" + error);
1186 trace(error.getStackTrace());
1187 }
1188
1189 if(this.nativeWindow != null && !(this as Window).closed){
1190
1191 this.visible = true;
1192
1193 this.nativeWindow.x = 0;
1194 this.nativeWindow.y = 0;
1195
1196 this.width = 380;
1197 this.height = 520;
1198 }
1199 }
1200
1201 /**
1202 *
1203 * @param urlList
1204 * @param videoNameList
1205 * @param playListName
1206 */
1207 public function setPlayList(urlList:Array, videoNameList:Array, playListName:String):void{
1208
1209 this.playListName = playListName;
1210 label_playListTitle_dataProvider = playListName;
1211
1212 for each(var title:String in videoNameList){
1213 playListProvider.addItem(title);
1214 }
1215
1216 for(var index:int = 0; index<urlList.length; index++){
1217 videoUrlMap[videoNameList[index]] = urlList[index];
1218 }
1219
1220 if(this.dataGrid_playList != null){
1221 // (dataGrid_playList as DataGrid).validateDisplayList();
1222 }
1223 }
1224
1225 /**
1226 *
1227 * @param url
1228 * @param title
1229 *
1230 */
1231 public function addPlayListItem(url:String, title:String):void{
1232
1233 videoUrlMap[title] = url;
1234
1235 }
1236
1237 /**
1238 *
1239 * @param url
1240 * @param title
1241 * @param index
1242 *
1243 */
1244 public function addPlayListItemWithList(url:String, title:String, index:int):void{
1245 playListProvider.addItemAt(title,index);
1246
1247 addPlayListItem(url, title);
1248
1249 if(this.dataGrid_playList != null){
1250 (dataGrid_playList as DataGrid).dataProvider = playListProvider;
1251 (dataGrid_playList as DataGrid).validateDisplayList();
1252 }
1253
1254 }
1255
1256
1257 /**
1258 *
1259 * @param title
1260 * @param index
1261 *
1262 */
1263 public function removePlayListItem(index:int):void{
1264 var title:String = String(playListProvider.removeItemAt(index));
1265
1266 //���������������������������������������������������������������
1267 for each(var videoName:String in playListProvider){
1268 if(title == videoName){
1269 //������������������videoUrlMap���������������������
1270 return;
1271 }
1272 }
1273 //���������������������videoUrlMap������������
1274 videoUrlMap[title] = null;
1275
1276 if(this.dataGrid_playList != null){
1277 (dataGrid_playList as DataGrid).dataProvider = playListProvider;
1278 (dataGrid_playList as DataGrid).validateDisplayList();
1279 }
1280 }
1281
1282 /**
1283 *
1284 * @return
1285 *
1286 */
1287 public function getPlayList():Array{
1288 var array:Array = new Array();
1289 for(var i:int = 0; i<playListProvider.length; i++){
1290 array.push(String(playListProvider[i]));
1291 }
1292
1293 var returnArray:Array = new Array();
1294
1295 for each(var title:String in array){
1296 returnArray.push(videoUrlMap[title]);
1297 }
1298
1299 return returnArray;
1300 }
1301
1302 /**
1303 * ���������������������������������������������������������������
1304 * @return
1305 *
1306 */
1307 public function getNameList():Array{
1308 var array:Array = new Array();
1309 for(var i:int = 0; i<playListProvider.length; i++){
1310 array.push(String(playListProvider[i]));
1311 }
1312
1313 return array;
1314 }
1315
1316 /**
1317 *
1318 *
1319 */
1320 public function resetPlayList():void{
1321 this.playListName = "";
1322 if(label_playListTitle != null){
1323 label_playListTitle.text = playListName;
1324 }else{
1325 canvas_videoInfo.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
1326 canvas_playList.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
1327 label_playListTitle.text = playListName;
1328 });
1329 });
1330 }
1331
1332 videoUrlMap = new Object();
1333
1334 playListProvider.removeAll();
1335
1336 if(this.dataGrid_playList != null){
1337 (dataGrid_playList as DataGrid).dataProvider = playListProvider;
1338 (dataGrid_playList as DataGrid).validateDisplayList();
1339 (dataGrid_playList as DataGrid).validateNow();
1340 }
1341 }
1342
1343 /**
1344 * ���������������������������������������������
1345 *
1346 * @details edvakf���������������������������
1347 * @see https://github.com/edvakf/NNDDMOD/commit/6984ba8919727a98c249e1bc8a4848705de27df5
1348 */
1349 public function shufflePlayList():void{
1350 var tempArrayCollection:ArrayCollection = new ArrayCollection();
1351 for each(var object:Object in playListProvider){
1352 tempArrayCollection.addItem(object);
1353 }
1354 var i:int = tempArrayCollection.length;
1355 while (--i) {
1356 var j:int = Math.floor( Math.random() * (i + 1) );
1357 if (i == j) {
1358 continue;
1359 }
1360 var object:Object = tempArrayCollection.getItemAt(i);
1361 tempArrayCollection.setItemAt( tempArrayCollection.getItemAt(j), i );
1362 tempArrayCollection.setItemAt( object, j );
1363 }
1364 playListProvider = tempArrayCollection;
1365 }
1366
1367 /**
1368 *
1369 * @param index
1370 * @return
1371 *
1372 */
1373 public function getPlayListUrl(index:int):String{
1374 var videoTitle:String = playListProvider[index];
1375
1376 return videoUrlMap[videoTitle];
1377 }
1378
1379 /**
1380 *
1381 * @param event
1382 *
1383 */
1384 public function playListDragDropHandler(event:DragEvent):void{
1385 if(event.dragInitiator == dataGrid_playList){
1386
1387 //���������������(������������������������������������������)
1388
1389 }else{
1390
1391 //DataGrid���������Drag������������������������������
1392
1393 if(event.dragInitiator as DataGrid){
1394 var selectedItems:Array = (event.dragInitiator as DataGrid).selectedItems;
1395 var addItems:Array = new Array();
1396
1397 for(var i:int=0; i<selectedItems.length; i++){
1398
1399 //������������������������
1400 var url:String = selectedItems[i].dataGridColumn_videoPath;
1401 if(url == null || url == ""){
1402 //��������������� or ���������videoPath���������������������
1403 url = selectedItems[i].dataGridColumn_nicoVideoUrl;
1404
1405 if(url == null || url == ""){
1406 //������������������������������
1407 url = selectedItems[i].dataGridColumn_videoLocalPath;
1408
1409 if(url == null || url == ""){
1410 //������������������videoLocalPath���������������������
1411 url = selectedItems[i].dataGridColumn_videoUrl;
1412
1413 if(url == null || url == ""){
1414 //������������������������
1415 continue;
1416 }
1417 }
1418 }
1419 }
1420
1421 var title:String = selectedItems[i].dataGridColumn_videoName;
1422 var index:int = title.indexOf("\n");
1423 if(index != -1){
1424 //������������������������������������������������������������������������
1425 title = title.substring(0, index);
1426 }
1427
1428 addItems.push(title);
1429 addPlayListItem(url, title);
1430 }
1431
1432 }
1433
1434 event.dragSource = new DragSource();
1435 event.dragSource.addData(addItems, "items");
1436 }
1437 }
1438
1439 /**
1440 *
1441 * @param event
1442 *
1443 */
1444 public function playListClearButtonClicked(event:MouseEvent):void{
1445 resetPlayList();
1446 }
1447
1448 public function playListShuffleButtonClicked(event:MouseEvent):void{
1449 shufflePlayList();
1450 }
1451
1452 /**
1453 *
1454 * @param event
1455 *
1456 */
1457 public function playListItemDeleteButtonClicked(event:MouseEvent):void{
1458 var selectedIndices:Array = (dataGrid_playList as DataGrid).selectedIndices;
1459
1460 for(var index:int = selectedIndices.length; index != 0; index--){
1461 removePlayListItem(selectedIndices[index-1]);
1462 }
1463 }
1464
1465 /**
1466 *
1467 * @param event
1468 *
1469 */
1470 public function playListSaveButtonClicked(event:MouseEvent):void{
1471 //1.���������������������������������������������������������or���������������
1472 //2.���������������������������������������������
1473 //3.������������������������������������
1474 var urlArray:Array = new Array();
1475 var nameArray:Array = new Array();
1476 for each(var name:String in playListProvider){
1477 urlArray.push(videoUrlMap[name]);
1478 nameArray.push(name);
1479 }
1480
1481 var isExist:Boolean = false;
1482 if(playListName != null){
1483 var playList:PlayList = PlayListManager.instance.isExist(playListName);
1484
1485 if(playList != null){
1486 isExist = true;
1487 }
1488 }
1489
1490 if(!isExist){
1491 // ���������������������������
1492 playerController.addNewPlayList(urlArray, nameArray);
1493 }else{
1494 Application.application.activate();
1495 Alert.show("���������������������������(" + playListName + ")���������������������������\n���������������������������������������������������������������������������������������", Message.M_MESSAGE, Alert.YES | Alert.NO | Alert.CANCEL, null, function(event:CloseEvent):void{
1496 if(event.detail == Alert.YES){
1497 // ���������
1498 playerController.updatePlayList(playListName, urlArray, nameArray);
1499 }else if(event.detail == Alert.NO){
1500 // ���������������tuika
1501 var title:String = playerController.addNewPlayList(urlArray, nameArray);
1502 label_playListTitle_dataProvider = title;
1503 }else{
1504
1505 }
1506 });
1507
1508 }
1509
1510 }
1511
1512 /**
1513 *
1514 * @param index
1515 *
1516 */
1517 public function showPlayingTitle(index:int):void{
1518 if(dataGrid_playList != null){
1519 (dataGrid_playList as DataGrid).scrollToIndex(index);
1520 (dataGrid_playList as DataGrid).selectedIndex = index;
1521 }else{
1522 canvas_playList.addEventListener(FlexEvent.CREATION_COMPLETE, function(event:FlexEvent):void{
1523 (dataGrid_playList as DataGrid).scrollToIndex(index);
1524 (dataGrid_playList as DataGrid).selectedIndex = index;
1525 });
1526 }
1527 }
1528
1529 /**
1530 *
1531 * @param event
1532 *
1533 */
1534 public function tagListDoubleClickEventHandler(event:ListEvent):void{
1535 if(event.itemRenderer.data != null){
1536 if(event.itemRenderer.data is String){
1537 var word:String = String(event.itemRenderer.data);
1538 Application.application.search(new SearchItem(word,
1539 SearchSortString.convertSortTypeFromIndex(4), SearchType.TAG, word));
1540 }
1541 }
1542 }
1543
1544 /**
1545 *
1546 * @param event
1547 *
1548 */
1549 public function button_goToWebClicked(event:Event):void{
1550 this.playerController.watchOnWeb();
1551 }
1552
1553 /**
1554 *
1555 * @param event
1556 *
1557 */
1558 public function tweet(event:Event):void{
1559 this.playerController.tweet();
1560 }
1561
1562 /**
1563 *
1564 * @param event
1565 *
1566 */
1567 public function addHatenaBookmark(event:Event):void{
1568 this.playerController.addHatenaBookmark();
1569 }
1570
1571 /**
1572 *
1573 * @param event
1574 *
1575 */
1576 public function openNicoSound(event:Event):void{
1577 this.playerController.openNicoSound();
1578 }
1579
1580 /**
1581 *
1582 * @param event
1583 *
1584 */
1585 public function openNicomimi(event:Event):void{
1586 this.playerController.openNicomimi();
1587 }
1588
1589 /**
1590 *
1591 * @param event
1592 *
1593 */
1594 public function button_addDownloadList(event:Event):void{
1595
1596 this.playerController.addDlList();
1597
1598 }
1599
1600 /**
1601 *
1602 * @param event
1603 *
1604 */
1605 public function myListAddButtonClicked(event:Event):void{
1606 var selectedItem:Object = comboBox_mylist.selectedItem;
1607
1608 if(selectedItem != null){
1609 var name:String = String(selectedItem);
1610 this.playerController.addMyList(myListMap[name]);
1611
1612 }else{
1613
1614 }
1615 }
1616
1617 /**
1618 *
1619 * @param myListNames
1620 * @param myListNums
1621 *
1622 */
1623 public function setMyLists(myListNames:Array, myListNums:Array):void{
1624
1625 var selectedIndex:int = comboBox_mylist.selectedIndex;
1626 var selectedName:String = myListDataProvider[selectedIndex];
1627
1628 myListDataProvider = new Array();
1629 for(var i:int = 0; i<myListNames.length; i++){
1630 myListMap[myListNames[i]] = myListNums[i];
1631 myListDataProvider[i] = myListNames[i];
1632 if(selectedName == myListDataProvider[i]){
1633 selectedIndex = i;
1634 }
1635 }
1636
1637 comboBox_mylist.dataProvider = myListDataProvider;
1638
1639 if(myListDataProvider.length >= 1){
1640 comboBox_mylist.selectedIndex = 0;
1641 }
1642
1643 comboBox_mylist.validateNow();
1644
1645 if(selectedIndex == -1){
1646 var value:Object = ConfigManager.getInstance().getItem("infoViewSelectedMyListIndex");
1647 if(value != null){
1648 selectedIndex = int(value);
1649 }else{
1650 selectedIndex = 0;
1651 }
1652 }
1653 comboBox_mylist.selectedIndex = selectedIndex;
1654
1655 }
1656
1657 private function ownerTextLinkClicked(event:TextEvent):void{
1658 if(event.text.indexOf("mylist/") != -1){
1659 // trace(event.text);
1660 Application.application.renewMyList(event.text);
1661 }else if(event.text.indexOf("watch/") != -1){
1662 var videoId:String = PathMaker.getVideoID(event.text);
1663 // trace(videoId);
1664 playerController.playMovie("http://www.nicovideo.jp/watch/" + videoId);
1665 }else{
1666 trace(event);
1667 }
1668 }
1669
1670 private function playListReverseButtonClicked(event:Event):void{
1671 var tempArrayCollection:ArrayCollection = new ArrayCollection();
1672
1673 for each(var object:Object in playListProvider){
1674 tempArrayCollection.addItemAt(object, 0);
1675 }
1676
1677 playListProvider = tempArrayCollection;
1678 }
1679
1680 public function get playList():PlayList{
1681 var playList:PlayList = null;
1682
1683 if(getPlayList().length > 0){
1684
1685 playList = new PlayList();
1686
1687 playList.name = playListName;
1688
1689 for(var index:int = 0; index < (getPlayList() as Array).length; index++){
1690 var path:String = getPlayList()[index];
1691 var name:String = getNameList()[index];
1692 var nnddVideo:NNDDVideo = new NNDDVideo(path, name);
1693
1694 playList.items.push(nnddVideo);
1695 }
1696 }
1697
1698 return playList;
1699 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26