summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
committerTobias Markmann <tm@ayena.de>2016-03-31 14:57:35 (GMT)
commitcfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch)
tree18d94153a302445196fc0c18586abf44a1ce4a38 /Swift/QtUI/UserSearch/UserSearchModel.cpp
parent1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff)
downloadswift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip
swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines in the process. Changed CheckTabs.py tool to disallow hard tabs in source files. Test-Information: Manually checked 30 random files that the conversion worked as expected. Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swift/QtUI/UserSearch/UserSearchModel.cpp')
-rw-r--r--Swift/QtUI/UserSearch/UserSearchModel.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/Swift/QtUI/UserSearch/UserSearchModel.cpp b/Swift/QtUI/UserSearch/UserSearchModel.cpp
index ba6ede3..b6ac3cf 100644
--- a/Swift/QtUI/UserSearch/UserSearchModel.cpp
+++ b/Swift/QtUI/UserSearch/UserSearchModel.cpp
@@ -14,76 +14,76 @@ UserSearchModel::UserSearchModel() {
}
void UserSearchModel::clear() {
- emit layoutAboutToBeChanged();
- results_.clear();
- emit layoutChanged();
+ emit layoutAboutToBeChanged();
+ results_.clear();
+ emit layoutChanged();
}
void UserSearchModel::setResults(const std::vector<UserSearchResult>& results) {
- clear();
- emit layoutAboutToBeChanged();
- results_ = results;
- emit layoutChanged();
+ clear();
+ emit layoutAboutToBeChanged();
+ results_ = results;
+ emit layoutChanged();
}
int UserSearchModel::columnCount(const QModelIndex& /*parent*/) const {
- return 1;
+ return 1;
}
QVariant UserSearchModel::data(const QModelIndex& index, int role) const {
- if (!index.isValid()) return QVariant();
- UserSearchResult* result = static_cast<UserSearchResult*>(index.internalPointer());
- return data(result, role);
+ if (!index.isValid()) return QVariant();
+ UserSearchResult* result = static_cast<UserSearchResult*>(index.internalPointer());
+ return data(result, role);
}
QVariant UserSearchModel::data(UserSearchResult* item, int role) {
- switch (role) {
- case Qt::DisplayRole: return QVariant(nameLine(item));
- case DetailTextRole: return QVariant(detailLine(item));
- default: return QVariant();
- }
+ switch (role) {
+ case Qt::DisplayRole: return QVariant(nameLine(item));
+ case DetailTextRole: return QVariant(detailLine(item));
+ default: return QVariant();
+ }
}
QString UserSearchModel::nameLine(UserSearchResult* item) {
- QString result;
- const std::map<std::string, std::string> fields = item->getFields();
- std::map<std::string, std::string>::const_iterator first = fields.find("first");
- if (first != fields.end()) {
- result += P2QSTRING((*first).second);
- }
- std::map<std::string, std::string>::const_iterator last = fields.find("last");
- if (last != fields.end()) {
- if (!result.isEmpty()) {
- result += " ";
- }
- result += P2QSTRING((*last).second);
- }
- if (result.isEmpty()) {
- result = P2QSTRING(item->getJID().toString());
- }
- return result;
+ QString result;
+ const std::map<std::string, std::string> fields = item->getFields();
+ std::map<std::string, std::string>::const_iterator first = fields.find("first");
+ if (first != fields.end()) {
+ result += P2QSTRING((*first).second);
+ }
+ std::map<std::string, std::string>::const_iterator last = fields.find("last");
+ if (last != fields.end()) {
+ if (!result.isEmpty()) {
+ result += " ";
+ }
+ result += P2QSTRING((*last).second);
+ }
+ if (result.isEmpty()) {
+ result = P2QSTRING(item->getJID().toString());
+ }
+ return result;
}
QString UserSearchModel::detailLine(UserSearchResult* item) {
- return P2QSTRING(item->getJID().toString());
+ return P2QSTRING(item->getJID().toString());
}
QModelIndex UserSearchModel::index(int row, int column, const QModelIndex & parent) const {
- if (!hasIndex(row, column, parent)) {
- return QModelIndex();
- }
- return row < static_cast<int>(results_.size()) ? createIndex(row, column, reinterpret_cast<void*>(const_cast<UserSearchResult*>(&(results_[row])))) : QModelIndex();
+ if (!hasIndex(row, column, parent)) {
+ return QModelIndex();
+ }
+ return row < static_cast<int>(results_.size()) ? createIndex(row, column, reinterpret_cast<void*>(const_cast<UserSearchResult*>(&(results_[row])))) : QModelIndex();
}
QModelIndex UserSearchModel::parent(const QModelIndex& /*index*/) const {
- return QModelIndex();
+ return QModelIndex();
}
int UserSearchModel::rowCount(const QModelIndex& parentIndex) const {
- if (!parentIndex.isValid()) {
- return results_.size();
- }
- return 0;
+ if (!parentIndex.isValid()) {
+ return results_.size();
+ }
+ return 0;
}
}