void KNMusicStandardBackend::setMute(bool mute) { //Check the state is the same or not, if is the same, do nothing. if(m_mute==mute) { return; } //Save the new mute state. m_mute=mute; //Apply the mute state. if(m_mute) { //Backup the original volume. m_volumeBeforeMute=volume(); //Set all the volume to the minimal thread. synchronizeThreadVolume(minimalVolume()); } else { //Set the volume to the backup volume. synchronizeThreadVolume(m_volumeBeforeMute); //Clear up the backuped volume. m_volumeBeforeMute=-1; } //Emit changed signal. emit muteStateChanged(m_mute); }
void TvolumeView::mouseMoveEvent(QMouseEvent* event) { if (!isEnabled()) return; if (isPauseActive()) m_drawPaused = true; if (event->x() >= width() - m_noteWidth * 1.5) { if (!m_overNote) { if (parentWidget()) { QStatusTipEvent sEv(tr("Switch on/off pitch detection")); qApp->sendEvent(parentWidget(), &sEv); } } m_overNote = true; } else { if (m_overNote) { if (parentWidget()) { QStatusTipEvent sEv(statusTip()); qApp->sendEvent(parentWidget(), &sEv); } } m_overNote = false; if (!isPaused()) m_drawKnob = true; if (m_leftButton) { float minV = (float)event->pos().x() / (float)(width() - m_noteWidth); if (minV >= 0.1 && minV < 0.81) { m_minVolume = minV; setToolTip(QString("%1 %").arg((int)(m_minVolume * 100))); QToolTip::showText(QCursor::pos(), toolTip()); emit minimalVolume(m_minVolume); } } } update(); }
void KNMusicStandardBackend::setVolume(int volumeSize) { //If we want to change the volume, check the mute state first. if(mute()) { //Un-mute the backend. setMute(false); } //Check the volume size. if(volumeSize<minimalVolume()) { volumeSize=minimalVolume(); } else if(volumeSize>maximumVolume()) { volumeSize=maximumVolume(); } //Sync the thread volume. synchronizeThreadVolume(volumeSize); }