Ensure that the file list in the browser is always sorted
svn-id: r16108
This commit is contained in:
parent
06315c1ce1
commit
0894f83804
3 changed files with 17 additions and 1 deletions
|
@ -20,7 +20,21 @@
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include "fs.h"
|
#include "backends/fs/fs.h"
|
||||||
|
#include "common/util.h"
|
||||||
|
|
||||||
|
void FSList::sort() {
|
||||||
|
// Simple selection sort
|
||||||
|
for (int i = 0; i < _size-1; i++) {
|
||||||
|
int min = i;
|
||||||
|
for (int j = i+1; j < _size; j++)
|
||||||
|
if (_data[j] < _data[min])
|
||||||
|
min = j;
|
||||||
|
if (min != i)
|
||||||
|
SWAP(_data[min], _data[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FilesystemNode AbstractFilesystemNode::wrap(AbstractFilesystemNode *node) {
|
FilesystemNode AbstractFilesystemNode::wrap(AbstractFilesystemNode *node) {
|
||||||
FilesystemNode wrapper;
|
FilesystemNode wrapper;
|
||||||
|
|
|
@ -61,6 +61,7 @@ class FilesystemNode;
|
||||||
* List of multiple file system nodes. E.g. the contents of a given directory.
|
* List of multiple file system nodes. E.g. the contents of a given directory.
|
||||||
*/
|
*/
|
||||||
class FSList : public Common::Array<FilesystemNode> {
|
class FSList : public Common::Array<FilesystemNode> {
|
||||||
|
void sort();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -197,6 +197,7 @@ void BrowserDialog::updateListing() {
|
||||||
|
|
||||||
// Read in the data from the file system
|
// Read in the data from the file system
|
||||||
_nodeContent = _node.listDir();
|
_nodeContent = _node.listDir();
|
||||||
|
_nodeContent.sort();
|
||||||
|
|
||||||
// Populate the ListWidget
|
// Populate the ListWidget
|
||||||
Common::StringList list;
|
Common::StringList list;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue