Esempio n. 1
0
void ContentDialog::updateStatus(int id, const QHash<int, std::tuple<ContentDialog *, GenericChatroomWidget *> > &list)
{
    auto iter = list.find(id);

    if (iter == list.end())
        return;

    GenericChatroomWidget* chatroomWidget = std::get<1>(iter.value());
    chatroomWidget->updateStatusLight();

    if (chatroomWidget->isActive())
        std::get<0>(iter.value())->updateTitle(chatroomWidget);
}
Esempio n. 2
0
bool ContentDialog::event(QEvent* event)
{
    switch (event->type())
    {
        case QEvent::WindowActivate:
            if (activeChatroomWidget != nullptr)
            {
                activeChatroomWidget->resetEventFlags();
                activeChatroomWidget->updateStatusLight();
                updateTitle(activeChatroomWidget);

                Friend* frnd = activeChatroomWidget->getFriend();
                Group* group = activeChatroomWidget->getGroup();

                GenericChatroomWidget *widget = nullptr;

                if (frnd)
                    widget = frnd->getFriendWidget();
                else
                    widget = group->getGroupWidget();

                widget->resetEventFlags();
                widget->updateStatusLight();

                Widget::getInstance()->updateScroll(widget);
                Widget::getInstance()->resetIcon();
            }

            currentDialog = this;

#ifdef Q_OS_MAC
            emit activated();
#endif
        default:
            break;
    }

    return ActivateDialog::event(event);
}