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

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