2014-11-01 19:26:05 +01:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
Copyright 2011, David Sansome <me@davidsansome.com>
|
2014-11-02 19:36:21 +01:00
|
|
|
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
|
2014-11-01 19:26:05 +01:00
|
|
|
Copyright 2014, John Maguire <john.maguire@gmail.com>
|
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CORE_MULTISORTFILTERPROXY_H_
|
|
|
|
#define CORE_MULTISORTFILTERPROXY_H_
|
2011-07-26 13:17:28 +02:00
|
|
|
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
|
|
|
class MultiSortFilterProxy : public QSortFilterProxyModel {
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2014-11-01 19:26:05 +01:00
|
|
|
explicit MultiSortFilterProxy(QObject* parent = nullptr);
|
2011-07-26 13:17:28 +02:00
|
|
|
|
|
|
|
void AddSortSpec(int role, Qt::SortOrder order = Qt::AscendingOrder);
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
protected:
|
2011-07-26 13:17:28 +02:00
|
|
|
bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
private:
|
2011-07-26 14:22:23 +02:00
|
|
|
int Compare(const QVariant& left, const QVariant& right) const;
|
2011-07-26 13:17:28 +02:00
|
|
|
|
|
|
|
typedef QPair<int, Qt::SortOrder> SortSpec;
|
|
|
|
QList<SortSpec> sorting_;
|
|
|
|
};
|
|
|
|
|
2014-11-01 19:26:05 +01:00
|
|
|
#endif // CORE_MULTISORTFILTERPROXY_H_
|