void OverviewPage::setClientModel(ClientModel *model) { this->clientModel = model; if(model) { // Show warning if this is a prerelease version connect(model, SIGNAL(alertsChanged(QString)), this, SLOT(updateAlerts(QString))); updateAlerts(model->getStatusBarWarnings()); } }
void ContactsViewDelegate::setAlertOpacity(qreal alertOpacity) { if (alertOpacity == m_alertOpacity) return; m_alertOpacity = alertOpacity; if (!updateAlerts(view, view->model(), view->rootIndex())) { m_alertAnimation->stop(); m_alertAnimation->deleteLater(); m_alertAnimation = 0; } }
PsiContactListViewDelegate::PsiContactListViewDelegate(ContactListView* parent) : ContactListViewDelegate(parent) , font_(0) , fontMetrics_(0) { alertTimer_ = new QTimer(this); alertTimer_->setInterval(100); alertTimer_->setSingleShot(false); connect(alertTimer_, SIGNAL(timeout()), SLOT(updateAlerts())); connect(PsiOptions::instance(), SIGNAL(optionChanged(const QString&)), SLOT(optionChanged(const QString&))); optionChanged(slimGroupsOptionPath); optionChanged(outlinedGroupsOptionPath); optionChanged(contactListFontOptionPath); optionChanged(contactListBackgroundOptionPath); optionChanged(showStatusMessagesOptionPath); optionChanged(statusSingleOptionPath); }
static inline bool updateAlerts(QAbstractItemView *view, QAbstractItemModel *model, const QModelIndex &parent) { bool re = false; for (int r = 0, rc = model->rowCount(parent); r < rc; ++r) { /* Assuming that only column 0 needs to be updated */ QModelIndex index = model->index(r, 0, parent); if (index.data(ContactsModel::AlertRole).toBool()) { view->update(index); re = true; } if (model->hasChildren(index) && updateAlerts(view, model, index)) re = true; } return re; }