1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Multi-window: Fix circle modified from dialog window, fix groupchat leave warnings, flip dialog window title

This commit is contained in:
TheSpiritXIII 2015-07-20 08:13:51 -04:00 committed by tux3
parent aa9a10fa8b
commit 4e5c4cb678
4 changed files with 59 additions and 49 deletions

View File

@ -92,6 +92,8 @@ void CircleWidget::contextMenuEvent(QContextMenuEvent* event)
QAction* selectedItem = menu.exec(mapToGlobal(event->pos())); QAction* selectedItem = menu.exec(mapToGlobal(event->pos()));
if (selectedItem)
{
if (selectedItem == renameAction) if (selectedItem == renameAction)
{ {
editName(); editName();
@ -141,6 +143,7 @@ void CircleWidget::contextMenuEvent(QContextMenuEvent* event)
dialog->show(); dialog->show();
dialog->ensureSplitterVisible(); dialog->ensureSplitterVisible();
} }
}
setContainerAttribute(Qt::WA_UnderMouse, false); setContainerAttribute(Qt::WA_UnderMouse, false);
} }

View File

@ -241,8 +241,12 @@ void ContentDialog::removeFriend(int friendId)
void ContentDialog::removeGroup(int groupId) void ContentDialog::removeGroup(int groupId)
{ {
Group* group = GroupList::findGroup(groupId); Group* group = GroupList::findGroup(groupId);
if (group)
{
disconnect(group, &Group::titleChanged, this, &ContentDialog::updateGroupWidget); disconnect(group, &Group::titleChanged, this, &ContentDialog::updateGroupWidget);
disconnect(group, &Group::userListChanged, this, &ContentDialog::updateGroupWidget); disconnect(group, &Group::userListChanged, this, &ContentDialog::updateGroupWidget);
}
auto iter = groupList.find(groupId); auto iter = groupList.find(groupId);
@ -424,7 +428,7 @@ ContentDialog* ContentDialog::getGroupDialog(int groupId)
void ContentDialog::updateTitleUsername(const QString& username) void ContentDialog::updateTitleUsername(const QString& username)
{ {
if (displayWidget != nullptr) if (displayWidget != nullptr)
setWindowTitle(username + QStringLiteral(" - ") + displayWidget->getTitle()); setWindowTitle(displayWidget->getTitle() + QStringLiteral(" - ") + username);
else else
setWindowTitle(username); setWindowTitle(username);
} }

View File

@ -389,8 +389,11 @@ void FriendListWidget::addCircleWidget(FriendWidget* friendWidget)
} }
Widget::getInstance()->searchCircle(circleWidget); Widget::getInstance()->searchCircle(circleWidget);
if (window()->isActiveWindow())
circleWidget->editName(); circleWidget->editName();
} }
reDraw();
} }
void FriendListWidget::removeCircleWidget(CircleWidget* widget) void FriendListWidget::removeCircleWidget(CircleWidget* widget)

View File

@ -105,7 +105,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
FriendListWidget *friendList; FriendListWidget *friendList;
if (circleWidget == nullptr) if (circleWidget == nullptr)
friendList = dynamic_cast<FriendListWidget*>(parentWidget()); friendList = dynamic_cast<FriendListWidget*>(FriendList::findFriend(friendId)->getFriendWidget()->parentWidget());
else else
friendList = dynamic_cast<FriendListWidget*>(circleWidget->parentWidget()); friendList = dynamic_cast<FriendListWidget*>(circleWidget->parentWidget());
@ -214,7 +214,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
circleWidget->updateStatus(); circleWidget->updateStatus();
if (friendList != nullptr) if (friendList != nullptr)
friendList->addCircleWidget(this); friendList->addCircleWidget(FriendList::findFriend(friendId)->getFriendWidget());
else else
Settings::getInstance().setFriendCircleID(id, Settings::getInstance().addCircle()); Settings::getInstance().setFriendCircleID(id, Settings::getInstance().addCircle());
} }
@ -226,7 +226,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
else if (removeCircleAction != nullptr && selectedItem == removeCircleAction) else if (removeCircleAction != nullptr && selectedItem == removeCircleAction)
{ {
if (friendList != nullptr) if (friendList != nullptr)
friendList->moveWidget(this, FriendList::findFriend(friendId)->getStatus(), true); friendList->moveWidget(FriendList::findFriend(friendId)->getFriendWidget(), FriendList::findFriend(friendId)->getStatus(), true);
else else
Settings::getInstance().setFriendCircleID(id, -1); Settings::getInstance().setFriendCircleID(id, -1);
@ -242,7 +242,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
if (circle != nullptr) if (circle != nullptr)
{ {
circle->addFriendWidget(this, FriendList::findFriend(friendId)->getStatus()); circle->addFriendWidget(FriendList::findFriend(friendId)->getFriendWidget(), FriendList::findFriend(friendId)->getStatus());
circle->setExpanded(true); circle->setExpanded(true);
Widget::getInstance()->searchCircle(circle); Widget::getInstance()->searchCircle(circle);
Settings::getInstance().savePersonal(); Settings::getInstance().savePersonal();