~qutim/libcommuni/master

« back to all changes in this revision

Viewing changes to src/model/ircusermodel.cpp

  • Committer: J-P Nurmi
  • Author(s): Alexandre Colucci
  • Date: 2017-07-22 20:03:51 UTC
  • Revision ID: git-v1:560046f29ea317bec8333146eb9fb3077cb897a3
Fix warnings caused by the use of the deprecated qSort and qUpperBound (#57)


Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include "ircchannel_p.h"
34
34
#include "ircuser.h"
35
35
#include <qpointer.h>
 
36
#include <algorithm>
36
37
 
37
38
IRC_BEGIN_NAMESPACE
38
39
 
125
126
    if (sortMethod != Irc::SortByHand) {
126
127
        QList<IrcUser*>::iterator it;
127
128
        if (sortOrder == Qt::AscendingOrder)
128
 
            it = qUpperBound(userList.begin(), userList.end(), user, IrcUserLessThan(q, sortMethod));
 
129
            it = std::upper_bound(userList.begin(), userList.end(), user, IrcUserLessThan(q, sortMethod));
129
130
        else
130
 
            it = qUpperBound(userList.begin(), userList.end(), user, IrcUserGreaterThan(q, sortMethod));
 
131
            it = std::upper_bound(userList.begin(), userList.end(), user, IrcUserGreaterThan(q, sortMethod));
131
132
        index = it - userList.begin();
132
133
    }
133
134
    if (notify)
179
180
    userList = users;
180
181
    if (sortMethod != Irc::SortByHand) {
181
182
        if (sortOrder == Qt::AscendingOrder)
182
 
            qSort(userList.begin(), userList.end(), IrcUserLessThan(q, sortMethod));
 
183
            std::sort(userList.begin(), userList.end(), IrcUserLessThan(q, sortMethod));
183
184
        else
184
 
            qSort(userList.begin(), userList.end(), IrcUserGreaterThan(q, sortMethod));
 
185
            std::sort(userList.begin(), userList.end(), IrcUserGreaterThan(q, sortMethod));
185
186
    }
186
187
    updateTitles();
187
188
    if (reset)
695
696
        persistentUsers += static_cast<IrcUser*>(index.internalPointer());
696
697
 
697
698
    if (order == Qt::AscendingOrder)
698
 
        qSort(d->userList.begin(), d->userList.end(), IrcUserLessThan(this, method));
 
699
        std::sort(d->userList.begin(), d->userList.end(), IrcUserLessThan(this, method));
699
700
    else
700
 
        qSort(d->userList.begin(), d->userList.end(), IrcUserGreaterThan(this, method));
 
701
        std::sort(d->userList.begin(), d->userList.end(), IrcUserGreaterThan(this, method));
701
702
 
702
703
    if (d->updateTitles())
703
704
        emit titlesChanged(d->titles);