add quick switcher qml file and moved completerFor from inputbar to timeline view class

pull/493/head
Jedi18 4 years ago
parent 8351cc4180
commit 32d419d14f
  1. 6
      resources/qml/Completer.qml
  2. 38
      resources/qml/QuickSwitcher.qml
  3. 16
      resources/qml/TimelineView.qml
  4. 1
      resources/res.qrc
  5. 25
      src/timeline/TimelineViewManager.cpp
  6. 1
      src/timeline/TimelineViewManager.h

@ -52,7 +52,11 @@ Popup {
onCompleterNameChanged: {
if (completerName) {
completer = TimelineManager.timeline.input.completerFor(completerName);
if (completerName == "user") {
completer = TimelineManager.completerFor(completerName, TimelineManager.timeline.roomId());
} else {
completer = TimelineManager.completerFor(completerName);
}
completer.setSearchString("");
} else {
completer = undefined;

@ -0,0 +1,38 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import im.nheko 1.0
Popup {
x: parent.width / 2 - width / 2
y: parent.height / 4 - height / 2
width: parent.width / 2
height: 100
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
parent: Overlay.overlay
TextInput {
id: roomTextInput
anchors.fill: parent
focus: true
onTextEdited: {
completerPopup.completer.setSearchString(text)
}
}
Completer {
id: completerPopup
x: roomTextInput.x + 100
y: roomTextInput.y - 20
completerName: "room"
bottomToTop: true
}
onOpened: {
completerPopup.open()
}
}

@ -68,6 +68,22 @@ Page {
}
Component {
id: quickSwitcherComponent
QuickSwitcher {
id: quickSwitcher
}
}
Shortcut {
sequence: "Ctrl+L"
onActivated: {
var quickSwitch = quickSwitcherComponent.createObject(timelineRoot);
quickSwitch.open();
}
}
Menu {
id: messageContextMenu

@ -139,6 +139,7 @@
<file>qml/StatusIndicator.qml</file>
<file>qml/TimelineRow.qml</file>
<file>qml/TopBar.qml</file>
<file>qml/QuickSwitcher.qml</file>
<file>qml/TypingIndicator.qml</file>
<file>qml/RoomSettings.qml</file>
<file>qml/emoji/EmojiButton.qml</file>

@ -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;
}

@ -138,6 +138,7 @@ public slots:
}
void backToRooms() { emit showRoomList(); }
QObject *completerFor(QString completerName, QString roomId = "");
private:
#ifdef USE_QUICK_VIEW

Loading…
Cancel
Save