]> git.sur5r.net Git - minitube/blob - src/SearchView.h
6ad912d0321e1d41d02f70a7028861a915c7911d
[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 SearchView : public QWidget, public View {
10
11     Q_OBJECT
12
13 public:
14     SearchView(QWidget *parent);
15     void updateRecentKeywords();
16
17     void appear() {
18         updateRecentKeywords();
19         queryEdit->clear();
20         queryEdit->setFocus(Qt::OtherFocusReason);
21         queryEdit->enableSuggest();
22     }
23
24     void disappear() {}
25
26     QMap<QString, QVariant> metadata() {
27         QMap<QString, QVariant> metadata;
28         metadata.insert("title", "");
29         metadata.insert("description", tr("Make yourself comfortable"));
30         return metadata;
31     }
32
33 public slots:
34     void watch(QString query);
35     void gotNewVersion(QString version);
36
37 signals:
38     void search(QString query);
39
40 private slots:
41     void watch();
42     void textChanged(const QString &text);
43
44 private:
45     void checkForUpdate();
46
47     SearchLineEdit *queryEdit;
48     QLabel *recentKeywordsLabel;
49     QVBoxLayout *recentKeywordsLayout;
50     QLabel *message;
51     QPushButton *watchButton;
52
53     UpdateChecker *updateChecker;
54
55 };
56
57 #endif // __SEARCHVIEW_H__