private void OnAspectRatio() { Geometry.Type aspectRatio = Geometry.Type.Normal; using (Settings xmlreader = new MPSettings()) { string aspectRatioText = xmlreader.GetValueAsString("mytv", "defaultar", "Normal"); aspectRatio = Utils.GetAspectRatio(aspectRatioText); } GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(941); // Change aspect ratio dlg.AddLocalizedString(942); // Stretch dlg.AddLocalizedString(943); // Normal dlg.AddLocalizedString(944); // Original dlg.AddLocalizedString(945); // Letterbox dlg.AddLocalizedString(946); // Pan and scan dlg.AddLocalizedString(947); // Zoom dlg.AddLocalizedString(1190); // Zoom 14:9 // set the focus to currently used mode dlg.SelectedLabel = (int)aspectRatio; // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } aspectRatio = Utils.GetAspectRatioByLangID(dlg.SelectedId); using (Settings xmlwriter = new MPSettings()) { string aspectRatioText = Utils.GetAspectRatio(aspectRatio); xmlwriter.SetValue("mytv", "defaultar", aspectRatioText); } }
private void ShowAspectRatioMenu() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(941); // Change aspect ratio dlg.AddLocalizedString(942); // Stretch dlg.AddLocalizedString(943); // Normal dlg.AddLocalizedString(944); // Original dlg.AddLocalizedString(945); // Letterbox dlg.AddLocalizedString(946); // Smart stretch dlg.AddLocalizedString(947); // Zoom dlg.AddLocalizedString(1190); //14:9 // set the focus to currently used mode dlg.SelectedLabel = dlg.IndexOfItem(MediaPortal.Util.Utils.GetAspectRatioLocalizedString(GUIGraphicsContext.ARType)); // show dialog and wait for result // _IsDialogVisible = true; dlg.DoModal(GetID); // _IsDialogVisible = false; if (dlg.SelectedId == -1) { return; } //_timeStatusShowTime = (DateTime.Now.Ticks / 10000); //string strStatus = ""; GUIGraphicsContext.ARType = MediaPortal.Util.Utils.GetAspectRatioByLangID(dlg.SelectedId); //strStatus = GUILocalizeStrings.Get(dlg.SelectedId); //GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LABEL_SET, GetID, 0, (int)Control.LABEL_ROW1, 0, 0, // null); //msg.Label = strStatus; //OnMessage(msg); }
protected override void OnShowContextMenu() { GUIListItem item = GetSelectedItem(); if (item == null) { return; } NewMovie movie = item.AlbumInfoTag as NewMovie; if (movie == null) { return; } GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(498); // Menu dlg.AddLocalizedString(6032); // Search by title if (viewLevel == Utils.ViewLevel.Files) { } else if (movie.Status == Utils.ImporterStatus.COMPLETE) { dlg.AddLocalizedString(368); //IMDB } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } switch (dlg.SelectedId) { case 6032: // Search by title string moviename = movie.SearchTitle; if (moviename == "unknown") { moviename = MediaPortal.Util.Utils.GetFilename(movie.FileName, true); } if (VirtualKeyboard.GetKeyboard(ref moviename, GetID)) { if (!string.IsNullOrEmpty(moviename)) { movie.SearchTitle = moviename; movie.Status = Utils.ImporterStatus.QUEUED_IMDB; if (viewLevel == Utils.ViewLevel.Files) { SetStatus(ref item, movie); } else { item.Label = Translation.IMDBScanning; item.TVTag = Utils.ItemType.Search; SetStatus(ref item); } } } break; case 368: // IMDB ShowInfo(item); break; } }
private void OnClick(int iItem) { m_iSelectedItem = GetSelectedItemNo(); GUIListItem item = GetItem(iItem); if (item == null) { return; } Schedule rec = (Schedule)item.TVTag; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(rec.ProgramName); if (rec.Series == false) { dlg.AddLocalizedString(618); //delete } else { dlg.AddLocalizedString(981); //Delete this recording dlg.AddLocalizedString(982); //Delete series recording dlg.AddLocalizedString(888); //Episodes management } VirtualCard card; TvServer server = new TvServer(); if (server.IsRecordingSchedule(rec.IdSchedule, out card)) { dlg.AddLocalizedString(979); //Play recording from beginning dlg.AddLocalizedString(980); //Play recording from live point } else { IList <TuningDetail> details = Channel.Retrieve(rec.IdChannel).ReferringTuningDetail(); foreach (TuningDetail detail in details) { if (detail.ChannelType == 0) { dlg.AddLocalizedString(882); //Quality settings break; } } } dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 888: ////Episodes management OnSetEpisodesToKeep(rec); break; case 882: OnSetQuality(rec); break; case 981: //Delete this recording only { if (server.IsRecordingSchedule(rec.IdSchedule, out card)) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (null != dlgYesNo) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording? dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped. dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); if (dlgYesNo.IsConfirmed) { server.StopRecordingSchedule(rec.IdSchedule); CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime); rec.Persist(); server.OnNewSchedule(); } } } else { server.StopRecordingSchedule(rec.IdSchedule); CanceledSchedule schedule = new CanceledSchedule(rec.IdSchedule, rec.IdChannel, rec.StartTime); rec.Persist(); server.OnNewSchedule(); } LoadDirectory(); } break; case 982: //Delete series recording goto case 618; case 618: // delete entire recording { if (server.IsRecordingSchedule(rec.IdSchedule, out card)) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (null != dlgYesNo) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording? dlgYesNo.SetLine(1, GUILocalizeStrings.Get(730)); //This schedule is recording. If you delete dlgYesNo.SetLine(2, GUILocalizeStrings.Get(731)); //the schedule then the recording is stopped. dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); if (dlgYesNo.IsConfirmed) { server.StopRecordingSchedule(rec.IdSchedule); rec.Delete(); server.OnNewSchedule(); } } } else { rec.Delete(); server.OnNewSchedule(); } LoadDirectory(); } break; case 979: // Play recording from beginning if (g_Player.Playing && g_Player.IsTVRecording) { g_Player.Stop(true); } //TVHome.IsTVOn = true; TVHome.ViewChannel(rec.ReferencedChannel()); g_Player.SeekAbsolute(0); if (TVHome.Card.IsTimeShifting) { g_Player.ShowFullScreenWindow(); return; } break; case 980: // Play recording from live point //TVHome.IsTVOn = true; TVHome.ViewChannel(rec.ReferencedChannel()); if (TVHome.Card.IsTimeShifting) { if (g_Player.Playing) { g_Player.SeekAsolutePercentage(99); } g_Player.ShowFullScreenWindow(); return; } break; } while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0) { m_iSelectedItem--; } GUIControl.SelectItemControl(GetID, listPriorities.GetID, m_iSelectedItem); }
public static void OnSetQuality(Schedule rec) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(882); dlg.ShowQuickNumbers = true; dlg.AddLocalizedString(968); dlg.AddLocalizedString(965); dlg.AddLocalizedString(966); dlg.AddLocalizedString(967); VIDEOENCODER_BITRATE_MODE _newBitRate = rec.BitRateMode; switch (_newBitRate) { case VIDEOENCODER_BITRATE_MODE.NotSet: dlg.SelectedLabel = 0; break; case VIDEOENCODER_BITRATE_MODE.ConstantBitRate: dlg.SelectedLabel = 1; break; case VIDEOENCODER_BITRATE_MODE.VariableBitRateAverage: dlg.SelectedLabel = 2; break; case VIDEOENCODER_BITRATE_MODE.VariableBitRatePeak: dlg.SelectedLabel = 3; break; } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedLabel) { case 0: // Not Set _newBitRate = VIDEOENCODER_BITRATE_MODE.NotSet; break; case 1: // CBR _newBitRate = VIDEOENCODER_BITRATE_MODE.ConstantBitRate; break; case 2: // VBR _newBitRate = VIDEOENCODER_BITRATE_MODE.VariableBitRateAverage; break; case 3: // VBR Peak _newBitRate = VIDEOENCODER_BITRATE_MODE.VariableBitRatePeak; break; } rec.BitRateMode = _newBitRate; rec.Persist(); dlg.Reset(); dlg.SetHeading(882); dlg.ShowQuickNumbers = true; dlg.AddLocalizedString(968); dlg.AddLocalizedString(886); //Default dlg.AddLocalizedString(993); // Custom dlg.AddLocalizedString(893); //Portable dlg.AddLocalizedString(883); //Low dlg.AddLocalizedString(884); //Medium dlg.AddLocalizedString(885); //High QualityType _newQuality = rec.QualityType; switch (_newQuality) { case QualityType.NotSet: dlg.SelectedLabel = 0; break; case QualityType.Default: dlg.SelectedLabel = 1; break; case QualityType.Custom: dlg.SelectedLabel = 2; break; case QualityType.Portable: dlg.SelectedLabel = 3; break; case QualityType.Low: dlg.SelectedLabel = 4; break; case QualityType.Medium: dlg.SelectedLabel = 5; break; case QualityType.High: dlg.SelectedLabel = 6; break; } dlg.DoModal(GUIWindowManager.ActiveWindow); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedLabel) { case 0: // Not Set _newQuality = QualityType.NotSet; break; case 1: // Default _newQuality = QualityType.Default; break; case 2: // Custom _newQuality = QualityType.Custom; break; case 3: // Protable _newQuality = QualityType.Portable; break; case 4: // Low _newQuality = QualityType.Low; break; case 5: // Medium _newQuality = QualityType.Medium; break; case 6: // High _newQuality = QualityType.High; break; } rec.QualityType = _newQuality; rec.Persist(); } TvServer server = new TvServer(); server.OnNewSchedule(); }
protected override void OnShowSort() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(495); // Sort options // Watch for enums in VideoSort.cs dlg.AddLocalizedString(365); // name dlg.AddLocalizedString(104); // date created (date) dlg.AddLocalizedString(105); // size dlg.AddLocalizedString(366); // year dlg.AddLocalizedString(367); // rating dlg.AddLocalizedString(430); // label dlg.AddLocalizedString(527); // unwatched if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS) { dlg.AddLocalizedString(1221); // date modified dlg.AddLocalizedString(1220); // date created } // set the focus to currently used sort method dlg.SelectedLabel = (int)CurrentSortMethod; // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } CurrentSortAsc = true; switch (dlg.SelectedId) { case 365: CurrentSortMethod = VideoSort.SortMethod.Name; break; case 104: CurrentSortMethod = VideoSort.SortMethod.Date; CurrentSortAsc = false; break; case 1221: CurrentSortMethod = VideoSort.SortMethod.Modified; CurrentSortAsc = false; break; case 1220: CurrentSortMethod = VideoSort.SortMethod.Created; CurrentSortAsc = false; break; case 105: CurrentSortMethod = VideoSort.SortMethod.Size; break; case 366: CurrentSortMethod = VideoSort.SortMethod.Year; break; case 367: CurrentSortMethod = VideoSort.SortMethod.Rating; break; case 430: CurrentSortMethod = VideoSort.SortMethod.Label; break; case 527: CurrentSortMethod = VideoSort.SortMethod.Unwatched; break; default: CurrentSortMethod = VideoSort.SortMethod.Name; break; } OnSort(); GUIControl.FocusControl(GetID, btnSortBy.GetID); }
protected override void OnClicked(int controlId, GUIControl control, global::MediaPortal.GUI.Library.Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); if (control == _programTypeButton) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(467); dlg.Add(Utility.GetLocalizedText(TextId.UpcomingTypeRecordings)); dlg.Add(Utility.GetLocalizedText(TextId.UpcomingTypeAlerts)); dlg.Add(Utility.GetLocalizedText(TextId.UpcomingTypeSuggestions)); switch (_currentProgramType) { case ScheduleType.Recording: dlg.SelectedLabel = 0; break; case ScheduleType.Alert: dlg.SelectedLabel = 1; break; case ScheduleType.Suggestion: dlg.SelectedLabel = 2; break; } // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } switch (dlg.SelectedLabel) { case 0: _currentProgramType = ScheduleType.Recording; break; case 1: _currentProgramType = ScheduleType.Alert; break; case 2: _currentProgramType = ScheduleType.Suggestion; break; } m_iSelectedItem = 0; m_iSelectedItemInFolder = 0; LoadUpcomingPrograms(null); } if (control == _groupBySchedButton) { m_iSelectedItem = 0; m_iSelectedItemInFolder = 0; LoadUpcomingPrograms(null); } if (control == _newProgramButton) { OnNewSchedule(); } if (control == _sortByButton) // sort by { if (!_groupBySchedButton.Selected || _isInSubDirectory) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(495); //Sort Options dlg.AddLocalizedString(620); //channel dlg.AddLocalizedString(621); //date dlg.AddLocalizedString(268); //title // set the focus to currently used sort method dlg.SelectedLabel = (int)_currentSortMethod; // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _currentSortMethod = (SortMethod)dlg.SelectedLabel; } else { //we don't have a time and channel for schedules,so we can only use the title/name sorting. _currentSortMethod = SortMethod.Name; } OnSort(); } if (control == _viewsList) { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, control.GetID, 0, 0, null); OnMessage(msg); int iItem = (int)msg.Param1; if (actionType == Action.ActionType.ACTION_SELECT_ITEM) { OnEditSchedule(iItem); } if (actionType == Action.ActionType.ACTION_SHOW_INFO) { OnShowContextMenu(); } } }
private void OnClick(int iItem) { m_iSelectedItem = GetSelectedItemNo(); GUIListItem item = GetItem(iItem); if (item == null) { return; } if (item.IsFolder) { if (item.Label == "..") { if (selectedItem != null) { selectedItem = null; } LoadDirectory(); return; } if (selectedItem == null) { selectedItem = item; } LoadDirectory(); return; } Schedule schedule = item.TVTag as Schedule; if (schedule == null) { return; } if (schedule.ScheduleType == (int)ScheduleRecordingType.Once) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO); if (null != dlgYesNo) { dlgYesNo.SetHeading(GUILocalizeStrings.Get(653)); //Delete this recording? dlgYesNo.SetLine(1, schedule.ReferencedChannel().DisplayName); dlgYesNo.SetLine(2, schedule.ProgramName); dlgYesNo.SetLine(3, GUILocalizeStrings.Get(732)); //are you sure dlgYesNo.DoModal(GUIWindowManager.ActiveWindow); if (dlgYesNo.IsConfirmed) { if (schedule.ScheduleType == (int)ScheduleRecordingType.Once) { schedule.Delete(); selectedItem = null; } } } } else // advanced recording { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(schedule.ProgramName); dlg.AddLocalizedString(981); //Delete this recording dlg.AddLocalizedString(982); //Delete series recording dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 981: //delete specific series CanceledSchedule canceledSchedule = new CanceledSchedule(schedule.IdSchedule, schedule.IdChannel, schedule.StartTime); canceledSchedule.Persist(); selectedItem = null; TvServer server = new TvServer(); server.OnNewSchedule(); break; case 982: //Delete entire recording schedule.Delete(); selectedItem = null; break; } } } LoadDirectory(); }
protected override void OnShowSort() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } // Sorry for all the fuss with dlg selected index but there is a huge problem with it beacuse // sort methods are in enums and they are not separate per view. Because some sort methods are not // valid for share view we have problem with enums and dlg item index. I sorted out this by two // variables maxCommonSortIndex and dbSortCount but they are need to implement manually on every new // sort added. If there is a better way to handle this (with not meesing too much in code :)) I will // appreciate fix. dlg.Reset(); dlg.SetHeading(495); // Sort options int maxCommonSortIndex = -1; // Inrease by 1 when adding new common sort label(sort valid in share and db views)) int dbSortCount = 0; // increase by one when adding new database sort label // Watch for enums in VideoSort.cs - must be exactly as the enum order // Common sorts - group 1 dlg.AddLocalizedString(365); // 0 name maxCommonSortIndex++; dlg.AddLocalizedString(1309); // 1 nameall maxCommonSortIndex++; dlg.AddLocalizedString(104); // 2 date created (date) maxCommonSortIndex++; dlg.AddLocalizedString(105); // 3 size maxCommonSortIndex++; dlg.AddLocalizedString(527); // 4 watched maxCommonSortIndex++; // Database sorts - group 2 if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEO_TITLE) { dlg.AddLocalizedString(366); // 5 year dbSortCount++; dlg.AddLocalizedString(367); // 6 rating dbSortCount++; } // Share sorts - group 3 if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS) { dlg.AddLocalizedString(430); // 7 CD label dlg.AddLocalizedString(1221); // 8 date modified dlg.AddLocalizedString(1220); // 9 date created } // set the focus to currently used sort method // we need to correct index only if sort method enum is greater then max common sort index in share view if (GUIWindowManager.ActiveWindow == (int)Window.WINDOW_VIDEOS && // must be share view (int)CurrentSortMethod > maxCommonSortIndex) { dlg.SelectedLabel = (int)CurrentSortMethod - dbSortCount; } else { dlg.SelectedLabel = (int)CurrentSortMethod; } // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } CurrentSortAsc = true; switch (dlg.SelectedId) { case 365: CurrentSortMethod = VideoSort.SortMethod.Name; break; case 1309: CurrentSortMethod = VideoSort.SortMethod.NameAll; break; case 104: CurrentSortMethod = VideoSort.SortMethod.Date; CurrentSortAsc = false; break; case 1221: CurrentSortMethod = VideoSort.SortMethod.Modified; CurrentSortAsc = false; break; case 1220: CurrentSortMethod = VideoSort.SortMethod.Created; CurrentSortAsc = false; break; case 105: CurrentSortMethod = VideoSort.SortMethod.Size; break; case 366: CurrentSortMethod = VideoSort.SortMethod.Year; break; case 367: CurrentSortMethod = VideoSort.SortMethod.Rating; break; case 430: CurrentSortMethod = VideoSort.SortMethod.Label; break; case 527: CurrentSortMethod = VideoSort.SortMethod.Watched; break; default: CurrentSortMethod = VideoSort.SortMethod.Name; break; } OnSort(); GUIControl.FocusControl(GetID, btnSortBy.GetID); }
private void OnPlay(int type) { string strHowToPlay = string.Empty; string strType = string.Empty; using (Settings xmlreader = new MPSettings()) { if (type == 2135) // Audio { strType = "autoplay_video"; } if (type == 2134) // Video { strType = "autoplay_audio"; } if (type == 300006) // photo { strType = "autoplay_photo"; } strHowToPlay = xmlreader.GetValueAsString("general", strType, "Ask"); } GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(496)); //Options dlg.AddLocalizedString(208); // Play dlg.AddLocalizedString(300007); // Do not play dlg.AddLocalizedString(300008); // Ask what to do // Set options from config switch (strHowToPlay) { case "Yes": dlg.SelectedLabel = 0; break; case "No": dlg.SelectedLabel = 1; break; case "Ask": dlg.SelectedLabel = 2; break; default: dlg.SelectedLabel = 2; break; } // Show options dlg.DoModal(GetID); if (dlg.SelectedId == -1) { OnAutoPlay(); return; } switch (dlg.SelectedId) { case 208: // Play strHowToPlay = "Yes"; break; case 300007: // Do not play strHowToPlay = "No"; break; case 300008: // Ask what to do strHowToPlay = "Ask"; break; } using (Settings xmlwriter = new MPSettings()) { xmlwriter.SetValue("general", strType, strHowToPlay); } OnAutoPlay(); }
protected override void OnClicked(int controlId, GUIControl control, global::MediaPortal.GUI.Library.Action.ActionType actionType) { base.OnClicked(controlId, control, actionType); if (control == _searchButton) { _selectedTitleIndex = 0; _selectedProgramIndex = 0; if (_rules.Count > 0) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); if (dlgYesNo != null) { dlgYesNo.SetHeading(Utility.GetLocalizedText(TextId.Attention)); dlgYesNo.SetLine(1, Utility.GetLocalizedText(TextId.ContinueWithPrevResults)); dlgYesNo.SetDefaultToYes(true); dlgYesNo.DoModal(GetID); if (!dlgYesNo.IsConfirmed) { _rules.Clear(); if (_viewsList != null && _viewsList.Count > 0) { _viewsList.Clear(); } } } } VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); if (keyboard != null) { keyboard.Reset(); keyboard.IsSearchKeyboard = true; keyboard.Text = String.Empty; keyboard.DoModal(GetID); if (keyboard.IsConfirmed) { if (keyboard.Text == string.Empty) { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); if (dlgOk != null) { dlgOk.SetHeading(Utility.GetLocalizedText(TextId.Information)); dlgOk.SetLine(1, Utility.GetLocalizedText(TextId.NoValidSearchText)); dlgOk.DoModal(GetID); } } else { switch (_currentSearchMethod) { case SearchInMethod.Title: _rules.Add(ScheduleRuleType.TitleContains, keyboard.Text); break; case SearchInMethod.Description: _rules.Add(ScheduleRuleType.DescriptionContains, keyboard.Text); break; case SearchInMethod.ProgramInfo: _rules.Add(ScheduleRuleType.ProgramInfoContains, keyboard.Text); break; case SearchInMethod.Actor: _rules.Add(ScheduleRuleType.WithActor, keyboard.Text); break; case SearchInMethod.DirectedBy: _rules.Add(ScheduleRuleType.DirectedBy, keyboard.Text); break; } ShowSearchResults(string.Empty); } } } } else if (control == _searchMethodButton) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(467); dlg.Add(Utility.GetLocalizedText(TextId.SearchOnTitle)); dlg.Add(Utility.GetLocalizedText(TextId.SearchOnDescription)); dlg.Add(Utility.GetLocalizedText(TextId.SearchOnProgramInfo)); dlg.Add(Utility.GetLocalizedText(TextId.SearchOnActor)); dlg.Add(Utility.GetLocalizedText(TextId.SearchOnDirectedBy)); dlg.SelectedLabel = (int)_currentSearchMethod; // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _currentSearchMethod = (SearchInMethod)(dlg.SelectedLabel); UpdateButtonStates(); } else if (control == _selectChannelsButton) { List <ChannelGroup> groups = new List <ChannelGroup>(PluginMain.Navigator.GetGroups(this._channelType)); ChannelGroup _selectedGroup = new ChannelGroup(); if (groups.Count > 0) { if (groups.Count > 1) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(Utility.GetLocalizedText(TextId.SelectGroup)); foreach (ChannelGroup group in groups) { dlg.Add(group.GroupName); } // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _selectedGroup = groups[dlg.SelectedId - 1]; } else { _selectedGroup = groups[0]; } List <Channel> channels = new List <Channel>(); if (_channelArguments.Count > 0) { List <Channel> channels2 = new List <Channel>(SchedulerAgent.GetChannelsInGroup(_selectedGroup.ChannelGroupId, true)); foreach (Channel channel in channels2) { if (!_channelArguments.Contains(channel.ChannelId)) { channels.Add(channel); } } } else { channels = new List <Channel>(SchedulerAgent.GetChannelsInGroup(_selectedGroup.ChannelGroupId, true)); } if (channels.Count > 0) { GUIDialogMenu dlg2 = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg2 == null) { return; } dlg2.Reset(); dlg2.SetHeading(GetChannelArgumentsString(true)); foreach (Channel channel in channels) { dlg2.Add(channel.DisplayName); } // show dialog and wait for result dlg2.DoModal(GetID); if (dlg2.SelectedId == -1) { return; } _channelArguments.Add(channels[dlg2.SelectedId - 1].ChannelId); UpdateButtonStates(); } else { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); if (dlgOk != null) { dlgOk.SetHeading(Utility.GetLocalizedText(TextId.Information)); dlgOk.SetLine(1, Utility.GetLocalizedText(TextId.NoMoreChannelsToAdd)); dlgOk.DoModal(GetID); } } } } else if (control == _selectCategoriesButton) { List <string> categories = new List <string>(); string[] _categories = new string[0]; _categories = GuideAgent.GetAllCategories(); foreach (string categorie in _categories) { if (!_categorieArguments.Contains(categorie)) { categories.Add(categorie); } } if (categories.Count > 0) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(GetCategorieArgumentString(true)); foreach (string categorie in categories) { dlg.Add(categorie); } // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _categorieArguments.Add(dlg.SelectedLabelText); UpdateButtonStates(); } else { GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK); if (dlgOk != null) { dlgOk.SetHeading(Utility.GetLocalizedText(TextId.Information)); dlgOk.SetLine(1, Utility.GetLocalizedText(TextId.NoMoreCategoriesToAdd)); dlgOk.DoModal(GetID); } } } else if (control == _clearButton) { OnClearRules(true); ShowSearchResults(string.Empty); UpdateButtonStates(); } else if (control == _sortByButton) { if (_isInSubDirectory) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(495); //Sort Options dlg.AddLocalizedString(620); //channel dlg.AddLocalizedString(621); //date dlg.AddLocalizedString(268); //title/name // set the focus to currently used sort method dlg.SelectedLabel = (int)_currentSortMethod; // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _currentSortMethod = (SortMethod)dlg.SelectedLabel; OnSort(); } } else if (control == _viewsList) { GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, control.GetID, 0, 0, null); OnMessage(msg); int iItem = (int)msg.Param1; if (actionType == Action.ActionType.ACTION_SELECT_ITEM) { OnSelectItem(iItem); } if (actionType == Action.ActionType.ACTION_SHOW_INFO) { OnShowContextMenu(); } } }
protected override void OnShowContextMenu() { if (Youtube2MP.NowPlayingEntry == null) { base.OnShowContextMenu(); return; } YouTubeEntry videoEntry = Youtube2MP.NowPlayingEntry; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(Translation.ContextMenu); // menu dlg.AddLocalizedString(941); dlg.AddLocalizedString(970); dlg.Add(Translation.Info); if (Youtube2MP.service.Credentials != null) { dlg.Add(Translation.AddFavorites); } dlg.Add(Translation.DownloadVideo); dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } if (dlg.SelectedLabelText == Translation.Info) { YoutubeGuiInfoEx scr = (YoutubeGuiInfoEx)GUIWindowManager.GetWindow(29053); scr.YouTubeEntry = videoEntry; GUIWindowManager.ActivateWindow(29053); } if (dlg.SelectedLabelText == Translation.AddFavorites) { try { Youtube2MP.service.Insert(new Uri(YouTubeQuery.CreateFavoritesUri(null)), videoEntry); } catch (Exception) { Youtube2MP.Err_message(Translation.WrongRequestWrongUser); } } if (dlg.SelectedLabelText == Translation.DownloadVideo) { LocalFileStruct fil = Youtube2MP._settings.LocalFile.Get(Youtube2MP.GetVideoId(videoEntry)); if (fil != null && File.Exists(fil.LocalFile)) { Youtube2MP.Err_message(Translation.ItemAlreadyDownloaded); } else { if (Youtube2MP.VideoDownloader.IsBusy) { Youtube2MP.Err_message(Translation.AnotherDonwnloadProgress); } else { VideoInfo inf = Youtube2MP.SelectQuality(videoEntry); string streamurl = Youtube2MP.StreamPlaybackUrl(videoEntry, inf); Youtube2MP.VideoDownloader.AsyncDownload(streamurl, Youtube2MP._settings.DownloadFolder + "\\" + Utils.MakeFileName(Utils.GetFilename(videoEntry.Title.Text + "{" + Youtube2MP.GetVideoId(videoEntry) + "}")) + Path.GetExtension(streamurl) + ".___"); GUIPropertyManager.SetProperty("#Youtube.fm.IsDownloading", "true"); GUIPropertyManager.SetProperty("#Youtube.fm.Download.Progress", "0"); GUIPropertyManager.SetProperty("#Youtube.fm.Download.Item", videoEntry.Title.Text); DatabaseProvider.InstanInstance.Save(videoEntry); Youtube2MP.VideoDownloader.Entry = videoEntry; } } } if (dlg.SelectedId == 941) { ShowAspectRatioMenu(); } if (dlg.SelectedId == 970) { GUIWindowManager.IsOsdVisible = false; GUIGraphicsContext.IsFullScreenVideo = false; GUIWindowManager.ShowPreviousWindow(); } }
private void OnVideo() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu if (!_autoDecoderSettings) { dlg.AddLocalizedString(6000); // MPEG2 dlg.AddLocalizedString(6036); // H264 dlg.AddLocalizedString(300212); // VC-1 dlg.AddLocalizedString(300213); // VC-1i dlg.AddLocalizedString(300214); // DivX/Xvid if (_ForceSourceSplitter) { dlg.AddLocalizedString(300215); // Splitter if ((_strSplitterFilter == "File Source (Async.)" || _strSplitterFilter == "File Source (URL)")) { dlg.AddLocalizedString(300216); // FileSplitter } } } dlg.AddLocalizedString(6004); // Aspect Ratio dlg.AddLocalizedString(1029); // Subtitle if (_selectedOption != -1) { dlg.SelectedLabel = _selectedOption; } dlg.DoModal(GetID); // Set Source Splitter check for first init to true. if (btnForceSourceSplitter.Selected && (_strSplitterFilter == "LAV Splitter Source" || _strSplitterFilter == "LAV Splitter")) { btnUseAudioDefaultCheckBox.IsEnabled = true; btnUseSstreamLAVSelection.IsEnabled = true; } else { btnUseAudioDefaultCheckBox.IsEnabled = false; btnUseSstreamLAVSelection.IsEnabled = false; btnUseAudioDefaultCheckBox.Selected = false; btnUseSstreamLAVSelection.Selected = false; } if (dlg.SelectedId == -1) { return; } _selectedOption = dlg.SelectedLabel; switch (dlg.SelectedId) { case 6000: OnVideoCodec(); break; case 6036: OnH264VideoCodec(); break; case 6004: OnAspectRatio(); break; case 1029: OnSubtitle(); break; case 300212: OnVC1(); break; case 300213: OnVC1i(); break; case 300214: OnDivX(); break; case 300215: OnSplitter(); break; case 300216: OnSplitterFilesync(); break; } } }
private void OnVideo() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg != null) { dlg.Reset(); dlg.SetHeading(GUILocalizeStrings.Get(496)); //Menu dlg.AddLocalizedString(6000); // MPEG2 dlg.AddLocalizedString(6036); // H264 dlg.AddLocalizedString(300212); // VC-1 dlg.AddLocalizedString(300213); // VC-1i dlg.AddLocalizedString(300214); // DivX/Xvid dlg.AddLocalizedString(300215); // Splitter dlg.AddLocalizedString(300216); // FileSplitter dlg.AddLocalizedString(6004); // Aspect Ratio dlg.AddLocalizedString(1029); // Subtitle if (_selectedOption != -1) { dlg.SelectedLabel = _selectedOption; } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _selectedOption = dlg.SelectedLabel; switch (dlg.SelectedId) { case 6000: OnVideoCodec(); break; case 6036: OnH264VideoCodec(); break; case 6004: OnAspectRatio(); break; case 1029: OnSubtitle(); break; case 300212: OnVC1(); break; case 300213: OnVC1i(); break; case 300214: OnDivX(); break; case 300215: OnSplitter(); break; case 300216: OnSplitterFilesync(); break; } } }
private void OnKeep() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(1042); dlg.AddLocalizedString(1043); //Until watched dlg.AddLocalizedString(1044); //Until space needed dlg.AddLocalizedString(1045); //Until date dlg.AddLocalizedString(1046); //Always switch ((KeepMethodType)currentProgram.KeepUntil) { case KeepMethodType.UntilWatched: dlg.SelectedLabel = 0; break; case KeepMethodType.UntilSpaceNeeded: dlg.SelectedLabel = 1; break; case KeepMethodType.TillDate: dlg.SelectedLabel = 2; break; case KeepMethodType.Always: dlg.SelectedLabel = 3; break; } dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 1043: currentProgram.KeepUntil = (int)KeepMethodType.UntilWatched; break; case 1044: currentProgram.KeepUntil = (int)KeepMethodType.UntilSpaceNeeded; break; case 1045: currentProgram.KeepUntil = (int)KeepMethodType.TillDate; dlg.Reset(); dlg.ShowQuickNumbers = false; dlg.SetHeading(1045); for (int iDay = 1; iDay <= 100; iDay++) { DateTime dt = currentProgram.StartTime.AddDays(iDay); if (currentProgram.StartTime < DateTime.Now) { dt = DateTime.Now.AddDays(iDay); } dlg.Add(dt.ToLongDateString()); } TimeSpan ts = (currentProgram.KeepUntilDate - currentProgram.StartTime); if (currentProgram.StartTime < DateTime.Now) { ts = (currentProgram.KeepUntilDate - DateTime.Now); } int days = (int)ts.TotalDays; if (days >= 100) { days = 30; } dlg.SelectedLabel = days - 1; dlg.DoModal(GetID); if (dlg.SelectedLabel < 0) { return; } if (currentProgram.StartTime < DateTime.Now) { currentProgram.KeepUntilDate = DateTime.Now.AddDays(dlg.SelectedLabel + 1); } else { currentProgram.KeepUntilDate = currentProgram.StartTime.AddDays(dlg.SelectedLabel + 1); } break; case 1046: currentProgram.KeepUntil = (int)KeepMethodType.Always; break; } currentProgram.Persist(); }
private void OnShowContextMenu(int iItem, bool clicked) { m_iSelectedItem = iItem; GUIListItem item = GetItem(iItem); if (item == null) { return; } if (item.IsFolder && clicked) { bool noitems = false; if (item.Label == "..") { if (selectedItem != null) { selectedItem = null; } LoadDirectory(); return; } if (selectedItem == null) { IList <Schedule> seriesList = TVHome.Util.GetRecordingTimes(item.TVTag as Schedule); if (seriesList.Count < 1) { noitems = true; // no items existing } else { selectedItem = item.TVTag as Schedule; } } if (noitems == false) { LoadDirectory(); return; } } bool showSeries = btnSeries.Selected; Schedule rec = item.TVTag as Schedule; if (rec == null) { return; } Log.Info("OnShowContextMenu: Rec = {0}", rec.ToString()); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(rec.ProgramName); if (showSeries && item.IsFolder) { dlg.AddLocalizedString(982); //Cancel this show (618=delete) dlg.AddLocalizedString(888); //Episodes management } else if (rec.Series == false) { dlg.AddLocalizedString(618); //delete } else { dlg.AddLocalizedString(981); //Cancel this show dlg.AddLocalizedString(982); //Delete this entire recording dlg.AddLocalizedString(888); //Episodes management } VirtualCard card; TvServer server = new TvServer(); bool isRec = Schedule.IsScheduleRecording(rec.IdSchedule); //TVHome.IsRecordingSchedule(rec, null, out card); if (isRec) { dlg.AddLocalizedString(979); //Play recording from beginning dlg.AddLocalizedString(980); //Play recording from live point } //Schedule schedDB = Schedule.Retrieve(rec.IdSchedule); //if (schedDB.ScheduleType != (int)ScheduleRecordingType.Once) //{ dlg.AddLocalizedString(1048); // settings //} dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } bool isSchedRec = TvDatabase.Schedule.IsScheduleRecording(rec.IdSchedule); //TVHome.IsRecordingSchedule(rec, null, out card); string fileName = ""; if (isSchedRec) { bool isCardRec = server.IsRecording(rec.ReferencedChannel().IdChannel, out card); if (isCardRec && card != null) { fileName = card.RecordingFileName; } } Log.Info("recording fname:{0}", fileName); switch (dlg.SelectedId) { case 888: ////Episodes management TvPriorities.OnSetEpisodesToKeep(rec); break; case 1048: ////settings Schedule schedule = item.MusicTag as Schedule; if (schedule == null) { schedule = item.TVTag as Schedule; } if (schedule != null) { TVProgramInfo.CurrentRecording = schedule; GUIWindowManager.ActivateWindow((int)Window.WINDOW_TV_PROGRAM_INFO); } return; case 882: ////Quality settings TvPriorities.OnSetQuality(rec); break; case 981: //Cancel this show { var layer = new TvBusinessLayer(); // get the program that this episode is for var progs = layer.GetPrograms(rec.ReferencedChannel(), rec.StartTime, rec.EndTime); // pick up the schedule that is actually used for recording // see TVUtil.GetRecordingTimes where schedules are all spawend as one off types // and this is what rec is (ie. it does not actually exist in the database) var realSchedule = Schedule.Retrieve(rec.IdParentSchedule) ?? rec; bool res = TVUtil.DeleteRecAndSchedWithPrompt(realSchedule, progs[0]); if (res) { LoadDirectory(); } } break; case 982: //Delete series recording goto case 618; case 618: // delete entire recording { bool res = TVUtil.DeleteRecAndEntireSchedWithPrompt(rec, rec.StartTime); if (res) { if (showSeries && !item.IsFolder) { OnShowContextMenu(0, true); return; } else { LoadDirectory(); } } } break; case 979: // Play recording from beginning { Recording recDB = Recording.Retrieve(fileName); if (recDB != null) { TVUtil.PlayRecording(recDB); } } return; case 980: // Play recording from live point { TVHome.ViewChannelAndCheck(rec.ReferencedChannel()); if (g_Player.Playing) { g_Player.ShowFullScreenWindow(); } /* * g_Player.Stop(); * if (System.IO.File.Exists(fileName)) * { * g_Player.Play(fileName, g_Player.MediaType.Recording); * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.ShowFullScreenWindow(); * return; * } * else * { * string url = server.GetRtspUrlForFile(fileName); * Log.Info("recording url:{0}", url); * if (url.Length > 0) * { * g_Player.Play(url, g_Player.MediaType.Recording); * * if (g_Player.Playing) * { * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.SeekAbsolute(g_Player.Duration); * g_Player.ShowFullScreenWindow(); * return; * } * } * }*/ } break; } while (m_iSelectedItem >= GetItemCount() && m_iSelectedItem > 0) { m_iSelectedItem--; } GUIControl.SelectItemControl(GetID, listSchedules.GetID, m_iSelectedItem); }
// Main folders (drives, net shares) private void OnAddEditFolder() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(496); // Menu dlg.AddLocalizedString(300009); // Name dlg.AddLocalizedString(300058); // Path if (_section == "movies") { if (_globalVideoThumbsEnaled) { dlg.AddLocalizedString(109); // Create thumbs } dlg.AddLocalizedString(300221); // Each folder is movie } //dlg.AddLocalizedString(1374); // layout dlg.AddLocalizedString(300059);// Pin if (_selectedOption != -1) { dlg.SelectedLabel = _selectedOption; } // Show dialog menu dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } _selectedOption = dlg.SelectedLabel; switch (dlg.SelectedId) { case 300009: OnAddName(); break; case 300058: _selectedLabelIndex = -1; OnAddPath(); break; case 109: OnThumb(); break; case 300221: OnMovieFolder(); break; //case 1374: // OnAddLayout(); // break; case 300059: OnAddPin(); break; } }
protected override void OnShowContextMenu() { GUIListItem item = facadeLayout.SelectedListItem; if (item == null) { return; } int itemNo = facadeLayout.SelectedListItemIndex; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(498); // menu dlg.AddLocalizedString(4552); // Play now if (g_Player.Playing && g_Player.IsMusic) { dlg.AddLocalizedString(4551); // Play next } // only offer to queue items if // (a) playlist screen shows now playing list (_playlistIsCurrent is true) OR // (b) playlist screen is showing playlist (not what is playing) but music that is being played // is not from playlist (TEMP playlist is being used) if (_playlistIsCurrent || playlistPlayer.CurrentPlaylistType == PlayListType.PLAYLIST_MUSIC_TEMP) { dlg.AddLocalizedString(1225); // Queue item if (!item.IsFolder) { dlg.AddLocalizedString(1226); // Queue all items } } if (!_playlistIsCurrent) { dlg.AddLocalizedString(926); // add to playlist } dlg.AddLocalizedString(4521); // Show Album Info dlg.AddLocalizedString(4553); // Show playlist if (!item.IsFolder && !item.IsRemote) { Song song = item.AlbumInfoTag as Song; if (song.Id >= 0) { dlg.AddLocalizedString(930); //Add to favorites dlg.AddLocalizedString(931); //Rating } } if (handler.CurrentView == "271") { dlg.AddLocalizedString(718); //Clear top100 } dlg.DoModal(GetID); if (dlg.SelectedLabel == -1) { return; } switch (dlg.SelectedId) { case 4521: // Show album info OnInfo(itemNo); break; case 4552: // Play now (clear playlist, play, and jump to Now playing) AddSelectionToCurrentPlaylist(true, false); break; case 4551: // Play next (insert after current song) InsertSelectionToPlaylist(false); break; case 1225: // queue item at end of current playlist AddSelectionToCurrentPlaylist(false, false); break; case 1226: // queue all items at end of current playlist AddSelectionToCurrentPlaylist(false, true); break; case 926: // add to playlist AddSelectionToPlaylist(); break; //case 136: // show playlist case 4553: // show playlist GUIWindowManager.ActivateWindow((int)Window.WINDOW_MUSIC_PLAYLIST); break; case 930: // add to favorites AddSongToFavorites(item); break; case 931: // Rating OnSetRating(facadeLayout.SelectedListItemIndex); break; case 718: // Clear top 100 m_database.ResetTop100(); LoadDirectory("db_view"); break; } }
protected override void OnShowContextMenu() { GUIListItem item = facadeLayout.SelectedListItem; int itemNo = facadeLayout.SelectedListItemIndex; if (item == null) { return; } GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } IMDBMovie movie = item.AlbumInfoTag as IMDBMovie; if (movie == null) { Dialog_ProtectedContent(dlg); return; } // Actor group view if (handler.CurrentLevelWhere == "actor") { dlg.Reset(); dlg.SetHeading(498); // menu IMDBActor actor = VideoDatabase.GetActorInfo(movie.ActorID); if (actor != null) { dlg.AddLocalizedString(368); //IMDB } if (protectedShares.Count > 0) { if (ageConfirmed) { dlg.AddLocalizedString(1240); //Lock content } else { dlg.AddLocalizedString(1241); //Unlock content } } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } switch (dlg.SelectedId) { case 368: // IMDB OnVideoArtistInfo(actor); break; case 1240: // Protected content case 1241: // Protected content OnContentLock(); break; } return; } // Context menu on folders (Group names) if (movie.ID < 0) { Dialog_ProtectedContent(dlg); return; } // Context menu on movie title dlg.Reset(); dlg.SetHeading(498); // menu if (handler.CurrentLevelWhere == "title") { dlg.AddLocalizedString(368); //IMDB dlg.AddLocalizedString(208); //play dlg.AddLocalizedString(926); //add to playlist dlg.AddLocalizedString(925); //delete } if (protectedShares.Count > 0) { if (ageConfirmed) { dlg.AddLocalizedString(1240); //Lock content } else { dlg.AddLocalizedString(1241); //Unlock content } } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } switch (dlg.SelectedId) { case 925: // Delete OnDeleteItem(item); break; case 368: // IMDB OnInfo(itemNo); break; case 208: // play OnClick(itemNo); break; case 926: //add to playlist OnQueueItem(itemNo); break; case 1240: //Lock content case 1241: //Unlock content OnContentLock(); break; } }
protected override void OnShowContextMenu() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); MusicDatabase dbs; if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(498); // Menu dlg.AddLocalizedString(930); //Add to favorites if (CurrentTrackTag.Album != null) { dlg.AddLocalizedString(33041); } if (PluginManager.IsPluginNameEnabled2("LastFMScrobbler")) { dlg.AddLocalizedString(34010); //last.fm love dlg.AddLocalizedString(34011); //last.fm ban } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } switch (dlg.SelectedId) { case 928: // Find Coverart if (_MusicWindow != null) { string albumFolderPath = Path.GetDirectoryName(CurrentTrackFileName); _MusicWindow.FindCoverArt(false, CurrentTrackTag.Artist, CurrentTrackTag.Album, albumFolderPath, CurrentTrackTag, -1); CurrentThumbFileName = GUIMusicBaseWindow.GetCoverArt(false, CurrentTrackFileName, CurrentTrackTag); if (CurrentThumbFileName.Length > 0) { // let us test if there is a larger cover art image string strLarge = Util.Utils.ConvertToLargeCoverArt(CurrentThumbFileName); if (Util.Utils.FileExistsInCache(strLarge)) { CurrentThumbFileName = strLarge; } AddImageToImagePathContainer(CurrentThumbFileName); UpdateImagePathContainer(); } } break; case 4521: // Show Album Info if (_MusicWindow != null) { string albumFolderPath = Path.GetDirectoryName(CurrentTrackFileName); if (_MusicWindow != null) { _MusicWindow.ShowAlbumInfo(GetID, CurrentTrackTag.Artist, CurrentTrackTag.Album); } } break; case 930: // add to favorites dbs = MusicDatabase.Instance; Song currentSong = new Song(); string strFile = g_Player.Player.CurrentFile; bool songFound = dbs.GetSongByFileName(strFile, ref currentSong); if (songFound) { if (currentSong == null) { return; } if (currentSong.Id < 0) { return; } currentSong.Favorite = true; dbs.SetFavorite(currentSong); } break; case 33041: //Play this album try { if (CurrentTrackTag != null) { dbs = MusicDatabase.Instance; ArrayList albumSongs = new ArrayList(); String strAlbum = CurrentTrackTag.Album; bool albumSongsFound = dbs.GetSongsByAlbum(strAlbum, ref albumSongs); if (albumSongsFound) { for (int i = albumSongs.Count - 1; i >= 0; i--) { Song song = (Song)albumSongs[i]; if (song.Title != CurrentTrackTag.Title && song.Artist == CurrentTrackTag.Artist) { AddSongToPlaylist(ref song); } } OnSongInserted(); } } } catch (Exception ex) { Log.Error("GUIMusicPlayingNow: error while adding album tracks for {0} - {1}", CurrentTrackTag.Album, ex.Message); } break; } }
protected virtual void OnShowViews() { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(499); // Views menu dlg.AddLocalizedString(134); // Shares foreach (ViewDefinition view in handler.Views) { dlg.Add(view.LocalizedName); } bool isVideoWindow = (this.GetID == (int)Window.WINDOW_VIDEOS || this.GetID == (int)Window.WINDOW_VIDEO_TITLE); // set the focus to currently used view if (this.GetID == (int)Window.WINDOW_VIDEOS || this.GetID == (int)Window.WINDOW_MUSIC_FILES) { dlg.SelectedLabel = 0; } else if (this.GetID == (int)Window.WINDOW_VIDEO_TITLE || this.GetID == (int)Window.WINDOW_MUSIC_GENRE) { dlg.SelectedLabel = handler.CurrentViewIndex + 1; } // show dialog and wait for result dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } switch (dlg.SelectedId) { case 134: // Shares { int nNewWindow; if (isVideoWindow) { nNewWindow = (int)Window.WINDOW_VIDEOS; } else { nNewWindow = (int)Window.WINDOW_MUSIC_FILES; } StateBase.StartWindow = nNewWindow; if (nNewWindow != GetID) { if (isVideoWindow) { MediaPortal.GUI.Video.GUIVideoFiles.Reset(); } GUIWindowManager.ReplaceWindow(nNewWindow); } } break; case 4540: // Now playing { int nPlayingNowWindow = (int)Window.WINDOW_MUSIC_PLAYING_NOW; MediaPortal.GUI.Music.GUIMusicPlayingNow guiPlayingNow = (MediaPortal.GUI.Music.GUIMusicPlayingNow)GUIWindowManager.GetWindow(nPlayingNowWindow); if (guiPlayingNow != null) { guiPlayingNow.MusicWindow = (MediaPortal.GUI.Music.GUIMusicBaseWindow) this; GUIWindowManager.ActivateWindow(nPlayingNowWindow); } } break; default: // a db view { ViewDefinition selectedView = (ViewDefinition)handler.Views[dlg.SelectedLabel - 1]; handler.CurrentView = selectedView.Name; StateBase.View = selectedView.Name; int nNewWindow; if (isVideoWindow) { nNewWindow = (int)Window.WINDOW_VIDEO_TITLE; } else { nNewWindow = (int)Window.WINDOW_MUSIC_GENRE; } if (GetID != nNewWindow) { StateBase.StartWindow = nNewWindow; if (nNewWindow != GetID) { GUIWindowManager.ReplaceWindow(nNewWindow); } } else { LoadDirectory(string.Empty); if (facadeLayout.Count <= 0) { GUIControl.FocusControl(GetID, btnLayouts.GetID); } } } break; } }