当前位置: 首页>>代码示例>>C++>>正文


C++ MythUIButtonListItem::SetTextFromMap方法代码示例

本文整理汇总了C++中MythUIButtonListItem::SetTextFromMap方法的典型用法代码示例。如果您正苦于以下问题:C++ MythUIButtonListItem::SetTextFromMap方法的具体用法?C++ MythUIButtonListItem::SetTextFromMap怎么用?C++ MythUIButtonListItem::SetTextFromMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MythUIButtonListItem的用法示例。


在下文中一共展示了MythUIButtonListItem::SetTextFromMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateTimesList

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");
        }
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: PopulateResultList

void NetSearch::PopulateResultList(ResultItem::resultList list)
{
    for (ResultItem::resultList::iterator i = list.begin();
            i != list.end(); ++i)
    {
        QString title = (*i)->GetTitle();
        MythUIButtonListItem *item =
            new MythUIButtonListItem(m_searchResultList, title,
                                     qVariantFromValue(*i));
        InfoMap metadataMap;
        (*i)->toMap(metadataMap);
        item->SetTextFromMap(metadataMap);

        if (!(*i)->GetThumbnail().isEmpty())
        {
            QString dlfile = (*i)->GetThumbnail();

            if (dlfile.contains("%SHAREDIR%"))
            {
                dlfile.replace("%SHAREDIR%", GetShareDir());
                item->SetImage(dlfile);
            }
            else
            {
                uint pos = m_searchResultList->GetItemPos(item);

                m_imageDownload->addThumb((*i)->GetTitle(),
                                          (*i)->GetThumbnail(),
                                          qVariantFromValue<uint>(pos));
            }
        }
    }
}
开发者ID:DragonStalker,项目名称:mythtv,代码行数:33,代码来源:netsearch.cpp

示例3: updateStreamList

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!");
}
开发者ID:bfosberry,项目名称:mythtv,代码行数:55,代码来源:streamview.cpp

示例4: MythUIButtonListItem

MythUIButtonListItem *MythGenericTree::CreateListButton(MythUIButtonList *list)
{
    MythUIButtonListItem *item = new MythUIButtonListItem(list, getString());
    item->SetData(qVariantFromValue(this));
    item->SetTextFromMap(m_strings);
    item->SetImageFromMap(m_imageFilenames);

    if (visibleChildCount() > 0)
        item->setDrawArrow(true);

    return item;
}
开发者ID:Openivo,项目名称:mythtv,代码行数:12,代码来源:mythgenerictree.cpp

示例5: AddItem

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();
}
开发者ID:DocOnDev,项目名称:mythtv,代码行数:50,代码来源:backendselect.cpp

示例6: updateList

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());
}
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:47,代码来源:channelrecpriority.cpp

示例7: updateList

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());
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:44,代码来源:channelrecpriority.cpp

示例8: updateUIList

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();
    }
}
开发者ID:Openivo,项目名称:mythtv,代码行数:43,代码来源:viewschedulediff.cpp

示例9: UpdateButtonList

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()));
    }
}
开发者ID:gdenning,项目名称:mythtv,代码行数:41,代码来源:proglist.cpp

示例10: updateStreams

void SearchStream::updateStreams(void)
{
    m_streamList->Reset();

    QString station = m_stationList->GetValue();
    QString genre = m_genreList->GetValue();
    QString channel = m_channelEdit->GetText();

    bool searchStation = (station != tr("<All Stations>"));
    bool searchGenre = (genre != tr("<All Genres>"));
    bool searchChannel = !channel.isEmpty();

    QMap<QString, Metadata>::iterator it;

    for (it = m_streams.begin(); it != m_streams.end(); ++it)
    {
        Metadata *mdata = &(*it);

        if (searchStation && station != mdata->Station())
            continue;

        if (searchGenre && !mdata->Genre().contains(genre, Qt::CaseInsensitive))
            continue;

        if (searchChannel && !mdata->Channel().contains(channel, Qt::CaseInsensitive))
            continue;

        // if we got here we must have a match so add it to the list
        MythUIButtonListItem *item = new MythUIButtonListItem(m_streamList, 
                "", qVariantFromValue(mdata));

        MetadataMap metadataMap;
        mdata->toMap(metadataMap);
        item->SetTextFromMap(metadataMap);

        item->SetText(" ", "dummy");
    }

    m_matchesText->SetText(QString("%1").arg(m_streamList->GetCount()));
}
开发者ID:bfosberry,项目名称:mythtv,代码行数:40,代码来源:streamview.cpp

