[Pkg-owncloud-commits] [owncloud-client] 01/171: Sharee.cpp: Get rid of lambdas because we still need to support GCC 4.4
Sandro Knauß
hefee-guest at moszumanska.debian.org
Wed Feb 17 09:36:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to annotated tag upstream/2.1.1+dfsg
in repository owncloud-client.
commit 68057c1c5a6526a9abfe906c3a621627682b197f
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Thu Dec 3 12:52:13 2015 +0100
Sharee.cpp: Get rid of lambdas because we still need to support GCC 4.4
---
src/gui/sharee.cpp | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/gui/sharee.cpp b/src/gui/sharee.cpp
index 08aae3c..86f6a20 100644
--- a/src/gui/sharee.cpp
+++ b/src/gui/sharee.cpp
@@ -140,6 +140,18 @@ QSharedPointer<Sharee> ShareeModel::parseSharee(const QVariantMap &data)
return QSharedPointer<Sharee>(new Sharee(shareWith, displayName, type));
}
+
+// Helper function for setNewSharees (could be a lambda when we can use them)
+static QSharedPointer<Sharee> shareeFromModelIndex(const QModelIndex &idx)
+{ return idx.data(Qt::UserRole).value<QSharedPointer<Sharee>>(); }
+
+struct FindShareeHelper {
+ const QSharedPointer<Sharee> &sharee;
+ bool operator()(const QSharedPointer<Sharee> &s2) const {
+ return s2->format() == sharee->format() && s2->displayName() == sharee->format();
+ }
+};
+
/* Set the new sharee
Do that while preserving the model index so the selection stays
@@ -152,17 +164,15 @@ void ShareeModel::setNewSharees(const QVector<QSharedPointer<Sharee>>& newSharee
oldPersistantSharee.reserve(persistent.size());
std::transform(persistent.begin(), persistent.end(), std::back_inserter(oldPersistantSharee),
- [](const QModelIndex &idx) { return idx.data(Qt::UserRole).value<QSharedPointer<Sharee>>(); });
+ shareeFromModelIndex);
_sharees = newSharees;
QModelIndexList newPersistant;
newPersistant.reserve(persistent.size());
foreach(const QSharedPointer<Sharee> &sharee, oldPersistantSharee) {
- auto it = std::find_if(_sharees.constBegin(), _sharees.constEnd(),
- [&sharee](const QSharedPointer<Sharee> &s2) {
- return s2->format() == sharee->format() && s2->displayName() == sharee->format();
- });
+ FindShareeHelper helper = { sharee };
+ auto it = std::find_if(_sharees.constBegin(), _sharees.constEnd(), helper);
if (it == _sharees.constEnd()) {
newPersistant << QModelIndex();
} else {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list