mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-10 08:51:12 +00:00
New media player build fixed for Xcode.
This commit is contained in:
parent
31a847fb9d
commit
5d6dafeeda
@ -108,11 +108,11 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename EventType, typename Handler>
|
|
||||||
class Observable;
|
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
template <typename EventType, typename Handler, bool EventTypeIsSimple>
|
||||||
|
class BaseObservable;
|
||||||
|
|
||||||
template <typename EventType, typename Handler>
|
template <typename EventType, typename Handler>
|
||||||
class CommonObservable {
|
class CommonObservable {
|
||||||
public:
|
public:
|
||||||
@ -127,30 +127,13 @@ private:
|
|||||||
QSharedPointer<ObservableData<EventType, Handler>> _data;
|
QSharedPointer<ObservableData<EventType, Handler>> _data;
|
||||||
|
|
||||||
friend class CommonObservableData<EventType, Handler>;
|
friend class CommonObservableData<EventType, Handler>;
|
||||||
friend class Observable<EventType, Handler>;
|
friend class BaseObservable<EventType, Handler, base::type_traits<EventType>::is_fast_copy_type::value>;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
template <typename EventType, typename Handler>
|
||||||
|
class BaseObservable<EventType, Handler, true> : public internal::CommonObservable<EventType, Handler> {
|
||||||
template <typename EventType, typename Handler = internal::SubscriptionHandler<EventType>>
|
|
||||||
class Observable : public internal::CommonObservable<EventType, Handler> {
|
|
||||||
using SimpleEventType = typename base::type_traits<EventType>::is_fast_copy_type;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename = std_::enable_if_t<!SimpleEventType::value>>
|
|
||||||
void notify(EventType &&event, bool sync = false) {
|
|
||||||
if (this->_data) {
|
|
||||||
this->_data->notify(std_::move(event), sync);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template <typename = std_::enable_if_t<!SimpleEventType::value>>
|
|
||||||
void notify(const EventType &event, bool sync = false) {
|
|
||||||
if (this->_data) {
|
|
||||||
this->_data->notify(EventType(event), sync);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
template <typename = std_::enable_if_t<SimpleEventType::value>>
|
|
||||||
void notify(EventType event, bool sync = false) {
|
void notify(EventType event, bool sync = false) {
|
||||||
if (this->_data) {
|
if (this->_data) {
|
||||||
this->_data->notify(std_::move(event), sync);
|
this->_data->notify(std_::move(event), sync);
|
||||||
@ -159,6 +142,24 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename EventType, typename Handler>
|
||||||
|
class BaseObservable<EventType, Handler, false> : public internal::CommonObservable<EventType, Handler> {
|
||||||
|
public:
|
||||||
|
void notify(EventType &&event, bool sync = false) {
|
||||||
|
if (this->_data) {
|
||||||
|
this->_data->notify(std_::move(event), sync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void notify(const EventType &event, bool sync = false) {
|
||||||
|
if (this->_data) {
|
||||||
|
this->_data->notify(EventType(event), sync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template <typename EventType, typename Handler>
|
template <typename EventType, typename Handler>
|
||||||
@ -339,10 +340,8 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
template <typename Handler>
|
template <typename Handler>
|
||||||
class Observable<void, Handler> : public internal::CommonObservable<void, Handler> {
|
class BaseObservable<void, Handler, base::type_traits<void>::is_fast_copy_type::value> : public internal::CommonObservable<void, Handler> {
|
||||||
public:
|
public:
|
||||||
void notify(bool sync = false) {
|
void notify(bool sync = false) {
|
||||||
if (this->_data) {
|
if (this->_data) {
|
||||||
@ -352,6 +351,12 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
|
template <typename EventType, typename Handler = internal::SubscriptionHandler<EventType>>
|
||||||
|
class Observable : public internal::BaseObservable<EventType, Handler, base::type_traits<EventType>::is_fast_copy_type::value> {
|
||||||
|
};
|
||||||
|
|
||||||
class Subscriber {
|
class Subscriber {
|
||||||
protected:
|
protected:
|
||||||
template <typename EventType, typename Handler, typename Lambda>
|
template <typename EventType, typename Handler, typename Lambda>
|
||||||
|
@ -80,7 +80,20 @@ struct is_member_pointer<T C::*> : public std_::true_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using is_fast_copy_type = std_::integral_constant<bool, is_std_arith<T>::value || is_pointer<T>::value || is_member_pointer<T>::value || custom_is_fast_copy_type<T>::value>;
|
using is_fast_copy_type = std_::integral_constant<bool, is_std_fundamental<T>::value || is_pointer<T>::value || is_member_pointer<T>::value || custom_is_fast_copy_type<T>::value>;
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct add_const_reference {
|
||||||
|
using type = const T &;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct add_const_reference<void> {
|
||||||
|
using type = void;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
using add_const_reference_t = typename add_const_reference<T>::type;
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
@ -96,7 +109,7 @@ struct type_traits {
|
|||||||
using is_member_pointer = internal::is_member_pointer<T>;
|
using is_member_pointer = internal::is_member_pointer<T>;
|
||||||
using is_fast_copy_type = internal::is_fast_copy_type<T>;
|
using is_fast_copy_type = internal::is_fast_copy_type<T>;
|
||||||
|
|
||||||
using parameter_type = std_::conditional_t<is_fast_copy_type::value, T, const T&>;
|
using parameter_type = std_::conditional_t<is_fast_copy_type::value, T, internal::add_const_reference_t<T>>;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace base
|
} // namespace base
|
||||||
|
@ -21,12 +21,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/type_traits.h"
|
#include "core/type_traits.h"
|
||||||
|
#include "core/observer.h"
|
||||||
|
|
||||||
class LayerWidget;
|
class LayerWidget;
|
||||||
namespace base {
|
|
||||||
template <typename Type, typename>
|
|
||||||
class Observable;
|
|
||||||
} // namespace base
|
|
||||||
namespace InlineBots {
|
namespace InlineBots {
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
class ItemBase;
|
class ItemBase;
|
||||||
|
@ -89,7 +89,6 @@ private:
|
|||||||
int64 _seekPositionMs = -1;
|
int64 _seekPositionMs = -1;
|
||||||
int64 _lastDurationMs = 0;
|
int64 _lastDurationMs = 0;
|
||||||
QString _time;
|
QString _time;
|
||||||
bool _mouseOverLabels = false;
|
|
||||||
|
|
||||||
class PlayButton;
|
class PlayButton;
|
||||||
ChildWidget<FlatLabel> _nameLabel;
|
ChildWidget<FlatLabel> _nameLabel;
|
||||||
|
@ -44,7 +44,6 @@ public:
|
|||||||
SysBtn(QWidget *parent, const style::sysButton &st, const QString &text = QString());
|
SysBtn(QWidget *parent, const style::sysButton &st, const QString &text = QString());
|
||||||
|
|
||||||
void setText(const QString &text);
|
void setText(const QString &text);
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void setSysBtnStyle(const style::sysButton &st);
|
void setSysBtnStyle(const style::sysButton &st);
|
||||||
|
|
||||||
HitTestType hitTest(const QPoint &p) const;
|
HitTestType hitTest(const QPoint &p) const;
|
||||||
@ -55,6 +54,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onStateChanged(int oldState, ButtonStateChangeSource source) override;
|
void onStateChanged(int oldState, ButtonStateChangeSource source) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
style::sysButton _st;
|
style::sysButton _st;
|
||||||
anim::cvalue a_color;
|
anim::cvalue a_color;
|
||||||
|
@ -39,9 +39,6 @@ public:
|
|||||||
|
|
||||||
void updateCounter();
|
void updateCounter();
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
void maximizedChanged(bool maximized, bool force = false);
|
void maximizedChanged(bool maximized, bool force = false);
|
||||||
|
|
||||||
HitTestType hitTest(const QPoint &p);
|
HitTestType hitTest(const QPoint &p);
|
||||||
@ -62,6 +59,8 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void mouseDoubleClickEvent(QMouseEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updatePlayerButton(bool usePanel);
|
void updatePlayerButton(bool usePanel);
|
||||||
|
@ -140,11 +140,7 @@ void ContinuousSlider::wheelEvent(QWheelEvent *e) {
|
|||||||
} else {
|
} else {
|
||||||
deltaX *= -1;
|
deltaX *= -1;
|
||||||
}
|
}
|
||||||
if (deltaX * deltaY < 0) {
|
auto delta = (qAbs(deltaX) > qAbs(deltaY)) ? deltaX : deltaY;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto delta = (deltaX >= 0 && deltaY >= 0) ? qMax(deltaX, deltaY) : qMin(deltaX, deltaY);
|
|
||||||
auto finalValue = snap(a_value.to() + delta * coef, 0., 1.);
|
auto finalValue = snap(a_value.to() + delta * coef, 0., 1.);
|
||||||
setValue(finalValue, false);
|
setValue(finalValue, false);
|
||||||
if (_changeProgressCallback) {
|
if (_changeProgressCallback) {
|
||||||
|
@ -139,6 +139,7 @@ private:
|
|||||||
a_height.finish();
|
a_height.finish();
|
||||||
_a_height.stop();
|
_a_height.stop();
|
||||||
_forceHeight = _hiding ? 0 : -1;
|
_forceHeight = _hiding ? 0 : -1;
|
||||||
|
sendSynteticMouseEvent(this, QEvent::MouseMove, Qt::NoButton);
|
||||||
if (_hiding) hide();
|
if (_hiding) hide();
|
||||||
} else {
|
} else {
|
||||||
a_height.update(dt, anim::linear);
|
a_height.update(dt, anim::linear);
|
||||||
|
Loading…
Reference in New Issue
Block a user