示例11: ShowFileDetails

/** \fn     GalleryWidget::ShowFileDetails()
 *  \brief  Shows the available details of the current image file.
            The details will only be shown if the file is an image.
 *  \return void
 */
void GalleryWidget::ShowFileDetails()
{
    ImageMetadata *im = m_fileDataList->at(m_index);
    if (!im)
    {
        delete im;
        return;
    }

    if (im->m_type != kImageFile)
    {
        delete im;
        return;
    }

    // First remove all entries
    m_infoList->Reset();

    // This map holds all the exif tag values
    QMap<QString, QString> infoList;

    // Get all the available exif header information from the file
    // and create a data structure that can be displayed nicely
    QByteArray ba = m_fh->GetExifValues(im);
    if (ba.count() > 0)
    {
        bool readTagValues = false;
        QString key, value;

        QXmlStreamReader xml(ba);
        while (!xml.atEnd())
        {
            xml.readNext();

            // Read the general information
            if (xml.isStartElement() &&
                    (xml.name() == "Count"  ||
                     xml.name() == "File"   ||
                     xml.name() == "Path"   ||
                     xml.name() == "Size"   ||
                     xml.name() == "Extension"))
                infoList.insert(xml.name().toString(), xml.readElementText());

            if (xml.isStartElement() && xml.name() == "ImageMetadataInfo")
                readTagValues = true;

            if (readTagValues)
            {
                if (xml.isStartElement() && xml.name() == "Label")
                    key = xml.readElementText();

                if (xml.isStartElement() && xml.name() == "Value")
                    value = xml.readElementText();
            }

            if (xml.isEndElement() && xml.name() == "ImageMetadataInfo")
            {
                readTagValues = false;
                infoList.insert(key, value);
            }
        }
    }

    // Now go through the info list and create a map for the mythui buttonlist
    QMap<QString, QString>::const_iterator i = infoList.constBegin();
    while (i != infoList.constEnd())
    {
        MythUIButtonListItem *item = new MythUIButtonListItem(m_infoList, "");
        InfoMap infoMap;
        infoMap.insert("name", i.key());

        QString value = tr("Not defined");
        if (!i.value().isEmpty())
            value = i.value();

        infoMap.insert("value", value);

        item->SetTextFromMap(infoMap);

        ++i;
    }

    m_infoList->SetVisible(true);

    // All widgets are visible, remember this
    m_infoVisible = true;
    SetFocusWidget(m_infoList);

    delete im;
}
开发者ID:,项目名称:,代码行数:95,代码来源:

示例12: FillList

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")
//.........这里部分代码省略.........
开发者ID:tomhughes,项目名称:mythtv,代码行数:101,代码来源:viewscheduled.cpp

示例13: Init

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);
}
开发者ID:StefanRoss,项目名称:mythtv,代码行数:66,代码来源:themechooser.cpp

示例14: customEvent

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)
//.........这里部分代码省略.........
开发者ID:bfosberry,项目名称:mythtv,代码行数:101,代码来源:streamview.cpp

示例15: UpdateList

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) &&
//.........这里部分代码省略.........
开发者ID:Saner2oo2,项目名称:mythtv,代码行数:101,代码来源:programrecpriority.cpp


注:本文中的MythUIButtonListItem::SetTextFromMap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。