-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
134 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#include "media-data.hpp" | ||
|
||
std::vector<MediaData *> MediaData::mediaItems; | ||
|
||
MediaData::MediaData(const QString &name_, const QString &path_, bool loop_) | ||
: name(name_), path(path_), loop(loop_) | ||
{ | ||
mediaItems.emplace_back(this); | ||
} | ||
|
||
MediaData::~MediaData() | ||
{ | ||
obs_hotkey_unregister(hotkey); | ||
mediaItems.erase(std::remove(mediaItems.begin(), mediaItems.end(), | ||
this), | ||
mediaItems.end()); | ||
} | ||
|
||
QString MediaData::GetName(const MediaData &media) | ||
{ | ||
return media.name; | ||
} | ||
|
||
QString MediaData::GetPath(const MediaData &media) | ||
{ | ||
return media.path; | ||
} | ||
|
||
obs_hotkey_id MediaData::GetHotkey(const MediaData &media) | ||
{ | ||
return media.hotkey; | ||
} | ||
|
||
void MediaData::SetName(MediaData &media, const QString &newName) | ||
{ | ||
media.name = newName; | ||
} | ||
|
||
void MediaData::SetPath(MediaData &media, const QString &newPath) | ||
{ | ||
media.path = newPath; | ||
} | ||
|
||
void MediaData::SetHotkey(MediaData &media, const obs_hotkey_id &hotkey) | ||
{ | ||
media.hotkey = hotkey; | ||
} | ||
|
||
MediaData *MediaData::FindMediaByName(const QString &name) | ||
{ | ||
for (auto &media : mediaItems) { | ||
if (media->name == name) | ||
return media; | ||
} | ||
|
||
return nullptr; | ||
} | ||
|
||
void MediaData::SetLoopingEnabled(MediaData &media, bool loop) | ||
{ | ||
media.loop = loop; | ||
} | ||
|
||
bool MediaData::LoopingEnabled(const MediaData &media) | ||
{ | ||
return media.loop; | ||
} | ||
|
||
std::vector<MediaData *> MediaData::GetMedia() | ||
{ | ||
return mediaItems; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
|
||
#include "obs.hpp" | ||
#include <QString> | ||
#include <vector> | ||
|
||
class MediaData { | ||
private: | ||
static std::vector<MediaData *> mediaItems; | ||
QString name = ""; | ||
QString path = ""; | ||
obs_hotkey_id hotkey = OBS_INVALID_HOTKEY_ID; | ||
bool loop = false; | ||
|
||
public: | ||
MediaData(const QString &name_, const QString &path_, bool loop_); | ||
~MediaData(); | ||
|
||
static void SetName(MediaData &media, const QString &newName); | ||
static void SetPath(MediaData &media, const QString &newPath); | ||
static void SetHotkey(MediaData &media, const obs_hotkey_id &hotkey); | ||
|
||
static QString GetName(const MediaData &media); | ||
static QString GetPath(const MediaData &media); | ||
static obs_hotkey_id GetHotkey(const MediaData &media); | ||
static MediaData *FindMediaByName(const QString &name); | ||
|
||
static void SetLoopingEnabled(MediaData &media, bool loop); | ||
static bool LoopingEnabled(const MediaData &media); | ||
static std::vector<MediaData *> GetMedia(); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters