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