summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-21 23:10:21 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-21 23:10:21 +0530
commit32d419d14f19436c2c8352de06b5c6051e8cc0ab (patch)
treed3f5ffc946b1a8164d83b59d11912d813b3fbe38 /src
parentFix miscalculation of padding in timeline (diff)
downloadnheko-32d419d14f19436c2c8352de06b5c6051e8cc0ab.tar.xz
add quick switcher qml file and moved completerFor from inputbar to timeline view class
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineViewManager.cpp25
-rw-r--r--src/timeline/TimelineViewManager.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp

index f2e6d571..dc041cb9 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp
@@ -11,13 +11,16 @@ #include "BlurhashProvider.h" #include "ChatPage.h" #include "ColorImageProvider.h" +#include "CompletionProxyModel.h" #include "DelegateChooser.h" #include "DeviceVerificationFlow.h" #include "Logging.h" #include "MainWindow.h" #include "MatrixClient.h" #include "MxcImageProvider.h" +#include "RoomsModel.h" #include "UserSettingsPage.h" +#include "UsersModel.h" #include "dialogs/ImageOverlay.h" #include "emoji/EmojiModel.h" #include "emoji/Provider.h" @@ -552,3 +555,25 @@ TimelineViewManager::focusMessageInput() { emit focusInput(); } + +QObject * +TimelineViewManager::completerFor(QString completerName, QString roomId) +{ + if (completerName == "user") { + auto userModel = new UsersModel(roomId.toStdString()); + auto proxy = new CompletionProxyModel(userModel); + userModel->setParent(proxy); + return proxy; + } else if (completerName == "emoji") { + auto emojiModel = new emoji::EmojiModel(); + auto proxy = new CompletionProxyModel(emojiModel); + emojiModel->setParent(proxy); + return proxy; + } else if (completerName == "room") { + auto roomModel = new RoomsModel(true); + auto proxy = new CompletionProxyModel(roomModel); + roomModel->setParent(proxy); + return proxy; + } + return nullptr; +} \ No newline at end of file diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h
index 61fce574..d6383806 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h
@@ -138,6 +138,7 @@ public slots: } void backToRooms() { emit showRoomList(); } + QObject *completerFor(QString completerName, QString roomId = ""); private: #ifdef USE_QUICK_VIEW