Implement search filters in the proxy model. Partially closes #972

This commit is contained in:
Eugene Shalygin
2015-09-23 22:20:22 +02:00
committed by Eugene Shalygin
parent 93d8cadaaf
commit 1336cb7a61
16 changed files with 704 additions and 133 deletions

View File

@@ -31,42 +31,71 @@
#ifndef SEARCHTAB_H
#define SEARCHTAB_H
#include <QWidget>
#include <QVariant> // I don't know why <QMetaType> is not enought for Qt's 4.8.7 moc
#include "ui_searchtab.h"
#define ENGINE_URL_COLUMN 4
#define URL_COLUMN 5
class QLabel;
class QModelIndex;
class QTreeView;
class QHeaderView;
class QStandardItemModel;
class QSortFilterProxyModel;
class QModelIndex;
class QVBoxLayout;
class SearchSortModel;
class SearchListDelegate;
class SearchWidget;
class SearchTab: public QWidget
class SearchTab: public QWidget, private Ui::SearchTab
{
Q_OBJECT
public:
explicit SearchTab(SearchWidget *m_parent);
QLabel* getCurrentLabel() const;
enum NameFilteringMode
{
Everywhere,
OnlyNames
};
Q_ENUMS(NameFilteringMode)
explicit SearchTab(SearchWidget *parent);
QStandardItemModel* getCurrentSearchListModel() const;
QSortFilterProxyModel* getCurrentSearchListProxy() const;
SearchSortModel* getCurrentSearchListProxy() const;
QTreeView* getCurrentTreeView() const;
QHeaderView* header() const;
QString status() const;
bool loadColWidthResultsList();
void setRowColor(int row, QString color);
void setStatus(const QString &value);
enum class Status
{
Ongoing,
Finished,
Error,
Aborted,
NoResults
};
void setStatus(Status value);
Status status() const;
void updateResultsCount();
private slots:
void downloadSelectedItem(const QModelIndex &index);
void updateFilter();
private:
void fillFilterComboBoxes();
NameFilteringMode filteringMode() const;
static QString statusText(Status st);
static QString statusIconName(Status st);
QVBoxLayout *m_box;
QLabel *m_resultsLbl;
QTreeView *m_resultsBrowser;
@@ -74,8 +103,9 @@ private:
SearchSortModel *m_proxyModel;
SearchListDelegate *m_searchDelegate;
SearchWidget *m_parent;
QString m_status;
Status m_status;
};
#endif // SEARCHTAB_H
Q_DECLARE_METATYPE(SearchTab::NameFilteringMode)
#endif // SEARCHTAB_H