summaryrefslogtreecommitdiffstats
path: root/common/modelresult.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 15:58:23 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-11-30 15:58:23 +0100
commit0b8850f85f420fcb08643463afe01b026e58dde5 (patch)
tree1e4c8704ab90b353651de0b184a3ec58c864e732 /common/modelresult.cpp
parentbf28c2e3f43038165dc83c10267d103e779b245e (diff)
downloadsink-0b8850f85f420fcb08643463afe01b026e58dde5.tar.gz
sink-0b8850f85f420fcb08643463afe01b026e58dde5.zip
Less debug output
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r--common/modelresult.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp
index e2a05f8..c7fcd49 100644
--- a/common/modelresult.cpp
+++ b/common/modelresult.cpp
@@ -55,21 +55,18 @@ qint64 ModelResult<T, Ptr>::parentId(const Ptr &value)
55template<class T, class Ptr> 55template<class T, class Ptr>
56int ModelResult<T, Ptr>::rowCount(const QModelIndex &parent) const 56int ModelResult<T, Ptr>::rowCount(const QModelIndex &parent) const
57{ 57{
58 qDebug() << "row count " << mTree[getIdentifier(parent)].size();
59 return mTree[getIdentifier(parent)].size(); 58 return mTree[getIdentifier(parent)].size();
60} 59}
61 60
62template<class T, class Ptr> 61template<class T, class Ptr>
63int ModelResult<T, Ptr>::columnCount(const QModelIndex &parent) const 62int ModelResult<T, Ptr>::columnCount(const QModelIndex &parent) const
64{ 63{
65 qDebug() << "porperty count " << mPropertyColumns.size();
66 return mPropertyColumns.size(); 64 return mPropertyColumns.size();
67} 65}
68 66
69template<class T, class Ptr> 67template<class T, class Ptr>
70QVariant ModelResult<T, Ptr>::data(const QModelIndex &index, int role) const 68QVariant ModelResult<T, Ptr>::data(const QModelIndex &index, int role) const
71{ 69{
72 qDebug() << index;
73 if (role == DomainObjectRole) { 70 if (role == DomainObjectRole) {
74 Q_ASSERT(mEntities.contains(index.internalId())); 71 Q_ASSERT(mEntities.contains(index.internalId()));
75 return QVariant::fromValue(mEntities.value(index.internalId())); 72 return QVariant::fromValue(mEntities.value(index.internalId()));
@@ -128,14 +125,12 @@ bool ModelResult<T, Ptr>::hasChildren(const QModelIndex &parent) const
128template<class T, class Ptr> 125template<class T, class Ptr>
129bool ModelResult<T, Ptr>::canFetchMore(const QModelIndex &parent) const 126bool ModelResult<T, Ptr>::canFetchMore(const QModelIndex &parent) const
130{ 127{
131 qDebug() << "Can fetch more: " << parent << mEntityChildrenFetched.contains(parent.internalId());
132 return !mEntityChildrenFetched.contains(parent.internalId()); 128 return !mEntityChildrenFetched.contains(parent.internalId());
133} 129}
134 130
135template<class T, class Ptr> 131template<class T, class Ptr>
136void ModelResult<T, Ptr>::fetchMore(const QModelIndex &parent) 132void ModelResult<T, Ptr>::fetchMore(const QModelIndex &parent)
137{ 133{
138 qDebug() << "Fetch more: " << parent;
139 fetchEntities(parent); 134 fetchEntities(parent);
140} 135}
141 136
@@ -146,7 +141,6 @@ void ModelResult<T, Ptr>::add(const Ptr &value)
146 const auto id = parentId(value); 141 const auto id = parentId(value);
147 //Ignore updates we get before the initial fetch is done 142 //Ignore updates we get before the initial fetch is done
148 if (!mEntityChildrenFetched.contains(id)) { 143 if (!mEntityChildrenFetched.contains(id)) {
149 qDebug() << "Children not yet fetched";
150 return; 144 return;
151 } 145 }
152 auto parent = createIndexFromId(id); 146 auto parent = createIndexFromId(id);
@@ -178,7 +172,7 @@ void ModelResult<T, Ptr>::remove(const Ptr &value)
178 auto childId = qHash(value->identifier()); 172 auto childId = qHash(value->identifier());
179 auto id = parentId(value); 173 auto id = parentId(value);
180 auto parent = createIndexFromId(id); 174 auto parent = createIndexFromId(id);
181 qDebug() << "Removed entity" << childId; 175 // qDebug() << "Removed entity" << childId;
182 auto index = mTree[id].indexOf(qHash(value->identifier())); 176 auto index = mTree[id].indexOf(qHash(value->identifier()));
183 beginRemoveRows(parent, index, index); 177 beginRemoveRows(parent, index, index);
184 mEntities.remove(childId); 178 mEntities.remove(childId);
@@ -218,7 +212,7 @@ void ModelResult<T, Ptr>::setEmitter(const typename Akonadi2::ResultEmitter<Ptr>
218 this->remove(value); 212 this->remove(value);
219 }); 213 });
220 emitter->onInitialResultSetComplete([this](const Ptr &parent) { 214 emitter->onInitialResultSetComplete([this](const Ptr &parent) {
221 qint64 parentId = parent ? qHash(parent->identifier()) : 0; 215 const qint64 parentId = parent ? qHash(parent->identifier()) : 0;
222 const auto parentIndex = createIndexFromId(parentId); 216 const auto parentIndex = createIndexFromId(parentId);
223 mEntityChildrenFetchComplete.insert(parentId); 217 mEntityChildrenFetchComplete.insert(parentId);
224 emit dataChanged(parentIndex, parentIndex, QVector<int>() << ChildrenFetchedRole); 218 emit dataChanged(parentIndex, parentIndex, QVector<int>() << ChildrenFetchedRole);
@@ -242,7 +236,7 @@ void ModelResult<T, Ptr>::modify(const Ptr &value)
242 return; 236 return;
243 } 237 }
244 auto parent = createIndexFromId(id); 238 auto parent = createIndexFromId(id);
245 qDebug() << "Modified entity" << childId; 239 // qDebug() << "Modified entity" << childId;
246 auto i = mTree[id].indexOf(childId); 240 auto i = mTree[id].indexOf(childId);
247 mEntities.remove(childId); 241 mEntities.remove(childId);
248 mEntities.insert(childId, value); 242 mEntities.insert(childId, value);