void MythBurn::toggleUseCutlist(void) { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); ArchiveItem *a = qVariantValue<ArchiveItem *>(item->GetData()); if (!a) return; if (!a->hasCutlist) return; a->useCutlist = !a->useCutlist; if (a->hasCutlist) { if (a->useCutlist) { item->SetText(tr("Using Cutlist"), "cutlist"); item->DisplayState("using", "cutliststatus"); } else { item->SetText(tr("Not Using Cutlist"), "cutlist"); item->DisplayState("notusing", "cutliststatus"); } } else { item->SetText(tr("No Cut List"), "cutlist"); item->DisplayState("none", "cutliststatus"); } recalcItemSize(a); updateSizeBar(); }
void Ripper::updateTrackList(void) { if (m_tracks->isEmpty()) return; QString tmptitle; if (m_trackList) { m_trackList->Reset(); int i; for (i = 0; i < (int)m_tracks->size(); i++) { if (i >= m_tracks->size()) break; RipTrack *track = m_tracks->at(i); Metadata *metadata = track->metadata; MythUIButtonListItem *item = new MythUIButtonListItem(m_trackList,""); item->setCheckable(true); item->SetData(qVariantFromValue(track)); if (track->isNew) item->DisplayState("new", "yes"); else item->DisplayState("new", "no"); if (track->active) item->setChecked(MythUIButtonListItem::FullChecked); else item->setChecked(MythUIButtonListItem::NotChecked); item->SetText(QString::number(metadata->Track()), "track"); item->SetText(metadata->Title(), "title"); item->SetText(metadata->Artist(), "artist"); int length = track->length / 1000; if (length > 0) { int min, sec; min = length / 60; sec = length % 60; QString s; s.sprintf("%02d:%02d", min, sec); item->SetText(s, "length"); } else item->SetText("", "length"); // if (i == m_currentTrack) // m_trackList->SetItemCurrent(i); } } }
void StreamView::updateStreamList(void) { m_streamList->Reset(); bool foundActiveStream = false; for (int x = 0; x < gPlayer->getPlaylist()->getSongs().count(); x++) { Metadata *mdata = gPlayer->getPlaylist()->getSongs().at(x); MythUIButtonListItem *item = new MythUIButtonListItem(m_streamList, "", qVariantFromValue(mdata)); MetadataMap metadataMap; if (mdata) mdata->toMap(metadataMap); item->SetTextFromMap(metadataMap); item->SetText("", "imageloaded"); item->SetFontState("normal"); item->DisplayState("default", "playstate"); // if this is the current radio stream update its play state to match the player if (gPlayer->getCurrentMetadata() && mdata->ID() == gPlayer->getCurrentMetadata()->ID()) { if (gPlayer->isPlaying()) { item->SetFontState("running"); item->DisplayState("playing", "playstate"); } else if (gPlayer->isPaused()) { item->SetFontState("idle"); item->DisplayState("paused", "playstate"); } else { item->SetFontState("normal"); item->DisplayState("stopped", "playstate"); } m_streamList->SetItemCurrent(item); foundActiveStream = true; } } if (m_streamList->GetCount() > 0 && !foundActiveStream) { m_streamList->SetItemCurrent(0); gPlayer->stop(true); } if (m_noStreams) m_noStreams->SetVisible((m_streamList->GetCount() == 0)); if (m_streamList->GetCount() == 0) LOG(VB_GENERAL, LOG_ERR, "StreamView hasn't found any streams!"); }
void BackendSelection::AddItem(DeviceLocation *dev) { if (!dev) return; QString USN = dev->m_sUSN; m_mutex.lock(); // The devices' USN should be unique. Don't add if it is already there: if (m_devices.find(USN) == m_devices.end()) { dev->AddRef(); m_devices.insert(USN, dev); m_mutex.unlock(); InfoMap infomap; dev->GetDeviceDetail(infomap, true); // We only want the version number, not the library version info infomap["version"] = infomap["modelnumber"].section('.', 0, 1); MythUIButtonListItem *item; item = new MythUIButtonListItem(m_backendList, infomap["modelname"], qVariantFromValue(dev)); item->SetTextFromMap(infomap); bool protoMatch = (infomap["protocolversion"] == MYTH_PROTO_VERSION); QString status = "good"; if (!protoMatch) status = "protocolmismatch"; // TODO: Not foolproof but if we can't get device details then it's // probably because we could not connect to port 6544 - firewall? // Maybe we can replace this with a more specific check if (infomap["modelname"].isEmpty()) status = "blocked"; item->DisplayState(status, "connection"); bool needPin = dev->NeedSecurityPin(); item->DisplayState(needPin ? "yes" : "no", "securitypin"); } else m_mutex.unlock(); dev->Release(); }
void ChannelRecPriority::updateList() { m_channelList->Reset(); QMap<QString, ChannelInfo*>::Iterator it; MythUIButtonListItem *item; for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it) { ChannelInfo *chanInfo = *it; item = new MythUIButtonListItem(m_channelList, "", qVariantFromValue(chanInfo)); QString fontState = "default"; if (!m_visMap[chanInfo->chanid]) fontState = "disabled"; QString stringFormat = item->GetText(); if (stringFormat.isEmpty()) stringFormat = "<num> <sign> \"<name>\""; item->SetText(chanInfo->GetFormatted(stringFormat), fontState); item->SetText(chanInfo->chanstr, "channum", fontState); item->SetText(chanInfo->callsign, "callsign", fontState); item->SetText(chanInfo->channame, "name", fontState); item->SetText(QString().setNum(chanInfo->sourceid), "sourceid", fontState); item->SetText(chanInfo->sourcename, "sourcename", fontState); if (m_visMap[chanInfo->chanid]) item->DisplayState("normal", "status"); else item->DisplayState("disabled", "status"); item->SetImage(chanInfo->iconpath, "icon"); item->SetImage(chanInfo->iconpath); item->SetText(chanInfo->recpriority, "priority", fontState); if (m_currentItem == chanInfo) m_channelList->SetItemCurrent(item); } MythUIText *norecordingText = dynamic_cast<MythUIText*> (GetChild("norecordings_info")); if (norecordingText) norecordingText->SetVisible(m_channelData.isEmpty()); }
void BookmarkManager::UpdateURLList(void) { m_bookmarkList->Reset(); if (m_messageText) m_messageText->SetVisible((m_siteList.count() == 0)); MythUIButtonListItem *item = m_groupList->GetItemCurrent(); if (!item) return; QString group = item->GetText(); for (int x = 0; x < m_siteList.count(); x++) { Bookmark *site = m_siteList.at(x); if (group == site->category) { MythUIButtonListItem *item = new MythUIButtonListItem( m_bookmarkList, "", "", true, MythUIButtonListItem::NotChecked); item->SetText(site->name, "name"); item->SetText(site->url, "url"); if (site->isHomepage) item->DisplayState("yes", "homepage"); item->SetData(qVariantFromValue(site)); item->setChecked(site->selected ? MythUIButtonListItem::FullChecked : MythUIButtonListItem::NotChecked); } } }
void ProgFinder::updateTimesList() { InfoMap infoMap; m_timesList->Reset(); if (m_showData.size() > 0) { QString itemText; QDateTime starttime; for (uint i = 0; i < m_showData.size(); ++i) { starttime = m_showData[i]->GetScheduledStartTime(); itemText = MythDateTimeToString(starttime, kDateTimeFull | kSimplify); MythUIButtonListItem *item = new MythUIButtonListItem(m_timesList, ""); m_showData[i]->ToMap(infoMap); item->SetTextFromMap(infoMap); QString state = toUIState(m_showData[i]->GetRecordingStatus()); item->SetText(itemText, "buttontext", state); item->DisplayState(state, "status"); } } }
void StatusBox::Init() { MythUIButtonListItem *item; item = new MythUIButtonListItem(m_categoryList, tr("Listings Status"), qVariantFromValue((void*)SLOT(doListingsStatus()))); item->DisplayState("listings", "icon"); item = new MythUIButtonListItem(m_categoryList, tr("Schedule Status"), qVariantFromValue((void*)SLOT(doScheduleStatus()))); item->DisplayState("schedule", "icon"); item = new MythUIButtonListItem(m_categoryList, tr("Tuner Status"), qVariantFromValue((void*)SLOT(doTunerStatus()))); item->DisplayState("tuner", "icon"); item = new MythUIButtonListItem(m_categoryList, tr("Log Entries"), qVariantFromValue((void*)SLOT(doLogEntries()))); item->DisplayState("log", "icon"); item = new MythUIButtonListItem(m_categoryList, tr("Job Queue"), qVariantFromValue((void*)SLOT(doJobQueueStatus()))); item->DisplayState("jobqueue", "icon"); item = new MythUIButtonListItem(m_categoryList, tr("Machine Status"), qVariantFromValue((void*)SLOT(doMachineStatus()))); item->DisplayState("machine", "icon"); item = new MythUIButtonListItem(m_categoryList, tr("AutoExpire List"), qVariantFromValue((void*)SLOT(doAutoExpireList()))); item->DisplayState("autoexpire", "icon"); int itemCurrent = gCoreContext->GetNumSetting("StatusBoxItemCurrent", 0); m_categoryList->SetItemCurrent(itemCurrent); }
void ChannelRecPriority::updateList() { m_channelList->Reset(); QMap<QString, ChannelInfo*>::Iterator it; MythUIButtonListItem *item; for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it) { ChannelInfo *chanInfo = *it; item = new MythUIButtonListItem(m_channelList, "", qVariantFromValue(chanInfo)); QString fontState = "default"; if (!m_visMap[chanInfo->chanid]) fontState = "disabled"; item->SetText(chanInfo->GetFormatted(ChannelInfo::kChannelLong), fontState); InfoMap infomap; chanInfo->ToMap(infomap); item->SetTextFromMap(infomap, fontState); if (m_visMap[chanInfo->chanid]) item->DisplayState("normal", "status"); else item->DisplayState("disabled", "status"); item->SetImage(chanInfo->iconpath, "icon"); item->SetImage(chanInfo->iconpath); item->SetText(chanInfo->recpriority, "priority", fontState); if (m_currentItem == chanInfo) m_channelList->SetItemCurrent(item); } MythUIText *norecordingText = dynamic_cast<MythUIText*> (GetChild("norecordings_info")); if (norecordingText) norecordingText->SetVisible(m_channelData.isEmpty()); }
void ProgramRecPriority::deactivate(void) { MythUIButtonListItem *item = m_programList->GetItemCurrent(); if (!item) return; ProgramRecPriorityInfo *pgRecInfo = item->GetData().value<ProgramRecPriorityInfo*>(); if (pgRecInfo) { MSqlQuery query(MSqlQuery::InitCon()); query.prepare("SELECT inactive " "FROM record " "WHERE recordid = :RECID"); query.bindValue(":RECID", pgRecInfo->GetRecordingRuleID()); if (!query.exec()) { MythDB::DBError("ProgramRecPriority::deactivate()", query); } else if (query.next()) { int inactive = query.value(0).toInt(); if (inactive) inactive = 0; else inactive = 1; query.prepare("UPDATE record " "SET inactive = :INACTIVE " "WHERE recordid = :RECID"); query.bindValue(":INACTIVE", inactive); query.bindValue(":RECID", pgRecInfo->GetRecordingRuleID()); if (!query.exec()) { MythDB::DBError( "Update recording schedule inactive query", query); } else { ScheduledRecording::ReschedulePlace( QString("DeactivateRule %1 %2") .arg(pgRecInfo->GetRecordingRuleID()) .arg(pgRecInfo->GetTitle())); pgRecInfo->recstatus = inactive ? RecStatus::Inactive : RecStatus::Unknown; item->DisplayState("disabled", "status"); } } } }
void ProgLister::UpdateButtonList(void) { ProgramList::const_iterator it = m_itemList.begin(); for (; it != m_itemList.end(); ++it) { MythUIButtonListItem *item = new MythUIButtonListItem( m_progList, "", qVariantFromValue(*it)); InfoMap infoMap; (**it).ToMap(infoMap); QString state = toUIState((**it).GetRecordingStatus()); if ((state == "warning") && (plPreviouslyRecorded == m_type)) state = "disabled"; item->SetTextFromMap(infoMap, state); if (m_type == plTitle) { QString tempSubTitle = (**it).GetSubtitle(); if (tempSubTitle.trimmed().isEmpty()) tempSubTitle = (**it).GetTitle(); item->SetText(tempSubTitle, "titlesubtitle", state); } item->DisplayState( QString::number((**it).GetStars(10)), "ratingstate"); item->DisplayState(state, "status"); } if (m_positionText) { m_positionText->SetText( tr("%1 of %2", "Current position in list where %1 is the " "position, %2 is the total count") .arg(m_progList->GetCurrentPos()) .arg(m_progList->GetCount())); } }
void ChannelRecPriority::updateList() { m_channelList->Reset(); QMap<QString, ChannelInfo*>::Iterator it; for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it) { ChannelInfo *chanInfo = *it; MythUIButtonListItem *item = new MythUIButtonListItem(m_channelList, "", qVariantFromValue(chanInfo)); QString fontState = "default"; item->SetText(chanInfo->GetFormatted(ChannelInfo::kChannelLong), fontState); InfoMap infomap; chanInfo->ToMap(infomap); item->SetTextFromMap(infomap, fontState); item->DisplayState("normal", "status"); if (!chanInfo->icon.isEmpty()) { QString iconUrl = gCoreContext->GetMasterHostPrefix("ChannelIcons", chanInfo->icon); item->SetImage(iconUrl, "icon"); item->SetImage(iconUrl); } item->SetText(QString::number(chanInfo->recpriority), "priority", fontState); if (m_currentItem == chanInfo) m_channelList->SetItemCurrent(item); } // this textarea name is depreciated use 'nochannels_warning' instead MythUIText *noChannelsText = dynamic_cast<MythUIText*>(GetChild("norecordings_info")); if (!noChannelsText) noChannelsText = dynamic_cast<MythUIText*>(GetChild("nochannels_warning")); if (noChannelsText) noChannelsText->SetVisible(m_channelData.isEmpty()); }
void EditAlbumartDialog::updateImageGrid(void) { AlbumArtList *albumArtList = m_albumArt->getImageList(); m_coverartList->Reset(); for (int x = 0; x < albumArtList->size(); x++) { MythUIButtonListItem *item = new MythUIButtonListItem(m_coverartList, AlbumArtImages::getTypeName(albumArtList->at(x)->imageType), qVariantFromValue(albumArtList->at(x))); item->SetImage(albumArtList->at(x)->filename); QString state = albumArtList->at(x)->embedded ? "tag" : "file"; item->DisplayState(state, "locationstate"); } }
void ViewScheduleDiff::updateUIList(void) { for (uint i = 0; i < m_recList.size(); i++) { class ProgramStruct s = m_recList[i]; class ProgramInfo *pginfo = s.after; if (!pginfo) pginfo = s.before; MythUIButtonListItem *item = new MythUIButtonListItem( m_conflictList, "", qVariantFromValue(pginfo)); InfoMap infoMap; pginfo->ToMap(infoMap); QString state = toUIState(pginfo->GetRecordingStatus()); item->DisplayState(state, "status"); item->SetTextFromMap(infoMap, state); if (s.before) item->SetText(toString(s.before->GetRecordingStatus(), s.before->GetCardID()), "statusbefore", state); else item->SetText("-", "statusbefore"); if (s.after) item->SetText(toString(s.after->GetRecordingStatus(), s.after->GetCardID()), "statusafter", state); else item->SetText("-", "statusafter"); } if (m_noChangesText) { if (m_recList.empty()) m_noChangesText->Show(); else m_noChangesText->Hide(); } }
MythUIButtonListItem* StatusBox::AddLogLine(const QString & line, const QString & help, const QString & detail, const QString & helpdetail, const QString & state, const QString & data) { LogLine logline; logline.line = line; if (detail.isEmpty()) logline.detail = line; else logline.detail = detail; if (help.isEmpty()) logline.help = logline.detail; else logline.help = help; if (helpdetail.isEmpty()) logline.helpdetail = logline.detail; else logline.helpdetail = helpdetail; logline.state = state; logline.data = data; MythUIButtonListItem *item = new MythUIButtonListItem(m_logList, line, qVariantFromValue(logline)); if (logline.state.isEmpty()) logline.state = "normal"; item->SetFontState(logline.state); item->DisplayState(logline.state, "status"); item->SetText(logline.detail, "detail"); return item; }
/** \brief Create a new MythThemedButton based on the MythThemedMenuState * m_state and the type, text, alt-text and action provided in * the parameters. * * \param type type of button to be created * \param text text to appear on the button * \param alttext alternate text to appear when required * \param action actions to be associated with button */ void MythThemedMenu::addButton(const QString &type, const QString &text, const QString &alttext, const QStringList &action, const QString &description, const QString &password) { ThemedButton newbutton; newbutton.type = type; newbutton.action = action; newbutton.text = text; newbutton.description = description; newbutton.password = password; if (m_watermarkState) m_watermarkState->EnsureStateLoaded(type); MythUIButtonListItem *listbuttonitem = new MythUIButtonListItem(m_buttonList, text, qVariantFromValue(newbutton)); listbuttonitem->DisplayState(type, "icon"); listbuttonitem->SetText(description, "description"); }
void ThemeChooser::Init(void) { QString curTheme = gCoreContext->GetSetting("Theme"); ThemeInfo *themeinfo = NULL; ThemeInfo *curThemeInfo = NULL; MythUIButtonListItem *item = NULL; m_themes->Reset(); for( QFileInfoList::iterator it = m_infoList.begin(); it != m_infoList.end(); ++it ) { QFileInfo &theme = *it; if (!m_themeFileNameInfos.contains(theme.filePath())) continue; themeinfo = m_themeFileNameInfos[theme.filePath()]; if (!themeinfo) continue; QString buttonText = QString("%1 %2.%3") .arg(themeinfo->GetName()) .arg(themeinfo->GetMajorVersion()) .arg(themeinfo->GetMinorVersion()); item = new MythUIButtonListItem(m_themes, buttonText); if (item) { if (themeinfo->GetDownloadURL().isEmpty()) item->DisplayState("local", "themelocation"); else item->DisplayState("remote", "themelocation"); item->DisplayState(themeinfo->GetAspect(), "aspectstate"); item->DisplayState(m_themeStatuses[themeinfo->GetName()], "themestatus"); QHash<QString, QString> infomap; themeinfo->ToMap(infomap); item->SetTextFromMap(infomap); item->SetData(qVariantFromValue(themeinfo)); QString thumbnail = themeinfo->GetPreviewPath(); QFileInfo fInfo(thumbnail); // Downloadable themeinfos have thumbnail copies of their preview images if (!themeinfo->GetDownloadURL().isEmpty()) thumbnail = thumbnail.append(".thumb.jpg"); item->SetImage(thumbnail); if (curTheme == themeinfo->GetDirectoryName()) curThemeInfo = themeinfo; } else delete item; } SetFocusWidget(m_themes); if (curThemeInfo) m_themes->SetValueByData(qVariantFromValue(curThemeInfo)); MythUIButtonListItem *current = m_themes->GetItemCurrent(); if (current) itemChanged(current); }
void ProgramRecPriority::UpdateList() { if (!m_currentItem && !m_programList->IsEmpty()) m_currentItem = m_programList->GetItemCurrent()->GetData() .value<ProgramRecPriorityInfo*>(); m_programList->Reset(); vector<ProgramRecPriorityInfo*>::iterator it; MythUIButtonListItem *item; for (it = m_sortedProgram.begin(); it != m_sortedProgram.end(); ++it) { ProgramRecPriorityInfo *progInfo = *it; item = new MythUIButtonListItem(m_programList, "", qVariantFromValue(progInfo)); int progRecPriority = progInfo->GetRecordingPriority(); if ((progInfo->rectype == kSingleRecord || progInfo->rectype == kOverrideRecord || progInfo->rectype == kDontRecord) && !(progInfo->GetSubtitle()).trimmed().isEmpty()) { QString rating = QString::number(progInfo->GetStars(10)); item->DisplayState(rating, "ratingstate"); } else progInfo->subtitle.clear(); QString state; if (progInfo->recType == kDontRecord || (progInfo->recType != kTemplateRecord && progInfo->recstatus == RecStatus::Inactive)) state = "disabled"; else if (m_conMatch[progInfo->GetRecordingRuleID()] > 0) state = "error"; else if (m_recMatch[progInfo->GetRecordingRuleID()] > 0 || progInfo->recType == kTemplateRecord) state = "normal"; else if (m_nowMatch[progInfo->GetRecordingRuleID()] > 0) state = "running"; else state = "warning"; InfoMap infoMap; progInfo->ToMap(infoMap); item->SetTextFromMap(infoMap, state); QString subtitle; if (progInfo->subtitle != "(null)" && (progInfo->rectype == kSingleRecord || progInfo->rectype == kOverrideRecord || progInfo->rectype == kDontRecord)) { subtitle = progInfo->subtitle; } QString matchInfo; if (progInfo->GetRecordingStatus() == RecStatus::Inactive) { matchInfo = QString("%1 %2") .arg(m_listMatch[progInfo->GetRecordingRuleID()]) .arg(RecStatus::toString(progInfo->GetRecordingStatus(), progInfo->GetRecordingRuleType())); } else matchInfo = tr("Recording %1 of %2") .arg(m_recMatch[progInfo->GetRecordingRuleID()]) .arg(m_listMatch[progInfo->GetRecordingRuleID()]); subtitle = QString("(%1) %2").arg(matchInfo).arg(subtitle); item->SetText(subtitle, "scheduleinfo", state); item->SetText(QString::number(progRecPriority), "progpriority", state); item->SetText(QString::number(progRecPriority), "finalpriority", state); item->SetText(QString::number(progRecPriority), "recpriority", state); item->SetText(QString::number(progRecPriority), "recpriorityB", state); QString tempDateTime = MythDate::toString(progInfo->last_record, MythDate::kDateTimeFull | MythDate::kSimplify | MythDate::kAddYear); item->SetText(tempDateTime, "lastrecorded", state); QString tempDate = MythDate::toString(progInfo->last_record, MythDate::kDateFull | MythDate::kSimplify | MythDate::kAddYear); item->SetText(tempDate, "lastrecordeddate", state); QString tempTime = MythDate::toString( progInfo->last_record, MythDate::kTime); item->SetText(tempTime, "lastrecordedtime", state); QString channame = progInfo->channame; QString channum = progInfo->chanstr; QString callsign = progInfo->chansign; if (progInfo->recType != kSingleRecord && progInfo->recType != kOverrideRecord && progInfo->recType != kDontRecord && !(progInfo->GetRecordingRule()->m_filter & 1024) && progInfo->GetRecordingRule()->m_searchType != kManualSearch) { channame = tr("Any"); channum = tr("Any"); callsign = tr("Any"); } item->SetText(channame, "channel", state); item->SetText(channum, "channum", state); item->SetText(callsign, "callsign", state); QString profile = progInfo->profile; if ((profile == "Default") || (profile == "Live TV") || (profile == "High Quality") || (profile == "Low Quality")) profile = tr(profile.toUtf8().constData()); item->SetText(profile, "recordingprofile", state); item->DisplayState(state, "status"); if (m_currentItem == progInfo) m_programList->SetItemCurrent(item); } m_currentItem = NULL; MythUIText *norecordingText = dynamic_cast<MythUIText*> (GetChild("norecordings_info")); if (norecordingText) norecordingText->SetVisible(m_programData.isEmpty()); }
void SearchView::customEvent(QEvent *event) { bool handled = false; if (event->type() == MusicPlayerEvent::TrackRemovedEvent || event->type() == MusicPlayerEvent::TrackAddedEvent) { MusicPlayerEvent *mpe = dynamic_cast<MusicPlayerEvent *>(event); if (!mpe) return; int trackID = mpe->TrackID; for (int x = 0; x < m_tracksList->GetCount(); x++) { MythUIButtonListItem *item = m_tracksList->GetItemAt(x); MusicMetadata *mdata = qVariantValue<MusicMetadata*> (item->GetData()); if (mdata && (mdata->ID() == (MusicMetadata::IdType) trackID || trackID == -1)) { if (gPlayer->getCurrentPlaylist() && gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID())) item->DisplayState("on", "selectedstate"); else item->DisplayState("off", "selectedstate"); } } // call the default handler in MusicCommon so the playlist and UI is updated MusicCommon::customEvent(event); handled = true; if (m_playTrack) { m_playTrack = false; if (event->type() == MusicPlayerEvent::TrackAddedEvent) { // make the added track current and play it m_currentPlaylist->SetItemCurrent(m_currentPlaylist->GetCount() - 1); playlistItemClicked(m_currentPlaylist->GetItemCurrent()); } } } else if (event->type() == MusicPlayerEvent::AllTracksRemovedEvent) { for (int x = 0; x < m_tracksList->GetCount(); x++) { MythUIButtonListItem *item = m_tracksList->GetItemAt(x); if (item) item->DisplayState("off", "selectedstate"); } } else if (event->type() == MusicPlayerEvent::MetadataChangedEvent) { MusicPlayerEvent *mpe = dynamic_cast<MusicPlayerEvent *>(event); if (!mpe) return; uint trackID = mpe->TrackID; for (int x = 0; x < m_tracksList->GetCount(); x++) { MythUIButtonListItem *item = m_tracksList->GetItemAt(x); MusicMetadata *mdata = qVariantValue<MusicMetadata*> (item->GetData()); if (mdata && mdata->ID() == trackID) { InfoMap metadataMap; mdata->toMap(metadataMap); item->SetTextFromMap(metadataMap); } } // if (trackID == gPlayer->getCurrentMetadata()->ID()) // updateTrackInfo(gPlayer->getCurrentMetadata()); } else if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = static_cast<DialogCompletionEvent *>(event); // make sure the user didn't ESCAPE out of the menu if (dce->GetResult() < 0) return; QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); if (resultid == "searchviewmenu") { if (resulttext == tr("Add To Playlist") || resulttext == tr("Remove From Playlist")) { if (GetFocusWidget() == m_tracksList) { MythUIButtonListItem *item = m_tracksList->GetItemCurrent(); if (item) { m_playTrack = false; trackClicked(item); } } } else if (resulttext == tr("Add To Playlist And Play")) { if (GetFocusWidget() == m_tracksList) { MythUIButtonListItem *item = m_tracksList->GetItemCurrent(); if (item) { m_playTrack = true; trackClicked(item); } } } else if (resulttext == tr("Search List...")) searchButtonList(); } } if (!handled) MusicCommon::customEvent(event); }
void ViewScheduled::FillList() { m_schedulesList->Reset(); MythUIText *norecordingText = dynamic_cast<MythUIText*> (GetChild("norecordings_info")); if (norecordingText) norecordingText->SetVisible(m_recList.empty()); if (m_recList.empty()) return; ProgramList plist; if (!m_recgroupList.contains(m_currentGroup)) m_currentGroup = m_defaultGroup; plist = m_recgroupList[m_currentGroup]; ProgramList::iterator pit = plist.begin(); while (pit != plist.end()) { ProgramInfo *pginfo = *pit; if (!pginfo) { ++pit; continue; } QString state; const RecStatusType recstatus = pginfo->GetRecordingStatus(); if (recstatus == rsRecording) state = "running"; else if (recstatus == rsConflict || recstatus == rsOffLine || recstatus == rsTunerBusy || recstatus == rsFailed || recstatus == rsAborted || recstatus == rsMissed) state = "error"; else if (recstatus == rsWillRecord) { if ((m_curcard == 0 && m_curinput == 0) || pginfo->GetCardID() == m_curcard || pginfo->GetInputID() == m_curinput) { if (pginfo->GetRecordingPriority2() < 0) state = "warning"; else state = "normal"; } } else if (recstatus == rsRepeat || recstatus == rsOtherShowing || recstatus == rsNeverRecord || recstatus == rsDontRecord || (recstatus != rsDontRecord && recstatus <= rsEarlierShowing)) state = "disabled"; else state = "warning"; MythUIButtonListItem *item = new MythUIButtonListItem(m_schedulesList,"", qVariantFromValue(pginfo)); InfoMap infoMap; pginfo->ToMap(infoMap); item->SetTextFromMap(infoMap, state); QString rating = QString::number(pginfo->GetStars(10)); item->DisplayState(rating, "ratingstate"); item->DisplayState(state, "status"); ++pit; } MythUIText *statusText = dynamic_cast<MythUIText*>(GetChild("status")); if (statusText) { if (m_conflictBool) { // Find first conflict and store in m_conflictDate field ProgramList::const_iterator it = plist.begin(); for (; it != plist.end(); ++it) { ProgramInfo &p = **it; if (p.GetRecordingStatus() == rsConflict) { m_conflictDate = p.GetRecordingStartTime().date(); break; } } // figure out caption based on m_conflictDate QString cstring = tr("Time Conflict"); QDate now = QDate::currentDate(); int daysToConflict = now.daysTo(m_conflictDate); if (daysToConflict == 0) cstring = tr("Conflict Today"); else if (daysToConflict > 0) cstring = QString(tr("Conflict %1")) .arg(m_conflictDate.toString(m_dateFormat)); statusText->SetText(cstring); } else statusText->SetText(tr("No Conflicts")); } MythUIText *filterText = dynamic_cast<MythUIText*>(GetChild("filter")); if (filterText) { if (m_showAll) filterText->SetText(tr("All")); else filterText->SetText(tr("Important")); } }
void SearchView::updateTracksList(void) { m_tracksList->Reset(); MythUIButtonListItem *item = m_fieldList->GetItemCurrent(); if (!item) return; QString searchStr = m_criteriaEdit->GetText(); int field = item->GetData().toInt(); QString sql; MSqlQuery query(MSqlQuery::InitCon()); if (searchStr.isEmpty()) { sql = "SELECT song_id " "FROM music_songs "; query.prepare(sql); } else { switch(field) { case 1: // artist { sql = "SELECT song_id " "FROM music_songs " "LEFT JOIN music_artists ON " " music_songs.artist_id=music_artists.artist_id " "WHERE music_artists.artist_name LIKE '%" + searchStr + "%' "; query.prepare(sql); break; } case 2: // album { sql = "SELECT song_id " "FROM music_songs " "LEFT JOIN music_albums ON music_songs.album_id=music_albums.album_id " "WHERE music_albums.album_name LIKE '%" + searchStr + "%' "; query.prepare(sql); break; } case 3: // title { sql = "SELECT song_id " "FROM music_songs " "WHERE music_songs.name LIKE '%" + searchStr + "%' "; query.prepare(sql); break; } case 4: // genre { sql = "SELECT song_id " "FROM music_songs " "LEFT JOIN music_genres ON music_songs.genre_id=music_genres.genre_id " "WHERE music_genres.genre LIKE '%" + searchStr + "%' "; query.prepare(sql); break; } case 5: // tags { //TODO add tag query } case 0: // all fields default: { sql = "SELECT song_id " "FROM music_songs " "LEFT JOIN music_artists ON " " music_songs.artist_id=music_artists.artist_id " "LEFT JOIN music_albums ON music_songs.album_id=music_albums.album_id " "LEFT JOIN music_artists AS music_comp_artists ON " " music_albums.artist_id=music_comp_artists.artist_id " "LEFT JOIN music_genres ON music_songs.genre_id=music_genres.genre_id " "WHERE music_songs.name LIKE '%" + searchStr + "%' " "OR music_artists.artist_name LIKE '%" + searchStr + "%' " "OR music_albums.album_name LIKE '%" + searchStr + "%' " "OR music_genres.genre LIKE '%" + searchStr + "%' "; query.prepare(sql); } } } if (!query.exec() || !query.isActive()) { MythDB::DBError("Search music database", query); return; } while (query.next()) { int trackid = query.value(0).toInt(); MusicMetadata *mdata = gMusicData->all_music->getMetadata(trackid); if (mdata) { MythUIButtonListItem *newitem = new MythUIButtonListItem(m_tracksList, ""); newitem->SetData(qVariantFromValue(mdata)); InfoMap metadataMap; mdata->toMap(metadataMap); newitem->SetTextFromMap(metadataMap); if (gPlayer->getCurrentPlaylist() && gPlayer->getCurrentPlaylist()->checkTrack(mdata->ID())) newitem->DisplayState("on", "selectedstate"); else newitem->DisplayState("off", "selectedstate"); // TODO rating state etc } } trackVisible(m_tracksList->GetItemCurrent()); if (m_matchesText) m_matchesText->SetText(QString("%1").arg(m_tracksList->GetCount())); }
void MythBurn::updateArchiveList(void) { QString message = tr("Retrieving File Information. Please Wait..."); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUIBusyDialog *busyPopup = new MythUIBusyDialog(message, popupStack, "mythburnbusydialog"); if (busyPopup->Create()) popupStack->AddScreen(busyPopup, false); else { delete busyPopup; busyPopup = NULL; } qApp->processEvents(); m_archiveButtonList->Reset(); if (m_archiveList.size() == 0) { m_nofilesText->Show(); } else { ArchiveItem *a; for (int x = 0; x < m_archiveList.size(); x++) { qApp->processEvents(); a = m_archiveList.at(x); // get duration of this file if (a->duration == 0) getFileDetails(a); // get default encoding profile if needed if (a->encoderProfile == NULL) a->encoderProfile = getDefaultProfile(a); recalcItemSize(a); MythUIButtonListItem* item = new MythUIButtonListItem(m_archiveButtonList, a->title); item->SetData(qVariantFromValue(a)); item->SetText(a->subtitle, "subtitle"); item->SetText(a->startDate + " " + a->startTime, "date"); item->SetText(formatSize(a->newsize / 1024, 2), "size"); if (a->hasCutlist) { if (a->useCutlist) { item->SetText(tr("Using Cutlist"), "cutlist"); item->DisplayState("using", "cutliststatus"); } else { item->SetText(tr("Not Using Cutlist"), "cutlist"); item->DisplayState("notusing", "cutliststatus"); } } else { item->SetText(tr("No Cut List"), "cutlist"); item->DisplayState("none", "cutliststatus"); } item->SetText(tr("Encoder: ") + a->encoderProfile->name, "profile"); } m_nofilesText->Hide(); m_archiveButtonList->SetItemCurrent( m_archiveButtonList->GetItemFirst()); } updateSizeBar(); if (busyPopup) busyPopup->Close(); }
void ViewScheduled::FillList() { m_schedulesList->Reset(); MythUIText *norecordingText = dynamic_cast<MythUIText*> (GetChild("norecordings_info")); if (norecordingText) norecordingText->SetVisible(m_recList.empty()); if (m_recList.empty()) return; ProgramList plist; if (!m_recgroupList.contains(m_currentGroup)) m_currentGroup = m_defaultGroup; plist = m_recgroupList[m_currentGroup]; ProgramList::iterator pit = plist.begin(); while (pit != plist.end()) { ProgramInfo *pginfo = *pit; if (!pginfo) { ++pit; continue; } QString state; const RecStatus::Type recstatus = pginfo->GetRecordingStatus(); if (recstatus == RecStatus::Recording || recstatus == RecStatus::Tuning) state = "running"; else if (recstatus == RecStatus::Conflict || recstatus == RecStatus::Offline || recstatus == RecStatus::TunerBusy || recstatus == RecStatus::Failed || recstatus == RecStatus::Failing || recstatus == RecStatus::Aborted || recstatus == RecStatus::Missed) state = "error"; else if (recstatus == RecStatus::WillRecord || recstatus == RecStatus::Pending) { if (m_curinput == 0 || pginfo->GetInputID() == m_curinput) { if (pginfo->GetRecordingPriority2() < 0) state = "warning"; else state = "normal"; } } else if (recstatus == RecStatus::Repeat || recstatus == RecStatus::NeverRecord || recstatus == RecStatus::DontRecord || (recstatus != RecStatus::DontRecord && recstatus <= RecStatus::EarlierShowing)) state = "disabled"; else state = "warning"; MythUIButtonListItem *item = new MythUIButtonListItem(m_schedulesList,"", qVariantFromValue(pginfo)); InfoMap infoMap; pginfo->ToMap(infoMap); item->SetTextFromMap(infoMap, state); QString rating = QString::number(pginfo->GetStars(10)); item->DisplayState(rating, "ratingstate"); item->DisplayState(state, "status"); ++pit; } MythUIText *statusText = dynamic_cast<MythUIText*>(GetChild("status")); if (statusText) { if (m_conflictBool) { // Find first conflict and store in m_conflictDate field ProgramList::const_iterator it = plist.begin(); for (; it != plist.end(); ++it) { ProgramInfo &p = **it; if (p.GetRecordingStatus() == RecStatus::Conflict) { m_conflictDate = p.GetRecordingStartTime() .toLocalTime().date(); break; } } // TODO: This can be templated instead of hardcoding // Conflict/No Conflict QString cstring = tr("Conflict %1") .arg(MythDate::toString(m_conflictDate, MythDate::kDateFull | MythDate::kSimplify)); statusText->SetText(cstring); } else statusText->SetText(tr("No Conflicts")); } MythUIText *filterText = dynamic_cast<MythUIText*>(GetChild("filter")); if (filterText) { if (m_showAll) filterText->SetText(tr("All")); else filterText->SetText(tr("Important")); } }
void ChannelEditor::fillList(void) { QString currentValue = m_channelList->GetValue(); uint currentIndex = qMax(m_channelList->GetCurrentPos(), 0); m_channelList->Reset(); QString newchanlabel = tr("(Add New Channel)"); MythUIButtonListItem *item = new MythUIButtonListItem(m_channelList, ""); item->SetText(newchanlabel, "compoundname"); item->SetText(newchanlabel, "name"); bool fAllSources = true; QString querystr = "SELECT channel.name,channum,chanid,callsign,icon," "visible ,videosource.name FROM channel " "LEFT JOIN videosource ON " "(channel.sourceid = videosource.sourceid) "; if (m_sourceFilter == FILTER_ALL) { fAllSources = true; } else { querystr += QString(" WHERE channel.sourceid='%1' ") .arg(m_sourceFilter); fAllSources = false; } if (m_currentSortMode == tr("Channel Name")) { querystr += " ORDER BY channel.name"; } else if (m_currentSortMode == tr("Channel Number")) { querystr += " ORDER BY channum + 0"; } MSqlQuery query(MSqlQuery::InitCon()); query.prepare(querystr); uint selidx = 0, idx = 1; if (query.exec() && query.size() > 0) { for (; query.next() ; idx++) { QString name = query.value(0).toString(); QString channum = query.value(1).toString(); QString chanid = query.value(2).toString(); QString callsign = query.value(3).toString(); QString icon = query.value(4).toString(); bool visible = query.value(5).toBool(); QString sourceid = "Unassigned"; QString state = "normal"; if (!visible) state = "disabled"; if (!query.value(6).toString().isEmpty()) { sourceid = query.value(6).toString(); if (fAllSources && m_sourceFilter == FILTER_UNASSIGNED) continue; } else state = "warning"; if (channum.isEmpty() && m_currentHideMode) continue; if (name.isEmpty()) name = "(Unnamed : " + chanid + ")"; QString compoundname = name; if (m_currentSortMode == tr("Channel Name")) { if (!channum.isEmpty()) compoundname += " (" + channum + ")"; } else if (m_currentSortMode == tr("Channel Number")) { if (!channum.isEmpty()) compoundname = channum + ". " + compoundname; else compoundname = "???. " + compoundname; } if (m_sourceFilter == FILTER_ALL) compoundname += " (" + sourceid + ")"; bool sel = (chanid == currentValue); selidx = (sel) ? idx : selidx; item = new MythUIButtonListItem(m_channelList, "", qVariantFromValue(chanid)); item->SetText(compoundname, "compoundname"); item->SetText(name, "name"); item->SetText(channum, "channum"); item->SetText(chanid, "chanid"); item->SetText(callsign, "callsign"); item->SetText(sourceid, "sourcename"); item->SetImage(icon); item->SetImage(icon, "icon"); item->DisplayState(state, "status"); } } // Make sure we select the current item, or the following one after // deletion, with wrap around to "(New Channel)" after deleting last item. m_channelList->SetItemCurrent((!selidx && currentIndex < idx) ? currentIndex : selidx); }
void IconView::LoadDirectory(const QString &dir) { if (m_thumbGen && m_thumbGen->isRunning()) m_thumbGen->cancel(); if (m_childCountThread && m_childCountThread->isRunning()) m_childCountThread->cancel(); QDir d(dir); if (!d.exists()) { LOG(VB_GENERAL, LOG_ERR, LOC + "LoadDirectory called with " + QString("non-existant directory: '%1'").arg(dir)); return; } m_showDevices = false; m_currDir = d.absolutePath(); while (!m_itemList.isEmpty()) delete m_itemList.takeFirst(); m_itemHash.clear(); m_imageList->Reset(); m_isGallery = GalleryUtil::LoadDirectory(m_itemList, dir, *m_galleryFilter, false, &m_itemHash, m_thumbGen); if (m_thumbGen && !m_thumbGen->isRunning()) m_thumbGen->start(); ThumbItem *thumbitem; for (int x = 0; x < m_itemList.size(); x++) { thumbitem = m_itemList.at(x); thumbitem->InitCaption(m_showcaption); MythUIButtonListItem* item = new MythUIButtonListItem(m_imageList, thumbitem->GetCaption(), 0, true, MythUIButtonListItem::NotChecked); item->SetData(qVariantFromValue(thumbitem)); if (thumbitem->IsDir()) { item->DisplayState("subfolder", "nodetype"); m_childCountThread->addFile(thumbitem->GetPath()); } LoadThumbnail(thumbitem); if (QFile(thumbitem->GetImageFilename()).exists()) item->SetImage(thumbitem->GetImageFilename()); if (m_itemMarked.contains(thumbitem->GetPath())) item->setChecked(MythUIButtonListItem::FullChecked); } if (m_childCountThread && !m_childCountThread->isRunning()) m_childCountThread->start(); if (m_noImagesText) m_noImagesText->SetVisible(m_itemList.isEmpty()); if (!m_itemList.isEmpty()) { UpdateText(m_imageList->GetItemCurrent()); UpdateImage(m_imageList->GetItemCurrent()); } }
void StreamView::customEvent(QEvent *event) { bool handled = true; if (event->type() == MusicPlayerEvent::PlayedTracksChangedEvent) { if (gPlayer->getPlayedTracksList().count()) updateTrackInfo(gPlayer->getCurrentMetadata()); // add the new track to the list if (m_playedTracksList && gPlayer->getPlayedTracksList().count()) { Metadata *mdata = gPlayer->getPlayedTracksList().last(); MythUIButtonListItem *item = new MythUIButtonListItem(m_playedTracksList, "", qVariantFromValue(mdata), 0); MetadataMap metadataMap; mdata->toMap(metadataMap); item->SetTextFromMap(metadataMap); item->SetFontState("normal"); item->DisplayState("default", "playstate"); item->SetImage(mdata->getAlbumArtFile()); m_playedTracksList->SetItemCurrent(item); } } else if (event->type() == MusicPlayerEvent::TrackChangeEvent) { MusicPlayerEvent *mpe = dynamic_cast<MusicPlayerEvent *>(event); if (!mpe) return; int trackNo = mpe->TrackID; if (m_streamList) { if (m_currentTrack >= 0 && m_currentTrack < m_streamList->GetCount()) { MythUIButtonListItem *item = m_streamList->GetItemAt(m_currentTrack); if (item) { item->SetFontState("normal"); item->DisplayState("default", "playstate"); } } if (trackNo >= 0 && trackNo < m_streamList->GetCount()) { if (m_currentTrack == m_streamList->GetCurrentPos()) m_streamList->SetItemCurrent(trackNo); MythUIButtonListItem *item = m_streamList->GetItemAt(trackNo); if (item) { item->SetFontState("running"); item->DisplayState("playing", "playstate"); } } } m_currentTrack = trackNo; updateTrackInfo(gPlayer->getCurrentMetadata()); } else if (event->type() == OutputEvent::Playing) { if (gPlayer->isPlaying()) { if (m_streamList) { MythUIButtonListItem *item = m_streamList->GetItemAt(m_currentTrack); if (item) { item->SetFontState("running"); item->DisplayState("playing", "playstate"); } } } // pass it on to the default handler in MusicCommon handled = false; } else if (event->type() == OutputEvent::Stopped) { if (m_streamList) { MythUIButtonListItem *item = m_streamList->GetItemAt(m_currentTrack); if (item) { item->SetFontState("normal"); item->DisplayState("stopped", "playstate"); } } // pass it on to the default handler in MusicCommon handled = false; } else if (event->type() == OutputEvent::Buffering) { } else if (event->type() == MythEvent::MythEventMessage) { MythEvent *me = (MythEvent *)event; QStringList tokens = me->Message().split(" ", QString::SkipEmptyParts); if (tokens.isEmpty()) return; if (tokens[0] == "DOWNLOAD_FILE") { QStringList args = me->ExtraDataList(); if (tokens[1] == "UPDATE") { } else if (tokens[1] == "FINISHED") { QString url = args[0]; int fileSize = args[2].toInt(); int errorCode = args[4].toInt(); QString filename = args[1]; if ((errorCode != 0) || (fileSize == 0)) LOG(VB_GENERAL, LOG_ERR, QString("StreamView: failed to download radio icon from '%1'").arg(url)); else { for (int x = 0; x < m_streamList->GetCount(); x++) { MythUIButtonListItem *item = m_streamList->GetItemAt(x); Metadata *mdata = qVariantValue<Metadata*> (item->GetData()); if (mdata && mdata->LogoUrl() == url) item->SetImage(filename); } } } } } else if (event->type() == DecoderHandlerEvent::OperationStart) { DecoderHandlerEvent *dhe = dynamic_cast<DecoderHandlerEvent*>(event); if (!dhe) return; if (dhe->getMessage() && m_bufferStatus) { m_bufferStatus->SetText(*dhe->getMessage()); } } else if (event->type() == DecoderHandlerEvent::BufferStatus) { DecoderHandlerEvent *dhe = dynamic_cast<DecoderHandlerEvent*>(event); if (!dhe) return; int available, maxSize; dhe->getBufferStatus(&available, &maxSize); if (m_bufferStatus) { QString status = QString("%1%").arg((int)(100.0 / ((double)maxSize / (double)available))); m_bufferStatus->SetText(status); } if (m_bufferProgress) { m_bufferProgress->SetTotal(maxSize); m_bufferProgress->SetUsed(available); } } else if (event->type() == DecoderHandlerEvent::OperationStop) { if (m_bufferStatus) m_bufferStatus->SetText(""); } else if (event->type() == DialogCompletionEvent::kEventType) { DialogCompletionEvent *dce = static_cast<DialogCompletionEvent*>(event); // make sure the user didn't ESCAPE out of the menu if (dce->GetResult() < 0) return; QString resultid = dce->GetId(); QString resulttext = dce->GetResultText(); if (resultid == "streammenu") { if (resulttext == tr("Add Stream")) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); MythScreenType *screen = new EditStreamMetadata(mainStack, this, NULL); if (screen->Create()) mainStack->AddScreen(screen); else delete screen; } else if (resulttext == tr("Remove Stream")) { removeStream(); } else if (resulttext == tr("Edit Stream")) { editStream(); } } else handled = false; } else handled = false; if (!handled) MusicCommon::customEvent(event); }
void RecordingSelector::updateRecordingList(void) { if (!m_recordingList || m_recordingList->empty()) return; m_recordingButtonList->Reset(); if (m_categorySelector) { ProgramInfo *p; vector<ProgramInfo *>::iterator i = m_recordingList->begin(); for ( ; i != m_recordingList->end(); ++i) { p = *i; if (p->GetTitle() == m_categorySelector->GetValue() || m_categorySelector->GetValue() == tr("All Recordings")) { MythUIButtonListItem* item = new MythUIButtonListItem( m_recordingButtonList, p->GetTitle() + " ~ " + p->GetScheduledStartTime().toLocalTime() .toString("dd MMM yy (hh:mm)")); item->setCheckable(true); if (m_selectedList.indexOf((ProgramInfo *) p) != -1) { item->setChecked(MythUIButtonListItem::FullChecked); } else { item->setChecked(MythUIButtonListItem::NotChecked); } QString title = p->GetTitle(); QString subtitle = p->GetSubtitle(); QDateTime recstartts = p->GetScheduledStartTime(); QDateTime recendts = p->GetScheduledEndTime(); QString timedate = QString("%1 - %2") .arg(MythDate::toString(recstartts,MythDate::kDateTimeFull)) .arg(MythDate::toString(recendts, MythDate::kTime)); uint season = p->GetSeason(); uint episode = p->GetEpisode(); QString seasone, seasonx; if (season && episode) { seasone = QString("s%1e%2") .arg(format_season_and_episode(season, 2)) .arg(format_season_and_episode(episode, 2)); seasonx = QString("%1x%2") .arg(format_season_and_episode(season, 1)) .arg(format_season_and_episode(episode, 2)); } item->SetText(title, "title"); item->SetText(subtitle, "subtitle"); if (subtitle.isEmpty()) item->SetText(title, "titlesubtitle"); else item->SetText(title + " - \"" + subtitle + '"', "titlesubtitle"); item->SetText(timedate, "timedate"); item->SetText(p->GetDescription(), "description"); item->SetText(formatSize(p->GetFilesize() / 1024), "filesize_str"); item->SetText(QString::number(season), "season"); item->SetText(QString::number(episode), "episode"); item->SetText(seasonx, "00x00"); item->SetText(seasone, "s00e00"); item->DisplayState(p->HasCutlist() ? "yes" : "no", "cutlist"); item->SetData(qVariantFromValue(p)); } qApp->processEvents(); } } m_recordingButtonList->SetItemCurrent(m_recordingButtonList->GetItemFirst()); titleChanged(m_recordingButtonList->GetItemCurrent()); }
void MythUIFileBrowser::updateRemoteFileList() { QStringList sgdirlist; QString sgdir; QStringList slist; if (!m_baseDirectory.endsWith("/")) m_baseDirectory.append("/"); QString dirURL = QString("%1%2").arg(m_baseDirectory) .arg(m_subDirectory); if (!GetRemoteFileList(m_baseDirectory, sgdir, sgdirlist)) { LOG(VB_GENERAL, LOG_ERR, "GetRemoteFileList failed to get " "Storage Group dirs"); return; } if ((sgdirlist.size() == 1) && (sgdirlist[0].startsWith("sgdir::"))) { QStringList tokens = sgdirlist[0].split("::"); m_storageGroupDir = tokens[1]; } if (!GetRemoteFileList(dirURL, m_storageGroupDir, slist)) { LOG(VB_GENERAL, LOG_ERR, QString("GetRemoteFileList failed for '%1' in '%2' SG dir") .arg(dirURL).arg(m_storageGroupDir)); return; } m_locationEdit->SetText(dirURL); QString displayName; QString dataName; QString type; if ((sgdirlist.size() > 1 && !m_storageGroupDir.isEmpty()) || (!m_subDirectory.isEmpty())) { displayName = tr("Parent"); type = "upfolder"; m_parentDir = m_baseDirectory; if (!m_subDirectory.isEmpty()) { m_parentDir += "/" + m_subDirectory; int pos = m_parentDir.lastIndexOf('/'); if (pos > 0) m_parentDir = m_parentDir.left(pos); } MFileInfo finfo(m_parentDir, m_storageGroupDir, true); m_parentSGDir = m_storageGroupDir; if (m_subDirectory.isEmpty() && m_parentDir == m_baseDirectory) { finfo.setSGDir(""); m_parentSGDir = ""; } MythUIButtonListItem *item = new MythUIButtonListItem( m_fileList, displayName, qVariantFromValue(finfo)); item->SetText(QString("0"), "filesize"); item->SetText(m_parentDir, "fullpath"); item->DisplayState(type, "nodetype"); if (m_backButton) m_backButton->SetEnabled(true); } else { if (m_backButton) m_backButton->SetEnabled(false); } QStringList::const_iterator it = slist.begin(); while (it != slist.end()) { QStringList tokens = (*it).split("::"); if (tokens.size() < 2) { LOG(VB_GENERAL, LOG_ERR, QString("failed to parse '%1'.").arg(*it)); ++it; continue; } displayName = tokens[1]; if (tokens[0] == "sgdir") dataName = m_baseDirectory; else if (m_subDirectory.isEmpty()) dataName = QString("%1%2").arg(m_baseDirectory) .arg(displayName); else dataName = QString("%1%2/%3").arg(m_baseDirectory) .arg(m_subDirectory).arg(displayName); MFileInfo finfo(dataName, m_storageGroupDir); if ((tokens[0] == "dir") && (m_typeFilter & (QDir::Dirs | QDir::AllDirs))) { type = "folder"; finfo.setIsDir(true); finfo.setSGDir(m_storageGroupDir); finfo.setSize(0); } else if ((tokens[0] == "sgdir") && (m_typeFilter & (QDir::Dirs | QDir::AllDirs))) { type = "folder"; finfo.setIsDir(true); finfo.setSGDir(displayName); finfo.setSize(0); } else if ((tokens[0] == "file") && (m_typeFilter & QDir::Files)) { finfo.setIsDir(false); finfo.setSize(tokens[2].toInt()); if (IsImage(finfo.suffix())) type = "image"; else type = "file"; } else { // unknown type or filtered out ++it; continue; } MythUIButtonListItem *item = new MythUIButtonListItem(m_fileList, displayName, qVariantFromValue(finfo)); if (finfo.size()) item->SetText(FormatSize(finfo.size()), "filesize"); if (type == "image") item->SetImage(dataName); item->SetText(dataName, "fullpath"); item->DisplayState(type, "nodetype"); ++it; } }
void MythUIFileBrowser::updateLocalFileList() { QDir d; d.setPath(m_subDirectory); d.setNameFilters(m_nameFilter); d.setFilter(m_typeFilter); d.setSorting(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase); if (!d.exists()) { LOG(VB_GENERAL, LOG_ERR, "MythUIFileBrowser: current directory does not exist!"); m_locationEdit->SetText("/"); m_subDirectory = "/"; d.setPath("/"); } QFileInfoList list = d.entryInfoList(); bool showBackButton = false; if (list.isEmpty()) { MythUIButtonListItem *item = new MythUIButtonListItem(m_fileList, tr("Parent Directory")); item->DisplayState("upfolder", "nodetype"); } else { QFileInfoList::const_iterator it = list.begin(); const QFileInfo *fi; while (it != list.end()) { fi = &(*it); MFileInfo finfo(fi->filePath()); if (finfo.fileName() == ".") { ++it; continue; } QString displayName = finfo.fileName(); QString type; if (displayName == "..") { if (m_subDirectory.endsWith("/")) { ++it; continue; } displayName = tr("Parent"); type = "upfolder"; showBackButton = true; } else if (finfo.isDir()) { type = "folder"; } else if (finfo.isExecutable()) { type = "executable"; } else if (finfo.isFile()) { type = "file"; } MythUIButtonListItem *item = new MythUIButtonListItem(m_fileList, displayName, qVariantFromValue(finfo)); if (IsImage(finfo.suffix())) { item->SetImage(finfo.absoluteFilePath()); type = "image"; } item->SetText(FormatSize(finfo.size()), "filesize"); item->SetText(finfo.absoluteFilePath(), "fullpath"); item->DisplayState(type, "nodetype"); ++it; } } if (m_backButton) m_backButton->SetEnabled(showBackButton); m_locationEdit->SetText(m_subDirectory); }
bool MythBurn::keyPressEvent(QKeyEvent *event) { if (!m_moveMode && GetFocusWidget()->keyPressEvent(event)) return true; bool handled = false; QStringList actions; handled = GetMythMainWindow()->TranslateKeyPress("Archive", event, actions); for (int i = 0; i < actions.size() && !handled; i++) { QString action = actions[i]; handled = true; // if we are currently moving an item, // we only accept UP/DOWN/SELECT/ESCAPE if (m_moveMode) { MythUIButtonListItem *item = m_archiveButtonList->GetItemCurrent(); if (!item) return false; if (action == "SELECT" || action == "ESCAPE") { m_moveMode = false; item->DisplayState("off", "movestate"); } else if (action == "UP") { item->MoveUpDown(true); } else if (action == "DOWN") { item->MoveUpDown(false); } return true; } if (action == "MENU") { showMenu(); } else if (action == "DELETE") { removeItem(); } else if (action == "INFO") { editThumbnails(); } else if (action == "TOGGLECUT") { toggleUseCutlist(); } else handled = false; } if (!handled && MythScreenType::keyPressEvent(event)) handled = true; return handled; }