← Back to team overview

uonedb-qt team mailing list archive

[Merge] lp:~kalikiana/u1db-qt/range2 into lp:u1db-qt

 

Christian Dywan has proposed merging lp:~kalikiana/u1db-qt/range2 into lp:u1db-qt.

Commit message:
Remove range property for now, it's not implemented'

Requested reviews:
  U1DB Qt developers (uonedb-qt)

For more details, see:
https://code.launchpad.net/~kalikiana/u1db-qt/range2/+merge/160353

Remove range property for now, it's not implemented'
-- 
https://code.launchpad.net/~kalikiana/u1db-qt/range2/+merge/160353
Your team U1DB Qt developers is requested to review the proposed merge of lp:~kalikiana/u1db-qt/range2 into lp:u1db-qt.
=== modified file 'src/query.cpp'
--- src/query.cpp	2013-04-22 13:19:33 +0000
+++ src/query.cpp	2013-04-23 12:44:24 +0000
@@ -36,8 +36,7 @@
     \inmodule U1db
     \ingroup modules
 
-    \brief The Query class generates a filtered list of documents based on either
-    a query or a range, and using the given Index.
+    \brief The Query class generates a filtered list of documents based on a query using the given Index.
 
     Query can be used as a QAbstractListModel, delegates will then have access to \a docId and \a contents
     analogous to the properties of Document.
@@ -287,8 +286,8 @@
 }
 
 /*!
-    Sets the Index to use. The index must have a valid name and index expressions,
-    then either a range or query can be set.
+    Sets the Index to use. The index must have a valid name and index expressions.
+    If no query is set, the default is all results of the index.
  */
 void
 Query::setIndex(Index* index)
@@ -321,8 +320,8 @@
 
 
 /*!
-    Sets a range, such as ['match', false].
-    Only one of query and range is used - setting range unsets the query.
+    Sets a query, in one of the allowed forms such as 'value', ['value'] or [{'sub-field': 'value'].
+    The default is equivalent to '*'.
  */
 void
 Query::setQuery(QVariant query)
@@ -330,38 +329,11 @@
     if (m_query == query)
         return;
 
-    if (m_range.isValid())
-        m_range = QVariant();
-
     m_query = query;
     Q_EMIT queryChanged(query);
     onDataInvalidated();
 }
 
-QVariant
-Query::getRange()
-{
-    return m_range;
-}
-
-/*!
-    Sets a range, such as [['a', 'b'], ['*']].
-    Only one of query and range is used - setting range unsets the query.
- */
-void
-Query::setRange(QVariant range)
-{
-    if (m_range == range)
-        return;
-
-    if (m_query.isValid())
-        m_query = QVariant();
-
-    m_range = range;
-    Q_EMIT rangeChanged(range);
-    onDataInvalidated();
-}
-
 QT_END_NAMESPACE_U1DB
 
 #include "moc_query.cpp"

=== modified file 'src/query.h'
--- src/query.h	2013-04-19 11:19:43 +0000
+++ src/query.h	2013-04-23 12:44:24 +0000
@@ -35,7 +35,6 @@
     Q_PROPERTY(QT_PREPEND_NAMESPACE_U1DB(Index*) index READ getIndex WRITE setIndex NOTIFY indexChanged)
 #endif
     Q_PROPERTY(QVariant query READ getQuery WRITE setQuery NOTIFY queryChanged)
-    Q_PROPERTY(QVariant range READ getRange WRITE setRange NOTIFY rangeChanged)
 public:
     Query(QObject* parent = 0);
     ~Query() { }
@@ -49,8 +48,6 @@
     void setIndex(Index* index);
     QVariant getQuery();
     void setQuery(QVariant query);
-    QVariant getRange();
-    void setRange(QVariant range);
 
     void generateQueryResults();
     bool iterateQueryList(QVariant query, QString field, QString value);
@@ -61,13 +58,11 @@
 Q_SIGNALS:
     void indexChanged(Index* index);
     void queryChanged(QVariant query);
-    void rangeChanged(QVariant range);
 private:
     Q_DISABLE_COPY(Query)
     Index* m_index;
     QHash<int, QVariantMap> m_hash;
     QVariant m_query;
-    QVariant m_range;
 
     void onDataInvalidated();
 };


Follow ups