X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fautocomplete.h;fp=src%2Fautocomplete.h;h=eaf4eb182bf642ddb86e78141dbf21d9b01ad6a7;hb=5ecc9c04fb173c5693bcded5191d29816304d12c;hp=17a59530bf82c76d7678b6ed24705176b72360b0;hpb=e911bb9726db1c3e46ba365e52f7541b8f4a47d4;p=minitube
diff --git a/src/autocomplete.h b/src/autocomplete.h
index 17a5953..eaf4eb1 100644
--- a/src/autocomplete.h
+++ b/src/autocomplete.h
@@ -17,46 +17,55 @@ You should have received a copy of the GNU General Public License
along with Minitube. If not, see .
$END_LICENSE */
-
-#ifndef SUGGESTCOMPLETION_H
-#define SUGGESTCOMPLETION_H
+#ifndef AUTOCOMPLETE_H
+#define AUTOCOMPLETE_H
#include
class Suggester;
+class Suggestion;
class SearchLineEdit;
class AutoComplete : public QObject {
+
Q_OBJECT
public:
- AutoComplete(SearchLineEdit *parent, QLineEdit *editor);
- ~AutoComplete();
- bool eventFilter(QObject *obj, QEvent *ev);
- void showCompletion(const QStringList &choices);
+ AutoComplete(SearchLineEdit *buddy, QLineEdit *lineEdit);
void setSuggester(Suggester* suggester);
QListWidget* getPopup() { return popup; }
-
-public slots:
- void doneCompletion();
void preventSuggest();
void enableSuggest();
- void autoSuggest();
- void currentItemChanged(QListWidgetItem *current);
- void suggestionsReady(QStringList suggestions);
signals:
- void suggestionAccepted(const QString &suggestion);
+ void suggestionAccepted(Suggestion *suggestion);
+ void suggestionAccepted(const QString &value);
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *ev);
+
+private slots:
+ void acceptSuggestion();
+ void suggest();
+ void itemEntered(QListWidgetItem *item);
+ void currentItemChanged(QListWidgetItem *item);
+ void suggestionsReady(const QList &suggestions);
+ void adjustPosition();
+ void enableItemHovering();
private:
+ void showSuggestions(const QList &suggestions);
+ void hideSuggestions();
+
SearchLineEdit *buddy;
- QLineEdit *editor;
+ QLineEdit *lineEdit;
QString originalText;
QListWidget *popup;
QTimer *timer;
bool enabled;
- Suggester* suggester;
-
+ Suggester *suggester;
+ QList suggestions;
+ bool itemHovering;
};
-#endif // SUGGESTCOMPLETION_H
+#endif // AUTOCOMPLETE_H