2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-06 01:16:12 +00:00

moved shadows to widgets where they are displayed

This commit is contained in:
John Preston
2015-10-17 10:31:48 +02:00
parent 48756111a9
commit 5c3d030b9a
20 changed files with 193 additions and 166 deletions

View File

@@ -32,12 +32,28 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org
#include "audio.h"
PlayerWidget::PlayerWidget(QWidget *parent) : TWidget(parent),
_prevAvailable(false), _nextAvailable(false), _fullAvailable(false),
_over(OverNone), _down(OverNone), _downCoord(0), _downFrequency(AudioVoiceMsgFrequency), _downProgress(0.),
_stateAnim(animFunc(this, &PlayerWidget::stateStep)),
_index(-1), _history(0), _timeWidth(0), _repeat(false), _showPause(false), _position(0), _duration(0), _loaded(0),
a_progress(0., 0.), a_loadProgress(0., 0.), _progressAnim(animFunc(this, &PlayerWidget::progressStep)) {
PlayerWidget::PlayerWidget(QWidget *parent) : TWidget(parent)
, _prevAvailable(false)
, _nextAvailable(false)
, _fullAvailable(false)
, _over(OverNone)
, _down(OverNone)
, _downCoord(0)
, _downFrequency(AudioVoiceMsgFrequency)
, _downProgress(0.)
, _stateAnim(animFunc(this, &PlayerWidget::stateStep))
, _index(-1)
, _history(0)
, _timeWidth(0)
, _repeat(false)
, _showPause(false)
, _position(0)
, _duration(0)
, _loaded(0)
, a_progress(0., 0.)
, a_loadProgress(0., 0.)
, _progressAnim(animFunc(this, &PlayerWidget::progressStep))
, _sideShadow(this, st::shadowColor) {
resize(st::wndMinWidth, st::playerHeight);
setMouseTracking(true);
memset(_stateHovers, 0, sizeof(_stateHovers));
@@ -492,7 +508,7 @@ void PlayerWidget::stopPressed() {
void PlayerWidget::resizeEvent(QResizeEvent *e) {
int32 availh = (height() - st::playerLineHeight);
int32 ch = st::playerPlay.pxHeight() + st::playerSkip, ct = (availh - ch) / 2;
_playbackRect = QRect(cWideMode() ? st::dlgShadow : 0, height() - st::playerMoverSize.height(), width() - (cWideMode() ? st::dlgShadow : 0), st::playerMoverSize.height());
_playbackRect = QRect(cWideMode() ? st::lineWidth : 0, height() - st::playerMoverSize.height(), width() - (cWideMode() ? st::lineWidth : 0), st::playerMoverSize.height());
_prevRect = _fullAvailable ? QRect(st::playerSkip / 2, ct, st::playerPrev.pxWidth() + st::playerSkip, ch) : QRect();
_playRect = QRect(_fullAvailable ? (_prevRect.x() + _prevRect.width()) : (st::playerSkip / 2), ct, st::playerPlay.pxWidth() + st::playerSkip, ch);
_nextRect = _fullAvailable ? QRect(_playRect.x() + _playRect.width(), ct, st::playerNext.pxWidth() + st::playerSkip, ch) : QRect();
@@ -504,6 +520,10 @@ void PlayerWidget::resizeEvent(QResizeEvent *e) {
int32 infoLeft = (_fullAvailable ? (_nextRect.x() + _nextRect.width()) : (_playRect.x() + _playRect.width()));
_infoRect = QRect(infoLeft + st::playerSkip / 2, 0, (_fullAvailable ? _fullRect.x() : _repeatRect.x()) - infoLeft - st::playerSkip, availh);
_sideShadow.resize(st::lineWidth, height());
_sideShadow.moveToLeft(0, 0);
update();
}