Esempio n. 1
0
void WeatherItemFactory::updateItem(ListView* list, bb::cascades::VisualNode *listItem,
        const QString &type, const QVariantList &indexPath, const QVariant &data)
{
    Q_UNUSED(list);
    Q_UNUSED(indexPath);
    Q_UNUSED(type);

    // Update the control with the correct data.
    QVariantMap map = data.value<QVariantMap>();
    WeatherItem *weatherItem = static_cast<WeatherItem *>(listItem);

    ImageLoader *imloader = new ImageLoader();
    imloader->loadImage(map["weatherIconUrl"].toString(), weatherItem->getConditionsImage(), "/wsymbols01_png_64/", ".png");

    //set labels
    weatherItem->setTime(map["time"].toString());

    weatherItem->setWindSpeed(map["windspeedKmph"].toString());

    weatherItem->setTemperature(map["tempC"]);

    weatherItem->setCloudCover(map["cloudcover"].toString());

    weatherItem->setPressure(map["pressure"].toString());

    weatherItem->setHumidity(map["humidity"].toString());

    weatherItem->setSwellHeight(map["swellHeight_m"].toString());

    //rotate arrows
    weatherItem->setWindDirection(180 + map["winddirDegree"].toFloat());

    weatherItem->setSwellDirection(180 + map["swellDir"].toFloat());
}
Esempio n. 2
0
void ShopItemFactory::updateItem(ListView* list, bb::cascades::VisualNode *listItem,
        const QString &type, const QVariantList &indexPath, const QVariant &data)
{
    Q_UNUSED(list);
    Q_UNUSED(indexPath);
    Q_UNUSED(type);

    // Update the control with the correct data.
    QVariantMap map = data.value<QVariantMap>();
    ShopItem *recipeItem = static_cast<ShopItem *>(listItem);
    //recipeItem->updateItem(map["fruit"].toString());
    ImageLoader *imloader = new ImageLoader();
    imloader->loadImage(map["productthumb"].toString(), recipeItem->itemImage(),"/products/",".png");

    //set labels
    recipeItem->setTitle(map["productname"].toString());

    recipeItem->setDescription("Credits: " + map["productprice"].toString() + "\nCards: "+map["productnumcards"].toString());
}