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

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