mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Multi-window: Normalize window size on separate change, notification separate fix, segfault groupchat fix
This commit is contained in:
parent
014ba45ebb
commit
868099d484
|
@ -137,7 +137,9 @@ void CircleWidget::contextMenuEvent(QContextMenuEvent* event)
|
|||
dialog->addFriend(friendWidget->friendId, f->getDisplayedName());
|
||||
}
|
||||
}
|
||||
|
||||
dialog->show();
|
||||
dialog->ensureSplitterVisible();
|
||||
}
|
||||
|
||||
setContainerAttribute(Qt::WA_UnderMouse, false);
|
||||
|
|
|
@ -245,6 +245,14 @@ int ContentDialog::chatroomWidgetCount() const
|
|||
return friendLayout->friendTotalCount() + groupLayout.getLayout()->count();
|
||||
}
|
||||
|
||||
void ContentDialog::ensureSplitterVisible()
|
||||
{
|
||||
if (splitter->sizes().at(0) == 0)
|
||||
splitter->setSizes({1, 1});
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void ContentDialog::cycleContacts(bool forward, bool loop)
|
||||
{
|
||||
Settings::getInstance().getGroupchatPosition();
|
||||
|
@ -374,6 +382,37 @@ void ContentDialog::nextContact()
|
|||
cycleContacts(true);
|
||||
}
|
||||
|
||||
bool ContentDialog::event(QEvent* event)
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::WindowActivate:
|
||||
if (activeChatroomWidget != nullptr)
|
||||
{
|
||||
activeChatroomWidget->resetEventFlags();
|
||||
activeChatroomWidget->updateStatusLight();
|
||||
QString windowTitle = activeChatroomWidget->getName();
|
||||
if (!activeChatroomWidget->getStatusString().isNull())
|
||||
windowTitle += " (" + activeChatroomWidget->getStatusString() + ")";
|
||||
setWindowTitle(windowTitle);
|
||||
|
||||
Friend* frnd = activeChatroomWidget->getFriend();
|
||||
|
||||
if (frnd)
|
||||
{
|
||||
frnd->getFriendWidget()->resetEventFlags();
|
||||
frnd->getFriendWidget()->updateStatusLight();
|
||||
}
|
||||
}
|
||||
|
||||
currentDialog = this;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
void ContentDialog::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (event->mimeData()->hasFormat("friend"))
|
||||
|
@ -407,10 +446,7 @@ void ContentDialog::dropEvent(QDropEvent *event)
|
|||
|
||||
Friend* contact = FriendList::findFriend(friendId);
|
||||
Widget::getInstance()->addFriendDialog(contact, this);
|
||||
|
||||
// Display friend list after dropping, if not already visible.
|
||||
if (splitter->sizes().at(0) == 0)
|
||||
splitter->setSizes({1, 1});
|
||||
ensureSplitterVisible();
|
||||
}
|
||||
else if (event->mimeData()->hasFormat("group"))
|
||||
{
|
||||
|
@ -422,10 +458,7 @@ void ContentDialog::dropEvent(QDropEvent *event)
|
|||
|
||||
Group* contact = GroupList::findGroup(groupId);
|
||||
Widget::getInstance()->addGroupDialog(contact, this);
|
||||
|
||||
// Display friend list after dropping, if not already visible.
|
||||
if (splitter->sizes().at(0) == 0)
|
||||
splitter->setSizes({1, 1});
|
||||
ensureSplitterVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
bool hasFriendWidget(int friendId, GenericChatroomWidget* chatroomWidget);
|
||||
bool hasGroupWidget(int groupId, GenericChatroomWidget* chatroomWidget);
|
||||
int chatroomWidgetCount() const;
|
||||
void ensureSplitterVisible();
|
||||
|
||||
void cycleContacts(bool forward, bool loop = true);
|
||||
|
||||
|
@ -69,6 +70,7 @@ public slots:
|
|||
void nextContact();
|
||||
|
||||
protected:
|
||||
bool event(QEvent* event) final override;
|
||||
void dragEnterEvent(QDragEnterEvent* event) final override;
|
||||
void dropEvent(QDropEvent* event) final override;
|
||||
void changeEvent(QEvent* event) override;
|
||||
|
|
|
@ -565,7 +565,10 @@ void Widget::onSeparateWindowChanged(bool separate, bool clicked)
|
|||
setMinimumWidth(ui->tooliconsZone->sizeHint().width());
|
||||
|
||||
if (clicked)
|
||||
{
|
||||
showNormal();
|
||||
resize(width, height());
|
||||
}
|
||||
|
||||
setWindowTitle(QString());
|
||||
setActiveToolMenuButton(None);
|
||||
|
@ -1401,7 +1404,7 @@ void Widget::removeGroup(Group* g, bool fake)
|
|||
GroupList::removeGroup(g->getGroupId(), fake);
|
||||
Nexus::getCore()->removeGroup(g->getGroupId(), fake);
|
||||
delete g;
|
||||
if (contentLayout->mainHead->layout()->isEmpty())
|
||||
if (contentLayout != nullptr && contentLayout->mainHead->layout()->isEmpty())
|
||||
onAddClicked();
|
||||
|
||||
contactListWidget->reDraw();
|
||||
|
|
Loading…
Reference in New Issue
Block a user