commit 5018227dd0f81d7fdcb52f2929305075e73f2b09
parent e8c6dc0532ccd173831be39b7a23407e1233f746
Author: cfillion <cfillion@users.noreply.github.com>
Date: Sat, 16 Sep 2017 21:59:18 -0400
add support for Automation Item files
Diffstat:
6 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/browser.cpp b/src/browser.cpp
@@ -295,6 +295,7 @@ void Browser::displayButton()
{"&Project Templates", Package::ProjectTemplateType},
{"&Track Templates", Package::TrackTemplateType},
{"&MIDI Note Names", Package::MIDINoteNamesType},
+ {"&Automation Items", Package::AutomationItemType},
{"&Other packages", Package::UnknownType},
};
@@ -345,6 +346,7 @@ bool Browser::isFiltered(Package::Type type) const
case Package::ProjectTemplateType:
case Package::TrackTemplateType:
case Package::MIDINoteNamesType:
+ case Package::AutomationItemType:
break;
case Package::DataType:
type = Package::UnknownType;
diff --git a/src/package.cpp b/src/package.cpp
@@ -47,6 +47,8 @@ Package::Type Package::getType(const char *type)
return TrackTemplateType;
else if(!strcmp(type, "midinotenames"))
return MIDINoteNamesType;
+ else if(!strcmp(type, "autoitem"))
+ return AutomationItemType;
else
return UnknownType;
}
@@ -76,6 +78,8 @@ string Package::displayType(const Type type)
return "Track Template";
case MIDINoteNamesType:
return "MIDI Note Names";
+ case AutomationItemType:
+ return "Automation Item";
}
return "Unknown";
diff --git a/src/package.hpp b/src/package.hpp
@@ -37,6 +37,7 @@ public:
ProjectTemplateType,
TrackTemplateType,
MIDINoteNamesType,
+ AutomationItemType,
};
static Type getType(const char *);
diff --git a/src/source.cpp b/src/source.cpp
@@ -124,6 +124,9 @@ Path Source::targetPath() const
case Package::MIDINoteNamesType:
path += "MIDINoteNames";
break;
+ case Package::AutomationItemType:
+ path += "AutomationItems";
+ break;
case Package::UnknownType:
// The package has an unsupported type, so we make an empty path.
// The empty path won't be used because the category will reject
@@ -136,7 +139,8 @@ Path Source::targetPath() const
// append the rest of the path
switch(type) {
case Package::ScriptType:
- case Package::EffectType: {
+ case Package::EffectType:
+ case Package::AutomationItemType: {
const Category *cat = m_version->package()->category();
path += cat->index()->name();
diff --git a/test/package.cpp b/test/package.cpp
@@ -21,6 +21,7 @@ TEST_CASE("package type from string", M) {
{"projecttpl", Package::ProjectTemplateType},
{"tracktpl", Package::TrackTemplateType},
{"midinotenames", Package::MIDINoteNamesType},
+ {"autoitem", Package::AutomationItemType},
};
for(const auto &pair : tests)
@@ -40,6 +41,7 @@ TEST_CASE("package type to string", M) {
{Package::ProjectTemplateType, "Project Template"},
{Package::TrackTemplateType, "Track Template"},
{Package::MIDINoteNamesType, "MIDI Note Names"},
+ {Package::AutomationItemType, "Automation Item"},
{static_cast<Package::Type>(-1), "Unknown"},
};
diff --git a/test/source.cpp b/test/source.cpp
@@ -155,6 +155,7 @@ TEST_CASE("source target path", M) {
{Package::ProjectTemplateType, "ProjectTemplates/file.name"},
{Package::TrackTemplateType, "TrackTemplates/file.name"},
{Package::MIDINoteNamesType, "MIDINoteNames/file.name"},
+ {Package::AutomationItemType, "AutomationItems/Index Name/Category Name/file.name"},
};
Source source("file.name", "url", &ver);