diff options
Diffstat (limited to 'src/plugins/General/streambrowser')
| -rw-r--r-- | src/plugins/General/streambrowser/streamwindow.cpp | 4 | ||||
| -rw-r--r-- | src/plugins/General/streambrowser/streamwindow.h | 23 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/plugins/General/streambrowser/streamwindow.cpp b/src/plugins/General/streambrowser/streamwindow.cpp index 93f2e64d9..452b68e17 100644 --- a/src/plugins/General/streambrowser/streamwindow.cpp +++ b/src/plugins/General/streambrowser/streamwindow.cpp @@ -52,7 +52,7 @@ StreamWindow::StreamWindow(QWidget *parent) : QWidget(parent) << tr("Genre") << tr("Bitrate") << tr("Format")); - m_iceCastFilterModel = new QSortFilterProxyModel(this); + m_iceCastFilterModel = new StreamsProxyModel(this); m_iceCastFilterModel->setSourceModel(m_iceCastModel); m_iceCastFilterModel->setDynamicSortFilter(true); m_iceCastFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); @@ -70,7 +70,7 @@ StreamWindow::StreamWindow(QWidget *parent) : QWidget(parent) << tr("Genre") << tr("Bitrate") << tr("Format")); - m_favoritesFilterModel = new QSortFilterProxyModel(this); + m_favoritesFilterModel = new StreamsProxyModel(this); m_favoritesFilterModel->setSourceModel(m_favoritesModel); m_favoritesFilterModel->setDynamicSortFilter(true); m_favoritesFilterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/plugins/General/streambrowser/streamwindow.h b/src/plugins/General/streambrowser/streamwindow.h index 35844702d..9e29e81e3 100644 --- a/src/plugins/General/streambrowser/streamwindow.h +++ b/src/plugins/General/streambrowser/streamwindow.h @@ -21,6 +21,7 @@ #define STREAMWINDOW_H #include <QWidget> +#include <QSortFilterProxyModel> #include "ui_streamwindow.h" class QNetworkAccessManager; @@ -28,6 +29,7 @@ class QNetworkReply; class QStandardItemModel; class QSortFilterProxyModel; class QMenu; +class StreamsProxyModel; /** @author Ilya Kotov <forkotov02@hotmail.ru> @@ -64,4 +66,25 @@ private: QMenu *m_favoritesMenu; }; +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class StreamsProxyModel: public QSortFilterProxyModel +{ +Q_OBJECT +public: + StreamsProxyModel(QObject *parent) : QSortFilterProxyModel(parent){} + +protected: + bool lessThan (const QModelIndex &left, const QModelIndex &right) const + { + if(left.column() == 2 && right.column() == 2) + { + return sourceModel()->data(left).toInt() < sourceModel()->data(right).toInt(); + } + return QSortFilterProxyModel::lessThan(left, right); + } +}; + + #endif |
