Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
file_importer.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "actions/arranger_object_creator.h"
7#include "actions/track_creator.h"
8#include "structure/scenes/scene.h"
9
10#include <juce_wrapper.h>
11
12namespace zrythm::gui::backend
13{
14
15class FileImporter : public QObject
16{
17 Q_OBJECT
18 QML_ELEMENT
19 QML_UNCREATABLE ("One instance per project")
20
21public:
22 explicit FileImporter (
23 undo::UndoStack &undo_stack,
24 ::zrythm::actions::ArrangerObjectCreator &arranger_object_creator,
26 QObject * parent = nullptr);
27
31 enum class FileType
32 {
33 Audio,
34 Midi,
35 Unsupported
36 };
37
45 Q_INVOKABLE void importFiles (
46 const QStringList &filePaths,
47 double startTicks,
48 structure::tracks::Track * track) const;
49
50 Q_INVOKABLE void importFileToClipSlot (
51 const QString &filePath,
54 structure::scenes::ClipSlot * clipSlot) const;
55
62 Q_INVOKABLE FileType getFileType (const QString &filePath) const;
63
70 Q_INVOKABLE bool isAudioFile (const QString &filePath) const;
71
78 Q_INVOKABLE bool isMidiFile (const QString &filePath) const;
79
80private:
81 ::zrythm::actions::TrackCreator &track_creator_;
82 ::zrythm::actions::ArrangerObjectCreator &arranger_object_creator_;
83 undo::UndoStack &undo_stack_;
84
86 mutable juce::AudioFormatManager audio_format_manager_;
87};
88}
FileType
Enumeration for supported file types.
Q_INVOKABLE bool isAudioFile(const QString &filePath) const
Checks if a file is an audio file.
Q_INVOKABLE void importFiles(const QStringList &filePaths, double startTicks, structure::tracks::Track *track) const
Imports the given file.
Q_INVOKABLE FileType getFileType(const QString &filePath) const
Determines the type of a file.
Q_INVOKABLE bool isMidiFile(const QString &filePath) const
Checks if a file is a MIDI file.
Represents a track in the project.
Definition track.h:54