[vlc-devel] [PATCH 1/6] qt: add scale method on VLCTick

pierre at videolabs.io pierre at videolabs.io
Mon Jun 3 09:42:09 CEST 2019


On 2019-06-01 11:58, Alexandre Janniaux wrote:
> Hi,
> 
> vlc_tick doesn't really have meaning in the GUI world.
> 
> Instead of adding a scale function on vlctick for UI purpose,
> you should wrap conversion methods to units that have meaning
> like seconds or milliseconds, matching the existing vlctick
> API. Then the computation can be done in primitive type.

This is the goal of this class, to provide representation of time unit.
We may add toMilliseconds, toSeconds methods there if needed.

> Greats,
> 
> --
> Alexandre Janniaux
> VideoLabs
> 
> On Fri, May 31, 2019 at 02:00:52PM +0300, Abel Tesfaye wrote:
>> From: Abel Tesfaye <Abeltesfaye45 at gmail.com>
>> 
>> ---
>>  modules/gui/qt/util/vlctick.cpp | 5 +++++
>>  modules/gui/qt/util/vlctick.hpp | 1 +
>>  2 files changed, 6 insertions(+)
>> 
>> diff --git a/modules/gui/qt/util/vlctick.cpp 
>> b/modules/gui/qt/util/vlctick.cpp
>> index bd0074da54..6cbf6f553a 100644
>> --- a/modules/gui/qt/util/vlctick.cpp
>> +++ b/modules/gui/qt/util/vlctick.cpp
>> @@ -49,3 +49,8 @@ QString VLCTick::toString() const
>>                  .arg(min, 2, 10, QChar('0'))
>>                  .arg(sec, 2, 10, QChar('0'));
>>  }
>> +
>> +VLCTick VLCTick::scale(float scalar) const
>> +{
>> +    return VLCTick(m_ticks*scalar);
>> +}
>> \ No newline at end of file
>> diff --git a/modules/gui/qt/util/vlctick.hpp 
>> b/modules/gui/qt/util/vlctick.hpp
>> index 19ea5d1db5..e6f8f2b2aa 100644
>> --- a/modules/gui/qt/util/vlctick.hpp
>> +++ b/modules/gui/qt/util/vlctick.hpp
>> @@ -39,6 +39,7 @@ public:
>>       * @return time as HH:MM:SS
>>       */
>>      Q_INVOKABLE QString toString() const;
>> +    Q_INVOKABLE VLCTick scale(float) const;
>> 
>>  private:
>>      vlc_tick_t m_ticks;
>> --
>> 2.21.0
>> 
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list