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->addFriend(friendWidget->friendId, f->getDisplayedName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog->show();
|
dialog->show();
|
||||||
|
dialog->ensureSplitterVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
setContainerAttribute(Qt::WA_UnderMouse, false);
|
setContainerAttribute(Qt::WA_UnderMouse, false);
|
||||||
|
|
|
@ -245,6 +245,14 @@ int ContentDialog::chatroomWidgetCount() const
|
||||||
return friendLayout->friendTotalCount() + groupLayout.getLayout()->count();
|
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)
|
void ContentDialog::cycleContacts(bool forward, bool loop)
|
||||||
{
|
{
|
||||||
Settings::getInstance().getGroupchatPosition();
|
Settings::getInstance().getGroupchatPosition();
|
||||||
|
@ -374,6 +382,37 @@ void ContentDialog::nextContact()
|
||||||
cycleContacts(true);
|
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)
|
void ContentDialog::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
if (event->mimeData()->hasFormat("friend"))
|
if (event->mimeData()->hasFormat("friend"))
|
||||||
|
@ -407,10 +446,7 @@ void ContentDialog::dropEvent(QDropEvent *event)
|
||||||
|
|
||||||
Friend* contact = FriendList::findFriend(friendId);
|
Friend* contact = FriendList::findFriend(friendId);
|
||||||
Widget::getInstance()->addFriendDialog(contact, this);
|
Widget::getInstance()->addFriendDialog(contact, this);
|
||||||
|
ensureSplitterVisible();
|
||||||
// Display friend list after dropping, if not already visible.
|
|
||||||
if (splitter->sizes().at(0) == 0)
|
|
||||||
splitter->setSizes({1, 1});
|
|
||||||
}
|
}
|
||||||
else if (event->mimeData()->hasFormat("group"))
|
else if (event->mimeData()->hasFormat("group"))
|
||||||
{
|
{
|
||||||
|
@ -422,10 +458,7 @@ void ContentDialog::dropEvent(QDropEvent *event)
|
||||||
|
|
||||||
Group* contact = GroupList::findGroup(groupId);
|
Group* contact = GroupList::findGroup(groupId);
|
||||||
Widget::getInstance()->addGroupDialog(contact, this);
|
Widget::getInstance()->addGroupDialog(contact, this);
|
||||||
|
ensureSplitterVisible();
|
||||||
// Display friend list after dropping, if not already visible.
|
|
||||||
if (splitter->sizes().at(0) == 0)
|
|
||||||
splitter->setSizes({1, 1});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
bool hasFriendWidget(int friendId, GenericChatroomWidget* chatroomWidget);
|
bool hasFriendWidget(int friendId, GenericChatroomWidget* chatroomWidget);
|
||||||
bool hasGroupWidget(int groupId, GenericChatroomWidget* chatroomWidget);
|
bool hasGroupWidget(int groupId, GenericChatroomWidget* chatroomWidget);
|
||||||
int chatroomWidgetCount() const;
|
int chatroomWidgetCount() const;
|
||||||
|
void ensureSplitterVisible();
|
||||||
|
|
||||||
void cycleContacts(bool forward, bool loop = true);
|
void cycleContacts(bool forward, bool loop = true);
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ public slots:
|
||||||
void nextContact();
|
void nextContact();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool event(QEvent* event) final override;
|
||||||
void dragEnterEvent(QDragEnterEvent* event) final override;
|
void dragEnterEvent(QDragEnterEvent* event) final override;
|
||||||
void dropEvent(QDropEvent* event) final override;
|
void dropEvent(QDropEvent* event) final override;
|
||||||
void changeEvent(QEvent* event) override;
|
void changeEvent(QEvent* event) override;
|
||||||
|
|
|
@ -565,7 +565,10 @@ void Widget::onSeparateWindowChanged(bool separate, bool clicked)
|
||||||
setMinimumWidth(ui->tooliconsZone->sizeHint().width());
|
setMinimumWidth(ui->tooliconsZone->sizeHint().width());
|
||||||
|
|
||||||
if (clicked)
|
if (clicked)
|
||||||
|
{
|
||||||
|
showNormal();
|
||||||
resize(width, height());
|
resize(width, height());
|
||||||
|
}
|
||||||
|
|
||||||
setWindowTitle(QString());
|
setWindowTitle(QString());
|
||||||
setActiveToolMenuButton(None);
|
setActiveToolMenuButton(None);
|
||||||
|
@ -1401,7 +1404,7 @@ void Widget::removeGroup(Group* g, bool fake)
|
||||||
GroupList::removeGroup(g->getGroupId(), fake);
|
GroupList::removeGroup(g->getGroupId(), fake);
|
||||||
Nexus::getCore()->removeGroup(g->getGroupId(), fake);
|
Nexus::getCore()->removeGroup(g->getGroupId(), fake);
|
||||||
delete g;
|
delete g;
|
||||||
if (contentLayout->mainHead->layout()->isEmpty())
|
if (contentLayout != nullptr && contentLayout->mainHead->layout()->isEmpty())
|
||||||
onAddClicked();
|
onAddClicked();
|
||||||
|
|
||||||
contactListWidget->reDraw();
|
contactListWidget->reDraw();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user