Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /NNDDv2/trunk/src/org/mineap/nndd/view/VideoInfoView.as

Parent Directory Parent Directory | Revision Log Revision Log


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

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