diff options
author | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2010-11-19 02:36:18 +0000 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@gmail.com> | 2010-11-19 02:36:18 +0000 |
commit | b098f1b66782c3a1459f6ad72295572778fabcc2 (patch) | |
tree | 7a68f8afeca3e7a6b70e565fce6942403b63ac28 /legacy/emotion | |
parent | ceec64fa7624c27ead31c29dbba2df1488636882 (diff) |
improve emotion_test, make better use of getopt, be less strict.
SVN revision: 54708
Diffstat (limited to 'legacy/emotion')
-rw-r--r-- | legacy/emotion/src/bin/emotion_test_main.c | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/legacy/emotion/src/bin/emotion_test_main.c b/legacy/emotion/src/bin/emotion_test_main.c index 7e799e6929..1d020d4f97 100644 --- a/legacy/emotion/src/bin/emotion_test_main.c +++ b/legacy/emotion/src/bin/emotion_test_main.c | |||
@@ -13,12 +13,11 @@ | |||
13 | 13 | ||
14 | static const Ecore_Getopt options = { | 14 | static const Ecore_Getopt options = { |
15 | "emotion_test", | 15 | "emotion_test", |
16 | "%prog [options]", | 16 | "%prog [options] <filename>", |
17 | "1.0.0", | 17 | "1.0.0", |
18 | "(C) 2010 Enlightenment", | 18 | "(C) 2010 Enlightenment", |
19 | "BSD\nThis is a 3 clause bsd bla bla", | 19 | "BSD\nThis is a 3 clause bsd bla bla", |
20 | "a simple test program for emotion using enlightenment foundation libraries.\n" | 20 | "a simple test program for emotion.", |
21 | "Here is the text of the licence", | ||
22 | 1, | 21 | 1, |
23 | { | 22 | { |
24 | ECORE_GETOPT_STORE_STR('e', "engine", "ecore-evas engine to use"), | 23 | ECORE_GETOPT_STORE_STR('e', "engine", "ecore-evas engine to use"), |
@@ -27,7 +26,6 @@ static const Ecore_Getopt options = { | |||
27 | ECORE_GETOPT_CALLBACK_ARGS('g', "geometry", "geometry to use in x:y:w:h form.", "X:Y:W:H", | 26 | ECORE_GETOPT_CALLBACK_ARGS('g', "geometry", "geometry to use in x:y:w:h form.", "X:Y:W:H", |
28 | ecore_getopt_callback_geometry_parse, NULL), | 27 | ecore_getopt_callback_geometry_parse, NULL), |
29 | ECORE_GETOPT_STORE_STR('b', "backend", "backend to use"), | 28 | ECORE_GETOPT_STORE_STR('b', "backend", "backend to use"), |
30 | ECORE_GETOPT_STORE_STR('f', "filename", "file to playback"), | ||
31 | ECORE_GETOPT_STORE_INT('v', "vis", "visualization type"), | 29 | ECORE_GETOPT_STORE_INT('v', "vis", "visualization type"), |
32 | ECORE_GETOPT_COUNT('v', "verbose", "be more verbose"), | 30 | ECORE_GETOPT_COUNT('v', "verbose", "be more verbose"), |
33 | ECORE_GETOPT_VERSION('V', "version"), | 31 | ECORE_GETOPT_VERSION('V', "version"), |
@@ -725,8 +723,7 @@ main(int argc, char **argv) | |||
725 | int args; | 723 | int args; |
726 | Eina_Rectangle geometry = {0, 0, startw, starth}; | 724 | Eina_Rectangle geometry = {0, 0, startw, starth}; |
727 | char *engine = NULL; | 725 | char *engine = NULL; |
728 | char *backend = "xine"; | 726 | char *backend = NULL; |
729 | char *filename = NULL; | ||
730 | int verbose = 0; | 727 | int verbose = 0; |
731 | int visual = EMOTION_VIS_NONE; | 728 | int visual = EMOTION_VIS_NONE; |
732 | unsigned char help = 0; | 729 | unsigned char help = 0; |
@@ -736,7 +733,6 @@ main(int argc, char **argv) | |||
736 | ECORE_GETOPT_VALUE_BOOL(engines_listed), | 733 | ECORE_GETOPT_VALUE_BOOL(engines_listed), |
737 | ECORE_GETOPT_VALUE_PTR_CAST(geometry), | 734 | ECORE_GETOPT_VALUE_PTR_CAST(geometry), |
738 | ECORE_GETOPT_VALUE_STR(backend), | 735 | ECORE_GETOPT_VALUE_STR(backend), |
739 | ECORE_GETOPT_VALUE_STR(filename), | ||
740 | ECORE_GETOPT_VALUE_INT(visual), | 736 | ECORE_GETOPT_VALUE_INT(visual), |
741 | ECORE_GETOPT_VALUE_INT(verbose), | 737 | ECORE_GETOPT_VALUE_INT(verbose), |
742 | ECORE_GETOPT_VALUE_NONE, | 738 | ECORE_GETOPT_VALUE_NONE, |
@@ -758,44 +754,28 @@ main(int argc, char **argv) | |||
758 | 754 | ||
759 | ecore_app_args_set(argc, (const char **)argv); | 755 | ecore_app_args_set(argc, (const char **)argv); |
760 | args = ecore_getopt_parse(&options, values, argc, argv); | 756 | args = ecore_getopt_parse(&options, values, argc, argv); |
761 | if (args < 0) | 757 | if (args < 0) goto shutdown_edje; |
762 | goto shutdown_edje; | 758 | else if (help) goto shutdown_edje; |
763 | 759 | else if (engines_listed) goto shutdown_edje; | |
764 | if (help) | 760 | else if (args == argc) |
765 | goto shutdown_edje; | ||
766 | if (engines_listed) | ||
767 | goto shutdown_edje; | ||
768 | if (!engine) | ||
769 | { | 761 | { |
770 | printf ("select engine\n"); | 762 | printf("must provide at least one file to play!\n"); |
771 | goto shutdown_edje; | 763 | goto shutdown_edje; |
772 | } | ||
773 | if (!filename) | ||
774 | { | ||
775 | printf ("select engine\n"); | ||
776 | goto shutdown_edje; | ||
777 | } | ||
778 | if (!backend) | ||
779 | { | ||
780 | backend = "xine"; | ||
781 | printf ("selected backend: %s\n", backend); | ||
782 | goto shutdown_edje; | ||
783 | } | 764 | } |
765 | |||
784 | if ((geometry.w == 0) || (geometry.h == 0)) | 766 | if ((geometry.w == 0) || (geometry.h == 0)) |
785 | { | 767 | { |
786 | printf("size nulle\n"); | 768 | if (geometry.w == 0) geometry.w = 320; |
787 | goto shutdown_edje; | 769 | if (geometry.h == 0) geometry.h = 240; |
788 | } | 770 | } |
789 | 771 | ||
790 | printf ("backend: %s\n", backend); | 772 | printf("evas engine: %s\n", engine ? engine : "<auto>"); |
791 | printf ("filename: %s\n", filename); | 773 | printf("emotion backend: %s\n", backend ? backend : "<auto>"); |
792 | printf ("vis: %d\n", vis); | 774 | printf("vis: %d\n", vis); |
793 | printf ("engine: %s\n", engine); | 775 | printf("geometry: %d %d %dx%d\n", geometry.x, geometry.y, geometry.w, geometry.h); |
794 | printf ("geometry: %d %d %dx%d\n", geometry.x, geometry.y, geometry.w, geometry.h); | ||
795 | 776 | ||
796 | ecore_evas = ecore_evas_new(engine, | 777 | ecore_evas = ecore_evas_new |
797 | geometry.x, geometry.y, geometry.w, geometry.h, | 778 | (engine, geometry.x, geometry.y, geometry.w, geometry.h, NULL); |
798 | NULL); | ||
799 | if (!ecore_evas) | 779 | if (!ecore_evas) |
800 | goto shutdown_edje; | 780 | goto shutdown_edje; |
801 | 781 | ||
@@ -811,7 +791,8 @@ main(int argc, char **argv) | |||
811 | 791 | ||
812 | bg_setup(); | 792 | bg_setup(); |
813 | 793 | ||
814 | init_video_object(backend, filename); | 794 | for (; args < argc; args++) |
795 | init_video_object(backend, argv[args]); | ||
815 | 796 | ||
816 | ecore_idle_enterer_add(enter_idle, NULL); | 797 | ecore_idle_enterer_add(enter_idle, NULL); |
817 | ecore_animator_add(check_positions, NULL); | 798 | ecore_animator_add(check_positions, NULL); |