Browse Source

ModuleBrowser case insensitive sort for author name

tags/v0.6.1
Andrew Belt 6 years ago
parent
commit
1753453db2
2 changed files with 10 additions and 2 deletions
  1. +9
    -1
      include/util/common.hpp
  2. +1
    -1
      src/app/ModuleBrowser.cpp

+ 9
- 1
include/util/common.hpp View File

@@ -110,11 +110,12 @@ DeferWrapper<F> deferWrapper(F f) {

/** Seeds the RNG with the current time */
void randomInit();
/** Returns a uniform random uint32_t from 0 to UINT32_MAX */
uint32_t randomu32();
uint64_t randomu64();
/** Returns a uniform random float in the interval [0.0, 1.0) */
float randomUniform();
/** Returns a normal random number with mean 0 and std dev 1 */
/** Returns a normal random number with mean 0 and standard deviation 1 */
float randomNormal();

inline float DEPRECATED randomf() {return randomUniform();}
@@ -139,6 +140,13 @@ std::string stringDirectory(std::string path);
std::string stringFilename(std::string path);
std::string stringExtension(std::string path);

struct StringCaseInsensitiveCompare {
bool operator()(const std::string &a, const std::string &b) const {
return stringLowercase(a) < stringLowercase(b);
}
};


////////////////////
// Operating-system specific utilities
// system.cpp


+ 1
- 1
src/app/ModuleBrowser.cpp View File

@@ -279,7 +279,7 @@ struct ModuleBrowser : OpaqueWidget {
SearchModuleField *searchField;
ScrollWidget *moduleScroll;
BrowserList *moduleList;
std::set<std::string> availableAuthors;
std::set<std::string, StringCaseInsensitiveCompare> availableAuthors;
std::set<ModelTag> availableTags;

ModuleBrowser() {


Loading…
Cancel
Save