Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
qml_utils.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "gui/qquick/waveform_channel.h"
7
8#include <QObject>
9#include <QVector>
10#include <QtQmlIntegration/qqmlintegration.h>
11
12namespace zrythm::gui::qquick
13{
14
15class QmlUtils : public QObject
16{
17 Q_OBJECT
18 QML_ELEMENT
19 QML_SINGLETON
20
21public:
22 Q_INVOKABLE static QString toPathString (const QUrl &url);
23 Q_INVOKABLE static QUrl localFileToQUrl (const QString &path);
24
25 Q_INVOKABLE static float amplitudeToDbfs (float amplitude);
26 Q_INVOKABLE static QStringList splitTextLines (const QString &text);
27 Q_INVOKABLE static QStringList removeDuplicates (const QStringList &list);
28 Q_INVOKABLE static QString readTextFileContent (const QString &filePath);
29
30 Q_INVOKABLE static QColor saturate (const QColor &color, float perc);
31 Q_INVOKABLE static QColor makeBrighter (const QColor &color, float perc);
32 Q_INVOKABLE static QColor
33 adjustOpacity (const QColor &color, float newOpacity);
34
42 Q_INVOKABLE static QVector<gui::qquick::WaveformChannel *>
43 getAudioRegionWaveform (QObject * audioRegion, int pixelWidth);
44
45 Q_INVOKABLE static QVector<float>
46 getAutomationRegionValues (QObject * automationRegion, int pixelWidth);
47
48 Q_INVOKABLE static bool rectanglesIntersect (QRectF a, QRectF b);
49 Q_INVOKABLE static bool rectanglesIntersect (QRect a, QRect b);
50};
51}
static Q_INVOKABLE QVector< gui::qquick::WaveformChannel * > getAudioRegionWaveform(QObject *audioRegion, int pixelWidth)
Generate waveform data for an AudioRegion.