Sélectionner une révision Git
-
Kubat a rédigé
CMP0100 is set to NEW, so moc and uic can be run on .hh files if needed. This is the new behaviour of the policy so it's safe. It also permits to separate clearly C++ headers from C ones.
Kubat a rédigéCMP0100 is set to NEW, so moc and uic can be run on .hh files if needed. This is the new behaviour of the policy so it's safe. It also permits to separate clearly C++ headers from C ones.
TimingAxis.hh 1,47 Kio
#ifndef VIVY_TIMING_AXIS_H
#define VIVY_TIMING_AXIS_H
#ifndef __cplusplus
#error "This is a C++ header"
#endif
#include <QGraphicsWidget>
#include <QPainter>
#include <QGraphicsScene>
#include <cmath>
#include "../../../Lib/Audio.hh"
namespace Vivy
{
class TimingAxis final : public QGraphicsObject {
Q_OBJECT
public:
explicit TimingAxis(AudioContext::StreamPtr stream, int x0, int x1, int y) noexcept;
~TimingAxis() noexcept override = default;
QRectF boundingRect() const override;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
private:
static inline constexpr QColor axisColour = QColor(0, 0, 127);
qreal penWidth{ 1 };
AudioContext::StreamPtr audioStream;
/*
* We use ints here because
* qPainter->drawLine() and qPainter->drawText()
* restrict us to ints anyways
*/
QVector<quint64> availableTicks = { 10, 100, 1000, 10000, 60000, 3600000, 86400000 };
quint64 minBetweenMinor{ 10 };
quint64 minorTicks;
quint64 majorTicks;
int minorTicksHeight { 3 };
int majorTicksHeight { 7 };
int timeDigitsHeight { 20 };
int timeDigitsMargin { 3 };
int ticksBase { 30 };
int x0{ 0 };
int x1{ 0 };
int y{ 0 };
QString msToString(quint64 i) const noexcept;
inline quint64 posFromMs(quint64 t, quint64 width, quint64 length) const noexcept;
protected:
public slots:
void refreshTicks();
};
}
#endif // VIVY_TIMING_AXIS_H