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

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