diff options
Diffstat (limited to 'src/imports/location/declarativeplaces')
7 files changed, 0 insertions, 403 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; |