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

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