mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
Sort preset categories and names alphabetically
This commit is contained in:
parent
b8b0624a80
commit
c6415cb28d
1 changed files with 4 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
#include <juce_audio_processors/juce_audio_processors.h>
|
#include <juce_audio_processors/juce_audio_processors.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
struct Preset {
|
struct Preset {
|
||||||
juce::String name;
|
juce::String name;
|
||||||
|
|
@ -23,6 +24,7 @@ public:
|
||||||
if (c == p.category) { found = true; break; }
|
if (c == p.category) { found = true; break; }
|
||||||
if (!found) cats.push_back(p.category);
|
if (!found) cats.push_back(p.category);
|
||||||
}
|
}
|
||||||
|
std::sort(cats.begin(), cats.end());
|
||||||
return cats;
|
return cats;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -31,6 +33,8 @@ public:
|
||||||
for (auto& p : presets)
|
for (auto& p : presets)
|
||||||
if (p.category == cat)
|
if (p.category == cat)
|
||||||
result.push_back(p);
|
result.push_back(p);
|
||||||
|
std::sort(result.begin(), result.end(),
|
||||||
|
[](const Preset& a, const Preset& b) { return a.name < b.name; });
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue