mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Circles: Fix quick switch crash, remove circle crash
This commit is contained in:
parent
5c80d06ee9
commit
7f7ab9a1bc
|
@ -256,9 +256,10 @@ void CategoryWidget::onCompactChanged(bool _compact)
|
||||||
topLayout->setSpacing(0);
|
topLayout->setSpacing(0);
|
||||||
topLayout->setMargin(0);
|
topLayout->setMargin(0);
|
||||||
|
|
||||||
setCompact(_compact);
|
(void)_compact;
|
||||||
|
setCompact(true);
|
||||||
|
|
||||||
if (isCompact())
|
if (true)
|
||||||
{
|
{
|
||||||
nameLabel->minimizeMaximumWidth();
|
nameLabel->minimizeMaximumWidth();
|
||||||
|
|
||||||
|
@ -277,7 +278,7 @@ void CategoryWidget::onCompactChanged(bool _compact)
|
||||||
topLayout->addSpacing(5);
|
topLayout->addSpacing(5);
|
||||||
topLayout->activate();
|
topLayout->activate();
|
||||||
}
|
}
|
||||||
else
|
/*else
|
||||||
{
|
{
|
||||||
nameLabel->setMaximumWidth(QWIDGETSIZE_MAX);
|
nameLabel->setMaximumWidth(QWIDGETSIZE_MAX);
|
||||||
|
|
||||||
|
@ -285,7 +286,7 @@ void CategoryWidget::onCompactChanged(bool _compact)
|
||||||
mainLayout->setSpacing(0);
|
mainLayout->setSpacing(0);
|
||||||
mainLayout->setContentsMargins(20, 0, 20, 0);
|
mainLayout->setContentsMargins(20, 0, 20, 0);
|
||||||
|
|
||||||
container->setFixedHeight(35);
|
container->setFixedHeight(25);
|
||||||
container->setLayout(mainLayout);
|
container->setLayout(mainLayout);
|
||||||
|
|
||||||
topLayout->addWidget(&statusPic);
|
topLayout->addWidget(&statusPic);
|
||||||
|
@ -300,7 +301,7 @@ void CategoryWidget::onCompactChanged(bool _compact)
|
||||||
mainLayout->addWidget(lineFrame);
|
mainLayout->addWidget(lineFrame);
|
||||||
mainLayout->addStretch();
|
mainLayout->addStretch();
|
||||||
mainLayout->activate();
|
mainLayout->activate();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
Style::repolish(this);
|
Style::repolish(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ CircleWidget::CircleWidget(FriendListWidget* parent, int id)
|
||||||
|
|
||||||
CircleWidget::~CircleWidget()
|
CircleWidget::~CircleWidget()
|
||||||
{
|
{
|
||||||
|
if (circleList[id] == this)
|
||||||
circleList.remove(id);
|
circleList.remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,12 +97,15 @@ void CircleWidget::contextMenuEvent(QContextMenuEvent* event)
|
||||||
|
|
||||||
friendList->removeCircleWidget(this);
|
friendList->removeCircleWidget(this);
|
||||||
|
|
||||||
circleList.remove(id);
|
|
||||||
int replacedCircle = Settings::getInstance().removeCircle(id);
|
int replacedCircle = Settings::getInstance().removeCircle(id);
|
||||||
|
|
||||||
auto circleReplace = circleList.find(replacedCircle);
|
auto circleReplace = circleList.find(replacedCircle);
|
||||||
if (circleReplace != circleList.end())
|
if (circleReplace != circleList.end())
|
||||||
circleReplace.value()->updateID(id);
|
circleReplace.value()->updateID(id);
|
||||||
|
else
|
||||||
|
assert(true); // This should never happen.
|
||||||
|
|
||||||
|
circleList.remove(replacedCircle);
|
||||||
}
|
}
|
||||||
setContainerAttribute(Qt::WA_UnderMouse, false);
|
setContainerAttribute(Qt::WA_UnderMouse, false);
|
||||||
}
|
}
|
||||||
|
@ -168,6 +172,10 @@ void CircleWidget::updateID(int index)
|
||||||
{
|
{
|
||||||
// For when a circle gets destroyed, another takes its id.
|
// For when a circle gets destroyed, another takes its id.
|
||||||
// This function updates all friends widgets for this new id.
|
// This function updates all friends widgets for this new id.
|
||||||
|
|
||||||
|
if (id == index)
|
||||||
|
return;
|
||||||
|
|
||||||
id = index;
|
id = index;
|
||||||
circleList[id] = this;
|
circleList[id] = this;
|
||||||
|
|
||||||
|
|
|
@ -374,10 +374,12 @@ void FriendListWidget::addCircleWidget(FriendWidget* friendWidget)
|
||||||
|
|
||||||
if (circleOriginal != nullptr)
|
if (circleOriginal != nullptr)
|
||||||
Widget::getInstance()->searchCircle(circleOriginal);
|
Widget::getInstance()->searchCircle(circleOriginal);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::getInstance()->searchCircle(circleWidget);
|
Widget::getInstance()->searchCircle(circleWidget);
|
||||||
}
|
}
|
||||||
|
circleWidget->editName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendListWidget::removeCircleWidget(CircleWidget* widget)
|
void FriendListWidget::removeCircleWidget(CircleWidget* widget)
|
||||||
|
@ -660,8 +662,6 @@ void FriendListWidget::reDraw()
|
||||||
|
|
||||||
CircleWidget* FriendListWidget::createCircleWidget(int id)
|
CircleWidget* FriendListWidget::createCircleWidget(int id)
|
||||||
{
|
{
|
||||||
bool isNew = (id == -1);
|
|
||||||
|
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
id = Settings::getInstance().addCircle();
|
id = Settings::getInstance().addCircle();
|
||||||
|
|
||||||
|
@ -677,9 +677,6 @@ CircleWidget* FriendListWidget::createCircleWidget(int id)
|
||||||
connect(circleWidget, &CircleWidget::renameRequested, this, &FriendListWidget::renameCircleWidget);
|
connect(circleWidget, &CircleWidget::renameRequested, this, &FriendListWidget::renameCircleWidget);
|
||||||
circleWidget->show(); // Avoid flickering.
|
circleWidget->show(); // Avoid flickering.
|
||||||
|
|
||||||
if (isNew)
|
|
||||||
circleWidget->editName();
|
|
||||||
|
|
||||||
return circleWidget;
|
return circleWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,17 @@
|
||||||
#include <QResizeEvent>
|
#include <QResizeEvent>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
|
class LineEdit : public QLineEdit
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LineEdit(QWidget* parent = 0) : QLineEdit(parent) {}
|
||||||
|
protected:
|
||||||
|
void focusOutEvent(QFocusEvent *)
|
||||||
|
{
|
||||||
|
emit editingFinished();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
CroppingLabel::CroppingLabel(QWidget* parent)
|
CroppingLabel::CroppingLabel(QWidget* parent)
|
||||||
: QLabel(parent)
|
: QLabel(parent)
|
||||||
, blockPaintEvents(false)
|
, blockPaintEvents(false)
|
||||||
|
|
|
@ -1499,13 +1499,17 @@ void Widget::searchContacts()
|
||||||
|
|
||||||
void Widget::changeDisplayMode()
|
void Widget::changeDisplayMode()
|
||||||
{
|
{
|
||||||
|
filterDisplayGroup->setEnabled(false);
|
||||||
|
|
||||||
if (filterDisplayGroup->checkedAction() == filterDisplayActivity)
|
if (filterDisplayGroup->checkedAction() == filterDisplayActivity)
|
||||||
contactListWidget->setMode(FriendListWidget::Activity);
|
contactListWidget->setMode(FriendListWidget::Activity);
|
||||||
else if (filterDisplayGroup->checkedAction() == filterDisplayName)
|
else if (filterDisplayGroup->checkedAction() == filterDisplayName)
|
||||||
contactListWidget->setMode(FriendListWidget::Name);
|
contactListWidget->setMode(FriendListWidget::Name);
|
||||||
|
|
||||||
updateFilterText();
|
|
||||||
searchContacts();
|
searchContacts();
|
||||||
|
filterDisplayGroup->setEnabled(true);
|
||||||
|
|
||||||
|
updateFilterText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::updateFilterText()
|
void Widget::updateFilterText()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user