sorted mode

This commit is contained in:
Manuel Dewald
2020-08-13 17:09:17 +02:00
committed by Manuel
parent 7b77e62af5
commit 05e5bb9460
4 changed files with 70 additions and 2 deletions

View File

@@ -27,7 +27,8 @@ int main(int argc, char *argv[])
int opt;
bool recursive = false;
bool shuffle = false;
while ((opt = getopt(argc, argv, "b:p:t:o:rs")) != -1) {
bool sorted = false;
while ((opt = getopt(argc, argv, "b:p:t:o:rsS")) != -1) {
switch (opt) {
case 'p':
path = optarg;
@@ -48,6 +49,9 @@ int main(int argc, char *argv[])
shuffle = true;
std::cout << "Shuffle mode is on." << std::endl;
break;
case 'S':
sorted = true;
break;
default: /* '?' */
usage(argv[0]);
return 1;
@@ -72,7 +76,11 @@ int main(int argc, char *argv[])
}
std::unique_ptr<ImageSelector> selector;
if (shuffle)
if (sorted)
{
selector = std::unique_ptr<ImageSelector>(new SortedImageSelector(pathTraverser));
}
else if (shuffle)
{
selector = std::unique_ptr<ImageSelector>(new ShuffleImageSelector(pathTraverser));
}