Skip to content
Extraits de code Groupes Projets
Valider b6f5ab1e rédigé par Elliu's avatar Elliu Validation de Elliu
Parcourir les fichiers

Duration from microseconds to seconds using std::chrono

parent 54b1904c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!29Improve timingView with display of the ASS lines
...@@ -101,9 +101,9 @@ public: ...@@ -101,9 +101,9 @@ public:
qreal getDuration() const noexcept qreal getDuration() const noexcept
{ {
TODO(Use std::chrono here) return qreal(std::chrono::duration<qreal, std::ratio<1, 1>>(
// The whole file duration, not individual streams. std::chrono::microseconds(dataFormat->duration))
return static_cast<qreal>(dataFormat->duration) / 1000000; .count());
} }
protected: protected:
...@@ -192,11 +192,12 @@ public: ...@@ -192,11 +192,12 @@ public:
return StreamWeakPtr{ spareNullSreamPtr }; return StreamWeakPtr{ spareNullSreamPtr };
} }
qreal getLength() const noexcept qreal getDuration() const noexcept
{ {
TODO(Use std::chrono here)
// The whole file duration, not individual streams. // The whole file duration, not individual streams.
return static_cast<qreal>(format->duration) / 1000000; return qreal(std::chrono::duration<qreal, std::ratio<1, 1>>(
std::chrono::microseconds(format->duration))
.count());
} }
StreamWeakPtr getDefaultStream() const noexcept StreamWeakPtr getDefaultStream() const noexcept
......
...@@ -14,7 +14,7 @@ namespace Vivy ...@@ -14,7 +14,7 @@ namespace Vivy
class TimingAxis final : public QGraphicsItem { class TimingAxis final : public QGraphicsItem {
public: public:
explicit TimingAxis(qreal soundLength, int x0, int x1, int y) noexcept; explicit TimingAxis(qreal soundLength, int x0, int x1, int y) noexcept;
~TimingAxis() noexcept = default; ~TimingAxis() noexcept override = default;
QRectF boundingRect() const override; QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
...@@ -23,13 +23,13 @@ private: ...@@ -23,13 +23,13 @@ private:
static inline constexpr QColor axisColour = QColor(0, 0, 127); static inline constexpr QColor axisColour = QColor(0, 0, 127);
QVector<qreal> availableTicks = { 0.01, 0.1, 1, 10, 60, 3600, 86400 }; QVector<qreal> availableTicks = { 0.01, 0.1, 1, 10, 60, 3600, 86400 };
qreal minBetweenMinor = 5; qreal minBetweenMinor{ 5 };
qreal penWidth = { 1 }; qreal penWidth{ 1 };
qreal soundLength = { 0 }; qreal soundLength{ 0 };
int x0 = { 0 }; int x0{ 0 };
int x1 = { 0 }; int x1{ 0 };
int y = { 0 }; int y{ 0 };
protected: protected:
}; };
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter