mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
add group title menu option, other half of closes #780
also truncate all group titles to max len
This commit is contained in:
parent
6831778371
commit
d68788c644
|
@ -81,7 +81,7 @@ GroupChatForm::GroupChatForm(Group* chatGroup)
|
|||
connect(micButton, SIGNAL(clicked()), this, SLOT(onMicMuteToggle()));
|
||||
connect(volButton, SIGNAL(clicked()), this, SLOT(onVolMuteToggle()));
|
||||
connect(nameLabel, &CroppingLabel::textChanged, this, [=](QString text, QString orig)
|
||||
{if (text != orig) emit groupTitleChanged(group->groupId, text);} );
|
||||
{if (text != orig) emit groupTitleChanged(group->groupId, text.left(128));} );
|
||||
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
|
|
@ -235,7 +235,7 @@ void FriendWidget::setFriendAlias()
|
|||
bool ok;
|
||||
Friend* f = FriendList::findFriend(friendId);
|
||||
|
||||
QString alias = QInputDialog::getText(nullptr, tr("User alias"), tr("Alias:"), QLineEdit::Normal,
|
||||
QString alias = QInputDialog::getText(nullptr, tr("User alias"), tr("You can also set this by clicking the chat form name.\nAlias:"), QLineEdit::Normal,
|
||||
f->getDisplayedName(), &ok);
|
||||
|
||||
if (ok)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QContextMenuEvent>
|
||||
#include <QMimeData>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
|
@ -51,10 +52,25 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||
QPoint pos = event->globalPos();
|
||||
QMenu menu;
|
||||
QAction* quitGroup = menu.addAction(tr("Quit group","Menu to quit a groupchat"));
|
||||
QAction* setAlias = menu.addAction(tr("Set title..."));
|
||||
|
||||
QAction* selectedItem = menu.exec(pos);
|
||||
if (selectedItem == quitGroup)
|
||||
emit removeGroup(groupId);
|
||||
if (selectedItem)
|
||||
{
|
||||
if (selectedItem == quitGroup)
|
||||
emit removeGroup(groupId);
|
||||
else if (selectedItem == setAlias)
|
||||
{
|
||||
bool ok;
|
||||
Group* g = GroupList::findGroup(groupId);
|
||||
|
||||
QString alias = QInputDialog::getText(nullptr, tr("Group title"), tr("You can also set this by clicking the chat form name.\nTitle:"), QLineEdit::Normal,
|
||||
nameLabel->fullText(), &ok);
|
||||
|
||||
if (ok && alias != nameLabel->fullText())
|
||||
emit g->chatForm->groupTitleChanged(groupId, alias.left(128));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GroupWidget::onUserListChanged()
|
||||
|
|
Loading…
Reference in New Issue
Block a user