Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
file_path_list.h
1// SPDX-FileCopyrightText: © 2024 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <filesystem>
7
8#include "utils/utf8_string.h"
9
10#include <QObject>
11#include <QtQmlIntegration/qqmlintegration.h>
12
13namespace juce
14{
15class FileSearchPath;
16}
17
18namespace zrythm::utils
19{
20
21class FilePathList : public QObject
22{
23 Q_OBJECT
24 Q_PROPERTY (
25 QStringList paths READ getPaths WRITE setPaths NOTIFY pathsChanged FINAL)
26
27public:
28 FilePathList (QObject * parent = nullptr);
29 FilePathList (juce::FileSearchPath paths, QObject * parent = nullptr);
30
31 Q_SIGNAL void pathsChanged ();
32
33 QStringList getPaths () const;
34 void setPaths (const QStringList &paths);
35
36 Q_INVOKABLE void addPath (const QString &path);
37 Q_INVOKABLE void clear ();
38
39 void add_path (const std::filesystem::path &path);
40 void add_path (const Utf8String &path);
41 void add_paths (const juce::FileSearchPath &paths);
42 juce::FileSearchPath get_as_juce_file_search_path () const;
43
47 void print (const utils::Utf8String &title) const;
48
49 auto begin () const { return paths_.begin (); }
50 auto end () const { return paths_.end (); }
51 auto begin () { return paths_.begin (); }
52 auto end () { return paths_.end (); }
53
54 bool empty () const { return paths_.empty (); }
55
56private:
57 std::vector<std::filesystem::path> paths_;
58};
59
60} // namespace zrythm::utils
void print(const utils::Utf8String &title) const
For debugging.
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:37
String utilities.