SoundDrop.hpp
1 #pragma once
2 #include <Process/Drop/ProcessDropHandler.hpp>
3 #include <Process/TimeValue.hpp>
4 
5 #include <Media/MediaFileHandle.hpp>
6 
7 namespace Media::Sound
8 {
9 struct SCORE_PLUGIN_MEDIA_EXPORT DroppedAudioFiles
10 {
11  DroppedAudioFiles(const score::DocumentContext& ctx, const QMimeData& mime);
12 
13  bool valid() const { return !files.empty() && maxDuration != TimeVal::zero(); }
14 
15  TimeVal dropMaxDuration() const;
16  TimeVal maxDuration = TimeVal::zero();
17  std::vector<std::pair<QString, TimeVal>> files;
18 };
19 
25 class SCORE_PLUGIN_MEDIA_EXPORT DropHandler final : public Process::ProcessDropHandler
26 {
27  SCORE_CONCRETE("bc57983b-c29e-4b12-8afe-9d6ffbcb7a94")
28  public:
29  QSet<QString> mimeTypes() const noexcept override;
30  QSet<QString> fileExtensions() const noexcept override;
31 private:
32  void dropCustom(
33  std::vector<ProcessDrop>& drops, const QMimeData& data,
34  const score::DocumentContext& ctx) const noexcept override;
35 };
36 
37 }
The DropHandler class If something with audio mime type is dropped, then we create a box with an audi...
Definition: SoundDrop.hpp:26
Definition: ProcessDropHandler.hpp:25
Definition: SoundDrop.hpp:10
Definition: TimeValue.hpp:21
Definition: DocumentContext.hpp:18