mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
add quick switcher qml file and moved completerFor from inputbar to timeline view class
This commit is contained in:
parent
8351cc4180
commit
32d419d14f
6 changed files with 86 additions and 1 deletions
|
@ -52,7 +52,11 @@ Popup {
|
||||||
|
|
||||||
onCompleterNameChanged: {
|
onCompleterNameChanged: {
|
||||||
if (completerName) {
|
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("");
|
completer.setSearchString("");
|
||||||
} else {
|
} else {
|
||||||
completer = undefined;
|
completer = undefined;
|
||||||
|
|
38
resources/qml/QuickSwitcher.qml
Normal file
38
resources/qml/QuickSwitcher.qml
Normal file
|
@ -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 {
|
Menu {
|
||||||
id: messageContextMenu
|
id: messageContextMenu
|
||||||
|
|
||||||
|
|
|
@ -139,6 +139,7 @@
|
||||||
<file>qml/StatusIndicator.qml</file>
|
<file>qml/StatusIndicator.qml</file>
|
||||||
<file>qml/TimelineRow.qml</file>
|
<file>qml/TimelineRow.qml</file>
|
||||||
<file>qml/TopBar.qml</file>
|
<file>qml/TopBar.qml</file>
|
||||||
|
<file>qml/QuickSwitcher.qml</file>
|
||||||
<file>qml/TypingIndicator.qml</file>
|
<file>qml/TypingIndicator.qml</file>
|
||||||
<file>qml/RoomSettings.qml</file>
|
<file>qml/RoomSettings.qml</file>
|
||||||
<file>qml/emoji/EmojiButton.qml</file>
|
<file>qml/emoji/EmojiButton.qml</file>
|
||||||
|
|
|
@ -11,13 +11,16 @@
|
||||||
#include "BlurhashProvider.h"
|
#include "BlurhashProvider.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
#include "ColorImageProvider.h"
|
#include "ColorImageProvider.h"
|
||||||
|
#include "CompletionProxyModel.h"
|
||||||
#include "DelegateChooser.h"
|
#include "DelegateChooser.h"
|
||||||
#include "DeviceVerificationFlow.h"
|
#include "DeviceVerificationFlow.h"
|
||||||
#include "Logging.h"
|
#include "Logging.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
#include "MxcImageProvider.h"
|
#include "MxcImageProvider.h"
|
||||||
|
#include "RoomsModel.h"
|
||||||
#include "UserSettingsPage.h"
|
#include "UserSettingsPage.h"
|
||||||
|
#include "UsersModel.h"
|
||||||
#include "dialogs/ImageOverlay.h"
|
#include "dialogs/ImageOverlay.h"
|
||||||
#include "emoji/EmojiModel.h"
|
#include "emoji/EmojiModel.h"
|
||||||
#include "emoji/Provider.h"
|
#include "emoji/Provider.h"
|
||||||
|
@ -552,3 +555,25 @@ TimelineViewManager::focusMessageInput()
|
||||||
{
|
{
|
||||||
emit focusInput();
|
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(); }
|
void backToRooms() { emit showRoomList(); }
|
||||||
|
QObject *completerFor(QString completerName, QString roomId = "");
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef USE_QUICK_VIEW
|
#ifdef USE_QUICK_VIEW
|
||||||
|
|
Loading…
Reference in a new issue