Recursive folders

* Allow recursive traversing of folders with -r flag
* Print useful error in case of no image found
* Fixes issues 4 & 6
This commit is contained in:
Manuel
2019-12-23 11:28:12 +01:00
parent ee7e88128a
commit 09fc431034
3 changed files with 41 additions and 7 deletions

View File

@@ -10,7 +10,7 @@
#include <stdio.h>
void usage(std::string programName) {
std::cerr << "Usage: " << programName << " [-t rotation_seconds] [-o background_opacity(0..255)] [-b blur_radius] -p image_folder" << std::endl;
std::cerr << "Usage: " << programName << " [-t rotation_seconds] [-o background_opacity(0..255)] [-b blur_radius] -p image_folder -r" << std::endl;
}
int main(int argc, char *argv[])
@@ -22,7 +22,8 @@ int main(int argc, char *argv[])
MainWindow w;
int opt;
while ((opt = getopt(argc, argv, "b:p:t:o:")) != -1) {
bool recursive = false;
while ((opt = getopt(argc, argv, "b:p:t:o:r")) != -1) {
switch (opt) {
case 'p':
path = optarg;
@@ -36,6 +37,9 @@ int main(int argc, char *argv[])
case 'o':
w.setBackgroundOpacity(atoi(optarg));
break;
case 'r':
recursive = true;
break;
default: /* '?' */
usage(argv[0]);
return 1;
@@ -49,7 +53,7 @@ int main(int argc, char *argv[])
}
w.show();
ImageSelector is(w, rotationSeconds * 1000, path);
ImageSelector is(w, rotationSeconds * 1000, path, recursive);
is.start();
return a.exec();
}