mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-23 03:18:49 +03:00
Merge remote-tracking branch 'upstream/master' into voip
This commit is contained in:
commit
b86711a388
5 changed files with 1661 additions and 12 deletions
1604
resources/langs/nheko_si.ts
Normal file
1604
resources/langs/nheko_si.ts
Normal file
File diff suppressed because it is too large
Load diff
|
@ -245,6 +245,7 @@ Page {
|
||||||
width: contentWidth * 1.2
|
width: contentWidth * 1.2
|
||||||
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
radius: parent.height / 2
|
radius: parent.height / 2
|
||||||
color: colors.base
|
color: colors.base
|
||||||
|
|
|
@ -1197,11 +1197,19 @@ ChatPage::leaveRoom(const QString &room_id)
|
||||||
void
|
void
|
||||||
ChatPage::inviteUser(QString userid, QString reason)
|
ChatPage::inviteUser(QString userid, QString reason)
|
||||||
{
|
{
|
||||||
|
auto room = current_room_;
|
||||||
|
|
||||||
|
if (QMessageBox::question(this,
|
||||||
|
tr("Confirm invite"),
|
||||||
|
tr("Do you really want to invite %1 (%2)?")
|
||||||
|
.arg(cache::displayName(current_room_, userid))
|
||||||
|
.arg(userid)) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
http::client()->invite_user(
|
http::client()->invite_user(
|
||||||
current_room_.toStdString(),
|
room.toStdString(),
|
||||||
userid.toStdString(),
|
userid.toStdString(),
|
||||||
[this, userid, room = current_room_](const mtx::responses::Empty &,
|
[this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) {
|
||||||
mtx::http::RequestErr err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
emit showNotification(
|
emit showNotification(
|
||||||
tr("Failed to invite %1 to %2: %3")
|
tr("Failed to invite %1 to %2: %3")
|
||||||
|
@ -1216,11 +1224,19 @@ ChatPage::inviteUser(QString userid, QString reason)
|
||||||
void
|
void
|
||||||
ChatPage::kickUser(QString userid, QString reason)
|
ChatPage::kickUser(QString userid, QString reason)
|
||||||
{
|
{
|
||||||
|
auto room = current_room_;
|
||||||
|
|
||||||
|
if (QMessageBox::question(this,
|
||||||
|
tr("Confirm kick"),
|
||||||
|
tr("Do you really want to kick %1 (%2)?")
|
||||||
|
.arg(cache::displayName(current_room_, userid))
|
||||||
|
.arg(userid)) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
http::client()->kick_user(
|
http::client()->kick_user(
|
||||||
current_room_.toStdString(),
|
room.toStdString(),
|
||||||
userid.toStdString(),
|
userid.toStdString(),
|
||||||
[this, userid, room = current_room_](const mtx::responses::Empty &,
|
[this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) {
|
||||||
mtx::http::RequestErr err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
emit showNotification(
|
emit showNotification(
|
||||||
tr("Failed to kick %1 to %2: %3")
|
tr("Failed to kick %1 to %2: %3")
|
||||||
|
@ -1235,11 +1251,19 @@ ChatPage::kickUser(QString userid, QString reason)
|
||||||
void
|
void
|
||||||
ChatPage::banUser(QString userid, QString reason)
|
ChatPage::banUser(QString userid, QString reason)
|
||||||
{
|
{
|
||||||
|
auto room = current_room_;
|
||||||
|
|
||||||
|
if (QMessageBox::question(this,
|
||||||
|
tr("Confirm ban"),
|
||||||
|
tr("Do you really want to ban %1 (%2)?")
|
||||||
|
.arg(cache::displayName(current_room_, userid))
|
||||||
|
.arg(userid)) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
http::client()->ban_user(
|
http::client()->ban_user(
|
||||||
current_room_.toStdString(),
|
room.toStdString(),
|
||||||
userid.toStdString(),
|
userid.toStdString(),
|
||||||
[this, userid, room = current_room_](const mtx::responses::Empty &,
|
[this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) {
|
||||||
mtx::http::RequestErr err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
emit showNotification(
|
emit showNotification(
|
||||||
tr("Failed to ban %1 in %2: %3")
|
tr("Failed to ban %1 in %2: %3")
|
||||||
|
@ -1254,11 +1278,19 @@ ChatPage::banUser(QString userid, QString reason)
|
||||||
void
|
void
|
||||||
ChatPage::unbanUser(QString userid, QString reason)
|
ChatPage::unbanUser(QString userid, QString reason)
|
||||||
{
|
{
|
||||||
|
auto room = current_room_;
|
||||||
|
|
||||||
|
if (QMessageBox::question(this,
|
||||||
|
tr("Confirm unban"),
|
||||||
|
tr("Do you really want to unban %1 (%2)?")
|
||||||
|
.arg(cache::displayName(current_room_, userid))
|
||||||
|
.arg(userid)) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
http::client()->unban_user(
|
http::client()->unban_user(
|
||||||
current_room_.toStdString(),
|
room.toStdString(),
|
||||||
userid.toStdString(),
|
userid.toStdString(),
|
||||||
[this, userid, room = current_room_](const mtx::responses::Empty &,
|
[this, userid, room](const mtx::responses::Empty &, mtx::http::RequestErr err) {
|
||||||
mtx::http::RequestErr err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
emit showNotification(
|
emit showNotification(
|
||||||
tr("Failed to unban %1 in %2: %3")
|
tr("Failed to unban %1 in %2: %3")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
@ -97,6 +98,14 @@ UserProfile::UserProfile(QWidget *parent)
|
||||||
if (utils::localUser() != user_id)
|
if (utils::localUser() != user_id)
|
||||||
req.invite = {user_id.toStdString()};
|
req.invite = {user_id.toStdString()};
|
||||||
|
|
||||||
|
if (QMessageBox::question(
|
||||||
|
this,
|
||||||
|
tr("Confirm DM"),
|
||||||
|
tr("Do you really want to invite %1 (%2) to a direct chat?")
|
||||||
|
.arg(cache::displayName(roomId_, user_id))
|
||||||
|
.arg(user_id)) != QMessageBox::Yes)
|
||||||
|
return;
|
||||||
|
|
||||||
emit ChatPage::instance()->createRoom(req);
|
emit ChatPage::instance()->createRoom(req);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -199,6 +208,8 @@ UserProfile::init(const QString &userId, const QString &roomId)
|
||||||
{
|
{
|
||||||
resetToDefaults();
|
resetToDefaults();
|
||||||
|
|
||||||
|
this->roomId_ = roomId;
|
||||||
|
|
||||||
auto displayName = cache::displayName(roomId, userId);
|
auto displayName = cache::displayName(roomId, userId);
|
||||||
|
|
||||||
userIdLabel_->setText(userId);
|
userIdLabel_->setText(userId);
|
||||||
|
|
|
@ -53,6 +53,7 @@ private:
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
|
|
||||||
Avatar *avatar_;
|
Avatar *avatar_;
|
||||||
|
QString roomId_;
|
||||||
|
|
||||||
QLabel *userIdLabel_;
|
QLabel *userIdLabel_;
|
||||||
QLabel *displayNameLabel_;
|
QLabel *displayNameLabel_;
|
||||||
|
|
Loading…
Reference in a new issue