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

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