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/backend/waveform_channel.h"
7
8#include <QObject>
9#include <QVector>
10#include <QtQmlIntegration>
11
12class QmlUtils : public QObject
13{
14 Q_OBJECT
15 QML_ELEMENT
16 QML_SINGLETON
17
18public:
19 Q_INVOKABLE static QString toPathString (const QUrl &url);
20 Q_INVOKABLE static QUrl localFileToQUrl (const QString &path);
21
22 Q_INVOKABLE static float amplitudeToDbfs (float amplitude);
23 Q_INVOKABLE static QStringList splitTextLines (const QString &text);
24 Q_INVOKABLE static QStringList removeDuplicates (const QStringList &list);
25 Q_INVOKABLE static QString readTextFileContent (const QString &filePath);
26
27 Q_INVOKABLE static QColor saturate (const QColor &color, float perc);
28 Q_INVOKABLE static QColor makeBrighter (const QColor &color, float perc);
29 Q_INVOKABLE static QColor
30 adjustOpacity (const QColor &color, float newOpacity);
31
39 Q_INVOKABLE static QVector<gui::WaveformChannel *>
40 getAudioRegionWaveform (QObject * audioRegion, int pixelWidth);
41
42 Q_INVOKABLE static QVector<float>
43 getAutomationRegionValues (QObject * automationRegion, int pixelWidth);
44
45 Q_INVOKABLE static bool rectanglesIntersect (QRectF a, QRectF b);
46 Q_INVOKABLE static bool rectanglesIntersect (QRect a, QRect b);
47};
static Q_INVOKABLE QVector< gui::WaveformChannel * > getAudioRegionWaveform(QObject *audioRegion, int pixelWidth)
Generate waveform data for an AudioRegion.