And yet more 'enum' cleanups.

This commit is contained in:
Stephen Anthony 2019-04-13 22:44:23 -02:30
parent 4d99772a10
commit d54f106a3a
8 changed files with 13 additions and 20 deletions

View File

@ -68,11 +68,7 @@ class FilesystemNode
/** /**
* Flag to tell listDir() which kind of files to list. * Flag to tell listDir() which kind of files to list.
*/ */
enum ListMode { enum class ListMode { FilesOnly, DirectoriesOnly, All };
kListFilesOnly = 1,
kListDirectoriesOnly = 2,
kListAll = 3
};
/** /**
* Create a new pathless FilesystemNode. Since there's no path associated * Create a new pathless FilesystemNode. Since there's no path associated
@ -143,7 +139,7 @@ class FilesystemNode
* @return true if successful, false otherwise (e.g. when the directory * @return true if successful, false otherwise (e.g. when the directory
* does not exist). * does not exist).
*/ */
bool getChildren(FSList& fslist, ListMode mode = kListDirectoriesOnly, bool getChildren(FSList& fslist, ListMode mode = ListMode::DirectoriesOnly,
bool hidden = false) const; bool hidden = false) const;
/** /**

View File

@ -211,10 +211,7 @@ class Serializer
// The stream to send the serialized data to. // The stream to send the serialized data to.
unique_ptr<iostream> myStream; unique_ptr<iostream> myStream;
enum { static constexpr uInt8 TruePattern = 0xfe, FalsePattern = 0x01;
TruePattern = 0xfe,
FalsePattern = 0x01
};
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

@ -114,7 +114,7 @@ void BrowserDialog::show(const string& startpath,
switch(_mode) switch(_mode)
{ {
case FileLoad: case FileLoad:
_fileList->setFileListMode(FilesystemNode::kListAll); _fileList->setFileListMode(FilesystemNode::ListMode::All);
_fileList->setFileExtension(ext); _fileList->setFileExtension(ext);
_selected->setEditable(false); _selected->setEditable(false);
_selected->clearFlags(WIDGET_INVISIBLE); _selected->clearFlags(WIDGET_INVISIBLE);
@ -122,7 +122,7 @@ void BrowserDialog::show(const string& startpath,
break; break;
case FileSave: case FileSave:
_fileList->setFileListMode(FilesystemNode::kListAll); _fileList->setFileListMode(FilesystemNode::ListMode::All);
_fileList->setFileExtension(ext); _fileList->setFileExtension(ext);
_selected->setEditable(false); // FIXME - disable user input for now _selected->setEditable(false); // FIXME - disable user input for now
_selected->clearFlags(WIDGET_INVISIBLE); _selected->clearFlags(WIDGET_INVISIBLE);
@ -130,7 +130,7 @@ void BrowserDialog::show(const string& startpath,
break; break;
case Directories: case Directories:
_fileList->setFileListMode(FilesystemNode::kListDirectoriesOnly); _fileList->setFileListMode(FilesystemNode::ListMode::DirectoriesOnly);
_selected->setEditable(false); _selected->setEditable(false);
_selected->setFlags(WIDGET_INVISIBLE); _selected->setFlags(WIDGET_INVISIBLE);
_type->setFlags(WIDGET_INVISIBLE); _type->setFlags(WIDGET_INVISIBLE);

View File

@ -24,7 +24,7 @@
FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font, FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h) int x, int y, int w, int h)
: StringListWidget(boss, font, x, y, w, h), : StringListWidget(boss, font, x, y, w, h),
_fsmode(FilesystemNode::kListAll), _fsmode(FilesystemNode::ListMode::All),
_extension("") _extension("")
{ {
// This widget is special, in that it catches signals and redirects them // This widget is special, in that it catches signals and redirects them

View File

@ -340,7 +340,7 @@ void LauncherDialog::loadDirListing()
FSList files; FSList files;
files.reserve(2048); files.reserve(2048);
myCurrentNode.getChildren(files, FilesystemNode::kListAll); myCurrentNode.getChildren(files, FilesystemNode::ListMode::All);
// Add '[..]' to indicate previous folder // Add '[..]' to indicate previous folder
if(myCurrentNode.hasParent()) if(myCurrentNode.hasParent())

View File

@ -121,7 +121,7 @@ void RomAuditDialog::auditRoms()
FilesystemNode node(auditPath); FilesystemNode node(auditPath);
FSList files; FSList files;
files.reserve(2048); files.reserve(2048);
node.getChildren(files, FilesystemNode::kListFilesOnly); node.getChildren(files, FilesystemNode::ListMode::FilesOnly);
// Create a progress dialog box to show the progress of processing // Create a progress dialog box to show the progress of processing
// the ROMs, since this is usually a time-consuming operation // the ROMs, since this is usually a time-consuming operation

View File

@ -174,8 +174,8 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode,
continue; continue;
// Honor the chosen mode // Honor the chosen mode
if ((mode == FilesystemNode::kListFilesOnly && !entry._isFile) || if ((mode == FilesystemNode::ListMode::FilesOnly && !entry._isFile) ||
(mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) (mode == FilesystemNode::ListMode::DirectoriesOnly && !entry._isDirectory))
continue; continue;
myList.emplace_back(new FilesystemNodePOSIX(entry)); myList.emplace_back(new FilesystemNodePOSIX(entry));

View File

@ -134,8 +134,8 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode,
isDirectory = ((find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false); isDirectory = ((find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false);
isFile = !isDirectory;//(find_data->dwFileAttributes & FILE_ATTRIBUTE_NORMAL ? true : false); isFile = !isDirectory;//(find_data->dwFileAttributes & FILE_ATTRIBUTE_NORMAL ? true : false);
if((isFile && mode == FilesystemNode::kListDirectoriesOnly) || if((isFile && mode == FilesystemNode::ListMode::DirectoriesOnly) ||
(isDirectory && mode == FilesystemNode::kListFilesOnly)) (isDirectory && mode == FilesystemNode::ListMode::FilesOnly))
return; return;
entry._isDirectory = isDirectory; entry._isDirectory = isDirectory;