Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
qml_utils.h
1// SPDX-FileCopyrightText: © 2025-2026 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 Q_INVOKABLE static QString pathBasename (const QString &path);
25
26 Q_INVOKABLE static float amplitudeToDbfs (float amplitude);
27 Q_INVOKABLE static QStringList splitTextLines (const QString &text);
28 Q_INVOKABLE static QStringList removeDuplicates (const QStringList &list);
29 Q_INVOKABLE static QString readTextFileContent (const QString &filePath);
30
31 Q_INVOKABLE static QColor saturate (const QColor &color, float perc);
32 Q_INVOKABLE static QColor makeBrighter (const QColor &color, float perc);
33 Q_INVOKABLE static QColor
34 adjustOpacity (const QColor &color, float newOpacity);
35
43 Q_INVOKABLE static QVector<gui::qquick::WaveformChannel *>
44 getAudioRegionWaveform (QObject * audioRegion, int pixelWidth);
45
46 Q_INVOKABLE static QVector<float>
47 getAutomationRegionValues (QObject * automationRegion, int pixelWidth);
48
49 Q_INVOKABLE static bool rectanglesIntersect (QRectF a, QRectF b);
50 Q_INVOKABLE static bool rectanglesIntersect (QRect a, QRect b);
51};
52}
static Q_INVOKABLE QVector< gui::qquick::WaveformChannel * > getAudioRegionWaveform(QObject *audioRegion, int pixelWidth)
Generate waveform data for an AudioRegion.