]> git.sur5r.net Git - minitube/blob - src/SearchView.h
c32db4b5bb2adbb662785750110febab0b51327b
[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 protected:
41     void paintEvent(QPaintEvent *);
42
43 private slots:
44     void watch();
45     void textChanged(const QString &text);
46
47 private:
48     void checkForUpdate();
49
50     SearchLineEdit *queryEdit;
51     QLabel *recentKeywordsLabel;
52     QVBoxLayout *recentKeywordsLayout;
53     QLabel *message;
54     QPushButton *watchButton;
55
56     UpdateChecker *updateChecker;
57
58 };
59
60 #endif // __SEARCHVIEW_H__