diff --git a/src/Soundboard.ui b/src/Soundboard.ui
index e694c4f..9746b70 100644
--- a/src/Soundboard.ui
+++ b/src/Soundboard.ui
@@ -10,6 +10,9 @@
317
+
+ true
+
Soundboard
diff --git a/src/soundboard.cpp b/src/soundboard.cpp
index a5c6651..adbf262 100644
--- a/src/soundboard.cpp
+++ b/src/soundboard.cpp
@@ -15,6 +15,8 @@
#include
#include
#include
+#include
+#include
#include "scene-tree.hpp"
#include "media-controls.hpp"
@@ -158,7 +160,7 @@ void Soundboard::CreateSource()
ui->mediaControls->SetSource(source);
}
- obs_set_output_source(8, source);
+ obs_set_output_source(63, source);
}
OBSDataArray Soundboard::SaveMedia()
@@ -544,6 +546,31 @@ void Soundboard::on_actionFilters_triggered()
obs_frontend_open_source_filters(source);
}
+void Soundboard::dragEnterEvent(QDragEnterEvent *event)
+{
+ if (event->mimeData()->hasUrls())
+ event->acceptProposedAction();
+}
+
+void Soundboard::dropEvent(QDropEvent *event)
+{
+ QStringList supportedExt;
+ supportedExt << ".mp3" << ".aac" << ".ogg" << ".wav" << ".flac";
+
+ foreach(const QUrl &url, event->mimeData()->urls())
+ {
+ QString path = url.toLocalFile();
+ QFileInfo fi(path);
+ QString name = fi.fileName();
+ QString ext = QString(".") + fi.completeSuffix();
+
+ if (!supportedExt.contains(ext))
+ continue;
+
+ Add(name, path);
+ }
+}
+
void Soundboard::EditMediaName()
{
removeAction(renameMedia);
diff --git a/src/soundboard.hpp b/src/soundboard.hpp
index 1ece7ed..0870f26 100644
--- a/src/soundboard.hpp
+++ b/src/soundboard.hpp
@@ -61,6 +61,10 @@ private slots:
void Load(OBSData saveData);
void CreateSource();
+
+protected:
+ virtual void dragEnterEvent(QDragEnterEvent *event) override;
+ virtual void dropEvent(QDropEvent *event) override;
};
class MediaRenameDelegate : public QStyledItemDelegate {