]> git.sur5r.net Git - minitube/blob - src/SearchView.h
30888d3f9bbb471f92e3f6bc304b52b7d448dd59
[minitube] / src / SearchView.h
1 #ifndef __SEARCHVIEW_H__
2 #define __SEARCHVIEW_H__
3
4 #include <QtGui>
5 #include "View.h"
6 #include "searchlineedit.h"
7
8 class SearchParams;
9 class YouTubeSuggest;
10 class ChannelSuggest;
11
12 class SearchView : public QWidget, public View {
13
14     Q_OBJECT
15
16 public:
17     SearchView(QWidget *parent);
18     void updateRecentKeywords();
19     void updateRecentChannels();
20
21     void appear() {
22         updateRecentKeywords();
23         updateRecentChannels();
24         queryEdit->clear();
25         queryEdit->enableSuggest();
26         QTimer::singleShot(0, queryEdit, SLOT(setFocus()));
27     }
28
29     void disappear() {}
30
31     QMap<QString, QVariant> metadata() {
32         QMap<QString, QVariant> metadata;
33         metadata.insert("title", "");
34         metadata.insert("description", tr("Make yourself comfortable"));
35         return metadata;
36     }
37
38 public slots:
39     void watch(QString query);
40     void watchChannel(QString channel);
41     void watchKeywords(QString query);
42
43 signals:
44     void search(SearchParams*);
45
46 protected:
47     void paintEvent(QPaintEvent *);
48
49 private slots:
50     void watch();
51     void textChanged(const QString &text);
52     void searchTypeChanged(int index);
53
54 private:
55     YouTubeSuggest *youtubeSuggest;
56     ChannelSuggest *channelSuggest;
57
58     QComboBox *typeCombo;
59     SearchLineEdit *queryEdit;
60     QLabel *recentKeywordsLabel;
61     QBoxLayout *recentKeywordsLayout;
62     QLabel *recentChannelsLabel;
63     QBoxLayout *recentChannelsLayout;
64     QLabel *message;
65     QPushButton *watchButton;
66
67 };
68
69 #endif // __SEARCHVIEW_H__