mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
make lint
This commit is contained in:
parent
182de32380
commit
d2d5229ede
7 changed files with 72 additions and 34 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Layouts 1.12
|
||||||
|
@ -11,14 +15,11 @@ ApplicationWindow {
|
||||||
property InviteesModel invitees
|
property InviteesModel invitees
|
||||||
|
|
||||||
function addInvite() {
|
function addInvite() {
|
||||||
if (inviteeEntry.text.match("@.+?:.{3,}"))
|
if (inviteeEntry.text.match("@.+?:.{3,}")) {
|
||||||
{
|
|
||||||
invitees.addUser(inviteeEntry.text);
|
invitees.addUser(inviteeEntry.text);
|
||||||
inviteeEntry.clear();
|
inviteeEntry.clear();
|
||||||
}
|
} else {
|
||||||
else
|
warningLabel.show();
|
||||||
{
|
|
||||||
warningLabel.show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,19 +58,29 @@ ApplicationWindow {
|
||||||
|
|
||||||
placeholderText: qsTr("@joe:matrix.org", "Example user id. The name 'joe' can be localized however you want.")
|
placeholderText: qsTr("@joe:matrix.org", "Example user id. The name 'joe' can be localized however you want.")
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onAccepted: if (text !== "") addInvite()
|
onAccepted: {
|
||||||
|
if (text !== "") {
|
||||||
|
addInvite();
|
||||||
|
}
|
||||||
|
}
|
||||||
Component.onCompleted: forceActiveFocus()
|
Component.onCompleted: forceActiveFocus()
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: "Ctrl+Enter"
|
sequence: "Ctrl+Enter"
|
||||||
onActivated: invitees.accept()
|
onActivated: invitees.accept()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Add")
|
text: qsTr("Add")
|
||||||
onClicked: if (inviteeEntry.text !== "") addInvite()
|
onClicked: {
|
||||||
|
if (inviteeEntry.text !== "") {
|
||||||
|
addInvite();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
@ -85,26 +96,28 @@ ApplicationWindow {
|
||||||
visible: false
|
visible: false
|
||||||
opacity: 0
|
opacity: 0
|
||||||
state: "hidden"
|
state: "hidden"
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "shown"
|
name: "shown"
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: warningLabel
|
target: warningLabel
|
||||||
opacity: 1
|
opacity: 1
|
||||||
visible: true
|
visible: true
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "hidden"
|
name: "hidden"
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: warningLabel
|
target: warningLabel
|
||||||
opacity: 0
|
opacity: 0
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
transitions: [
|
transitions: [
|
||||||
Transition {
|
Transition {
|
||||||
from: "shown"
|
from: "shown"
|
||||||
|
@ -122,7 +135,9 @@ ApplicationWindow {
|
||||||
target: warningLabel
|
target: warningLabel
|
||||||
property: "visible"
|
property: "visible"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -134,6 +149,7 @@ ApplicationWindow {
|
||||||
running: false
|
running: false
|
||||||
onTriggered: warningLabel.state = "hidden"
|
onTriggered: warningLabel.state = "hidden"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
|
@ -174,9 +190,13 @@ ApplicationWindow {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: DialogButtonBox {
|
footer: DialogButtonBox {
|
||||||
|
@ -194,7 +214,9 @@ ApplicationWindow {
|
||||||
Button {
|
Button {
|
||||||
text: qsTr("Cancel")
|
text: qsTr("Cancel")
|
||||||
DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole
|
DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole
|
||||||
onClicked: inviteDialogRoot.close();
|
onClicked: inviteDialogRoot.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Layouts 1.12
|
||||||
|
|
|
@ -157,6 +157,7 @@ Item {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
enabled: false
|
enabled: false
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixText {
|
MatrixText {
|
||||||
text: parent.roomName
|
text: parent.roomName
|
||||||
font.pixelSize: 24
|
font.pixelSize: 24
|
||||||
|
|
|
@ -117,29 +117,32 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
||||||
connect(this, &ChatPage::loggedOut, this, &ChatPage::logout);
|
connect(this, &ChatPage::loggedOut, this, &ChatPage::logout);
|
||||||
|
|
||||||
// TODO: once this signal is moved, reenable this
|
// TODO: once this signal is moved, reenable this
|
||||||
// connect(view_manager_, &TimelineViewManager::inviteUsers, this, [this](QStringList users) {
|
// connect(view_manager_, &TimelineViewManager::inviteUsers, this, [this](QStringList
|
||||||
// const auto room_id = currentRoom().toStdString();
|
// users) {
|
||||||
|
// const auto room_id = currentRoom().toStdString();
|
||||||
|
|
||||||
// for (int ii = 0; ii < users.size(); ++ii) {
|
// for (int ii = 0; ii < users.size(); ++ii) {
|
||||||
// QTimer::singleShot(ii * 500, this, [this, room_id, ii, users]() {
|
// QTimer::singleShot(ii * 500, this, [this, room_id, ii, users]() {
|
||||||
// const auto user = users.at(ii);
|
// const auto user = users.at(ii);
|
||||||
|
|
||||||
// http::client()->invite_user(
|
// http::client()->invite_user(
|
||||||
// room_id,
|
// room_id,
|
||||||
// user.toStdString(),
|
// user.toStdString(),
|
||||||
// [this, user](const mtx::responses::RoomInvite &,
|
// [this, user](const mtx::responses::RoomInvite &,
|
||||||
// mtx::http::RequestErr err) {
|
// mtx::http::RequestErr err) {
|
||||||
// if (err) {
|
// if (err) {
|
||||||
// emit showNotification(
|
// emit showNotification(
|
||||||
// tr("Failed to invite user: %1").arg(user));
|
// tr("Failed to invite user:
|
||||||
// return;
|
// %1").arg(user));
|
||||||
// }
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
// emit showNotification(tr("Invited user: %1").arg(user));
|
// emit showNotification(tr("Invited user:
|
||||||
// });
|
// %1").arg(user));
|
||||||
// });
|
// });
|
||||||
// }
|
// });
|
||||||
// });
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
view_manager_,
|
view_manager_,
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#include "InviteesModel.h"
|
#include "InviteesModel.h"
|
||||||
|
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2021 Nheko Contributors
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
#ifndef INVITEESMODEL_H
|
#ifndef INVITEESMODEL_H
|
||||||
#define INVITEESMODEL_H
|
#define INVITEESMODEL_H
|
||||||
|
|
||||||
|
|
|
@ -430,10 +430,10 @@ TimelineViewManager::openImageOverlayInternal(QString eventId, QImage img)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//void
|
// void
|
||||||
//TimelineViewManager::openInviteUsersDialog()
|
// TimelineViewManager::openInviteUsersDialog()
|
||||||
//{
|
//{
|
||||||
// TODO: move this somewhere where it will actually work (probably Rooms)
|
// TODO: move this somewhere where it will actually work (probably Rooms)
|
||||||
// MainWindow::instance()->openInviteUsersDialog(
|
// MainWindow::instance()->openInviteUsersDialog(
|
||||||
// [this](const QStringList &invitees) { emit inviteUsers(invitees); });
|
// [this](const QStringList &invitees) { emit inviteUsers(invitees); });
|
||||||
//}
|
//}
|
||||||
|
|
Loading…
Reference in a new issue