2012-07-27 16:58:27 +00:00
|
|
|
#ifndef _FOLDER_H_
|
|
|
|
#define _FOLDER_H_
|
|
|
|
|
Support sorting of game list via input
You can now map the functions "sortordernext" and "sortorderprevious" to
inputs (in es_input.cfg) and toggle the game list sort order with them.
The order is: "file name, ascending" (default), "file name, descending",
"rating ascending", "rating descending", "user rating ascending", "user
rating descending", "time played ascending", "times played descending",
"last played time ascending", "last played time descending".
2013-06-28 17:44:28 +00:00
|
|
|
#include <map>
|
2012-07-27 16:58:27 +00:00
|
|
|
#include <vector>
|
|
|
|
|
Support sorting of game list via input
You can now map the functions "sortordernext" and "sortorderprevious" to
inputs (in es_input.cfg) and toggle the game list sort order with them.
The order is: "file name, ascending" (default), "file name, descending",
"rating ascending", "rating descending", "user rating ascending", "user
rating descending", "time played ascending", "times played descending",
"last played time ascending", "last played time descending".
2013-06-28 17:44:28 +00:00
|
|
|
#include "FileData.h"
|
|
|
|
|
|
|
|
|
2012-07-27 16:58:27 +00:00
|
|
|
class SystemData;
|
|
|
|
|
2012-09-07 21:44:07 +00:00
|
|
|
//This class lets us hold a vector of FileDatas within under a common name.
|
2012-07-27 16:58:27 +00:00
|
|
|
class FolderData : public FileData
|
|
|
|
{
|
Support sorting of game list via input
You can now map the functions "sortordernext" and "sortorderprevious" to
inputs (in es_input.cfg) and toggle the game list sort order with them.
The order is: "file name, ascending" (default), "file name, descending",
"rating ascending", "rating descending", "user rating ascending", "user
rating descending", "time played ascending", "times played descending",
"last played time ascending", "last played time descending".
2013-06-28 17:44:28 +00:00
|
|
|
public:
|
|
|
|
typedef bool ComparisonFunction(const FileData* a, const FileData* b);
|
|
|
|
struct SortState
|
|
|
|
{
|
|
|
|
ComparisonFunction & comparisonFunction;
|
|
|
|
bool ascending;
|
2013-06-30 17:24:09 +00:00
|
|
|
std::string description;
|
Support sorting of game list via input
You can now map the functions "sortordernext" and "sortorderprevious" to
inputs (in es_input.cfg) and toggle the game list sort order with them.
The order is: "file name, ascending" (default), "file name, descending",
"rating ascending", "rating descending", "user rating ascending", "user
rating descending", "time played ascending", "times played descending",
"last played time ascending", "last played time descending".
2013-06-28 17:44:28 +00:00
|
|
|
|
2013-06-30 17:24:09 +00:00
|
|
|
SortState(ComparisonFunction & sortFunction, bool sortAscending, const std::string & sortDescription) : comparisonFunction(sortFunction), ascending(sortAscending), description(sortDescription) {}
|
Support sorting of game list via input
You can now map the functions "sortordernext" and "sortorderprevious" to
inputs (in es_input.cfg) and toggle the game list sort order with them.
The order is: "file name, ascending" (default), "file name, descending",
"rating ascending", "rating descending", "user rating ascending", "user
rating descending", "time played ascending", "times played descending",
"last played time ascending", "last played time descending".
2013-06-28 17:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
static std::map<ComparisonFunction*, std::string> sortStateNameMap;
|
|
|
|
|
2012-07-27 16:58:27 +00:00
|
|
|
public:
|
|
|
|
FolderData(SystemData* system, std::string path, std::string name);
|
|
|
|
~FolderData();
|
|
|
|
|
2013-06-28 12:54:14 +00:00
|
|
|
bool isFolder() const;
|
|
|
|
const std::string & getName() const;
|
|
|
|
const std::string & getPath() const;
|
2012-07-27 16:58:27 +00:00
|
|
|
|
|
|
|
unsigned int getFileCount();
|
2013-06-28 12:54:14 +00:00
|
|
|
FileData* getFile(unsigned int i) const;
|
|
|
|
std::vector<FileData*> getFiles(bool onlyFiles = false) const;
|
|
|
|
std::vector<FileData*> getFilesRecursive(bool onlyFiles = false) const;
|
2012-07-27 16:58:27 +00:00
|
|
|
|
|
|
|
void pushFileData(FileData* file);
|
2012-08-02 04:03:15 +00:00
|
|
|
|
Support sorting of game list via input
You can now map the functions "sortordernext" and "sortorderprevious" to
inputs (in es_input.cfg) and toggle the game list sort order with them.
The order is: "file name, ascending" (default), "file name, descending",
"rating ascending", "rating descending", "user rating ascending", "user
rating descending", "time played ascending", "times played descending",
"last played time ascending", "last played time descending".
2013-06-28 17:44:28 +00:00
|
|
|
void sort(ComparisonFunction & comparisonFunction = compareFileName, bool ascending = true);
|
2013-06-28 12:54:14 +00:00
|
|
|
static bool compareFileName(const FileData* file1, const FileData* file2);
|
|
|
|
static bool compareRating(const FileData* file1, const FileData* file2);
|
2013-06-28 15:25:18 +00:00
|
|
|
static bool compareUserRating(const FileData* file1, const FileData* file2);
|
2013-06-28 12:54:14 +00:00
|
|
|
static bool compareTimesPlayed(const FileData* file1, const FileData* file2);
|
2013-06-28 15:25:18 +00:00
|
|
|
static bool compareLastPlayed(const FileData* file1, const FileData* file2);
|
Support sorting of game list via input
You can now map the functions "sortordernext" and "sortorderprevious" to
inputs (in es_input.cfg) and toggle the game list sort order with them.
The order is: "file name, ascending" (default), "file name, descending",
"rating ascending", "rating descending", "user rating ascending", "user
rating descending", "time played ascending", "times played descending",
"last played time ascending", "last played time descending".
2013-06-28 17:44:28 +00:00
|
|
|
static std::string getSortStateName(ComparisonFunction & comparisonFunction = compareFileName, bool ascending = true);
|
|
|
|
|
2012-07-27 16:58:27 +00:00
|
|
|
private:
|
|
|
|
SystemData* mSystem;
|
|
|
|
std::string mPath;
|
|
|
|
std::string mName;
|
|
|
|
std::vector<FileData*> mFileVector;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|