mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
enter key now works, fix room highlighting and add overlay
This commit is contained in:
parent
3f4ad1dd8b
commit
b1dec6f6ac
7 changed files with 30 additions and 1 deletions
|
@ -52,6 +52,12 @@ Popup {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function finishCompletion() {
|
||||||
|
if(popup.completerName == "room") {
|
||||||
|
popup.completionSelected(listView.itemAtIndex(currentIndex).modelData.roomid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onCompleterNameChanged: {
|
onCompleterNameChanged: {
|
||||||
if (completerName) {
|
if (completerName) {
|
||||||
if (completerName == "user") {
|
if (completerName == "user") {
|
||||||
|
@ -85,6 +91,7 @@ Popup {
|
||||||
color: model.index == popup.currentIndex ? colors.highlight : colors.base
|
color: model.index == popup.currentIndex ? colors.highlight : colors.base
|
||||||
height: chooser.childrenRect.height + 4
|
height: chooser.childrenRect.height + 4
|
||||||
implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4
|
implicitWidth: fullWidth ? popup.width : chooser.childrenRect.width + 4
|
||||||
|
property variant modelData: model
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
|
|
|
@ -11,6 +11,10 @@ Popup {
|
||||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||||
parent: Overlay.overlay
|
parent: Overlay.overlay
|
||||||
|
|
||||||
|
Overlay.modal: Rectangle {
|
||||||
|
color: "#aa1E1E1E"
|
||||||
|
}
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
id: roomTextInput
|
id: roomTextInput
|
||||||
|
|
||||||
|
@ -29,6 +33,9 @@ Popup {
|
||||||
} else if (event.key == Qt.Key_Down && completerPopup.opened) {
|
} else if (event.key == Qt.Key_Down && completerPopup.opened) {
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
completerPopup.down();
|
completerPopup.down();
|
||||||
|
} else if (event.matches(StandardKey.InsertParagraphSeparator)) {
|
||||||
|
completerPopup.finishCompletion()
|
||||||
|
event.accepted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +64,9 @@ Popup {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
onCompletionSelected: {
|
onCompletionSelected: {
|
||||||
|
console.log(id)
|
||||||
TimelineManager.setHistoryView(id)
|
TimelineManager.setHistoryView(id)
|
||||||
|
TimelineManager.highlightRoom(id)
|
||||||
quickSwitcher.close()
|
quickSwitcher.close()
|
||||||
}
|
}
|
||||||
target: completerPopup
|
target: completerPopup
|
||||||
|
|
|
@ -72,7 +72,6 @@ Page {
|
||||||
id: quickSwitcherComponent
|
id: quickSwitcherComponent
|
||||||
|
|
||||||
QuickSwitcher {
|
QuickSwitcher {
|
||||||
id: quickSwitcher
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1429,3 +1429,9 @@ ChatPage::handleMatrixUri(const QUrl &uri)
|
||||||
{
|
{
|
||||||
handleMatrixUri(uri.toString(QUrl::ComponentFormattingOption::FullyEncoded).toUtf8());
|
handleMatrixUri(uri.toString(QUrl::ComponentFormattingOption::FullyEncoded).toUtf8());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ChatPage::highlightRoom(const QString &room_id)
|
||||||
|
{
|
||||||
|
room_list_->highlightSelectedRoom(room_id);
|
||||||
|
}
|
|
@ -116,6 +116,7 @@ public slots:
|
||||||
void startChat(QString userid);
|
void startChat(QString userid);
|
||||||
void leaveRoom(const QString &room_id);
|
void leaveRoom(const QString &room_id);
|
||||||
void createRoom(const mtx::requests::CreateRoom &req);
|
void createRoom(const mtx::requests::CreateRoom &req);
|
||||||
|
void highlightRoom(const QString &room_id);
|
||||||
void joinRoom(const QString &room);
|
void joinRoom(const QString &room);
|
||||||
void joinRoomVia(const std::string &room_id, const std::vector<std::string> &via);
|
void joinRoomVia(const std::string &room_id, const std::vector<std::string> &via);
|
||||||
|
|
||||||
|
|
|
@ -333,6 +333,12 @@ TimelineViewManager::setHistoryView(const QString &room_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimelineViewManager::highlightRoom(const QString &room_id)
|
||||||
|
{
|
||||||
|
ChatPage::instance()->highlightRoom(room_id);
|
||||||
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
TimelineViewManager::escapeEmoji(QString str) const
|
TimelineViewManager::escapeEmoji(QString str) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,6 +100,7 @@ public slots:
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHistoryView(const QString &room_id);
|
void setHistoryView(const QString &room_id);
|
||||||
|
void highlightRoom(const QString &room_id);
|
||||||
TimelineModel *getHistoryView(const QString &room_id)
|
TimelineModel *getHistoryView(const QString &room_id)
|
||||||
{
|
{
|
||||||
auto room = models.find(room_id);
|
auto room = models.find(room_id);
|
||||||
|
|
Loading…
Reference in a new issue