summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2012-12-23 16:01:45 (GMT)
committerSwift Review <review@swift.im>2012-12-23 16:48:15 (GMT)
commit5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2 (patch)
treed57334bf18662d6753a2cb14bff3b192ff3e7a76 /Swift/QtUI
parentfe5b5e25eadbfe9f8bdaa152b987273ab77d4711 (diff)
downloadswift-5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2.zip
swift-5ccbd7fc3de7afed6c06deb93be3967a7eb5fac2.tar.bz2
Replace functors and for loops by boost::lambdas.
Change-Id: I6d2364dc85464f238d95978793f35953a2947799
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtStatusWidget.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/Swift/QtUI/QtStatusWidget.cpp b/Swift/QtUI/QtStatusWidget.cpp
index 1899b71..8cc366a 100644
--- a/Swift/QtUI/QtStatusWidget.cpp
+++ b/Swift/QtUI/QtStatusWidget.cpp
@@ -6,6 +6,10 @@
#include "QtStatusWidget.h"
+#include <algorithm>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+
#include <QBoxLayout>
#include <QComboBox>
#include <QLabel>
@@ -25,6 +29,8 @@
#include <Swift/Controllers/StatusUtil.h>
#include <Swift/Controllers/StatusCache.h>
+namespace lambda = boost::lambda;
+
namespace Swift {
QtStatusWidget::QtStatusWidget(StatusCache* statusCache, QWidget *parent) : QWidget(parent), statusCache_(statusCache), editCursor_(Qt::IBeamCursor), viewCursor_(Qt::PointingHandCursor) {
@@ -144,13 +150,8 @@ void QtStatusWidget::generateList() {
}
std::vector<StatusCache::PreviousStatus> previousStatuses = statusCache_->getMatches(Q2PSTRING(text), 8);
foreach (StatusCache::PreviousStatus savedStatus, previousStatuses) {
- bool breakEarly = false;
- foreach (StatusShow::Type type, allTypes_) {
- if (savedStatus.first.empty() || (savedStatus.second == type && savedStatus.first == statusShowTypeToFriendlyName(type))) {
- breakEarly = true;
- }
- }
- if (breakEarly) {
+ if (savedStatus.first.empty() || std::find_if(allTypes_.begin(), allTypes_.end(),
+ savedStatus.second == lambda::_1 && savedStatus.first == lambda::bind(&statusShowTypeToFriendlyName, lambda::_1)) != allTypes_.end()) {
continue;
}
QListWidgetItem* item = new QListWidgetItem(P2QSTRING(savedStatus.first), menu_);