diff options
Diffstat (limited to 'src')
25 files changed, 19 insertions, 968 deletions
diff --git a/src/imports/location/declarativeplaces/declarativeplaces.pri b/src/imports/location/declarativeplaces/declarativeplaces.pri index f39b09c9..7bdade4b 100644 --- a/src/imports/location/declarativeplaces/declarativeplaces.pri +++ b/src/imports/location/declarativeplaces/declarativeplaces.pri @@ -7,7 +7,6 @@ SOURCES += \ declarativeplaces/qdeclarativetextpredictionmodel.cpp \ declarativeplaces/qdeclarativesearchresultmodel.cpp \ #data - declarativeplaces/qdeclarativealternativevalue.cpp \ declarativeplaces/qdeclarativebusinessfeature.cpp \ declarativeplaces/qdeclarativebusinessinformation.cpp \ declarativeplaces/qdeclarativecategory.cpp \ @@ -32,7 +31,6 @@ HEADERS += \ declarativeplaces/qdeclarativetextpredictionmodel_p.h \ declarativeplaces/qdeclarativesearchresultmodel_p.h \ #data - declarativeplaces/qdeclarativealternativevalue_p.h \ declarativeplaces/qdeclarativebusinessfeature_p.h \ declarativeplaces/qdeclarativebusinessinformation_p.h \ declarativeplaces/qdeclarativecategory_p.h \ diff --git a/src/imports/location/declarativeplaces/qdeclarativealternativevalue.cpp b/src/imports/location/declarativeplaces/qdeclarativealternativevalue.cpp deleted file mode 100644 index bac8159f..00000000 --- a/src/imports/location/declarativeplaces/qdeclarativealternativevalue.cpp +++ /dev/null @@ -1,148 +0,0 @@ -#include "qdeclarativealternativevalue_p.h" - -QT_USE_NAMESPACE - -/*! - \qmlclass AlternativeValue - - \brief The AlternativeValue element holds another value for property. - \inherits QObject - - \ingroup qml-places -*/ - -QDeclarativeAlternativeValue::QDeclarativeAlternativeValue(QObject* parent) - : QObject(parent) -{ -} - -QDeclarativeAlternativeValue::QDeclarativeAlternativeValue(const QPlaceAlternativeValue &value, - QObject *parent) - : QObject(parent), - m_value(value) -{ -} - -QDeclarativeAlternativeValue::~QDeclarativeAlternativeValue() -{ -} - -void QDeclarativeAlternativeValue::setValueObject(const QPlaceAlternativeValue &value) -{ - QPlaceAlternativeValue previous = m_value; - m_value = value; - - if (previous.key() != m_value.key()) { - emit keyChanged(); - } - if (previous.language() != m_value.language()) { - emit languageChanged(); - } - if (previous.semantics() != m_value.semantics()) { - emit semanticsChanged(); - } - if (previous.type() != m_value.type()) { - emit typeChanged(); - } - if (previous.value() != m_value.value()) { - emit valueChanged(); - } -} - -QPlaceAlternativeValue QDeclarativeAlternativeValue::valueObject() const -{ - return m_value; -} - -/*! - \qmlproperty string AlternativeValue::key - - This property holds key description. -*/ - -void QDeclarativeAlternativeValue::setKey(const QString &key) -{ - if (m_value.key() != key) { - m_value.setKey(key); - emit keyChanged(); - } -} - -QString QDeclarativeAlternativeValue::key() const -{ - return m_value.key(); -} - -/*! - \qmlproperty string AlternativeValue::language - - This property holds language description. -*/ - -void QDeclarativeAlternativeValue::setLanguage(const QString &language) -{ - if (m_value.language() != language) { - m_value.setLanguage(language); - emit languageChanged(); - } -} - -QString QDeclarativeAlternativeValue::language() const -{ - return m_value.language(); -} - -/*! - \qmlproperty string AlternativeValue::semantics - - This property holds semantics. -*/ -void QDeclarativeAlternativeValue::setSemantics(const QDeclarativeAlternativeValue::TextSemantics &semantics) -{ - if (m_value.semantics() != (QPlaceAlternativeValue::TextSemantics)semantics) { - m_value.setSemantics((QPlaceAlternativeValue::TextSemantics)semantics); - emit semanticsChanged(); - } -} - -QDeclarativeAlternativeValue::TextSemantics QDeclarativeAlternativeValue::semantics() const -{ - return (QDeclarativeAlternativeValue::TextSemantics) m_value.semantics(); -} - -/*! - \qmlproperty string AlternativeValue::type - - This property holds type. -*/ -void QDeclarativeAlternativeValue::setType(const QDeclarativeAlternativeValue::NameType &type) -{ - if (m_value.type() != (QPlaceAlternativeValue::NameType)type) { - m_value.setType((QPlaceAlternativeValue::NameType)type); - emit typeChanged(); - } -} - -QDeclarativeAlternativeValue::NameType QDeclarativeAlternativeValue::type() const -{ - return (QDeclarativeAlternativeValue::NameType) m_value.type(); -} - -/*! - \qmlproperty string AlternativeValue::value - - This property holds value. -*/ - -void QDeclarativeAlternativeValue::setValue(const QString &value) -{ - if (m_value.value() != value) { - m_value.setValue(value); - emit valueChanged(); - } -} - -QString QDeclarativeAlternativeValue::value() const -{ - return m_value.value(); -} diff --git a/src/imports/location/declarativeplaces/qdeclarativealternativevalue_p.h b/src/imports/location/declarativeplaces/qdeclarativealternativevalue_p.h deleted file mode 100644 index 753dcedc..00000000 --- a/src/imports/location/declarativeplaces/qdeclarativealternativevalue_p.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef QDECLARATIVEALTERNATIVEVALUE_P_H -#define QDECLARATIVEALTERNATIVEVALUE_P_H - -#include <qplacealternativevalue.h> -#include <QtDeclarative/qdeclarative.h> - -#include <QObject> - -QT_BEGIN_NAMESPACE - -class QDeclarativeAlternativeValue : public QObject -{ - Q_OBJECT - - Q_ENUMS(TextSemantics) - Q_ENUMS(NameType) - - Q_PROPERTY(QString key READ key WRITE setKey NOTIFY keyChanged); - Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged); - Q_PROPERTY(TextSemantics semantics READ semantics WRITE setSemantics NOTIFY semanticsChanged); - Q_PROPERTY(NameType type READ type WRITE setType NOTIFY typeChanged); - Q_PROPERTY(QString value READ value WRITE setValue NOTIFY valueChanged); - -public: - enum TextSemantics { - Synonim, - Exonym, - Unclassified - }; - - enum NameType { - BaseName, - ShortBaseName, - Abbrevation, - Unknown - }; - - explicit QDeclarativeAlternativeValue(QObject* parent = 0); - explicit QDeclarativeAlternativeValue(const QPlaceAlternativeValue &value, QObject* parent = 0); - ~QDeclarativeAlternativeValue(); - - QPlaceAlternativeValue valueObject() const; - void setValueObject(const QPlaceAlternativeValue &value); - - QString key() const; - void setKey(const QString &key); - - QString language() const; - void setLanguage(const QString &language); - - TextSemantics semantics() const; - void setSemantics(const TextSemantics &semantics); - - NameType type() const; - void setType(const NameType &type); - - QString value() const; - void setValue(const QString &value); - - -signals: - void keyChanged(); - void languageChanged(); - void semanticsChanged(); - void typeChanged(); - void valueChanged(); - -private: - QPlaceAlternativeValue m_value; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAlternativeValue)); - -#endif // QDECLARATIVEALTERNATIVEVALUE_P_H diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp index 5f5b6e7d..3de347a6 100644 --- a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp @@ -20,7 +20,6 @@ QDeclarativeCategory::QDeclarativeCategory(const QPlaceCategory &category, : QObject(parent), m_category(category) { - synchronizeAlternativeValues(); } QDeclarativeCategory::~QDeclarativeCategory() {} @@ -39,20 +38,10 @@ void QDeclarativeCategory::setCategory(const QPlaceCategory &category) if (category.description() != previous.description()) { emit descriptionChanged(); } - if (category.alternativeNames() != previous.alternativeNames()) { - synchronizeAlternativeValues(); - emit alternativeNamesChanged(); - } } QPlaceCategory QDeclarativeCategory::category() { - QList<QPlaceAlternativeValue> list; - foreach (QDeclarativeAlternativeValue *value, m_alternativeValues) { - list.append(value->valueObject()); - } - m_category.setAlternativeNames(list); - return m_category; } @@ -112,68 +101,3 @@ QString QDeclarativeCategory::name() const { return m_category.name(); } - -/*! - \qmlproperty QVariantHash Address::alternativeAttributes - - This property alternative values for label property. - Note: this property's changed() signal is currently emitted only if the - whole element changes, not if only the contents of the element change. -*/ -QDeclarativeListProperty<QDeclarativeAlternativeValue> QDeclarativeCategory::alternativeNames() -{ - return QDeclarativeListProperty<QDeclarativeAlternativeValue>(this, - 0, // opaque data parameter - alternativeValue_append, - alternativeValue_count, - alternativeValue_at, - alternativeValue_clear); -} - -void QDeclarativeCategory::alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - QDeclarativeAlternativeValue *value) -{ - QDeclarativeCategory* object = static_cast<QDeclarativeCategory*>(prop->object); - QDeclarativeAlternativeValue *altValue = new QDeclarativeAlternativeValue(object); - altValue->setValueObject(value->valueObject()); - object->m_alternativeValues.append(altValue); - QList<QPlaceAlternativeValue> list = object->m_category.alternativeNames(); - list.append(value->valueObject()); - object->m_category.setAlternativeNames(list); - emit object->alternativeNamesChanged(); -} - -int QDeclarativeCategory::alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop) -{ - return static_cast<QDeclarativeCategory*>(prop->object)->m_alternativeValues.count(); -} - -QDeclarativeAlternativeValue* QDeclarativeCategory::alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - int index) -{ - QDeclarativeCategory* object = static_cast<QDeclarativeCategory*>(prop->object); - QDeclarativeAlternativeValue *res = NULL; - if (object->m_alternativeValues.count() > index && index > -1) { - res = object->m_alternativeValues[index]; - } - return res; -} - -void QDeclarativeCategory::alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop) -{ - QDeclarativeCategory* object = static_cast<QDeclarativeCategory*>(prop->object); - qDeleteAll(object->m_alternativeValues); - object->m_alternativeValues.clear(); - object->m_category.setAlternativeNames(QList<QPlaceAlternativeValue>()); - emit object->alternativeNamesChanged(); -} - -void QDeclarativeCategory::synchronizeAlternativeValues() -{ - qDeleteAll(m_alternativeValues); - m_alternativeValues.clear(); - foreach (QPlaceAlternativeValue value, m_category.alternativeNames()) { - QDeclarativeAlternativeValue* declarativeValue = new QDeclarativeAlternativeValue(value, this); - m_alternativeValues.append(declarativeValue); - } -} diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory_p.h b/src/imports/location/declarativeplaces/qdeclarativecategory_p.h index a8fee94e..9e371516 100644 --- a/src/imports/location/declarativeplaces/qdeclarativecategory_p.h +++ b/src/imports/location/declarativeplaces/qdeclarativecategory_p.h @@ -5,7 +5,6 @@ #include <QObject> #include <qplacecategory.h> -#include "qdeclarativealternativevalue_p.h" QT_BEGIN_NAMESPACE @@ -16,7 +15,6 @@ class QDeclarativeCategory : public QObject Q_PROPERTY(QString categoryId READ categoryId WRITE setCategoryId NOTIFY categoryIdChanged) Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) - Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAlternativeValue> alternativeNames READ alternativeNames NOTIFY alternativeNamesChanged) public: explicit QDeclarativeCategory(QObject* parent = 0); @@ -26,13 +24,6 @@ public: QPlaceCategory category(); void setCategory(const QPlaceCategory &category); - QDeclarativeListProperty<QDeclarativeAlternativeValue> alternativeNames(); - static void alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - QDeclarativeAlternativeValue* value); - static int alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop); - static QDeclarativeAlternativeValue* alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, int index); - static void alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop); - QString categoryId() const; void setCategoryId(const QString &catID); QString description() const; @@ -44,13 +35,8 @@ signals: void categoryIdChanged(); void descriptionChanged(); void nameChanged(); - void alternativeNamesChanged(); - -private: - void synchronizeAlternativeValues(); private: - QList<QDeclarativeAlternativeValue*> m_alternativeValues; QPlaceCategory m_category; }; diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp index e7542794..7b4d09c7 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp @@ -24,7 +24,6 @@ QDeclarativePlace::QDeclarativePlace(const QGeoPlace &src, : QObject(parent), m_src(src) { - synchronizeAlternativeValues(); synchronizeCategories(); synchronizeContacts(); synchronizeDescriptions(); @@ -46,10 +45,6 @@ void QDeclarativePlace::setPlace(const QGeoPlace &src) if (previous.additionalData() != m_src.additionalData()) { emit additionalDataChanged(); } - if (previous.alternativeNames() != m_src.alternativeNames()) { - synchronizeAlternativeValues(); - emit alternativeNamesChanged(); - } if (previous.businessInformation() != m_src.businessInformation()) { m_businessInformation.setBusinessInformation(m_src.businessInformation()); emit businessInformationChanged(); @@ -114,11 +109,6 @@ void QDeclarativePlace::setPlace(const QGeoPlace &src) QGeoPlace QDeclarativePlace::place() { - QList<QPlaceAlternativeValue> list; - foreach (QDeclarativeAlternativeValue *value, m_alternativeValues) { - list.append(value->valueObject()); - } - m_src.setAlternativeNames(list); QList<QPlaceCategory> categories; foreach (QDeclarativeCategory *value, m_categories) { categories.append(value->category()); @@ -423,72 +413,6 @@ QDeclarativeReviewPaginationList *QDeclarativePlace::reviews() } /*! - \qmlproperty QDeclarativeListProperty<QDeclarativeAlternativeValue> Place::alternativeNames - - This property holds alternative values for name property. - - Note: this property's changed() signal is currently emitted only if the - whole element changes, not if only the contents of the element change. -*/ -QDeclarativeListProperty<QDeclarativeAlternativeValue> QDeclarativePlace::alternativeNames() -{ - return QDeclarativeListProperty<QDeclarativeAlternativeValue>(this, - 0, // opaque data parameter - alternativeValue_append, - alternativeValue_count, - alternativeValue_at, - alternativeValue_clear); -} - -void QDeclarativePlace::alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - QDeclarativeAlternativeValue *value) -{ - QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object); - QDeclarativeAlternativeValue *altValue = new QDeclarativeAlternativeValue(object); - altValue->setValueObject(value->valueObject()); - object->m_alternativeValues.append(altValue); - QList<QPlaceAlternativeValue> list = object->m_src.alternativeNames(); - list.append(value->valueObject()); - object->m_src.setAlternativeNames(list); - emit object->alternativeNamesChanged(); -} - -int QDeclarativePlace::alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop) -{ - return static_cast<QDeclarativePlace*>(prop->object)->m_alternativeValues.count(); -} - -QDeclarativeAlternativeValue* QDeclarativePlace::alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - int index) -{ - QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object); - QDeclarativeAlternativeValue *res = NULL; - if (object->m_alternativeValues.count() > index && index > -1) { - res = object->m_alternativeValues[index]; - } - return res; -} - -void QDeclarativePlace::alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop) -{ - QDeclarativePlace* object = static_cast<QDeclarativePlace*>(prop->object); - qDeleteAll(object->m_alternativeValues); - object->m_alternativeValues.clear(); - object->m_src.setAlternativeNames(QList<QPlaceAlternativeValue>()); - emit object->alternativeNamesChanged(); -} - -void QDeclarativePlace::synchronizeAlternativeValues() -{ - qDeleteAll(m_alternativeValues); - m_alternativeValues.clear(); - foreach (QPlaceAlternativeValue value, m_src.alternativeNames()) { - QDeclarativeAlternativeValue* declarativeValue = new QDeclarativeAlternativeValue(value, this); - m_alternativeValues.append(declarativeValue); - } -} - -/*! \qmlproperty QDeclarativeListProperty<QDeclarativeCategory> Place::categories This property categories list. diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h index 7bb986b9..6b50db26 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h +++ b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h @@ -11,7 +11,6 @@ #include "qdeclarativecontact_p.h" #include "qdeclarativerating_p.h" #include "qdeclarativedescription_p.h" -#include "qdeclarativealternativevalue_p.h" #include "qdeclarativemediapaginationlist_p.h" #include "qdeclarativereviewpaginationlist_p.h" @@ -22,7 +21,6 @@ class QDeclarativePlace : public QObject Q_OBJECT Q_PROPERTY(QVariantHash additionalData READ additionalData WRITE setAdditionalData NOTIFY additionalDataChanged); - Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAlternativeValue> alternativeNames READ alternativeNames NOTIFY alternativeNamesChanged) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeCategory> categories READ categories NOTIFY categoriesChanged) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeContact> contacts READ contacts NOTIFY contactsChanged) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeDescription> descriptions READ descriptions NOTIFY descriptionsChanged) @@ -51,12 +49,6 @@ public: QVariantHash additionalData() const; void setAdditionalData(const QVariantHash &data); - QDeclarativeListProperty<QDeclarativeAlternativeValue> alternativeNames(); - static void alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - QDeclarativeAlternativeValue* value); - static int alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop); - static QDeclarativeAlternativeValue* alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, int index); - static void alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop); QDeclarativeListProperty<QDeclarativeCategory> categories(); static void category_append(QDeclarativeListProperty<QDeclarativeCategory> *prop, QDeclarativeCategory* value); @@ -110,7 +102,6 @@ public: signals: void additionalDataChanged(); - void alternativeNamesChanged(); void categoriesChanged(); void contactsChanged(); void descriptionsChanged(); @@ -130,14 +121,12 @@ signals: void detailsFetchedChanged(); private: - void synchronizeAlternativeValues(); void synchronizeCategories(); void synchronizeContacts(); void synchronizeDescriptions(); void synchronizeSuppliers(); private: - QList<QDeclarativeAlternativeValue*> m_alternativeValues; QList<QDeclarativeCategory*> m_categories; QList<QDeclarativeContact*> m_contacts; QList<QDeclarativeDescription*> m_descriptions; diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index eb46826f..02de330c 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -75,7 +75,6 @@ #include "qdeclarativegeomaneuver_p.h" //Place includes -#include "qdeclarativealternativevalue_p.h" #include "qdeclarativebusinessfeature_p.h" #include "qdeclarativebusinessinformation_p.h" #include "qdeclarativecategory_p.h" @@ -197,7 +196,6 @@ public: qmlRegisterType<QDeclarativeGeoRouteSegment>(uri, 5, 0, "RouteSegment"); qmlRegisterType<QDeclarativeGeoManeuver>(uri, 5, 0, "RouteManeuver"); - qmlRegisterType<QDeclarativeAlternativeValue>(uri, 5, 0, "AlternativeValue"); qmlRegisterType<QDeclarativeBusinessFeature>(uri, 5, 0, "BusinessFeature"); qmlRegisterType<QDeclarativeBusinessInformation>(uri, 5, 0, "BusinessInformation"); qmlRegisterType<QDeclarativeCategory>(uri, 5, 0, "Category"); diff --git a/src/imports/location/qdeclarativegeolocation.cpp b/src/imports/location/qdeclarativegeolocation.cpp index bb03035e..36389dcc 100644 --- a/src/imports/location/qdeclarativegeolocation.cpp +++ b/src/imports/location/qdeclarativegeolocation.cpp @@ -44,10 +44,6 @@ void QDeclarativeGeoLocation::setLocation(const QGeoLocation &src) if (previous.additionalData() != m_src.additionalData()) { emit additionalDataChanged(); } - if (previous.alternativeLabels() != m_src.alternativeLabels()) { - synchronizeAlternativeValues(); - emit alternativeLabelsChanged(); - } if (previous.address() != m_src.address()) { m_address.setAddress(m_src.address()); emit addressChanged(); @@ -73,11 +69,6 @@ void QDeclarativeGeoLocation::setLocation(const QGeoLocation &src) QGeoLocation QDeclarativeGeoLocation::location() { - QList<QPlaceAlternativeValue> list; - foreach (QDeclarativeAlternativeValue *value, m_alternativeValues) { - list.append(value->valueObject()); - } - m_src.setAlternativeLabels(list); QList<QGeoCoordinate> navigationList; foreach (QDeclarativeCoordinate *value, m_navigationPositions) { navigationList.append(value->coordinate()); @@ -208,62 +199,6 @@ QDeclarativeGeoBoundingBox *QDeclarativeGeoLocation::viewport() } /*! - \qmlproperty QDeclarativeListProperty<QDeclarativeAlternativeValue> Location::alternativeLabels - - This property alternative values for label property. - - Note: this property's changed() signal is currently emitted only if the - whole element changes, not if only the contents of the element change. -*/ -QDeclarativeListProperty<QDeclarativeAlternativeValue> QDeclarativeGeoLocation::alternativeLabels() -{ - return QDeclarativeListProperty<QDeclarativeAlternativeValue>(this, - 0, // opaque data parameter - alternativeValue_append, - alternativeValue_count, - alternativeValue_at, - alternativeValue_clear); -} - -void QDeclarativeGeoLocation::alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - QDeclarativeAlternativeValue *value) -{ - QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object); - QDeclarativeAlternativeValue *altValue = new QDeclarativeAlternativeValue(object); - altValue->setValueObject(value->valueObject()); - object->m_alternativeValues.append(altValue); - QList<QPlaceAlternativeValue> list = object->m_src.alternativeLabels(); - list.append(value->valueObject()); - object->m_src.setAlternativeLabels(list); - emit object->alternativeLabelsChanged(); -} - -int QDeclarativeGeoLocation::alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop) -{ - return static_cast<QDeclarativeGeoLocation*>(prop->object)->m_alternativeValues.count(); -} - -QDeclarativeAlternativeValue* QDeclarativeGeoLocation::alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - int index) -{ - QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object); - QDeclarativeAlternativeValue *res = NULL; - if (object->m_alternativeValues.count() > index && index > -1) { - res = object->m_alternativeValues[index]; - } - return res; -} - -void QDeclarativeGeoLocation::alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop) -{ - QDeclarativeGeoLocation* object = static_cast<QDeclarativeGeoLocation*>(prop->object); - qDeleteAll(object->m_alternativeValues); - object->m_alternativeValues.clear(); - object->m_src.setAlternativeLabels(QList<QPlaceAlternativeValue>()); - emit object->alternativeLabelsChanged(); -} - -/*! \qmlproperty QDeclarativeListProperty<QDeclarativeCoordinate> Location::navigationPositions This property navigation coordinates for location. @@ -319,16 +254,6 @@ void QDeclarativeGeoLocation::navigationPosition_clear(QDeclarativeListProperty< emit object->navigationPositionsChanged(); } -void QDeclarativeGeoLocation::synchronizeAlternativeValues() -{ - qDeleteAll(m_alternativeValues); - m_alternativeValues.clear(); - foreach (QPlaceAlternativeValue value, m_src.alternativeLabels()) { - QDeclarativeAlternativeValue* declarativeValue = new QDeclarativeAlternativeValue(value, this); - m_alternativeValues.append(declarativeValue); - } -} - void QDeclarativeGeoLocation::synchronizeNavigationPositions() { qDeleteAll(m_navigationPositions); diff --git a/src/imports/location/qdeclarativegeolocation_p.h b/src/imports/location/qdeclarativegeolocation_p.h index 2b1b0444..e6918d52 100644 --- a/src/imports/location/qdeclarativegeolocation_p.h +++ b/src/imports/location/qdeclarativegeolocation_p.h @@ -7,7 +7,6 @@ #include "qdeclarativecoordinate_p.h" #include "qdeclarativegeoboundingbox_p.h" #include "qdeclarativegeoaddress_p.h" -#include "qdeclarativealternativevalue_p.h" QT_BEGIN_NAMESPACE @@ -16,7 +15,6 @@ class QDeclarativeGeoLocation : public QObject Q_OBJECT Q_PROPERTY(QVariantHash additionalData READ additionalData WRITE setAdditionalData NOTIFY additionalDataChanged); - Q_PROPERTY(QDeclarativeListProperty<QDeclarativeAlternativeValue> alternativeLabels READ alternativeLabels NOTIFY alternativeLabelsChanged) Q_PROPERTY(QDeclarativeGeoAddress* address READ address WRITE setAddress NOTIFY addressChanged); Q_PROPERTY(QDeclarativeCoordinate* coordinate READ coordinate WRITE setCoordinate NOTIFY coordinateChanged); Q_PROPERTY(QDeclarativeListProperty<QDeclarativeCoordinate> navigationPositions READ navigationPositions NOTIFY navigationPositionsChanged) @@ -34,12 +32,6 @@ public: QVariantHash additionalData() const; void setAdditionalData(const QVariantHash &data); - QDeclarativeListProperty<QDeclarativeAlternativeValue> alternativeLabels(); - static void alternativeValue_append(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, - QDeclarativeAlternativeValue* value); - static int alternativeValue_count(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop); - static QDeclarativeAlternativeValue* alternativeValue_at(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop, int index); - static void alternativeValue_clear(QDeclarativeListProperty<QDeclarativeAlternativeValue> *prop); QDeclarativeGeoAddress *address(); void setAddress(QDeclarativeGeoAddress *address); QDeclarativeCoordinate *coordinate(); @@ -59,7 +51,6 @@ public: signals: void additionalDataChanged(); - void alternativeLabelsChanged(); void addressChanged(); void coordinateChanged(); void navigationPositionsChanged(); @@ -68,11 +59,9 @@ signals: void viewportChanged(); private: - void synchronizeAlternativeValues(); void synchronizeNavigationPositions(); private: - QList<QDeclarativeAlternativeValue*> m_alternativeValues; QDeclarativeGeoAddress m_address; QDeclarativeCoordinate m_coordinate; QDeclarativeGeoBoundingBox m_boundingBox; diff --git a/src/location/places/places.pri b/src/location/places/places.pri index 20088fc4..121dff31 100644 --- a/src/location/places/places.pri +++ b/src/location/places/places.pri @@ -3,7 +3,6 @@ INCLUDEPATH += places PUBLIC_HEADERS += \ #data classes - places/qplacealternativevalue.h \ places/qplacebusinessfeature.h \ places/qplacebusinessinformation.h \ places/qplacecategory.h \ @@ -34,7 +33,6 @@ PUBLIC_HEADERS += \ places/qplacemanagerenginefactory.h PRIVATE_HEADERS += \ - places/qplacealternativevalue_p.h \ places/qplacebusinessfeature_p.h \ places/qplacebusinessinformation_p.h \ places/qplacecategory_p.h \ @@ -52,7 +50,6 @@ PRIVATE_HEADERS += \ SOURCES += \ #data classes - places/qplacealternativevalue.cpp \ places/qplacebusinessfeature.cpp \ places/qplacebusinessinformation.cpp \ places/qplacecategory.cpp \ diff --git a/src/location/places/qplacealternativevalue.cpp b/src/location/places/qplacealternativevalue.cpp deleted file mode 100644 index 86df9df1..00000000 --- a/src/location/places/qplacealternativevalue.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qplacealternativevalue.h" -#include "qplacealternativevalue_p.h" - -QT_USE_NAMESPACE - -QPlaceAlternativeValuePrivate::QPlaceAlternativeValuePrivate() - : QSharedData(), - semantics(QPlaceAlternativeValue::Unclassified), - type(QPlaceAlternativeValue::Unknown) -{ -} - -QPlaceAlternativeValuePrivate::QPlaceAlternativeValuePrivate(const QPlaceAlternativeValuePrivate &other) - : QSharedData() -{ - this->key = other.key; - this->language = other.language; - this->semantics = other.semantics; - this->type = other.type; - this->value = other.value; -} - -QPlaceAlternativeValuePrivate::~QPlaceAlternativeValuePrivate() -{ -} - -bool QPlaceAlternativeValuePrivate::operator==(const QPlaceAlternativeValuePrivate &other) const -{ - return ( - this->key == other.key - && this->language == other.language - && this->semantics == other.semantics - && this->type == other.type - && this->value == other.value - ); -} - -/*! - \class QPlaceAlternativeValue - - \inmodule QPlaces - - \brief The QPlaceAlternativeValue class represents a alternative value object. - - Each QPlaceAlternativeValue represents a alternative value object with a number of attributes - such as value, language id etc. Each QPlaceAlternativeValue is associated with place. - - Alternative value objects are read-only, e.g. user of API might get alternative value object - associated to specific place but can not edit its content. User might also create new - alternative value object and add it to place. - - QPlaceAlternativeValue is an in memory representation of a alternative value object. -*/ - -/*! - Constructs an new alternative value object. -*/ -QPlaceAlternativeValue::QPlaceAlternativeValue() - : d(new QPlaceAlternativeValuePrivate) -{ -} - -/*! - Constructs a copy of \a other -*/ -QPlaceAlternativeValue::QPlaceAlternativeValue(const QPlaceAlternativeValue &other) - :d(other.d) -{ -} - -/*! - Destructor. -*/ -QPlaceAlternativeValue::~QPlaceAlternativeValue() -{ -} - -QPlaceAlternativeValue &QPlaceAlternativeValue::operator =(const QPlaceAlternativeValue &other) { - d = other.d; - return *this; -} - -bool QPlaceAlternativeValue::operator==(const QPlaceAlternativeValue &other) const -{ - return (*(d.constData()) == *(other.d.constData())); -} - -/*! - Returns key. -*/ -QString QPlaceAlternativeValue::key() const -{ - return d->key; -} - -/*! - Sets key. -*/ -void QPlaceAlternativeValue::setKey(const QString &data) -{ - d->key = data; -} - -/*! - Returns language. -*/ -QString QPlaceAlternativeValue::language() const -{ - return d->language; -} - -/*! - Sets language. -*/ -void QPlaceAlternativeValue::setLanguage(const QString &data) -{ - d->language = data; -} - -/*! - Returns semantics. -*/ -QPlaceAlternativeValue::TextSemantics QPlaceAlternativeValue::semantics() const -{ - return d->semantics; -} - -/*! - Sets semantics. -*/ -void QPlaceAlternativeValue::setSemantics(const QPlaceAlternativeValue::TextSemantics &data) -{ - d->semantics = data; -} - -/*! - Returns type. -*/ -QPlaceAlternativeValue::NameType QPlaceAlternativeValue::type() const -{ - return d->type; -} - -/*! - Sets type. -*/ -void QPlaceAlternativeValue::setType(const QPlaceAlternativeValue::NameType &data) -{ - d->type = data; -} - -/*! - Returns value. -*/ -QString QPlaceAlternativeValue::value() const -{ - return d->value; -} - -/*! - Sets value. -*/ -void QPlaceAlternativeValue::setValue(const QString &data) -{ - d->value = data; -} diff --git a/src/location/places/qplacealternativevalue.h b/src/location/places/qplacealternativevalue.h deleted file mode 100644 index 7e17ca10..00000000 --- a/src/location/places/qplacealternativevalue.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLACEALTERNATIVEVALUE_H -#define QPLACEALTERNATIVEVALUE_H - -#include <QSharedDataPointer> -#include <QString> -#include "qmobilityglobal.h" - -QT_BEGIN_NAMESPACE - -class QPlaceAlternativeValuePrivate; - -class Q_LOCATION_EXPORT QPlaceAlternativeValue -{ -public: - enum TextSemantics { - Synonim, - Exonym, - Unclassified - }; - - enum NameType { - BaseName, - ShortBaseName, - Abbrevation, - Unknown - }; - - QPlaceAlternativeValue(); - QPlaceAlternativeValue(const QPlaceAlternativeValue &other); - - virtual ~QPlaceAlternativeValue(); - - QPlaceAlternativeValue &operator=(const QPlaceAlternativeValue &other); - - bool operator==(const QPlaceAlternativeValue &other) const; - bool operator!=(const QPlaceAlternativeValue &other) const { - return !(other == *this); - } - QString key() const; - void setKey(const QString &data); - QString language() const; - void setLanguage(const QString &data); - TextSemantics semantics() const; - void setSemantics(const TextSemantics &data); - NameType type() const; - void setType(const NameType &data); - QString value() const; - void setValue(const QString &data); - -private: - QSharedDataPointer<QPlaceAlternativeValuePrivate> d; -}; - -QT_END_NAMESPACE - -#endif // QPLACEALTERNATIVEVALUE_H diff --git a/src/location/places/qplacealternativevalue_p.h b/src/location/places/qplacealternativevalue_p.h deleted file mode 100644 index 2d51e70b..00000000 --- a/src/location/places/qplacealternativevalue_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the Qt Mobility Components. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLACEALTERNATIVEVALUE_P_H -#define QPLACEALTERNATIVEVALUE_P_H - -#include <QString> -#include <QSharedData> - -#include "qplacealternativevalue.h" - -QT_BEGIN_NAMESPACE - -class QPlaceAlternativeValuePrivate : public QSharedData -{ -public: - QPlaceAlternativeValuePrivate(); - QPlaceAlternativeValuePrivate(const QPlaceAlternativeValuePrivate &other); - - ~QPlaceAlternativeValuePrivate(); - - bool operator==(const QPlaceAlternativeValuePrivate &other) const; - - QString key; - QString language; - QPlaceAlternativeValue::TextSemantics semantics; - QPlaceAlternativeValue::NameType type; - QString value; -}; - -QT_END_NAMESPACE - -#endif // QPLACEALTERNATIVEVALUE_P_H diff --git a/src/location/places/qplacecategory.cpp b/src/location/places/qplacecategory.cpp index d74aff7b..3c0ce55e 100644 --- a/src/location/places/qplacecategory.cpp +++ b/src/location/places/qplacecategory.cpp @@ -54,7 +54,6 @@ QPlaceCategoryPrivate::QPlaceCategoryPrivate() QPlaceCategoryPrivate::QPlaceCategoryPrivate(const QPlaceCategoryPrivate &other) : QSharedData() { - this->alternativeNames = other.alternativeNames; this->categoryId = other.categoryId; this->description = other.description; this->name = other.name; @@ -66,9 +65,7 @@ QPlaceCategoryPrivate::~QPlaceCategoryPrivate() bool QPlaceCategoryPrivate::operator==(const QPlaceCategoryPrivate &other) const { - return ( - this->alternativeNames == other.alternativeNames - && this->categoryId == other.categoryId + return (this->categoryId == other.categoryId && this->description == other.description && this->name == other.name ); @@ -126,22 +123,6 @@ bool QPlaceCategory::operator==(const QPlaceCategory &other) const } /*! - Returns alternative names. -*/ -QList<QPlaceAlternativeValue> QPlaceCategory::alternativeNames() const -{ - return d->alternativeNames; -} - -/*! - Sets alternative names. -*/ -void QPlaceCategory::setAlternativeNames(const QList<QPlaceAlternativeValue> &names) -{ - d->alternativeNames = names; -} - -/*! Returns category id. */ QString QPlaceCategory::categoryId() const diff --git a/src/location/places/qplacecategory.h b/src/location/places/qplacecategory.h index 892b5ac5..63932174 100644 --- a/src/location/places/qplacecategory.h +++ b/src/location/places/qplacecategory.h @@ -46,7 +46,6 @@ #include <QString> #include <QVariant> #include <QList> -#include "qplacealternativevalue.h" QT_BEGIN_NAMESPACE @@ -68,8 +67,6 @@ public: return !(other == *this); } - QList<QPlaceAlternativeValue> alternativeNames() const; - void setAlternativeNames(const QList<QPlaceAlternativeValue> &names); QString categoryId() const; void setCategoryId(const QString &catID); QString description() const; diff --git a/src/location/places/qplacecategory_p.h b/src/location/places/qplacecategory_p.h index 22c0ab35..97ce28fe 100644 --- a/src/location/places/qplacecategory_p.h +++ b/src/location/places/qplacecategory_p.h @@ -58,7 +58,6 @@ public: bool operator==(const QPlaceCategoryPrivate &other) const; - QList<QPlaceAlternativeValue> alternativeNames; QString categoryId; QString description; QString name; diff --git a/src/location/qgeolocation.cpp b/src/location/qgeolocation.cpp index a03f21e4..57e5f15a 100644 --- a/src/location/qgeolocation.cpp +++ b/src/location/qgeolocation.cpp @@ -54,7 +54,6 @@ QGeoLocationPrivate::QGeoLocationPrivate(const QGeoLocationPrivate &other) { this->additionalData = other.additionalData; this->address = other.address; - this->alternativeLabels = other.alternativeLabels; this->coordinate = other.coordinate; this->navigationPositions = other.navigationPositions; this->label = other.label; @@ -70,7 +69,6 @@ bool QGeoLocationPrivate::operator==(const QGeoLocationPrivate &other) const { return (this->additionalData == other.additionalData && this->address == other.address - && this->alternativeLabels == other.alternativeLabels && this->coordinate == other.coordinate && this->navigationPositions == other.navigationPositions && this->label == other.label @@ -162,22 +160,6 @@ void QGeoLocation::setAddress(const QGeoAddress &address) } /*! - Returns alternative labels. -*/ -QList<QPlaceAlternativeValue> QGeoLocation::alternativeLabels() const -{ - return d->alternativeLabels; -} - -/*! - Sets alternative labels. -*/ -void QGeoLocation::setAlternativeLabels(const QList<QPlaceAlternativeValue> &labels) -{ - d->alternativeLabels = labels; -} - -/*! Returns the location's coordinate. */ QGeoCoordinate QGeoLocation::coordinate() const diff --git a/src/location/qgeolocation.h b/src/location/qgeolocation.h index 2c8c6d46..cec7479c 100644 --- a/src/location/qgeolocation.h +++ b/src/location/qgeolocation.h @@ -50,7 +50,6 @@ #include "qgeocoordinate.h" #include "qgeoboundingbox.h" #include "qmobilityglobal.h" -#include "qplacealternativevalue.h" QT_BEGIN_NAMESPACE @@ -75,8 +74,6 @@ public: void setAdditionalData(const QVariantHash &data); QGeoAddress address() const; void setAddress(const QGeoAddress &address); - QList<QPlaceAlternativeValue> alternativeLabels() const; - void setAlternativeLabels(const QList<QPlaceAlternativeValue> &labels); QGeoCoordinate coordinate() const; void setCoordinate(const QGeoCoordinate &position); QList<QGeoCoordinate> navigationPositions() const; diff --git a/src/location/qgeolocation_p.h b/src/location/qgeolocation_p.h index 1a13d5d9..a725b177 100644 --- a/src/location/qgeolocation_p.h +++ b/src/location/qgeolocation_p.h @@ -44,8 +44,6 @@ #include <QSharedData> -#include "qgeolocation.h" - QT_BEGIN_NAMESPACE class QGeoLocationPrivate : public QSharedData @@ -60,7 +58,6 @@ public: QVariantHash additionalData; QGeoAddress address; - QList<QPlaceAlternativeValue> alternativeLabels; QGeoCoordinate coordinate; QList<QGeoCoordinate> navigationPositions; QString label; diff --git a/src/location/qgeoplace.cpp b/src/location/qgeoplace.cpp index 536e1527..e1e8eb3d 100644 --- a/src/location/qgeoplace.cpp +++ b/src/location/qgeoplace.cpp @@ -253,24 +253,6 @@ void QGeoPlace::setAdditionalData(const QVariantHash &data) } /*! - Returns alternative names. -*/ -QList<QPlaceAlternativeValue> QGeoPlace::alternativeNames() const -{ - Q_D(const QGeoPlace); - return d->alternativeNames; -} - -/*! - Sets alternative names. -*/ -void QGeoPlace::setAlternativeNames(const QList<QPlaceAlternativeValue> &alternativeNames) -{ - Q_D(QGeoPlace); - d->alternativeNames = alternativeNames; -} - -/*! Returns business info. */ QPlaceBusinessInformation QGeoPlace::businessInformation() const @@ -635,7 +617,6 @@ bool QGeoPlacePrivate::operator== (const QGeoPlacePrivate &other) const qDebug() << "coordinate:" << (coordinate == other.coordinate); qDebug() << "address:" << (address == other.address); qDebug() << "additionalData: " << (additionalData == other.additionalData); - qDebug() << "alternativeNames: " << (alternativeNames == other.alternativeNames); qDebug() << "businessInfo: " << (businessInfo == other.businessInfo); qDebug() << "categories: " << (categories == other.categories); qDebug() << "descriptions: " << (descriptions == other.descriptions); @@ -658,7 +639,6 @@ bool QGeoPlacePrivate::operator== (const QGeoPlacePrivate &other) const && coordinate == other.coordinate && address == other.address && additionalData == other.additionalData - && alternativeNames == other.alternativeNames && businessInfo == other.businessInfo && categories == other.categories && contacts == other.contacts diff --git a/src/location/qgeoplace.h b/src/location/qgeoplace.h index b47076f6..4ca13482 100644 --- a/src/location/qgeoplace.h +++ b/src/location/qgeoplace.h @@ -50,7 +50,6 @@ #include "qgeoboundingbox.h" #include "qgeocoordinate.h" #include "qgeolocation.h" -#include "qplacealternativevalue.h" #include "qplacebusinessinformation.h" #include "qplacecategory.h" #include "qplacecontact.h" @@ -93,8 +92,6 @@ public: QVariantHash additionalData() const; void setAdditionalData(const QVariantHash &data); - QList<QPlaceAlternativeValue> alternativeNames() const; - void setAlternativeNames(const QList<QPlaceAlternativeValue> &alternativeNames); QPlaceBusinessInformation businessInformation() const; void setBusinessInformation(const QPlaceBusinessInformation &business); QList<QPlaceCategory> categories() const; diff --git a/src/location/qgeoplace_p.h b/src/location/qgeoplace_p.h index 774bd82e..be5fb8fe 100644 --- a/src/location/qgeoplace_p.h +++ b/src/location/qgeoplace_p.h @@ -86,7 +86,6 @@ public: QGeoAddress address; QVariantHash additionalData; - QList<QPlaceAlternativeValue> alternativeNames; QPlaceBusinessInformation businessInfo; QList<QPlaceCategory> categories; QList<QPlaceContact> contacts; diff --git a/src/plugins/places/nokia/qplacejsondetailsparser.cpp b/src/plugins/places/nokia/qplacejsondetailsparser.cpp index c9aebc81..27aff2f4 100644 --- a/src/plugins/places/nokia/qplacejsondetailsparser.cpp +++ b/src/plugins/places/nokia/qplacejsondetailsparser.cpp @@ -61,7 +61,6 @@ #include <qplacerating.h> #include <qplacebusinessinformation.h> #include <qgeolocation.h> -#include <qplacealternativevalue.h> #include <qplacemediaobject.h> #include <qplaceperiod.h> #include <qplaceweekdayhours.h> @@ -479,54 +478,46 @@ void QPlaceJSonDetailsParser::processNames(const QScriptValue &names, QGeoPlace* if (value.isValid()) { value = value.property(place_name_localized_element); if (value.isValid()) { - QList<QPlaceAlternativeValue> list; + QStringList list; if (value.isArray()) { QScriptValueIterator it(value); while (it.hasNext()) { it.next(); // array contains count as last element if (it.name() != "length") { - QPlaceAlternativeValue *name = processName(it.value()); - if (name) { - list.append(*name); - delete name; - name = NULL; + QString name = processName(it.value()); + if (!name.isEmpty()) { + list.append(name); } } } } else { - QPlaceAlternativeValue *name = processName(value); - if (name) { - list.append(*name); - delete name; - name = NULL; + QString name = processName(value); + if (!name.isEmpty()) { + list.append(name); } } - targetPlace->setAlternativeNames(list); + //The JSON data specification defines + //an alternative names element, + //but our api doesn't expose alternative names + //so we parse and skip assignment to a place here. } } value = names.property(place_name_default_element); if (value.isValid()) { - QPlaceAlternativeValue *name = processName(value); - if (name) { - targetPlace->setName(name->value()); - delete name; - name = NULL; + QString name = processName(value); + if (!name.isEmpty()) { + targetPlace->setName(name); } } } -QPlaceAlternativeValue *QPlaceJSonDetailsParser::processName(const QScriptValue &nameValue) +QString QPlaceJSonDetailsParser::processName(const QScriptValue &nameValue) { - QPlaceAlternativeValue *name = NULL; + QString name; QScriptValue value = nameValue.property(place_name_value_element); if (value.isValid() && !value.toString().isEmpty()) { - name = new QPlaceAlternativeValue(); - name->setValue(value.toString()); - value = nameValue.property(place_name_language_element); - if (value.isValid() && !value.toString().isEmpty()) { - name->setLanguage(value.toString()); - } + name = value.toString(); } return name; } diff --git a/src/plugins/places/nokia/qplacejsondetailsparser.h b/src/plugins/places/nokia/qplacejsondetailsparser.h index cbb84f34..8c255827 100644 --- a/src/plugins/places/nokia/qplacejsondetailsparser.h +++ b/src/plugins/places/nokia/qplacejsondetailsparser.h @@ -83,7 +83,7 @@ private: static void processLocation(const QScriptValue &location, QGeoPlace *targetPlace); static void processTags(const QScriptValue &locations, QGeoPlace *targetPlace); static void processNames(const QScriptValue &locations, QGeoPlace *targetPlace); - static QPlaceAlternativeValue *processName(const QScriptValue &nameValue); + static QString processName(const QScriptValue &nameValue); static void processPremiumContents(const QScriptValue &content, QGeoPlace *targetPlace); static void processPremiumVersion(const QScriptValue &content, QGeoPlace *targetPlace); static void processPremiumContent(const QScriptValue &content, QGeoPlace *targetPlace); |