void CGUIDialogPVRTimerSettings::AddChannelNames(CFileItemList &channelsList, SETTINGSTRINGS &channelNames, bool bRadio) { g_PVRChannelGroups->GetGroupAll(bRadio)->GetMembers(channelsList); channelNames.push_back("0 dummy"); for (int i = 0; i < channelsList.Size(); i++) { CStdString string; CFileItemPtr item = channelsList[i]; const CPVRChannel *channel = item->GetPVRChannelInfoTag(); string.Format("%i %s", channel->ChannelNumber(), channel->ChannelName().c_str()); channelNames.push_back(string); } int iControl = bRadio ? CONTROL_TMR_CHNAME_RADIO : CONTROL_TMR_CHNAME_TV; AddSpin(iControl, 19078, &m_timerItem->GetPVRTimerInfoTag()->m_iChannelNumber, channelNames.size(), channelNames); EnableSettings(iControl, m_timerItem->GetPVRTimerInfoTag()->m_bIsRadio == bRadio); }
void CGUIDialogPVRTimerSettings::CreateSettings() { CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag(); // clear out any old settings m_settings.clear(); // create our settings controls m_bTimerActive = tag->IsActive(); AddBool(CONTROL_TMR_ACTIVE, 19074, &m_bTimerActive); AddButton(CONTROL_TMR_NAME, 19075, &tag->m_strTitle, true); if (tag->SupportsFolders()) AddButton(CONTROL_TMR_DIR, 19076, &tag->m_strDirectory, true); AddBool(CONTROL_TMR_RADIO, 19077, &tag->m_bIsRadio); /// Channel names { // For TV CFileItemList channelslist_tv; SETTINGSTRINGS channelstrings_tv; AddChannelNames(channelslist_tv, channelstrings_tv, false); // For Radio CFileItemList channelslist_radio; SETTINGSTRINGS channelstrings_radio; AddChannelNames(channelslist_radio, channelstrings_radio, true); } /// Day { SETTINGSTRINGS daystrings; tm time_cur; tm time_tmr; for (unsigned int iDayPtr = 19086; iDayPtr <= 19096; iDayPtr++) daystrings.push_back(g_localizeStrings.Get(iDayPtr)); CDateTime time = CDateTime::GetCurrentDateTime(); CDateTime timestart = tag->StartAsLocalTime(); /* get diffence of timer in days between today and timer start date */ time.GetAsTm(time_cur); timestart.GetAsTm(time_tmr); m_tmp_day += time_tmr.tm_yday - time_cur.tm_yday; if (time_tmr.tm_yday - time_cur.tm_yday < 0) m_tmp_day += 365; for (int i = 1; i < 365; ++i) { CStdString string = time.GetAsLocalizedDate(); daystrings.push_back(string); time += CDateTimeSpan(1, 0, 0, 0); } SetWeekdaySettingFromTimer(*tag); AddSpin(CONTROL_TMR_DAY, 19079, &m_tmp_day, daystrings.size(), daystrings); } AddButton(CONTROL_TMR_BEGIN, 19080, &timerStartTimeStr, true); AddButton(CONTROL_TMR_END, 19081, &timerEndTimeStr, true); AddSpin(CONTROL_TMR_PRIORITY, 19082, &tag->m_iPriority, 0, 99); AddSpin(CONTROL_TMR_LIFETIME, 19083, &tag->m_iLifetime, 0, 365); /// First day { SETTINGSTRINGS daystrings; tm time_cur; tm time_tmr; CDateTime time = CDateTime::GetCurrentDateTime(); CDateTime timestart = tag->FirstDayAsLocalTime(); /* get diffence of timer in days between today and timer start date */ if (time < timestart) { time.GetAsTm(time_cur); timestart.GetAsTm(time_tmr); m_tmp_iFirstDay += time_tmr.tm_yday - time_cur.tm_yday + 1; if (time_tmr.tm_yday - time_cur.tm_yday < 0) m_tmp_iFirstDay += 365; } daystrings.push_back(g_localizeStrings.Get(19030)); for (int i = 1; i < 365; ++i) { CStdString string = time.GetAsLocalizedDate(); daystrings.push_back(string); time += CDateTimeSpan(1, 0, 0, 0); } AddSpin(CONTROL_TMR_FIRST_DAY, 19084, &m_tmp_iFirstDay, daystrings.size(), daystrings); if (tag->m_bIsRepeating) EnableSettings(CONTROL_TMR_FIRST_DAY, true); else EnableSettings(CONTROL_TMR_FIRST_DAY, false); } }
void CGUIDialogPVRTimerSettings::CreateSettings() { CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag(); // clear out any old settings m_settings.clear(); // create our settings controls AddBool(CONTROL_TMR_ACTIVE, 19074, &tag->m_bIsActive); AddButton(CONTROL_TMR_NAME, 19075, &tag->m_strTitle, true); AddBool(CONTROL_TMR_RADIO, 19077, &tag->m_bIsRadio); /// Channel names { // For TV CFileItemList channelslist_tv; SETTINGSTRINGS channelstrings_tv; CPVRManager::GetChannelGroups()->GetGroupAll(false)->GetMembers(&channelslist_tv); channelstrings_tv.push_back("0 dummy"); for (int i = 0; i < channelslist_tv.Size(); i++) { CStdString string; CFileItemPtr item = channelslist_tv[i]; string.Format("%i %s", item->GetPVRChannelInfoTag()->ChannelNumber(), item->GetPVRChannelInfoTag()->ChannelName().c_str()); channelstrings_tv.push_back(string); } AddSpin(CONTROL_TMR_CHNAME_TV, 19078, &tag->m_iChannelNumber, channelstrings_tv.size(), channelstrings_tv); EnableSettings(CONTROL_TMR_CHNAME_TV, !tag->m_bIsRadio); // For Radio CFileItemList channelslist_radio; SETTINGSTRINGS channelstrings_radio; CPVRManager::GetChannelGroups()->GetGroupAll(true)->GetMembers(&channelslist_radio); channelstrings_radio.push_back("0 dummy"); for (int i = 0; i < channelslist_radio.Size(); i++) { CStdString string; CFileItemPtr item = channelslist_radio[i]; string.Format("%i %s", item->GetPVRChannelInfoTag()->ChannelNumber(), item->GetPVRChannelInfoTag()->ChannelName().c_str()); channelstrings_radio.push_back(string); } AddSpin(CONTROL_TMR_CHNAME_RADIO, 19078, &tag->m_iChannelNumber, channelstrings_radio.size(), channelstrings_radio); EnableSettings(CONTROL_TMR_CHNAME_RADIO, tag->m_bIsRadio); } /// Day { SETTINGSTRINGS daystrings; tm time_cur; tm time_tmr; daystrings.push_back(g_localizeStrings.Get(19086)); daystrings.push_back(g_localizeStrings.Get(19087)); daystrings.push_back(g_localizeStrings.Get(19088)); daystrings.push_back(g_localizeStrings.Get(19089)); daystrings.push_back(g_localizeStrings.Get(19090)); daystrings.push_back(g_localizeStrings.Get(19091)); daystrings.push_back(g_localizeStrings.Get(19092)); daystrings.push_back(g_localizeStrings.Get(19093)); daystrings.push_back(g_localizeStrings.Get(19094)); daystrings.push_back(g_localizeStrings.Get(19095)); daystrings.push_back(g_localizeStrings.Get(19096)); CDateTime time = CDateTime::GetCurrentDateTime(); CDateTime timestart = tag->StartAsLocalTime(); /* get diffence of timer in days between today and timer start date */ time.GetAsTm(time_cur); timestart.GetAsTm(time_tmr); if (time_tmr.tm_yday - time_cur.tm_yday >= 0) m_tmp_day += time_tmr.tm_yday - time_cur.tm_yday; else m_tmp_day += time_tmr.tm_yday - time_cur.tm_yday + 365; for (int i = 1; i < 365; ++i) { CStdString string = time.GetAsLocalizedDate(); daystrings.push_back(string); time += CDateTimeSpan(1, 0, 0, 0); } if (tag->m_bIsRepeating) { if (tag->m_iWeekdays == 0x01) m_tmp_day = 0; else if (tag->m_iWeekdays == 0x02) m_tmp_day = 1; else if (tag->m_iWeekdays == 0x04) m_tmp_day = 2; else if (tag->m_iWeekdays == 0x08) m_tmp_day = 3; else if (tag->m_iWeekdays == 0x10) m_tmp_day = 4; else if (tag->m_iWeekdays == 0x20) m_tmp_day = 5; else if (tag->m_iWeekdays == 0x40) m_tmp_day = 6; else if (tag->m_iWeekdays == 0x1F) m_tmp_day = 7; else if (tag->m_iWeekdays == 0x3F) m_tmp_day = 8; else if (tag->m_iWeekdays == 0x7F) m_tmp_day = 9; else if (tag->m_iWeekdays == 0x60) m_tmp_day = 10; } AddSpin(CONTROL_TMR_DAY, 19079, &m_tmp_day, daystrings.size(), daystrings); } AddButton(CONTROL_TMR_BEGIN, 19080, &timerStartTimeStr, true); AddButton(CONTROL_TMR_END, 19081, &timerEndTimeStr, true); AddSpin(CONTROL_TMR_PRIORITY, 19082, &tag->m_iPriority, 0, 99); AddSpin(CONTROL_TMR_LIFETIME, 19083, &tag->m_iLifetime, 0, 365); /// First day { SETTINGSTRINGS daystrings; tm time_cur; tm time_tmr; CDateTime time = CDateTime::GetCurrentDateTime(); CDateTime timestart = tag->FirstDayAsLocalTime(); /* get diffence of timer in days between today and timer start date */ if (time < timestart) { time.GetAsTm(time_cur); timestart.GetAsTm(time_tmr); if (time_tmr.tm_yday - time_cur.tm_yday >= 0) { m_tmp_iFirstDay += time_tmr.tm_yday - time_cur.tm_yday + 1; } else { m_tmp_iFirstDay += time_tmr.tm_yday - time_cur.tm_yday + 365 + 1; } } daystrings.push_back(g_localizeStrings.Get(19030)); for (int i = 1; i < 365; ++i) { CStdString string = time.GetAsLocalizedDate(); daystrings.push_back(string); time += CDateTimeSpan(1, 0, 0, 0); } AddSpin(CONTROL_TMR_FIRST_DAY, 19084, &m_tmp_iFirstDay, daystrings.size(), daystrings); if (tag->m_bIsRepeating) EnableSettings(CONTROL_TMR_FIRST_DAY, true); else EnableSettings(CONTROL_TMR_FIRST_DAY, false); } }