Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
FileDescriptor Class Reference

Descriptor of a file. More...

#include <src/gui/backend/io/file_descriptor.h>

Public Member Functions

 FileDescriptor (const fs::path &abs_path)
bool is_audio () const
bool is_midi () const
bool is_supported () const
auto get_label () const
bool should_autoplay () const
 Returns whether the given file should auto-play (shorter than 1 min).
utils::Utf8String get_icon_name () const
 Gets the corresponding icon name for the given FileDescriptor's type.
utils::Utf8String get_info_text_for_label () const
 Returns a pango markup to be used in GTK labels.

Static Public Member Functions

static std::unique_ptr< FileDescriptornew_from_uri (const utils::Utf8String &uri)
 Creates a new FileDescriptor from a URI.
static utils::Utf8String get_type_description (FileType type)
 Returns a human readable description of the given file type.
static bool is_type_supported (FileType type)
 Returns if the given type is supported.
static bool is_type_audio (FileType type)
 Returns if the FileDescriptor is an audio file.
static bool is_type_midi (FileType type)
 Returns if the FileDescriptor is a midi file.
static std::optional< utils::Utf8String > get_type_ext (FileType type)
 Returns the most common extension for the given filetype.
static FileType get_type_from_path (const fs::path &file)
 Returns the file type of the given file path.

Data Fields

fs::path abs_path_
 Absolute path.
FileType type_ = {}
 Type of file.
utils::Utf8String label_
 Human readable label.
bool hidden_ = false
 Hidden or not.

Detailed Description

Descriptor of a file.

Definition at line 39 of file file_descriptor.h.

Member Function Documentation

◆ get_label()

auto FileDescriptor::get_label ( ) const
inline

Definition at line 94 of file file_descriptor.h.

◆ get_type_description()

utils::Utf8String FileDescriptor::get_type_description ( FileType type)
static

Returns a human readable description of the given file type.

Example: wav -> "Wave file".

◆ is_audio()

bool FileDescriptor::is_audio ( ) const
inline

Definition at line 88 of file file_descriptor.h.

◆ is_midi()

bool FileDescriptor::is_midi ( ) const
inline

Definition at line 90 of file file_descriptor.h.

◆ is_supported()

bool FileDescriptor::is_supported ( ) const
inline

Definition at line 92 of file file_descriptor.h.

◆ new_from_uri()

std::unique_ptr< FileDescriptor > FileDescriptor::new_from_uri ( const utils::Utf8String & uri)
static

Creates a new FileDescriptor from a URI.

Parameters
uri
Returns
std::unique_ptr<FileDescriptor>
Exceptions
ZrythmExceptionon error.

Field Documentation

◆ abs_path_

fs::path FileDescriptor::abs_path_

Absolute path.

Definition at line 113 of file file_descriptor.h.

◆ hidden_

bool FileDescriptor::hidden_ = false

Hidden or not.

Definition at line 122 of file file_descriptor.h.

◆ label_

utils::Utf8String FileDescriptor::label_

Human readable label.

Definition at line 119 of file file_descriptor.h.

◆ type_

FileType FileDescriptor::type_ = {}

Type of file.

Definition at line 116 of file file_descriptor.h.


The documentation for this class was generated from the following file: