void ControlPointPropertyDialog::setTableContent()
{
    switch (m_pItem->type())
    {
    case ControlPointDetailDisplayItem::ContentDirectory:
        {
            HClientDevice* device = static_cast<ControlPointContentDirectoryItem*>
                                    (m_pItem->itemPointer())->browser()->
                                    contentDirectory()->service()->parentDevice();
            HDeviceInfo info = device->info();
            m_pUi->propertyTable->setItem(0, 0, new QTableWidgetItem(info.friendlyName()));
            m_pUi->propertyTable->setItem(1, 0, new QTableWidgetItem(info.deviceType().toString()));
            m_pUi->propertyTable->setItem(2, 0, new QTableWidgetItem(info.modelName()));
            m_pUi->propertyTable->setItem(3, 0, new QTableWidgetItem(info.manufacturer()));
            m_pUi->propertyTable->setItem(4, 0, new QTableWidgetItem(info.udn().toString()));
            m_pUi->propertyTable->setItem(5, 0, new QTableWidgetItem(device->locations().
                                                                     at(0).toString()));
            break;
        }
    case ControlPointDetailDisplayItem::CdsContainer:
        {
            HContainer* container = static_cast<ControlPointCdsContainerItem*>
                                    (m_pItem->itemPointer())->container();
            m_pUi->propertyTable->setItem(0, 0, new QTableWidgetItem(container->title()));
            m_pUi->propertyTable->setItem(1, 0, new QTableWidgetItem(container->id()));
            m_pUi->propertyTable->setItem(2, 0, new QTableWidgetItem(tr("Folder")));
            m_pUi->propertyTable->setItem(3, 0, new QTableWidgetItem(tr("%1 items").
                                                                     arg(m_pItem->childCount())));
            break;
        }
    case ControlPointDetailDisplayItem::Item:
        {
            HItem* hItem = static_cast<HItem*>(m_pItem->itemPointer());
            QString resStr;
            for (int i = 0; i < hItem->resources().count(); ++i)
            {
                resStr.append(hItem->resources().at(i).location().toString().append(";"));
            }
            m_pUi->propertyTable->setItem(0, 0, new QTableWidgetItem(hItem->title()));
            m_pUi->propertyTable->setItem(1, 0, new QTableWidgetItem(hItem->id()));
            m_pUi->propertyTable->setItem(2, 0, new QTableWidgetItem(hItem->clazz()));
            m_pUi->propertyTable->setItem(3, 0, new QTableWidgetItem(resStr));
            break;
        }
    default:
        break;

    }
}
Ejemplo n.º 2
0
void DataItemDisplay::NavItemVisitor::visit(RendererItem* item)
{
    Q_ASSERT(item);

    m_owner->clearModel();

    HClientDevice* device = item->renderer()->device();
    HDeviceInfo deviceInfo = device->info();

    m_owner->m_rootDeviceUdn = device->rootDevice()->info().udn();
    m_owner->m_columns.clear();
    m_owner->m_columns.insert(0, "Name");
    m_owner->m_columns.insert(1, "Value");

    m_owner->m_modelData.push_back(
        new DisplayDataRow(QString(
            "Friendly name,%1").arg(deviceInfo.friendlyName()).split(",")));

    m_owner->m_modelData.push_back(
        new DisplayDataRow(QString(
            "Device type,%1").arg(deviceInfo.deviceType().toString()).split(",")));

    m_owner->m_modelData.push_back(
        new DisplayDataRow(QString(
            "Model name,%1").arg(deviceInfo.modelName()).split(",")));

    m_owner->m_modelData.push_back(
        new DisplayDataRow(QString(
            "Manufacturer,%1").arg(deviceInfo.manufacturer()).split(",")));

    m_owner->m_modelData.push_back(
        new DisplayDataRow(QString(
            "UDN,%1").arg(deviceInfo.udn().toString()).split(",")));

    QList<QUrl> locations = device->locations();
    for (qint32 i = 0; i < locations.size(); ++i)
    {
        m_owner->m_modelData.push_back(
            new DisplayDataRow(QString(
                "Device description URL,%1").arg(
                    locations.at(i).toString()).split(",")));
    }

    m_owner->reset();
}
Ejemplo n.º 3
0
void DataItemDisplay::NavItemVisitor::visit(DeviceItem* item)
{
    Q_ASSERT(item);

    m_owner->m_modelData.clear();

    HClientDevice* device = item->device();
    HDeviceInfo deviceInfo = device->info();

    m_owner->m_rootDeviceUdn = device->rootDevice()->info().udn();

    m_owner->m_modelData.push_back(
        qMakePair(QString("Friendly name"), deviceInfo.friendlyName()));

    m_owner->m_modelData.push_back(
        qMakePair(QString("Device type"), deviceInfo.deviceType().toString()));

    m_owner->m_modelData.push_back(
        qMakePair(QString("Model name"), deviceInfo.modelName()));

    m_owner->m_modelData.push_back(
        qMakePair(QString("Manufacturer"), deviceInfo.manufacturer()));

    m_owner->m_modelData.push_back(
        qMakePair(QString("UDN"), deviceInfo.udn().toString()));

    QList<QUrl> locations = device->locations();
    for (qint32 i = 0; i < locations.size(); ++i)
    {
        m_owner->m_modelData.push_back(
            qMakePair(
                QString("Device description URL"),
                locations.at(i).toString()));
    }

#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
    m_owner->reset();
#else
    m_owner->resetInternalData();
#endif
}