FriendListWidget::FriendListWidget(Widget* parent, bool groupsOnTop) : QWidget(parent) // Prevent Valgrind from complaining. We're changing this to Name here. // Must be Activity for change to take effect. , mode(Activity) , groupsOnTop(groupsOnTop) { listLayout = new FriendListLayout(); setLayout(listLayout); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); groupLayout.getLayout()->setSpacing(0); groupLayout.getLayout()->setMargin(0); // Prevent QLayout's add child warning before setting the mode. listLayout->removeItem(listLayout->getLayoutOnline()); listLayout->removeItem(listLayout->getLayoutOffline()); setMode(Name); onGroupchatPositionChanged(groupsOnTop); dayTimer = new QTimer(this); dayTimer->setTimerType(Qt::VeryCoarseTimer); connect(dayTimer, &QTimer::timeout, this, &FriendListWidget::dayTimeout); dayTimer->start(timeUntilTomorrow()); setAcceptDrops(true); }
void FriendListWidget::dayTimeout() { if (mode == Activity) { setMode(Name); setMode(Activity); // Refresh all. } dayTimer->start(timeUntilTomorrow()); }