コード例 #1
0
ファイル: mediaview.cpp プロジェクト: CapnRat/tdesktop
void MediaView::updateOver(const QPoint &pos) {
	if (_leftNavVisible && _leftNav.contains(pos)) {
		if (!updateOverState(OverLeftNav)) {
			update(_leftNav);
		}
	} else if (_rightNavVisible && _rightNav.contains(pos)) {
		if (!updateOverState(OverRightNav)) {
			update(_rightNav);
		}
	} else if (_nameNav.contains(pos)) {
		if (!updateOverState(OverName)) {
			update(_nameNav);
		}
	} else if (_msgid && _dateNav.contains(pos)) {
		if (!updateOverState(OverDate)) {
			update(_dateNav);
		}
	} else if (_over != OverNone) {
		if (_over == OverLeftNav) {
			update(_leftNav);
		} else if (_over == OverRightNav) {
			update(_rightNav);
		} else if (_over == OverName) {
			update(_nameNav);
		} else if (_over == OverDate) {
			update(_dateNav);
		}
		updateOverState(OverNone);
	}
}
コード例 #2
0
void PlayerWidget::updateSelected() {
	QPoint pos(myrtlpoint(mapFromGlobal(_lastMousePos)));

	if (_down == OverVolume) {
		int32 delta = (pos.x() - _volumeRect.x()) - _downCoord;
		float64 startFrom = snap((_downCoord - ((_volumeRect.width() - st::playerVolume.pxWidth()) / 2)) / float64(st::playerVolume.pxWidth()), 0., 1.);
		float64 add = delta / float64(4 * st::playerVolume.pxWidth()), result = snap(startFrom + add, 0., 1.);
		if (result != cSongVolume()) {
			cSetSongVolume(result);
			emit audioPlayer()->songVolumeChanged();
			rtlupdate(_volumeRect);
		}
	} else if (_down == OverPlayback) {
		_downProgress = snap((pos.x() - _playbackRect.x()) / float64(_playbackRect.width()), 0., 1.);
		rtlupdate(_playbackRect);
		updateDownTime();
	} else if (_down == OverNone) {
		bool inInfo = ((pos.x() >= _infoRect.x()) && (pos.x() < _fullRect.x() + _fullRect.width()) && (pos.y() >= _playRect.y()) && (pos.y() <= _playRect.y() + _playRect.height()));
		if (_prevAvailable && _prevRect.contains(pos)) {
			updateOverState(OverPrev);
		} else if (_nextAvailable && _nextRect.contains(pos)) {
			updateOverState(OverNext);
		} else if (_playRect.contains(pos)) {
			updateOverState(OverPlay);
		} else if (_closeRect.contains(pos)) {
			updateOverState(OverClose);
		} else if (_volumeRect.contains(pos)) {
			updateOverState(OverVolume);
		} else if (_repeatRect.contains(pos)) {
			updateOverState(OverRepeat);
		} else if (_duration && _playbackRect.contains(pos)) {
			updateOverState(OverPlayback);
		} else if (_fullAvailable && inInfo) {
			updateOverState(OverFull);
		} else if (_over != OverNone) {
			updateOverState(OverNone);
		}
	}
}