Changeset View
Changeset View
Standalone View
Standalone View
src/presentation/availablesourcesmodel.h
Show All 35 Lines | |||||
36 | class QModelIndex; | 36 | class QModelIndex; | ||
37 | 37 | | |||
38 | namespace Presentation { | 38 | namespace Presentation { | ||
39 | 39 | | |||
40 | class AvailableSourcesModel : public QObject, public ErrorHandlingModelBase | 40 | class AvailableSourcesModel : public QObject, public ErrorHandlingModelBase | ||
41 | { | 41 | { | ||
42 | Q_OBJECT | 42 | Q_OBJECT | ||
43 | Q_PROPERTY(QAbstractItemModel* sourceListModel READ sourceListModel) | 43 | Q_PROPERTY(QAbstractItemModel* sourceListModel READ sourceListModel) | ||
44 | Q_PROPERTY(QAbstractItemModel* searchListModel READ searchListModel) | | |||
45 | Q_PROPERTY(QString searchTerm READ searchTerm WRITE setSearchTerm NOTIFY searchTermChanged) | | |||
46 | public: | 44 | public: | ||
47 | explicit AvailableSourcesModel(const Domain::DataSourceQueries::Ptr &dataSourceQueries, | 45 | explicit AvailableSourcesModel(const Domain::DataSourceQueries::Ptr &dataSourceQueries, | ||
48 | const Domain::DataSourceRepository::Ptr &dataSourceRepository, | 46 | const Domain::DataSourceRepository::Ptr &dataSourceRepository, | ||
49 | QObject *parent = Q_NULLPTR); | 47 | QObject *parent = Q_NULLPTR); | ||
50 | 48 | | |||
51 | QAbstractItemModel *sourceListModel(); | 49 | QAbstractItemModel *sourceListModel(); | ||
52 | QAbstractItemModel *searchListModel(); | | |||
53 | | ||||
54 | QString searchTerm() const; | | |||
55 | void setSearchTerm(const QString &term); | | |||
56 | | ||||
57 | signals: | | |||
58 | void searchTermChanged(const QString &term); | | |||
59 | 50 | | |||
60 | public slots: | 51 | public slots: | ||
61 | void setDefaultItem(const QModelIndex &index); | 52 | void setDefaultItem(const QModelIndex &index); | ||
62 | 53 | | |||
63 | void listSource(const Domain::DataSource::Ptr &source); | | |||
64 | void unlistSource(const Domain::DataSource::Ptr &source); | | |||
65 | void bookmarkSource(const Domain::DataSource::Ptr &source); | | |||
66 | | ||||
67 | void showConfigDialog(); | 54 | void showConfigDialog(); | ||
68 | 55 | | |||
69 | private slots: | 56 | private slots: | ||
70 | void onDefaultSourceChanged(); | 57 | void onDefaultSourceChanged(); | ||
71 | 58 | | |||
72 | private: | 59 | private: | ||
73 | void emitDefaultSourceChanged(const QModelIndex &root); | 60 | void emitDefaultSourceChanged(const QModelIndex &root); | ||
74 | 61 | | |||
75 | QAbstractItemModel *createSourceListModel(); | 62 | QAbstractItemModel *createSourceListModel(); | ||
76 | QAbstractItemModel *createSearchListModel(); | | |||
77 | 63 | | |||
78 | QAbstractItemModel *m_sourceListModel; | 64 | QAbstractItemModel *m_sourceListModel; | ||
79 | QAbstractItemModel *m_searchListModel; | | |||
80 | 65 | | |||
81 | Domain::DataSourceQueries::Ptr m_dataSourceQueries; | 66 | Domain::DataSourceQueries::Ptr m_dataSourceQueries; | ||
82 | Domain::DataSourceRepository::Ptr m_dataSourceRepository; | 67 | Domain::DataSourceRepository::Ptr m_dataSourceRepository; | ||
83 | }; | 68 | }; | ||
84 | 69 | | |||
85 | } | 70 | } | ||
86 | 71 | | |||
87 | #endif // PRESENTATION_AVAILABLESOURCESMODEL_H | 72 | #endif // PRESENTATION_AVAILABLESOURCESMODEL_H |