From bd16af99a8475c3847cad3f8036c25ae35a7f66d Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Mon, 27 Feb 2012 11:47:42 +0000 Subject: stream browser: added filter git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2641 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/streambrowser/streamwindow.cpp | 18 ++++++++++-- src/plugins/General/streambrowser/streamwindow.h | 3 ++ src/plugins/General/streambrowser/streamwindow.ui | 34 +++++++++++++++------- .../translations/streambrowser_plugin_cs.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_de.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_es.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_it.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_ja.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_lt.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_nl.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_pl.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_ru.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_tr.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_uk_UA.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_zh_CN.ts | 26 ++++++++++++----- .../translations/streambrowser_plugin_zh_TW.ts | 26 ++++++++++++----- 16 files changed, 276 insertions(+), 117 deletions(-) (limited to 'src/plugins/General/streambrowser') diff --git a/src/plugins/General/streambrowser/streamwindow.cpp b/src/plugins/General/streambrowser/streamwindow.cpp index 4dbf86579..f893467fc 100644 --- a/src/plugins/General/streambrowser/streamwindow.cpp +++ b/src/plugins/General/streambrowser/streamwindow.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -45,13 +46,18 @@ StreamWindow::StreamWindow(QWidget *parent) : QWidget(parent) ui.addPushButton->setIcon(QIcon::fromTheme("list-add")); ui.updatePushButton->setIcon(QIcon::fromTheme("view-refresh")); - m_icecastModel = new QStandardItemModel(this); m_icecastModel->setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Genre") << tr("Bitrate") << tr("Format")); - ui.icecastTableView->setModel(m_icecastModel); + m_filterModel = new QSortFilterProxyModel(this); + m_filterModel->setSourceModel(m_icecastModel); + m_filterModel->setDynamicSortFilter(true); + m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); + + + ui.icecastTableView->setModel(m_filterModel); ui.icecastTableView->verticalHeader()->setDefaultSectionSize(fontMetrics().height()); ui.icecastTableView->verticalHeader()->setResizeMode(QHeaderView::Fixed); ui.icecastTableView->setEditTriggers(QAbstractItemView::NoEditTriggers); @@ -132,12 +138,18 @@ void StreamWindow::on_addPushButton_clicked() QStringList urls; foreach(QModelIndex index, indexes) { - urls.append(m_icecastModel->item(index.row(),0)->data().toString()); + QModelIndex source_index = m_filterModel->mapToSource(index); + urls.append(m_icecastModel->item(source_index.row(),0)->data().toString()); } urls.removeDuplicates(); PlayListManager::instance()->add(urls); } +void StreamWindow::on_filterLineEdit_textChanged(const QString &text) +{ + m_filterModel->setFilterFixedString(text); +} + void StreamWindow::closeEvent(QCloseEvent *) { QSettings settings(Qmmp::configFile(), QSettings::IniFormat); diff --git a/src/plugins/General/streambrowser/streamwindow.h b/src/plugins/General/streambrowser/streamwindow.h index 3bd0e69e7..b33e6f36f 100644 --- a/src/plugins/General/streambrowser/streamwindow.h +++ b/src/plugins/General/streambrowser/streamwindow.h @@ -26,6 +26,7 @@ class QNetworkAccessManager; class QNetworkReply; class QStandardItemModel; +class QSortFilterProxyModel; /** @author Ilya Kotov @@ -42,6 +43,7 @@ private slots: void showText(QNetworkReply *reply); void on_updatePushButton_clicked(); void on_addPushButton_clicked(); + void on_filterLineEdit_textChanged(const QString &text); private: void closeEvent(QCloseEvent *); @@ -51,6 +53,7 @@ private: QNetworkReply *m_requestReply; QString m_artist, m_title; QStandardItemModel *m_icecastModel; + QSortFilterProxyModel *m_filterModel; }; #endif diff --git a/src/plugins/General/streambrowser/streamwindow.ui b/src/plugins/General/streambrowser/streamwindow.ui index fc8c8dad7..e86e0f1e7 100644 --- a/src/plugins/General/streambrowser/streamwindow.ui +++ b/src/plugins/General/streambrowser/streamwindow.ui @@ -24,6 +24,20 @@ 6 + + + + + Filter: + + + + + + + + + 1 @@ -82,34 +96,34 @@ - + Add - + Update - - - - QDialogButtonBox::Close - - - - + ? + + + + QDialogButtonBox::Close + + + diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_cs.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_cs.ts index c82c66426..178f0a122 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_cs.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_cs.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done Hotovo - - + + Error Chyba - + Receiving Příjímám diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_de.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_de.ts index a655c2adb..7f612d5ea 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_de.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_de.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done Fertig - - + + Error Fehler - + Receiving Daten werden empfangen diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_es.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_es.ts index 374de4cf7..483b595cb 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_es.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_es.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done Hecho - - + + Error Error - + Receiving Recibiendo diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_it.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_it.ts index 4ba29ba44..e933bb385 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_it.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_it.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done - - + + Error - + Receiving Ricezione diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_ja.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_ja.ts index a53bc9090..d0ccde68e 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_ja.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_ja.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done 完了 - - + + Error 事故 - + Receiving 取得中 diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_lt.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_lt.ts index 68cd7d34a..bd2feb375 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_lt.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_lt.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done Atlikta - - + + Error Klaida - + Receiving Gaunu diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_nl.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_nl.ts index 15d8de383..13b3f6a1f 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_nl.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_nl.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done Klaar - - + + Error Fout - + Receiving Bezig met ontvangen diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_pl.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_pl.ts index 5579bf0af..bff4226d6 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_pl.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_pl.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done Gotowe - - + + Error Błąd - + Receiving Pobieranie diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_ru.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_ru.ts index d229fc3fb..3dd38ad19 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_ru.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_ru.ts @@ -8,6 +8,11 @@ Stream Browser Обзор потоков + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ Обзор потоков - + + Filter: + Фильтр: + + + Favorites Избранное - + IceCast IceCast - + Add Добавить - + Update Обновить @@ -85,18 +95,18 @@ Формат - + Done Готово - - + + Error Ошибка - + Receiving Получение diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_tr.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_tr.ts index 30b96f8a5..9dff74a6b 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_tr.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_tr.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done - - + + Error - + Receiving Alınıyor diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_uk_UA.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_uk_UA.ts index 754f8e7e0..b65aa9548 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_uk_UA.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_uk_UA.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done Готово - - + + Error Помилка - + Receiving Отримання diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_CN.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_CN.ts index 43336e056..81c682e7d 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_CN.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_CN.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done 完成 - - + + Error 错误 - + Receiving 接受 diff --git a/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_TW.ts b/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_TW.ts index ae5df051f..3cc29186d 100644 --- a/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_TW.ts +++ b/src/plugins/General/streambrowser/translations/streambrowser_plugin_zh_TW.ts @@ -8,6 +8,11 @@ Stream Browser + + + Ctrl+U + + StreamBrowserFactory @@ -45,22 +50,27 @@ - + + Filter: + + + + Favorites - + IceCast - + Add - + Update @@ -85,18 +95,18 @@ - + Done 完成 - - + + Error 錯誤 - + Receiving 接受 -- cgit v1.2.3-13-gbd6f