void WEffectParameterBase::parameterUpdated() { if (m_pEffectParameterSlot) { setText(m_pEffectParameterSlot->name()); setBaseTooltip(m_pEffectParameterSlot->description()); } else { setText(tr("None")); setBaseTooltip(tr("No effect loaded.")); } }
void WEffectChain::chainUpdated() { QString name = tr("None"); QString description = tr("No effect chain loaded."); if (m_pEffectChainSlot) { EffectChainPointer pChain = m_pEffectChainSlot->getEffectChain(); if (pChain) { name = pChain->name(); description = pChain->description(); } } setText(name); setBaseTooltip(description); }
void WBattery::update() { int minutesLeft = m_pBattery ? m_pBattery->getMinutesLeft() : 0; Battery::ChargingState chargingState = m_pBattery ? m_pBattery->getChargingState() : Battery::UNKNOWN; double dPercentage = m_pBattery ? m_pBattery->getPercentage() : 0; m_pCurrentPixmap.clear(); switch (chargingState) { case Battery::CHARGING: if (!m_chargingPixmaps.isEmpty()) { m_pCurrentPixmap = m_chargingPixmaps[ pixmapIndexFromPercentage(dPercentage, m_chargingPixmaps.size())]; } if (minutesLeft == -1) { setBaseTooltip(tr("Time until charged unknown.")); } else { setBaseTooltip(tr("Time until charged: %1") .arg(formatMinutes(minutesLeft))); } break; case Battery::DISCHARGING: if (!m_dischargingPixmaps.isEmpty()) { m_pCurrentPixmap = m_dischargingPixmaps[ pixmapIndexFromPercentage(dPercentage, m_dischargingPixmaps.size())]; } if (minutesLeft == -1) { setBaseTooltip(tr("Time left unknown.")); } else { setBaseTooltip(tr("Time left: %1") .arg(formatMinutes(minutesLeft))); } break; case Battery::CHARGED: m_pCurrentPixmap = m_pPixmapCharged; setBaseTooltip(tr("Battery fully charged.")); break; case Battery::UNKNOWN: default: m_pCurrentPixmap = m_pPixmapUnknown; setBaseTooltip(tr("Battery status unknown.")); break; } // call parent's update() to show changes, this should call // QWidget::update() WWidget::update(); }