summary refs log tree commit diff
path: root/include/QuickSwitcher.h
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-27 01:57:46 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-27 01:57:46 +0300
commitb72e48cbab53743b80130758b4bdb81e5778a014 (patch)
treef281fd56ebad04a258a97e3e51056f77ac6ad700 /include/QuickSwitcher.h
parentCopy lmdb.dll in the windows installer (diff)
downloadnheko-b72e48cbab53743b80130758b4bdb81e5778a014.tar.xz
Improve room searching
fixes #257
Diffstat (limited to 'include/QuickSwitcher.h')
-rw-r--r--include/QuickSwitcher.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/QuickSwitcher.h b/include/QuickSwitcher.h

index 01c5e6da..ce0ed00b 100644 --- a/include/QuickSwitcher.h +++ b/include/QuickSwitcher.h
@@ -22,8 +22,12 @@ #include <QVBoxLayout> #include <QWidget> +#include "Cache.h" +#include "SuggestionsPopup.hpp" #include "TextField.h" +Q_DECLARE_METATYPE(std::vector<RoomSearchResult>) + class RoomSearchInput : public TextField { Q_OBJECT @@ -38,20 +42,20 @@ signals: protected: void keyPressEvent(QKeyEvent *event) override; void hideEvent(QHideEvent *event) override; - bool focusNextPrevChild(bool next) override; + bool focusNextPrevChild(bool) override { return false; }; }; class QuickSwitcher : public QWidget { Q_OBJECT -public: - explicit QuickSwitcher(QWidget *parent = nullptr); - void setRoomList(const std::map<QString, QString> &rooms); +public: + QuickSwitcher(QSharedPointer<Cache> cache, QWidget *parent = nullptr); signals: void closing(); void roomSelected(const QString &roomid); + void queryResults(const std::vector<RoomSearchResult> &rooms); protected: void keyPressEvent(QKeyEvent *event) override; @@ -64,7 +68,9 @@ private: QVBoxLayout *topLayout_; RoomSearchInput *roomSearch_; - QCompleter *completer_; - std::map<QString, QString> rooms_; + //! Autocomplete popup box with the room suggestions. + SuggestionsPopup popup_; + //! Cache client for room quering. + QSharedPointer<Cache> cache_; };