void CGUIDialogSmartPlaylistEditor::UpdateRuleControlButtons() { int iSize = m_playlist.m_ruleCombination.m_rules.size(); int iItem = GetSelectedItem(); // only enable the remove control if ... CONTROL_ENABLE_ON_CONDITION(CONTROL_RULE_REMOVE, iSize > 0 && // there is at least one item iItem >= 0 && iItem < iSize && // and a valid item is selected m_playlist.m_ruleCombination.m_rules[iItem]->m_field != FieldNone); // and it is not be empty }
bool CGUIWindowSystemInfo::OnMessage(CGUIMessage& message) { switch (message.GetMessage()) { case GUI_MSG_WINDOW_INIT: { CGUIWindow::OnMessage(message); SET_CONTROL_LABEL(52, CSysInfo::GetAppName() + " " + CSysInfo::GetVersion()); SET_CONTROL_LABEL(53, CSysInfo::GetBuildDate()); CONTROL_ENABLE_ON_CONDITION(CONTROL_BT_PVR, PVR::CPVRManager::GetInstance().IsStarted()); return true; } break; case GUI_MSG_WINDOW_DEINIT: { CGUIWindow::OnMessage(message); m_diskUsage.clear(); return true; } break; case GUI_MSG_FOCUSED: { CGUIWindow::OnMessage(message); int focusedControl = GetFocusedControlID(); if (m_section != focusedControl && focusedControl >= CONTROL_START && focusedControl <= CONTROL_END) { ResetLabels(); m_section = focusedControl; } return true; } break; } return CGUIWindow::OnMessage(message); }
bool CGUIWindowSystemInfo::OnMessage(CGUIMessage& message) { switch ( message.GetMessage() ) { case GUI_MSG_WINDOW_INIT: { CGUIWindow::OnMessage(message); SET_CONTROL_LABEL(52, CSysInfo::GetAppName() + " " + g_infoManager.GetLabel(SYSTEM_BUILD_VERSION).c_str() + " (Compiled: " + g_infoManager.GetLabel(SYSTEM_BUILD_DATE).c_str() +")"); CONTROL_ENABLE_ON_CONDITION(CONTROL_BT_PVR, PVR::CPVRManager::Get().IsStarted()); return true; } break; case GUI_MSG_WINDOW_DEINIT: { CGUIWindow::OnMessage(message); m_diskUsage.clear(); return true; } break; case GUI_MSG_FOCUSED: { CGUIWindow::OnMessage(message); int focusedControl = GetFocusedControlID(); if (m_section != focusedControl && focusedControl >= CONTROL_START && focusedControl <= CONTROL_END) { ResetLabels(); m_section = focusedControl; } return true; } break; } return CGUIWindow::OnMessage(message); }
void CGUIDialogSmartPlaylistEditor::UpdateButtons() { CONTROL_ENABLE(CONTROL_OK); // always enabled since we can have no rules -> match everything (as we do with default partymode playlists) // if there's no rule available, add a dummy one the user can edit if (m_playlist.m_ruleCombination.m_rules.size() <= 0) m_playlist.m_ruleCombination.AddRule(CSmartPlaylistRule()); // name if (m_mode == "partyvideo" || m_mode == "partymusic") { SET_CONTROL_LABEL2(CONTROL_NAME, g_localizeStrings.Get(16035)); CONTROL_DISABLE(CONTROL_NAME); } else SET_CONTROL_LABEL2(CONTROL_NAME, m_playlist.m_playlistName); UpdateRuleControlButtons(); CONTROL_ENABLE_ON_CONDITION(CONTROL_MATCH, m_playlist.m_ruleCombination.m_rules.size() > 1); int currentItem = GetSelectedItem(); CGUIMessage msgReset(GUI_MSG_LABEL_RESET, GetID(), CONTROL_RULE_LIST); OnMessage(msgReset); m_ruleLabels->Clear(); for (unsigned int i = 0; i < m_playlist.m_ruleCombination.m_rules.size(); i++) { CFileItemPtr item(new CFileItem("", false)); if (m_playlist.m_ruleCombination.m_rules[i]->m_field == FieldNone) item->SetLabel(g_localizeStrings.Get(21423)); else item->SetLabel(std::static_pointer_cast<CSmartPlaylistRule>(m_playlist.m_ruleCombination.m_rules[i])->GetLocalizedRule()); m_ruleLabels->Add(item); } CGUIMessage msg(GUI_MSG_LABEL_BIND, GetID(), CONTROL_RULE_LIST, 0, 0, m_ruleLabels); OnMessage(msg); SendMessage(GUI_MSG_ITEM_SELECT, GetID(), CONTROL_RULE_LIST, currentItem); if (m_playlist.m_orderDirection != SortOrderDescending) { CONTROL_SELECT(CONTROL_ORDER_DIRECTION); } else { CONTROL_DESELECT(CONTROL_ORDER_DIRECTION); } // sort out the order fields std::vector< std::pair<std::string, int> > labels; std::vector<SortBy> orders = CSmartPlaylistRule::GetOrders(m_playlist.GetType()); for (unsigned int i = 0; i < orders.size(); i++) labels.push_back(make_pair(g_localizeStrings.Get(SortUtils::GetSortLabel(orders[i])), orders[i])); SET_CONTROL_LABELS(CONTROL_ORDER_FIELD, m_playlist.m_orderField, &labels); // setup groups labels.clear(); std::vector<Field> groups = CSmartPlaylistRule::GetGroups(m_playlist.GetType()); Field currentGroup = CSmartPlaylistRule::TranslateGroup(m_playlist.GetGroup().c_str()); for (unsigned int i = 0; i < groups.size(); i++) labels.push_back(make_pair(CSmartPlaylistRule::GetLocalizedGroup(groups[i]), groups[i])); SET_CONTROL_LABELS(CONTROL_GROUP_BY, currentGroup, &labels); if (m_playlist.IsGroupMixed()) CONTROL_SELECT(CONTROL_GROUP_MIXED); else CONTROL_DESELECT(CONTROL_GROUP_MIXED); // disable the group controls if there's no group // or only one group which can't be mixed if (groups.empty() || (groups.size() == 1 && !CSmartPlaylistRule::CanGroupMix(groups[0]))) { CONTROL_DISABLE(CONTROL_GROUP_BY); CONTROL_DISABLE(CONTROL_GROUP_MIXED); } else { CONTROL_ENABLE(CONTROL_GROUP_BY); CONTROL_ENABLE_ON_CONDITION(CONTROL_GROUP_MIXED, CSmartPlaylistRule::CanGroupMix(currentGroup)); } }
void CGUIDialogPlayEject::FrameMove() { CONTROL_ENABLE_ON_CONDITION(ID_BUTTON_PLAY, g_mediaManager.IsDiscInDrive()); CGUIDialogYesNo::FrameMove(); }
void CGUIDialogNetworkSetup::UpdateButtons() { // Address label BaseSettingControlPtr addressControl = GetSettingControl(SETTING_SERVER_ADDRESS); if (addressControl != NULL && addressControl->GetControl() != NULL) { int addressControlID = addressControl->GetID(); SET_CONTROL_LABEL2(addressControlID, m_server); if (m_protocol == NET_PROTOCOL_SMB) { SET_CONTROL_LABEL(addressControlID, 1010); // Server name } else { SET_CONTROL_LABEL(addressControlID, 1009); // Server Address } SendMessage(GUI_MSG_SET_TYPE, addressControlID, CGUIEditControl::INPUT_TYPE_TEXT, 1016); } // remote path BaseSettingControlPtr pathControl = GetSettingControl(SETTING_REMOTE_PATH); if (pathControl != NULL && pathControl->GetControl() != NULL) { int pathControlID = pathControl->GetID(); SET_CONTROL_LABEL2(pathControlID, m_path); CONTROL_ENABLE_ON_CONDITION(pathControlID, m_protocol != NET_PROTOCOL_UPNP); if (m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_DAV || m_protocol == NET_PROTOCOL_DAVS|| m_protocol == NET_PROTOCOL_SFTP|| m_protocol == NET_PROTOCOL_NFS) { SET_CONTROL_LABEL(pathControlID, 1011); // Remote Path } else { SET_CONTROL_LABEL(pathControlID, 1012); // Shared Folder } SendMessage(GUI_MSG_SET_TYPE, pathControlID, CGUIEditControl::INPUT_TYPE_TEXT, 1017); } // username BaseSettingControlPtr userControl = GetSettingControl(SETTING_USERNAME); if (userControl != NULL && userControl->GetControl() != NULL) { int userControlID = userControl->GetID(); SET_CONTROL_LABEL2(userControlID, m_username); CONTROL_ENABLE_ON_CONDITION(userControlID, m_protocol != NET_PROTOCOL_UPNP && m_protocol != NET_PROTOCOL_NFS); SendMessage(GUI_MSG_SET_TYPE, userControlID, CGUIEditControl::INPUT_TYPE_TEXT, 1019); } // port BaseSettingControlPtr portControl = GetSettingControl(SETTING_PORT_NUMBER); if (portControl != NULL && portControl->GetControl() != NULL) { int portControlID = portControl->GetID(); SET_CONTROL_LABEL2(portControlID, m_port); CONTROL_ENABLE_ON_CONDITION(portControlID, m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_DAV || m_protocol == NET_PROTOCOL_DAVS || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_SFTP); SendMessage(GUI_MSG_SET_TYPE, portControlID, CGUIEditControl::INPUT_TYPE_NUMBER, 1018); } // password BaseSettingControlPtr passControl = GetSettingControl(SETTING_PASSWORD); if (passControl != NULL && passControl->GetControl() != NULL) { int passControlID = passControl->GetID(); SET_CONTROL_LABEL2(passControlID, m_password); CONTROL_ENABLE_ON_CONDITION(passControlID, m_protocol != NET_PROTOCOL_UPNP && m_protocol != NET_PROTOCOL_NFS); SendMessage(GUI_MSG_SET_TYPE, passControlID, CGUIEditControl::INPUT_TYPE_PASSWORD, 12326); } // server browse should be disabled if we are in FTP, HTTP, HTTPS, RSS, DAV or DAVS BaseSettingControlPtr browseControl = GetSettingControl(SETTING_SERVER_BROWSE); if (browseControl != NULL && browseControl->GetControl() != NULL) { int browseControlID = browseControl->GetID(); CONTROL_ENABLE_ON_CONDITION(browseControlID, !m_server.empty() || !(m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_DAV || m_protocol == NET_PROTOCOL_DAVS || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_SFTP)); } }
void CGUIDialogNetworkSetup::UpdateButtons() { // Address label SET_CONTROL_LABEL2(CONTROL_SERVER_ADDRESS, m_server); if (m_protocol == NET_PROTOCOL_SMB) { SET_CONTROL_LABEL(CONTROL_SERVER_ADDRESS, 1010); // Server name } else { SET_CONTROL_LABEL(CONTROL_SERVER_ADDRESS, 1009); // Server Address } if (m_protocol == NET_PROTOCOL_DAAP) SendMessage(GUI_MSG_SET_TYPE, CONTROL_SERVER_ADDRESS, CGUIEditControl::INPUT_TYPE_IPADDRESS, 1016); else SendMessage(GUI_MSG_SET_TYPE, CONTROL_SERVER_ADDRESS, CGUIEditControl::INPUT_TYPE_TEXT, 1016); // remote path SET_CONTROL_LABEL2(CONTROL_REMOTE_PATH, m_path); CONTROL_ENABLE_ON_CONDITION(CONTROL_REMOTE_PATH, m_protocol != NET_PROTOCOL_DAAP && m_protocol != NET_PROTOCOL_UPNP && m_protocol != NET_PROTOCOL_TUXBOX && m_protocol != NET_PROTOCOL_HTSP && m_protocol != NET_PROTOCOL_VTP && m_protocol != NET_PROTOCOL_MYTH); if (m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_DAV || m_protocol == NET_PROTOCOL_DAVS|| m_protocol == NET_PROTOCOL_SFTP|| m_protocol == NET_PROTOCOL_NFS) { SET_CONTROL_LABEL(CONTROL_REMOTE_PATH, 1011); // Remote Path } else { SET_CONTROL_LABEL(CONTROL_REMOTE_PATH, 1012); // Shared Folder } SendMessage(GUI_MSG_SET_TYPE, CONTROL_REMOTE_PATH, CGUIEditControl::INPUT_TYPE_TEXT, 1017); // username SET_CONTROL_LABEL2(CONTROL_USERNAME, m_username); CONTROL_ENABLE_ON_CONDITION(CONTROL_USERNAME, m_protocol != NET_PROTOCOL_DAAP && m_protocol != NET_PROTOCOL_VTP && m_protocol != NET_PROTOCOL_UPNP && m_protocol != NET_PROTOCOL_NFS); SendMessage(GUI_MSG_SET_TYPE, CONTROL_USERNAME, CGUIEditControl::INPUT_TYPE_TEXT, 1019); // port SET_CONTROL_LABEL2(CONTROL_PORT_NUMBER, m_port); CONTROL_ENABLE_ON_CONDITION(CONTROL_PORT_NUMBER, m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_DAV || m_protocol == NET_PROTOCOL_DAVS || m_protocol == NET_PROTOCOL_TUXBOX || m_protocol == NET_PROTOCOL_HTSP || m_protocol == NET_PROTOCOL_VTP || m_protocol == NET_PROTOCOL_MYTH || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_DAAP || m_protocol == NET_PROTOCOL_SFTP); SendMessage(GUI_MSG_SET_TYPE, CONTROL_PORT_NUMBER, CGUIEditControl::INPUT_TYPE_NUMBER, 1018); // password SET_CONTROL_LABEL2(CONTROL_PASSWORD, m_password); CONTROL_ENABLE_ON_CONDITION(CONTROL_PASSWORD, m_protocol != NET_PROTOCOL_DAAP && m_protocol != NET_PROTOCOL_VTP && m_protocol != NET_PROTOCOL_UPNP && m_protocol != NET_PROTOCOL_NFS); SendMessage(GUI_MSG_SET_TYPE, CONTROL_PASSWORD, CGUIEditControl::INPUT_TYPE_PASSWORD, 12326); // TODO: FIX BETTER DAAP SUPPORT // server browse should be disabled if we are in DAAP, FTP, HTTP, HTTPS, RSS, HTSP, VTP, TUXBOX, DAV or DAVS CONTROL_ENABLE_ON_CONDITION(CONTROL_SERVER_BROWSE, !m_server.IsEmpty() || !(m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_DAV || m_protocol == NET_PROTOCOL_DAVS || m_protocol == NET_PROTOCOL_DAAP || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_HTSP || m_protocol == NET_PROTOCOL_VTP || m_protocol == NET_PROTOCOL_MYTH || m_protocol == NET_PROTOCOL_TUXBOX|| m_protocol == NET_PROTOCOL_SFTP || m_protocol == NET_PROTOCOL_AFP)); }