
* demo/demat/demat.pro, * demo/demat/demat.qrc, * demo/demat/src/doc_type.hh, * demo/demat/src/main.cc, * demo/demat/src/main_window.cc, * demo/demat/src/main_window.hh, * demo/demat/src/mln_widgets.cc, * demo/demat/src/preprocessing_task.hh, * demo/demat/src/process_args.hh, * demo/demat/src/runner.cc, * demo/demat/src/runner.hh, * demo/demat/ui/main_window.ui, * demo/review/Makefile.am, * demo/review/icons/document-open.png, * demo/review/icons/edit-find.png, * demo/review/icons/format-indent-more.png, * demo/review/icons/go-next.png, * demo/review/icons/image-x-generic.png, * demo/review/icons/list-add.png, * demo/review/icons/ocr.png, * demo/review/icons/text-x-generic.png, * demo/review/icons/view-refresh.png, * demo/review/icons/x-office-spreadsheet.png, * demo/review/mainwindow.ui, * demo/review/review.qrc, * demo/review/src/main.cc, * demo/review/src/mainwindow.cc, * demo/review/src/mainwindow.hh, * demo/shared/icons/Symbols-Delete-icon.png, * demo/shared/icons/accept-icon.png, * demo/shared/icons/close.gif, * demo/shared/icons/crop-icon.png, * demo/shared/icons/image-add-icon.png, * demo/shared/icons/image-edit-icon.png, * demo/shared/icons/image-multi-icon.png, * demo/shared/icons/image-next-icon.png, * demo/shared/icons/image-remove-icon.png, * demo/shared/icons/next-icon.png, * demo/shared/icons/olena_smaller.jpg, * demo/shared/icons/page-down-icon.png, * demo/shared/icons/page-search-icon.png, * demo/shared/icons/rotate_ccw.png, * demo/shared/icons/rotate_cw.png, * demo/shared/icons/search-add-icon.png, * demo/shared/icons/search-remove-icon.png, * demo/shared/shared.qrc, * demo/shared/src/bak/crop_item.cc, * demo/shared/src/bak/crop_item.hh, * demo/shared/src/bak/image_viewer.cc, * demo/shared/src/bak/image_viewer.hh, * demo/shared/src/bak/types.hh, * demo/shared/src/browse_widget.cc, * demo/shared/src/browse_widget.hh, * demo/shared/src/crop_item.cc, * demo/shared/src/crop_item.hh, * demo/shared/src/image_viewer.cc, * demo/shared/src/image_viewer.hh, * demo/shared/src/image_viewer.hxx, * demo/shared/src/internal.bak/interactive_scene.cc, * demo/shared/src/internal.bak/interactive_scene.hh, * demo/shared/src/internal.bak/selection_rectangle.cc, * demo/shared/src/internal.bak/selection_rectangle.hh, * demo/shared/src/internal/interactive_scene.cc, * demo/shared/src/internal/interactive_scene.hh, * demo/shared/src/internal/selection_rectangle.cc, * demo/shared/src/internal/selection_rectangle.hh, * demo/shared/src/to_mln_image.hh, * demo/shared/src/types.hh, * demo/shared/ui/browse_widget.ui, * demo/shared/ui/crop_widget.ui, * demo/shared/ui/image_viewer.ui, * demo/shared/ui/interactive_scene.cc, * demo/shared/ui/interactive_scene.hh, * demo/shared/ui/rotate_widget.ui, * demo/tip/gui.pro, * demo/tip/gui.qrc, * demo/tip/icons/next.png, * demo/tip/icons/ok.png, * demo/tip/icons/photos.png, * demo/tip/icons/prev.png, * demo/tip/icons/remove.png, * demo/tip/src/custom_delegate.cc, * demo/tip/src/custom_delegate.hh, * demo/tip/src/launch_dialog.cc, * demo/tip/src/launch_dialog.hh, * demo/tip/src/main.cc, * demo/tip/src/main_window.cc, * demo/tip/src/main_window.hh, * demo/tip/ui/launch_dialog.ui, * demo/tip/ui/main_window.ui, * demo/wizard/images/dematerialization.png, * demo/wizard/src/crop_page.cc, * demo/wizard/src/crop_page.hh, * demo/wizard/src/crop_widget.cc, * demo/wizard/src/crop_widget.hh, * demo/wizard/src/doc_type.hh, * demo/wizard/src/doc_type_page.cc, * demo/wizard/src/doc_type_page.hh, * demo/wizard/src/doc_type_widget.cc, * demo/wizard/src/doc_type_widget.hh, * demo/wizard/src/load_page.cc, * demo/wizard/src/load_page.hh, * demo/wizard/src/load_widget.cc, * demo/wizard/src/load_widget.hh, * demo/wizard/src/main.cc, * demo/wizard/src/main_window.cc, * demo/wizard/src/main_window.hh, * demo/wizard/src/mln_widgets.cc, * demo/wizard/src/preprocessing_page.cc, * demo/wizard/src/preprocessing_page.hh, * demo/wizard/src/preprocessing_task.hh, * demo/wizard/src/preprocessing_widget.cc, * demo/wizard/src/preprocessing_widget.hh, * demo/wizard/src/process_page.cc, * demo/wizard/src/process_page.hh, * demo/wizard/src/process_widget.cc, * demo/wizard/src/process_widget.hh, * demo/wizard/src/result_page.cc, * demo/wizard/src/result_page.hh, * demo/wizard/src/result_widget.cc, * demo/wizard/src/result_widget.hh, * demo/wizard/src/rotate_page.cc, * demo/wizard/src/rotate_page.hh, * demo/wizard/src/rotate_widget.cc, * demo/wizard/src/rotate_widget.hh, * demo/wizard/src/runner.cc, * demo/wizard/src/runner.hh, * demo/wizard/src/test.cc, * demo/wizard/ui/doc_type_widget.ui, * demo/wizard/ui/load_widget.ui, * demo/wizard/ui/main_window.ui, * demo/wizard/ui/preprocessing_widget.ui, * demo/wizard/wizard.pro, * demo/wizard/wizard.qrc: Remove. --- scribo/ChangeLog | 139 +++++ scribo/demo/Makefile.am | 4 - scribo/demo/demat/demat.pro | 42 -- scribo/demo/demat/demat.qrc | 4 - scribo/demo/demat/src/doc_type.hh | 51 -- scribo/demo/demat/src/main.cc | 31 - scribo/demo/demat/src/main_window.cc | 266 -------- scribo/demo/demat/src/main_window.hh | 96 --- scribo/demo/demat/src/mln_widgets.cc | 11 - scribo/demo/demat/src/preprocessing_task.hh | 62 -- scribo/demo/demat/src/process_args.hh | 47 -- scribo/demo/demat/src/runner.cc | 327 ---------- scribo/demo/demat/src/runner.hh | 94 --- scribo/demo/demat/ui/main_window.ui | 381 ------------ scribo/demo/review/Makefile.am | 56 -- scribo/demo/review/icons/document-open.png | Bin 1550 -> 0 bytes scribo/demo/review/icons/edit-find.png | Bin 1636 -> 0 bytes scribo/demo/review/icons/format-indent-more.png | Bin 766 -> 0 bytes scribo/demo/review/icons/go-next.png | Bin 1219 -> 0 bytes scribo/demo/review/icons/image-x-generic.png | Bin 1163 -> 0 bytes scribo/demo/review/icons/list-add.png | Bin 601 -> 0 bytes scribo/demo/review/icons/ocr.png | Bin 14929 -> 0 bytes scribo/demo/review/icons/text-x-generic.png | Bin 744 -> 0 bytes scribo/demo/review/icons/view-refresh.png | Bin 2024 -> 0 bytes scribo/demo/review/icons/x-office-spreadsheet.png | Bin 1518 -> 0 bytes scribo/demo/review/mainwindow.ui | 340 ---------- scribo/demo/review/review.qrc | 13 - scribo/demo/review/src/main.cc | 49 -- scribo/demo/review/src/mainwindow.cc | 569 ----------------- scribo/demo/review/src/mainwindow.hh | 139 ----- scribo/demo/shared/icons/Symbols-Delete-icon.png | Bin 3704 -> 0 bytes scribo/demo/shared/icons/accept-icon.png | Bin 4858 -> 0 bytes scribo/demo/shared/icons/close.gif | Bin 340 -> 0 bytes scribo/demo/shared/icons/crop-icon.png | Bin 228 -> 0 bytes scribo/demo/shared/icons/image-add-icon.png | Bin 2917 -> 0 bytes scribo/demo/shared/icons/image-edit-icon.png | Bin 2305 -> 0 bytes scribo/demo/shared/icons/image-multi-icon.png | Bin 2033 -> 0 bytes scribo/demo/shared/icons/image-next-icon.png | Bin 3008 -> 0 bytes scribo/demo/shared/icons/image-remove-icon.png | Bin 3127 -> 0 bytes scribo/demo/shared/icons/next-icon.png | Bin 4611 -> 0 bytes scribo/demo/shared/icons/olena_smaller.jpg | Bin 8028 -> 0 bytes scribo/demo/shared/icons/page-down-icon.png | Bin 3450 -> 0 bytes scribo/demo/shared/icons/page-search-icon.png | Bin 3101 -> 0 bytes scribo/demo/shared/icons/rotate_ccw.png | Bin 4200 -> 0 bytes scribo/demo/shared/icons/rotate_cw.png | Bin 4161 -> 0 bytes scribo/demo/shared/icons/search-add-icon.png | Bin 4274 -> 0 bytes scribo/demo/shared/icons/search-remove-icon.png | Bin 4196 -> 0 bytes scribo/demo/shared/shared.qrc | 21 - scribo/demo/shared/src/bak/crop_item.cc | 332 ---------- scribo/demo/shared/src/bak/crop_item.hh | 100 --- scribo/demo/shared/src/bak/image_viewer.cc | 242 ------- scribo/demo/shared/src/bak/image_viewer.hh | 116 ---- scribo/demo/shared/src/bak/types.hh | 50 -- scribo/demo/shared/src/browse_widget.cc | 72 --- scribo/demo/shared/src/browse_widget.hh | 78 --- scribo/demo/shared/src/crop_item.cc | 396 ------------ scribo/demo/shared/src/crop_item.hh | 119 ---- scribo/demo/shared/src/image_viewer.cc | 410 ------------ scribo/demo/shared/src/image_viewer.hh | 148 ----- scribo/demo/shared/src/image_viewer.hxx | 31 - .../shared/src/internal.bak/interactive_scene.cc | 286 --------- .../shared/src/internal.bak/interactive_scene.hh | 108 ---- .../shared/src/internal.bak/selection_rectangle.cc | 241 ------- .../shared/src/internal.bak/selection_rectangle.hh | 91 --- .../demo/shared/src/internal/interactive_scene.cc | 94 --- .../demo/shared/src/internal/interactive_scene.hh | 85 --- .../shared/src/internal/selection_rectangle.cc | 241 ------- .../shared/src/internal/selection_rectangle.hh | 91 --- scribo/demo/shared/src/to_mln_image.hh | 77 --- scribo/demo/shared/src/types.hh | 50 -- scribo/demo/shared/ui/browse_widget.ui | 106 ---- scribo/demo/shared/ui/crop_widget.ui | 34 - scribo/demo/shared/ui/image_viewer.ui | 296 --------- scribo/demo/shared/ui/interactive_scene.cc | 143 ----- scribo/demo/shared/ui/interactive_scene.hh | 87 --- scribo/demo/shared/ui/rotate_widget.ui | 34 - scribo/demo/tip/gui.pro | 19 - scribo/demo/tip/gui.qrc | 9 - scribo/demo/tip/icons/next.png | Bin 3337 -> 0 bytes scribo/demo/tip/icons/ok.png | Bin 3953 -> 0 bytes scribo/demo/tip/icons/photos.png | Bin 3750 -> 0 bytes scribo/demo/tip/icons/prev.png | Bin 3334 -> 0 bytes scribo/demo/tip/icons/remove.png | Bin 3704 -> 0 bytes scribo/demo/tip/src/custom_delegate.cc | 105 ---- scribo/demo/tip/src/custom_delegate.hh | 81 --- scribo/demo/tip/src/launch_dialog.cc | 94 --- scribo/demo/tip/src/launch_dialog.hh | 63 -- scribo/demo/tip/src/main.cc | 46 -- scribo/demo/tip/src/main_window.cc | 526 ---------------- scribo/demo/tip/src/main_window.hh | 119 ---- scribo/demo/tip/ui/launch_dialog.ui | 117 ---- scribo/demo/tip/ui/main_window.ui | 656 -------------------- scribo/demo/wizard/images/dematerialization.png | Bin 76309 -> 0 bytes scribo/demo/wizard/src/crop_page.cc | 48 -- scribo/demo/wizard/src/crop_page.hh | 60 -- scribo/demo/wizard/src/crop_widget.cc | 37 -- scribo/demo/wizard/src/crop_widget.hh | 62 -- scribo/demo/wizard/src/doc_type.hh | 51 -- scribo/demo/wizard/src/doc_type_page.cc | 48 -- scribo/demo/wizard/src/doc_type_page.hh | 61 -- scribo/demo/wizard/src/doc_type_widget.cc | 38 -- scribo/demo/wizard/src/doc_type_widget.hh | 64 -- scribo/demo/wizard/src/load_page.cc | 71 --- scribo/demo/wizard/src/load_page.hh | 67 -- scribo/demo/wizard/src/load_widget.cc | 56 -- scribo/demo/wizard/src/load_widget.hh | 64 -- scribo/demo/wizard/src/main.cc | 28 - scribo/demo/wizard/src/main_window.cc | 144 ----- scribo/demo/wizard/src/main_window.hh | 72 --- scribo/demo/wizard/src/mln_widgets.cc | 7 - scribo/demo/wizard/src/preprocessing_page.cc | 61 -- scribo/demo/wizard/src/preprocessing_page.hh | 66 -- scribo/demo/wizard/src/preprocessing_task.hh | 61 -- scribo/demo/wizard/src/preprocessing_widget.cc | 93 --- scribo/demo/wizard/src/preprocessing_widget.hh | 65 -- scribo/demo/wizard/src/process_page.cc | 68 -- scribo/demo/wizard/src/process_page.hh | 64 -- scribo/demo/wizard/src/process_widget.cc | 80 --- scribo/demo/wizard/src/process_widget.hh | 71 --- scribo/demo/wizard/src/result_page.cc | 43 -- scribo/demo/wizard/src/result_page.hh | 60 -- scribo/demo/wizard/src/result_widget.cc | 43 -- scribo/demo/wizard/src/result_widget.hh | 58 -- scribo/demo/wizard/src/rotate_page.cc | 45 -- scribo/demo/wizard/src/rotate_page.hh | 60 -- scribo/demo/wizard/src/rotate_widget.cc | 38 -- scribo/demo/wizard/src/rotate_widget.hh | 62 -- scribo/demo/wizard/src/runner.cc | 296 --------- scribo/demo/wizard/src/runner.hh | 84 --- scribo/demo/wizard/src/test.cc | 16 - scribo/demo/wizard/ui/doc_type_widget.ui | 115 ---- scribo/demo/wizard/ui/load_widget.ui | 110 ---- scribo/demo/wizard/ui/main_window.ui | 216 ------- scribo/demo/wizard/ui/preprocessing_widget.ui | 223 ------- scribo/demo/wizard/wizard.pro | 71 --- scribo/demo/wizard/wizard.qrc | 5 - 136 files changed, 139 insertions(+), 11748 deletions(-) delete mode 100644 scribo/demo/demat/demat.pro delete mode 100644 scribo/demo/demat/demat.qrc delete mode 100644 scribo/demo/demat/src/doc_type.hh delete mode 100644 scribo/demo/demat/src/main.cc delete mode 100644 scribo/demo/demat/src/main_window.cc delete mode 100644 scribo/demo/demat/src/main_window.hh delete mode 100644 scribo/demo/demat/src/mln_widgets.cc delete mode 100644 scribo/demo/demat/src/preprocessing_task.hh delete mode 100644 scribo/demo/demat/src/process_args.hh delete mode 100644 scribo/demo/demat/src/runner.cc delete mode 100644 scribo/demo/demat/src/runner.hh delete mode 100644 scribo/demo/demat/ui/main_window.ui delete mode 100644 scribo/demo/review/Makefile.am delete mode 100644 scribo/demo/review/icons/document-open.png delete mode 100644 scribo/demo/review/icons/edit-find.png delete mode 100644 scribo/demo/review/icons/format-indent-more.png delete mode 100644 scribo/demo/review/icons/go-next.png delete mode 100644 scribo/demo/review/icons/image-x-generic.png delete mode 100644 scribo/demo/review/icons/list-add.png delete mode 100644 scribo/demo/review/icons/ocr.png delete mode 100644 scribo/demo/review/icons/text-x-generic.png delete mode 100644 scribo/demo/review/icons/view-refresh.png delete mode 100644 scribo/demo/review/icons/x-office-spreadsheet.png delete mode 100644 scribo/demo/review/mainwindow.ui delete mode 100644 scribo/demo/review/review.qrc delete mode 100644 scribo/demo/review/src/main.cc delete mode 100644 scribo/demo/review/src/mainwindow.cc delete mode 100644 scribo/demo/review/src/mainwindow.hh delete mode 100644 scribo/demo/shared/icons/Symbols-Delete-icon.png delete mode 100644 scribo/demo/shared/icons/accept-icon.png delete mode 100644 scribo/demo/shared/icons/close.gif delete mode 100644 scribo/demo/shared/icons/crop-icon.png delete mode 100644 scribo/demo/shared/icons/image-add-icon.png delete mode 100644 scribo/demo/shared/icons/image-edit-icon.png delete mode 100644 scribo/demo/shared/icons/image-multi-icon.png delete mode 100644 scribo/demo/shared/icons/image-next-icon.png delete mode 100644 scribo/demo/shared/icons/image-remove-icon.png delete mode 100644 scribo/demo/shared/icons/next-icon.png delete mode 100644 scribo/demo/shared/icons/olena_smaller.jpg delete mode 100644 scribo/demo/shared/icons/page-down-icon.png delete mode 100644 scribo/demo/shared/icons/page-search-icon.png delete mode 100644 scribo/demo/shared/icons/rotate_ccw.png delete mode 100644 scribo/demo/shared/icons/rotate_cw.png delete mode 100644 scribo/demo/shared/icons/search-add-icon.png delete mode 100644 scribo/demo/shared/icons/search-remove-icon.png delete mode 100644 scribo/demo/shared/shared.qrc delete mode 100644 scribo/demo/shared/src/bak/crop_item.cc delete mode 100644 scribo/demo/shared/src/bak/crop_item.hh delete mode 100644 scribo/demo/shared/src/bak/image_viewer.cc delete mode 100644 scribo/demo/shared/src/bak/image_viewer.hh delete mode 100644 scribo/demo/shared/src/bak/types.hh delete mode 100644 scribo/demo/shared/src/browse_widget.cc delete mode 100644 scribo/demo/shared/src/browse_widget.hh delete mode 100644 scribo/demo/shared/src/crop_item.cc delete mode 100644 scribo/demo/shared/src/crop_item.hh delete mode 100644 scribo/demo/shared/src/image_viewer.cc delete mode 100644 scribo/demo/shared/src/image_viewer.hh delete mode 100644 scribo/demo/shared/src/image_viewer.hxx delete mode 100644 scribo/demo/shared/src/internal.bak/interactive_scene.cc delete mode 100644 scribo/demo/shared/src/internal.bak/interactive_scene.hh delete mode 100644 scribo/demo/shared/src/internal.bak/selection_rectangle.cc delete mode 100644 scribo/demo/shared/src/internal.bak/selection_rectangle.hh delete mode 100644 scribo/demo/shared/src/internal/interactive_scene.cc delete mode 100644 scribo/demo/shared/src/internal/interactive_scene.hh delete mode 100644 scribo/demo/shared/src/internal/selection_rectangle.cc delete mode 100644 scribo/demo/shared/src/internal/selection_rectangle.hh delete mode 100644 scribo/demo/shared/src/to_mln_image.hh delete mode 100644 scribo/demo/shared/src/types.hh delete mode 100644 scribo/demo/shared/ui/browse_widget.ui delete mode 100644 scribo/demo/shared/ui/crop_widget.ui delete mode 100644 scribo/demo/shared/ui/image_viewer.ui delete mode 100644 scribo/demo/shared/ui/interactive_scene.cc delete mode 100644 scribo/demo/shared/ui/interactive_scene.hh delete mode 100644 scribo/demo/shared/ui/rotate_widget.ui delete mode 100644 scribo/demo/tip/gui.pro delete mode 100644 scribo/demo/tip/gui.qrc delete mode 100644 scribo/demo/tip/icons/next.png delete mode 100644 scribo/demo/tip/icons/ok.png delete mode 100644 scribo/demo/tip/icons/photos.png delete mode 100644 scribo/demo/tip/icons/prev.png delete mode 100644 scribo/demo/tip/icons/remove.png delete mode 100644 scribo/demo/tip/src/custom_delegate.cc delete mode 100644 scribo/demo/tip/src/custom_delegate.hh delete mode 100644 scribo/demo/tip/src/launch_dialog.cc delete mode 100644 scribo/demo/tip/src/launch_dialog.hh delete mode 100644 scribo/demo/tip/src/main.cc delete mode 100644 scribo/demo/tip/src/main_window.cc delete mode 100644 scribo/demo/tip/src/main_window.hh delete mode 100644 scribo/demo/tip/ui/launch_dialog.ui delete mode 100644 scribo/demo/tip/ui/main_window.ui delete mode 100644 scribo/demo/wizard/images/dematerialization.png delete mode 100644 scribo/demo/wizard/src/crop_page.cc delete mode 100644 scribo/demo/wizard/src/crop_page.hh delete mode 100644 scribo/demo/wizard/src/crop_widget.cc delete mode 100644 scribo/demo/wizard/src/crop_widget.hh delete mode 100644 scribo/demo/wizard/src/doc_type.hh delete mode 100644 scribo/demo/wizard/src/doc_type_page.cc delete mode 100644 scribo/demo/wizard/src/doc_type_page.hh delete mode 100644 scribo/demo/wizard/src/doc_type_widget.cc delete mode 100644 scribo/demo/wizard/src/doc_type_widget.hh delete mode 100644 scribo/demo/wizard/src/load_page.cc delete mode 100644 scribo/demo/wizard/src/load_page.hh delete mode 100644 scribo/demo/wizard/src/load_widget.cc delete mode 100644 scribo/demo/wizard/src/load_widget.hh delete mode 100644 scribo/demo/wizard/src/main.cc delete mode 100644 scribo/demo/wizard/src/main_window.cc delete mode 100644 scribo/demo/wizard/src/main_window.hh delete mode 100644 scribo/demo/wizard/src/mln_widgets.cc delete mode 100644 scribo/demo/wizard/src/preprocessing_page.cc delete mode 100644 scribo/demo/wizard/src/preprocessing_page.hh delete mode 100644 scribo/demo/wizard/src/preprocessing_task.hh delete mode 100644 scribo/demo/wizard/src/preprocessing_widget.cc delete mode 100644 scribo/demo/wizard/src/preprocessing_widget.hh delete mode 100644 scribo/demo/wizard/src/process_page.cc delete mode 100644 scribo/demo/wizard/src/process_page.hh delete mode 100644 scribo/demo/wizard/src/process_widget.cc delete mode 100644 scribo/demo/wizard/src/process_widget.hh delete mode 100644 scribo/demo/wizard/src/result_page.cc delete mode 100644 scribo/demo/wizard/src/result_page.hh delete mode 100644 scribo/demo/wizard/src/result_widget.cc delete mode 100644 scribo/demo/wizard/src/result_widget.hh delete mode 100644 scribo/demo/wizard/src/rotate_page.cc delete mode 100644 scribo/demo/wizard/src/rotate_page.hh delete mode 100644 scribo/demo/wizard/src/rotate_widget.cc delete mode 100644 scribo/demo/wizard/src/rotate_widget.hh delete mode 100644 scribo/demo/wizard/src/runner.cc delete mode 100644 scribo/demo/wizard/src/runner.hh delete mode 100644 scribo/demo/wizard/src/test.cc delete mode 100644 scribo/demo/wizard/ui/doc_type_widget.ui delete mode 100644 scribo/demo/wizard/ui/load_widget.ui delete mode 100644 scribo/demo/wizard/ui/main_window.ui delete mode 100644 scribo/demo/wizard/ui/preprocessing_widget.ui delete mode 100644 scribo/demo/wizard/wizard.pro delete mode 100644 scribo/demo/wizard/wizard.qrc diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 18a73c0..66341a3 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,144 @@ 2013-03-07 Guillaume Lazzara <z@lrde.epita.fr> + Remove deprecated programs. + + * demo/demat/demat.pro, + * demo/demat/demat.qrc, + * demo/demat/src/doc_type.hh, + * demo/demat/src/main.cc, + * demo/demat/src/main_window.cc, + * demo/demat/src/main_window.hh, + * demo/demat/src/mln_widgets.cc, + * demo/demat/src/preprocessing_task.hh, + * demo/demat/src/process_args.hh, + * demo/demat/src/runner.cc, + * demo/demat/src/runner.hh, + * demo/demat/ui/main_window.ui, + * demo/review/Makefile.am, + * demo/review/icons/document-open.png, + * demo/review/icons/edit-find.png, + * demo/review/icons/format-indent-more.png, + * demo/review/icons/go-next.png, + * demo/review/icons/image-x-generic.png, + * demo/review/icons/list-add.png, + * demo/review/icons/ocr.png, + * demo/review/icons/text-x-generic.png, + * demo/review/icons/view-refresh.png, + * demo/review/icons/x-office-spreadsheet.png, + * demo/review/mainwindow.ui, + * demo/review/review.qrc, + * demo/review/src/main.cc, + * demo/review/src/mainwindow.cc, + * demo/review/src/mainwindow.hh, + * demo/shared/icons/Symbols-Delete-icon.png, + * demo/shared/icons/accept-icon.png, + * demo/shared/icons/close.gif, + * demo/shared/icons/crop-icon.png, + * demo/shared/icons/image-add-icon.png, + * demo/shared/icons/image-edit-icon.png, + * demo/shared/icons/image-multi-icon.png, + * demo/shared/icons/image-next-icon.png, + * demo/shared/icons/image-remove-icon.png, + * demo/shared/icons/next-icon.png, + * demo/shared/icons/olena_smaller.jpg, + * demo/shared/icons/page-down-icon.png, + * demo/shared/icons/page-search-icon.png, + * demo/shared/icons/rotate_ccw.png, + * demo/shared/icons/rotate_cw.png, + * demo/shared/icons/search-add-icon.png, + * demo/shared/icons/search-remove-icon.png, + * demo/shared/shared.qrc, + * demo/shared/src/bak/crop_item.cc, + * demo/shared/src/bak/crop_item.hh, + * demo/shared/src/bak/image_viewer.cc, + * demo/shared/src/bak/image_viewer.hh, + * demo/shared/src/bak/types.hh, + * demo/shared/src/browse_widget.cc, + * demo/shared/src/browse_widget.hh, + * demo/shared/src/crop_item.cc, + * demo/shared/src/crop_item.hh, + * demo/shared/src/image_viewer.cc, + * demo/shared/src/image_viewer.hh, + * demo/shared/src/image_viewer.hxx, + * demo/shared/src/internal.bak/interactive_scene.cc, + * demo/shared/src/internal.bak/interactive_scene.hh, + * demo/shared/src/internal.bak/selection_rectangle.cc, + * demo/shared/src/internal.bak/selection_rectangle.hh, + * demo/shared/src/internal/interactive_scene.cc, + * demo/shared/src/internal/interactive_scene.hh, + * demo/shared/src/internal/selection_rectangle.cc, + * demo/shared/src/internal/selection_rectangle.hh, + * demo/shared/src/to_mln_image.hh, + * demo/shared/src/types.hh, + * demo/shared/ui/browse_widget.ui, + * demo/shared/ui/crop_widget.ui, + * demo/shared/ui/image_viewer.ui, + * demo/shared/ui/interactive_scene.cc, + * demo/shared/ui/interactive_scene.hh, + * demo/shared/ui/rotate_widget.ui, + * demo/tip/gui.pro, + * demo/tip/gui.qrc, + * demo/tip/icons/next.png, + * demo/tip/icons/ok.png, + * demo/tip/icons/photos.png, + * demo/tip/icons/prev.png, + * demo/tip/icons/remove.png, + * demo/tip/src/custom_delegate.cc, + * demo/tip/src/custom_delegate.hh, + * demo/tip/src/launch_dialog.cc, + * demo/tip/src/launch_dialog.hh, + * demo/tip/src/main.cc, + * demo/tip/src/main_window.cc, + * demo/tip/src/main_window.hh, + * demo/tip/ui/launch_dialog.ui, + * demo/tip/ui/main_window.ui, + * demo/wizard/images/dematerialization.png, + * demo/wizard/src/crop_page.cc, + * demo/wizard/src/crop_page.hh, + * demo/wizard/src/crop_widget.cc, + * demo/wizard/src/crop_widget.hh, + * demo/wizard/src/doc_type.hh, + * demo/wizard/src/doc_type_page.cc, + * demo/wizard/src/doc_type_page.hh, + * demo/wizard/src/doc_type_widget.cc, + * demo/wizard/src/doc_type_widget.hh, + * demo/wizard/src/load_page.cc, + * demo/wizard/src/load_page.hh, + * demo/wizard/src/load_widget.cc, + * demo/wizard/src/load_widget.hh, + * demo/wizard/src/main.cc, + * demo/wizard/src/main_window.cc, + * demo/wizard/src/main_window.hh, + * demo/wizard/src/mln_widgets.cc, + * demo/wizard/src/preprocessing_page.cc, + * demo/wizard/src/preprocessing_page.hh, + * demo/wizard/src/preprocessing_task.hh, + * demo/wizard/src/preprocessing_widget.cc, + * demo/wizard/src/preprocessing_widget.hh, + * demo/wizard/src/process_page.cc, + * demo/wizard/src/process_page.hh, + * demo/wizard/src/process_widget.cc, + * demo/wizard/src/process_widget.hh, + * demo/wizard/src/result_page.cc, + * demo/wizard/src/result_page.hh, + * demo/wizard/src/result_widget.cc, + * demo/wizard/src/result_widget.hh, + * demo/wizard/src/rotate_page.cc, + * demo/wizard/src/rotate_page.hh, + * demo/wizard/src/rotate_widget.cc, + * demo/wizard/src/rotate_widget.hh, + * demo/wizard/src/runner.cc, + * demo/wizard/src/runner.hh, + * demo/wizard/src/test.cc, + * demo/wizard/ui/doc_type_widget.ui, + * demo/wizard/ui/load_widget.ui, + * demo/wizard/ui/main_window.ui, + * demo/wizard/ui/preprocessing_widget.ui, + * demo/wizard/wizard.pro, + * demo/wizard/wizard.qrc: Remove. + +2013-03-07 Guillaume Lazzara <z@lrde.epita.fr> + Fix compilation related problems in viewer. * demo/viewer/image_view.cc: Fix a warning; diff --git a/scribo/demo/Makefile.am b/scribo/demo/Makefile.am index b5825c9..104f93e 100644 --- a/scribo/demo/Makefile.am +++ b/scribo/demo/Makefile.am @@ -19,9 +19,6 @@ SUBDIRS = if HAVE_QT -SUBDIRS += review - - if HAVE_MAGICKXX @@ -35,7 +32,6 @@ endif HAVE_MAGICKXX - # FIXME: Add more dependencies (fop, xsltproc) if HAVE_MAGICKXX diff --git a/scribo/demo/demat/demat.pro b/scribo/demo/demat/demat.pro deleted file mode 100644 index ef07aef..0000000 --- a/scribo/demo/demat/demat.pro +++ /dev/null @@ -1,42 +0,0 @@ -# -*- c++ -*- -###################################################################### -# Automatically generated by qmake (2.01a) Tue Feb 9 12:02:10 2010 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . src -INCLUDEPATH += . ../ ../shared $(OLN)/milena $(OLN)/scribo - -QMAKE_CXXFLAGS += -g -O0 - -LIBS +=/usr/lib/libMagick++.so - -# `Magick++-config --ldflags --libs` - -DEFINES += NDEBUG MLN_WO_GLOBAL_VARS - -# Input - HEADERS += \ - ../shared/src/crop_item.hh \ - ../shared/src/image_viewer.hh \ - ../shared/src/internal/interactive_scene.hh \ - ../shared/src/browse_widget.hh \ - src/main_window.hh \ - src/runner.hh - -SOURCES += \ - ../shared/src/crop_item.cc \ - ../shared/src/image_viewer.cc \ - ../shared/src/internal/interactive_scene.cc \ - ../shared/src/browse_widget.cc \ - src/main_window.cc \ - src/main.cc \ - src/runner.cc - -FORMS += \ - ../shared/ui/image_viewer.ui \ - ui/main_window.ui - - -RESOURCES += ../shared/shared.qrc demat.qrc diff --git a/scribo/demo/demat/demat.qrc b/scribo/demo/demat/demat.qrc deleted file mode 100644 index 68031c7..0000000 --- a/scribo/demo/demat/demat.qrc +++ /dev/null @@ -1,4 +0,0 @@ -<RCC> - <qresource prefix="images" > - </qresource> -</RCC> diff --git a/scribo/demo/demat/src/doc_type.hh b/scribo/demo/demat/src/doc_type.hh deleted file mode 100644 index 320cd19..0000000 --- a/scribo/demo/demat/src/doc_type.hh +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_HH -# define SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_HH - - -namespace scribo -{ - - namespace demo - { - - enum Doc_Type - { - Text_Doc, - Picture, - Mixed_Doc, - - Invalid_Doc - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // !SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_HH diff --git a/scribo/demo/demat/src/main.cc b/scribo/demo/demat/src/main.cc deleted file mode 100644 index 231cd9d..0000000 --- a/scribo/demo/demat/src/main.cc +++ /dev/null @@ -1,31 +0,0 @@ -#undef MLN_WO_GLOBAL_VARS -#include <mln/core/image/image2d.hh> -#include <mln/trace/all.hh> - -#include <QtGui> -#include <src/main_window.hh> -#include <src/preprocessing_task.hh> - -namespace scribo { namespace demo {extern QString basedir_; } } - -int main(int argc, char* argv[]) -{ - QApplication app(argc, argv); - - qRegisterMetaType<preprocessing_task_set_t>("preprocessing_task_set_t"); - - if (argc == 2) - { - scribo::demo::basedir_ = argv[1]; - } - else - { - qDebug() << "Usage: " << argv[0] << " <path_to_scribo/src>"; - return 1; - } - - scribo::demo::demat::main_window win; - win.show(); - - return app.exec(); -} diff --git a/scribo/demo/demat/src/main_window.cc b/scribo/demo/demat/src/main_window.cc deleted file mode 100644 index 5d3a54b..0000000 --- a/scribo/demo/demat/src/main_window.cc +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <src/main_window.hh> - -#include <src/doc_type.hh> -#include <src/preprocessing_task.hh> -#include <src/process_args.hh> - -#include <mln/data/convert.hh> -#include <mln/convert/to_qimage_nocopy.hh> -#include <mln/core/routine/duplicate.hh> -#include <mln/make/box2d.hh> -#include <mln/data/paste.hh> -#include <mln/io/magick/load.hh> - -namespace scribo -{ - - namespace demo - { - - namespace demat - { - - main_window::main_window() - { - setupUi(this); - - text_->hide(); - - connect(action_Open, SIGNAL(activated()), - this, SLOT(open_file_slot())); - - connect(run_btn, SIGNAL(clicked()), this, SLOT(run())); - - - // Connections to/from task runner. - connect(&runner_, SIGNAL(new_progress_label(const QString&)), - this, SLOT(update_progress_label_slot(const QString&))); - - connect(&runner_, SIGNAL(progress(unsigned)), - this, SLOT(progress_slot(unsigned))); - connect(&runner_, SIGNAL(finished()), - this, SLOT(process_finished_slot())); - - // Connections for dock windows. - connect(advanced_dock_, SIGNAL(visibilityChanged(bool)), - actionAdvanced_options, SLOT(setChecked(bool))); - connect(options_dock_, SIGNAL(visibilityChanged(bool)), - actionOptions, SLOT(setChecked(bool))); - - connect(actionAdvanced_options, SIGNAL(triggered(bool)), - advanced_dock_, SLOT(setVisible(bool))); - connect(actionOptions, SIGNAL(triggered(bool)), - options_dock_, SLOT(setVisible(bool))); - - progress_ = new QProgressDialog(); - progress_->setLabelText("Processing..."); - progress_->setCancelButton(0); - progress_->setAutoClose(true); - - action_Reload->setEnabled(false); - run_btn->setEnabled(false); - - // Setup crop tool. - viewer_->set_selection_enabled(true); - connect(viewer_, SIGNAL(ready_for_crop()), this, SLOT(crop_slot())); - } - - - void main_window::open_file_slot() - { - QFileDialog dialog; - QStringList filters; - filters << tr("Image (*.ppm *.pbm *.pgm *.png *.jpg)"); - dialog.setNameFilters(filters); - - dialog.setFileMode(QFileDialog::ExistingFile); - dialog.setLabelText(QFileDialog::LookIn, - tr("Choose an existing file")); - - if (dialog.exec() && current_image_ != dialog.selectedFiles().at(0)) - { - current_image_ = dialog.selectedFiles().at(0); - load(); - } - - } - - - void main_window::load() - { - text_->hide(); - - mln::io::magick::load(input_, current_image_.toStdString()); - - input_dsp_ = QPixmap::fromImage(mln::convert::to_qimage_nocopy(input_)); - - viewer_->draw_image(input_dsp_); - - action_Reload->setEnabled(true); - run_btn->setEnabled(true); - } - - - void main_window::run() - { - preprocessing_task_set_t tasks = get_tasks(); - - prepare_progress_bar(tasks.size()); - - process_args args; // Nothing for now. - - runner_.start(current_image_, get_crop_image(), Text_Doc, tasks, args); - setEnabled(false); - } - - - preprocessing_task_set_t main_window::get_tasks() - { - preprocessing_task_set_t tasks; - - if (removeBg->isChecked()) - tasks.insert(RemoveBg); - - if (unskew->isChecked()) - tasks.insert(Unskew); - - if (removeNoise->isChecked()) - tasks.insert(RemoveNoise); - - if (improveContrast->isChecked()) - tasks.insert(ImproveContrast); - - if (reduceSize->isChecked()) - tasks.insert(ReduceSize); - - if (binarizationCBox->currentIndex() == 0) - tasks.insert(BinarizationSimple); - else if (binarizationCBox->currentIndex() == 1) - tasks.insert(BinarizationSauvola); - else if (binarizationCBox->currentIndex() == 2) - tasks.insert(BinarizationSauvolaMs); - else if (binarizationCBox->currentIndex() == 3) - tasks.insert(BinarizationSauvolaMsSplit); - - return tasks; - } - - - void main_window::prepare_progress_bar(unsigned max) - { - progress_->show(); - progress_->setValue(0); - progress_->setMaximum(max + 3); - } - - - void main_window::progress_slot(unsigned i) - { - progress_->setValue(progress_->value() + i); - } - - - void main_window::update_progress_label_slot(const QString& msg) - { - progress_->setLabelText(msg); - } - - - void main_window::process_finished_slot() - { - text_->clear(); - - QFile file("/tmp/out.txt"); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - return; - - QTextStream in(&file); - in.setCodec("UTF-8"); - while (!in.atEnd()) - { - QString line = in.readLine(); - line = line.section(' ', 4); - text_->append(line); - } - - - text_->show(); - setEnabled(true); - } - - - void main_window::on_action_Reload_triggered(bool) - { - load(); - } - - - mln::image2d<mln::value::rgb8> - main_window::get_crop_image() const - { - mln::box2d b = input_.domain(); - QRectF selection = viewer_->selection(); - - mln::box2d sbox = mln::make::box2d(selection.topLeft().y(), - selection.topLeft().x(), - selection.bottomRight().y(), - selection.bottomRight().x()); - - sbox.crop_wrt(b); - - if (sbox.is_valid()) - { - // Update underlying data. - mln::image2d<mln::value::rgb8> output(sbox); - mln::data::fill(output, input_); - return output; - } - - // No crop performed. - return input_; - } - - - void main_window::crop_slot() - { - mln::image2d<mln::value::rgb8> tmp = get_crop_image(); - if (tmp.buffer() != input_.buffer()) // A crop has been performed. - { - input_ = tmp; - - // Update display - viewer_->draw_image(input_); - } - } - - - } // end of namespace scribo::demo::demat - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/demat/src/main_window.hh b/scribo/demo/demat/src/main_window.hh deleted file mode 100644 index dc23ccb..0000000 --- a/scribo/demo/demat/src/main_window.hh +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_DEMAT_SRC_MAIN_WINDOW_HH -# define SCRIBO_DEMO_DEMAT_SRC_MAIN_WINDOW_HH - -# include <QtGui/QMainWindow> -# include <ui_main_window.h> -# include <src/doc_type.hh> -# include <src/preprocessing_task.hh> -# include <src/runner.hh> - -# include <mln/core/image/image2d.hh> -# include <mln/core/image/dmorph/image_if.hh> -# include <mln/pw/all.hh> -# include <mln/value/rgb8.hh> - - -namespace scribo -{ - - namespace demo - { - - namespace demat - { - - - class main_window : public QMainWindow, private Ui::MainWindow - { - Q_OBJECT; - - public: - main_window(); - - private slots: - void run(); - void open_file_slot(); - void progress_slot(unsigned i); - void update_progress_label_slot(const QString&); - void process_finished_slot(); - - void crop_slot(); - - void on_action_Reload_triggered(bool b); - - private: // members - void load(); - - void prepare_progress_bar(unsigned max); - Doc_Type get_doc_type(); - preprocessing_task_set_t get_tasks(); - mln::image2d<mln::value::rgb8> get_crop_image() const; - - private: // attributes - QPixmap input_dsp_; - - QString current_image_; - - QProgressDialog* progress_; - runner runner_; - - mln::image2d<mln::value::rgb8> input_; - }; - - - } // end of namespace scribo::demo::demat - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_DEMAT_SRC_MAIN_WINDOW_HH diff --git a/scribo/demo/demat/src/mln_widgets.cc b/scribo/demo/demat/src/mln_widgets.cc deleted file mode 100644 index 079fc7f..0000000 --- a/scribo/demo/demat/src/mln_widgets.cc +++ /dev/null @@ -1,11 +0,0 @@ -#undef MLN_INCLUDE_ONLY - -// Windows -#include <src/main_window.cc> - -// Widgets -#include <shared/src/image_viewer.cc> - -// Misc -#include <src/main.cc> -#include <src/runner.cc> diff --git a/scribo/demo/demat/src/preprocessing_task.hh b/scribo/demo/demat/src/preprocessing_task.hh deleted file mode 100644 index 5c287c4..0000000 --- a/scribo/demo/demat/src/preprocessing_task.hh +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_TASK_HH -# define SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_TASK_HH - -# include <QSet> - - -namespace scribo -{ - - namespace demo - { - - enum Preprocessing_Task - { - RemoveBg = 0, - Unskew, - RemoveNoise, - ImproveContrast, - ReduceSize, - - BinarizationSimple, - BinarizationSauvola, - BinarizationSauvolaMs, - BinarizationSauvolaMsSplit, - - PREPROCESSING_TASK_COUNT // Invalid task. - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - -typedef QSet<scribo::demo::Preprocessing_Task> preprocessing_task_set_t; -Q_DECLARE_METATYPE(preprocessing_task_set_t); - -#endif // !SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_TASK_HH diff --git a/scribo/demo/demat/src/process_args.hh b/scribo/demo/demat/src/process_args.hh deleted file mode 100644 index 5ca72cf..0000000 --- a/scribo/demo/demat/src/process_args.hh +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_PROCESS_ARGS_HH -# define SCRIBO_DEMO_SHARED_SRC_PROCESS_ARGS_HH - - -namespace scribo -{ - - namespace demo - { - - struct process_args - { - unsigned scale; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // !SCRIBO_DEMO_SHARED_SRC_PROCESS_ARGS_HH diff --git a/scribo/demo/demat/src/runner.cc b/scribo/demo/demat/src/runner.cc deleted file mode 100644 index 0ab591c..0000000 --- a/scribo/demo/demat/src/runner.cc +++ /dev/null @@ -1,327 +0,0 @@ -#include <src/runner.hh> - -#include <shared/src/to_mln_image.hh> -#include <src/preprocessing_task.hh> -#include <src/doc_type.hh> - -#include <mln/convert/to_qimage.hh> -#include <mln/convert/to_qimage_nocopy.hh> -#include <mln/fun/v2v/rgb_to_int_u.hh> -#include <mln/value/int_u8.hh> -#include <mln/value/rgb8.hh> -#include <mln/data/convert.hh> -#include <mln/data/paste_without_localization.hh> -#include <mln/io/pbm/save.hh> -#include <mln/io/magick/load.hh> -#include <mln/subsampling/antialiased.hh> - -#include <scribo/preprocessing/split_bg_fg.hh> -#include <scribo/preprocessing/denoise.hh> -#include <scribo/preprocessing/homogeneous_contrast.hh> -#include <scribo/preprocessing/deskew.hh> -#include <scribo/binarization/sauvola.hh> -#include <scribo/binarization/sauvola_ms.hh> -#include <scribo/binarization/sauvola_ms_split.hh> -#include <scribo/binarization/global_threshold_auto.hh> - -#include <mln/logical/not.hh> - -namespace scribo -{ - - namespace demo - { - - QString basedir_ = ""; - - - runner::runner(QObject *parent) - : QThread(parent) - { - process_.moveToThread(this); - } - - - void runner::start(const QString& filename, - const mln::image2d<mln::value::rgb8>& input, - const Doc_Type& doc_type, - const preprocessing_task_set_t& tasks, - const process_args& args) - { - filename_ = filename; - doc_type_ = doc_type; - tasks_ = tasks; - args_ = args; - input_ = input; - - QThread::start(); - } - - - void runner::run() - { - // Notification of the number of tasks. - emit new_progress_max_value(tasks_.size() + 2); - - qDebug() << "progress steps : " << tasks_.size() + 2; - - image2d<value::rgb8> ima = load(); - - preprocess(ima); - - process(); - } - - - image2d<value::rgb8> runner::load() - { - emit new_progress_label("Loading image"); - - image2d<value::rgb8> output(input_.nrows(), input_.ncols(), - input_.border()); - data::paste_without_localization(input_, output); - -// io::magick::load(output, filename_.toStdString()); - - emit progress(1); - - return output; - } - - - void runner::preprocess(const image2d<value::rgb8>& ima) - { - - image2d<value::rgb8> tmp_color = duplicate(ima); - - - // - //========== - // Subsample - //========== - if (tasks_.contains(ReduceSize)) - { - emit new_progress_label("Subsampling input image"); - tmp_color = mln::subsampling::antialiased(tmp_color, - find_best_scale(tmp_color)); - emit progress(1); - } - - - //================== - // Remove background - //================== - if (tasks_.contains(RemoveBg)) - { - std::cout << "Foreground extraction" << std::endl; - emit new_progress_label("Foreground Extraction"); - - tmp_color = scribo::preprocessing::split_bg_fg(tmp_color, 10000, 32).second(); - - emit progress(1); - } - - - //============================================= - // Convert to grayscale image (always happens). - //============================================= - emit new_progress_label("Convert to gray-scale image"); - image2d<value::int_u8> - intensity_ima = data::transform(tmp_color, - mln::fun::v2v::rgb_to_int_u<8>()); - emit progress(1); - - - //======= - // Deskew - //======= - if (tasks_.contains(Unskew)) - { - std::cout << "Deskew" << std::endl; - emit new_progress_label("Deskew"); - - intensity_ima = scribo::preprocessing::deskew(intensity_ima); - - emit progress(1); - } - - - //============================= - // Improve contrast homogeneity - //============================= - if (tasks_.contains(ImproveContrast)) - { - std::cout << "Improve contrast homogeneity" << std::endl; - emit new_progress_label("Improve contrast homogeneity"); - - intensity_ima = arith::revert(preprocessing::homogeneous_contrast(intensity_ima, 75)); - - emit progress(1); - } - - - std::cout << intensity_ima.domain() << std::endl; - io::pgm::save(intensity_ima, "intensity_ima.pgm"); - - //============================== - // Binarization (always happens) - //============================== - image2d<bool> out_bool; - emit new_progress_label("Binarization"); - - if (tasks_.contains(BinarizationSauvola)) - { - // FIXME: sauvola should not negate the image. - std::cout << "Binarization Sauvola" << std::endl; - out_bool = binarization::sauvola(intensity_ima); - } - else if (tasks_.contains(BinarizationSauvolaMs)) - { - // FIXME: sauvola should not negate the image. - std::cout << "Binarization Sauvola_ms" << std::endl; - out_bool = binarization::sauvola_ms(intensity_ima, 51, 2); - } - else if (tasks_.contains(BinarizationSauvolaMsSplit)) - { - // FIXME: sauvola should not negate the image. - // FIXME: WARNING: work directly on the color image -> it is - // NOT deskewed nor contrast improved. - std::cout << "Binarization Sauvola_ms_split" << std::endl; - out_bool = binarization::sauvola_ms_split(tmp_color, 51, 2, 2); - } - else if (tasks_.contains(BinarizationSimple)) - { - std::cout << "Binarization Simple" << std::endl; - out_bool = scribo::binarization::global_threshold_auto(intensity_ima); - } - else - { - std::cout << "Binary image conversion" << std::endl; - out_bool = data::convert(bool(), intensity_ima); - } - - emit progress(1); - - - // FIXME: remove! - logical::not_inplace(out_bool); - - - //======== - // Denoise - //======== - if (tasks_.contains(RemoveNoise)) - { - std::cout << "Remove noise" << std::endl; - emit new_progress_label("Remove noise"); - - out_bool = preprocessing::denoise(out_bool, c8(), 2, 2); - - emit progress(1); - } - - - //========================= - // Save preprocessed image. - //========================= - io::pbm::save(out_bool, "/tmp/tmp.pbm"); - } - - - void runner::process() - { - QStringList args; - - - // FIXME: require binaries to ask for a filename for bboxes - // output files. - switch(doc_type_) - { - case Text_Doc: - emit new_progress_label("Finding text in document..."); - qDebug() << "Running pbm_text_in_doc"; - args << "/tmp/tmp.pbm" << "/tmp/out.txt"; - - // Denoise. - if (! tasks_.contains(RemoveNoise)) - args << "0"; - else - { - args << "1"; - emit progress(1); // Consider denoising as done even though it is performed later. - } - - args << "/tmp/"; - - qDebug() << "Running:" - << basedir_ + "/pbm_text_in_doc" - << args; - - if (process_.execute(basedir_ + "/pbm_text_in_doc", args)) - { - qDebug() << "Error while running pbm_text_in_doc."; - return; - } - break; - - case Picture: - emit new_progress_label("Finding text in picture..."); - qDebug() << "Running text_in_picture"; - args << "/tmp/tmp.pbm" << "/tmp/out.ppm" << "1" << "1" << "1"; - if (process_.execute(basedir_ + "/text_in_picture", args)) - { - qDebug() << "Error while running text_in_picture."; - return; - } - break; - - case Mixed_Doc: - qDebug() << "Running pbm_text_in_mixed_doc"; - if (process_.execute(basedir_ + "/pbm_text_in_mixed_doc", args)) - { - qDebug() << "Error while running pbm_text_in_mixed_doc."; - return; - } - break; - - default: - case Invalid_Doc: - qDebug() << "runner - Invalid doc type..."; - return; - } - - process_.waitForFinished(-1); - - emit progress(1); - - emit finished(); - qDebug() << "Done"; - } - - - void runner::stop() - { - process_.kill(); - terminate(); - } - - - template <typename V> - unsigned runner::find_best_scale(const image2d<V>& ima) - { - if (ima.nrows() > 2500 - && ima.nrows() < 5000 - && ima.ncols() > 2500 - && ima.ncols() < 5000) - return 2; - - if (ima.nrows() > 5000 - && ima.ncols() > 5000) - return 3; - - return 1; - } - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/demat/src/runner.hh b/scribo/demo/demat/src/runner.hh deleted file mode 100644 index be32e5a..0000000 --- a/scribo/demo/demat/src/runner.hh +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_RUNNER_HH -# define SCRIBO_DEMO_SHARED_SRC_RUNNER_HH - -# include <QtGui> -# include <QProcess> - -# include <src/preprocessing_task.hh> -# include <src/doc_type.hh> - -# include <mln/core/image/image2d.hh> -# include <mln/value/qt/rgb32.hh> - -#include <src/process_args.hh> - -namespace scribo -{ - - namespace demo - { - - - class runner : public QThread - { - Q_OBJECT; - - public: - runner(QObject *parent = 0); - - void start(const QString& filename, - const mln::image2d<mln::value::rgb8>& input, - const Doc_Type& doc_type, - const preprocessing_task_set_t& tasks, - const process_args& args); - - void stop(); - - signals: - void new_intermediate_result(const QImage& ima); - void new_progress_max_value(unsigned i); - void new_progress_label(const QString& msg); - void progress(unsigned i); - void finished(); - - private: // members - mln::image2d<mln::value::rgb8> load(); - void preprocess(const mln::image2d<mln::value::rgb8>& ima); - void process(); - virtual void run(); - - template <typename V> - unsigned find_best_scale(const mln::image2d<V>& ima); - - private: // attributes - QProcess process_; - Doc_Type doc_type_; - QSet<Preprocessing_Task> tasks_; - QString filename_; - process_args args_; - mln::image2d<mln::value::rgb8> input_; - }; - - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_RUNNER_HH diff --git a/scribo/demo/demat/ui/main_window.ui b/scribo/demo/demat/ui/main_window.ui deleted file mode 100644 index 349d43a..0000000 --- a/scribo/demo/demat/ui/main_window.ui +++ /dev/null @@ -1,381 +0,0 @@ -<ui version="4.0" > - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>666</width> - <height>647</height> - </rect> - </property> - <property name="windowTitle" > - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget" > - <layout class="QVBoxLayout" name="verticalLayout" > - <item> - <widget class="QSplitter" name="splitter" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <widget class="scribo::demo::shared::image_viewer" name="viewer_" /> - <widget class="QTextEdit" name="text_" /> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout" > - <item> - <spacer name="horizontalSpacer" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="run_btn" > - <property name="text" > - <string>&Run</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>666</width> - <height>24</height> - </rect> - </property> - <widget class="QMenu" name="menu_File" > - <property name="title" > - <string>&File</string> - </property> - <addaction name="action_Open" /> - <addaction name="separator" /> - <addaction name="action_Reload" /> - <addaction name="separator" /> - <addaction name="action_Quit" /> - </widget> - <widget class="QMenu" name="menuWindow" > - <property name="title" > - <string>&Dialogs</string> - </property> - <addaction name="actionOptions" /> - <addaction name="actionAdvanced_options" /> - </widget> - <addaction name="menu_File" /> - <addaction name="menuWindow" /> - </widget> - <widget class="QStatusBar" name="statusbar" /> - <widget class="QDockWidget" name="options_dock_" > - <property name="font" > - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="floating" > - <bool>false</bool> - </property> - <property name="features" > - <set>QDockWidget::AllDockWidgetFeatures</set> - </property> - <property name="allowedAreas" > - <set>Qt::AllDockWidgetAreas</set> - </property> - <property name="windowTitle" > - <string>Options</string> - </property> - <attribute name="dockWidgetArea" > - <number>1</number> - </attribute> - <widget class="QWidget" name="dockWidgetContents" > - <layout class="QVBoxLayout" name="verticalLayout_7" > - <item> - <layout class="QVBoxLayout" name="verticalLayout_4" > - <item> - <widget class="QCheckBox" name="removeBg" > - <property name="font" > - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text" > - <string>Remove background (slow)</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="unskew" > - <property name="font" > - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text" > - <string>Unskew</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="removeNoise" > - <property name="enabled" > - <bool>true</bool> - </property> - <property name="font" > - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text" > - <string>Remove noise</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="improveContrast" > - <property name="enabled" > - <bool>true</bool> - </property> - <property name="font" > - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text" > - <string>Improve brightness/contrast</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_3" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - <widget class="QDockWidget" name="advanced_dock_" > - <property name="font" > - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="windowTitle" > - <string>Advanced options</string> - </property> - <attribute name="dockWidgetArea" > - <number>1</number> - </attribute> - <widget class="QWidget" name="dockWidgetContents_3" > - <layout class="QVBoxLayout" name="verticalLayout_8" > - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <item> - <widget class="QCheckBox" name="reduceSize" > - <property name="font" > - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text" > - <string>Run on subsampled image</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_6" > - <item> - <widget class="QLabel" name="binarizeLbl" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font" > - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="text" > - <string>Binarization method:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="binarizationCBox" > - <property name="font" > - <font> - <weight>50</weight> - <bold>false</bold> - </font> - </property> - <property name="currentIndex" > - <number>2</number> - </property> - <item> - <property name="text" > - <string>Global threshold</string> - </property> - </item> - <item> - <property name="text" > - <string>Local threshold</string> - </property> - </item> - <item> - <property name="text" > - <string>Local threshold multi-scale</string> - </property> - </item> - <item> - <property name="text" > - <string>Local threshold multi-scale (3-channels)</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_2" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - <action name="action_Open" > - <property name="text" > - <string>&Open</string> - </property> - <property name="shortcut" > - <string>Ctrl+O</string> - </property> - </action> - <action name="action_Quit" > - <property name="text" > - <string>&Quit</string> - </property> - </action> - <action name="actionDocument_Type" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - <property name="text" > - <string>Document Type</string> - </property> - </action> - <action name="actionOptions" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - <property name="text" > - <string>Options</string> - </property> - </action> - <action name="actionAdvanced_options" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>true</bool> - </property> - <property name="text" > - <string>Advanced options</string> - </property> - </action> - <action name="action_Reload" > - <property name="text" > - <string>&Reload</string> - </property> - <property name="shortcut" > - <string>F5, Ctrl+R</string> - </property> - </action> - </widget> - <customwidgets> - <customwidget> - <class>scribo::demo::shared::image_viewer</class> - <extends>QGraphicsView</extends> - <header location="global" >shared/src/image_viewer.hh</header> - </customwidget> - </customwidgets> - <resources/> - <connections> - <connection> - <sender>action_Quit</sender> - <signal>activated()</signal> - <receiver>MainWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel" > - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel" > - <x>332</x> - <y>298</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/scribo/demo/review/Makefile.am b/scribo/demo/review/Makefile.am deleted file mode 100644 index ec4a971..0000000 --- a/scribo/demo/review/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2009, 2010, 2011 EPITA Research and Development -# Laboratory (LRDE). -# -# This file is part of Olena. -# -# Olena is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, version 2 of the License. -# -# Olena is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Olena. If not, see <http://www.gnu.org/licenses/>. - -include $(top_srcdir)/build-aux/autotroll.mk - -noinst_PROGRAMS = scribo-review - -BUILT_SOURCES = src/mainwindow.moc.cc \ - mainwindow.ui.h - -scribo_review_SOURCES = src/main.cc \ - src/mainwindow.cc - -nodist_scribo_review_SOURCES = $(BUILT_SOURCES) - - -scribo_review_CPPFLAGS = $(QT_CPPFLAGS) $(AM_CPPFLAGS) \ - -DNDEBUG \ - -I$(srcdir) -scribo_review_CXXFLAGS = $(QT_CXXFLAGS) $(AM_CXXFLAGS) -O3 -scribo_review_LDFLAGS = $(QT_LDFLAGS) $(LDFLAGS) -scribo_review_LDADD = $(QT_LIBS) $(LDADD) - - -noinst_HEADERS = src/mainwindow.hh - - -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST = \ - icons/document-open.png \ - icons/edit-find.png \ - icons/format-indent-more.png \ - icons/go-next.png \ - icons/image-x-generic.png \ - icons/list-add.png \ - icons/ocr.png \ - icons/text-x-generic.png \ - icons/view-refresh.png \ - icons/x-office-spreadsheet.png\ - review.qrc \ - mainwindow.ui diff --git a/scribo/demo/review/icons/document-open.png b/scribo/demo/review/icons/document-open.png deleted file mode 100644 index f35f258..0000000 Binary files a/scribo/demo/review/icons/document-open.png and /dev/null differ diff --git a/scribo/demo/review/icons/edit-find.png b/scribo/demo/review/icons/edit-find.png deleted file mode 100644 index 5594785..0000000 Binary files a/scribo/demo/review/icons/edit-find.png and /dev/null differ diff --git a/scribo/demo/review/icons/format-indent-more.png b/scribo/demo/review/icons/format-indent-more.png deleted file mode 100644 index 6a18867..0000000 Binary files a/scribo/demo/review/icons/format-indent-more.png and /dev/null differ diff --git a/scribo/demo/review/icons/go-next.png b/scribo/demo/review/icons/go-next.png deleted file mode 100644 index a68e2db..0000000 Binary files a/scribo/demo/review/icons/go-next.png and /dev/null differ diff --git a/scribo/demo/review/icons/image-x-generic.png b/scribo/demo/review/icons/image-x-generic.png deleted file mode 100644 index 6f118cd..0000000 Binary files a/scribo/demo/review/icons/image-x-generic.png and /dev/null differ diff --git a/scribo/demo/review/icons/list-add.png b/scribo/demo/review/icons/list-add.png deleted file mode 100644 index 2acdd8f..0000000 Binary files a/scribo/demo/review/icons/list-add.png and /dev/null differ diff --git a/scribo/demo/review/icons/ocr.png b/scribo/demo/review/icons/ocr.png deleted file mode 100644 index 2523172..0000000 Binary files a/scribo/demo/review/icons/ocr.png and /dev/null differ diff --git a/scribo/demo/review/icons/text-x-generic.png b/scribo/demo/review/icons/text-x-generic.png deleted file mode 100644 index 928a679..0000000 Binary files a/scribo/demo/review/icons/text-x-generic.png and /dev/null differ diff --git a/scribo/demo/review/icons/view-refresh.png b/scribo/demo/review/icons/view-refresh.png deleted file mode 100644 index 606ea9e..0000000 Binary files a/scribo/demo/review/icons/view-refresh.png and /dev/null differ diff --git a/scribo/demo/review/icons/x-office-spreadsheet.png b/scribo/demo/review/icons/x-office-spreadsheet.png deleted file mode 100644 index c0ccb7a..0000000 Binary files a/scribo/demo/review/icons/x-office-spreadsheet.png and /dev/null differ diff --git a/scribo/demo/review/mainwindow.ui b/scribo/demo/review/mainwindow.ui deleted file mode 100644 index cb85804..0000000 --- a/scribo/demo/review/mainwindow.ui +++ /dev/null @@ -1,340 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>658</width> - <height>459</height> - </rect> - </property> - <property name="windowTitle"> - <string>Scribo Demo - v0.1</string> - </property> - <property name="dockOptions"> - <set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set> - </property> - <property name="unifiedTitleAndToolBarOnMac"> - <bool>false</bool> - </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <property name="margin"> - <number>0</number> - </property> - <item> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="margin"> - <number>5</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLineEdit" name="filepath"/> - </item> - <item row="0" column="1"> - <widget class="QPushButton" name="browseBtn"> - <property name="text"> - <string>&Browse</string> - </property> - <property name="icon"> - <iconset resource="../demo.qrc"> - <normaloff>:/icons/document-open.png</normaloff>:/icons/document-open.png</iconset> - </property> - <property name="shortcut"> - <string>Ctrl+B</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QPushButton" name="displayBtn"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Refresh</string> - </property> - <property name="icon"> - <iconset resource="../demo.qrc"> - <normaloff>:/icons/view-refresh.png</normaloff>:/icons/view-refresh.png</iconset> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QPushButton" name="runBtn"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Run</string> - </property> - <property name="icon"> - <iconset resource="../demo.qrc"> - <normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QCheckBox" name="autoRun"> - <property name="text"> - <string>Auto Run</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="5"> - <widget class="QCheckBox" name="useCache"> - <property name="text"> - <string>Enable cache</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>-1</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="zoomLabel"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Zoom:</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomIn"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>+</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomOut"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>-</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomFixed"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Fixed width</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomOriginal"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Original size</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="autoDemo"> - <property name="text"> - <string>Auto demo</string> - </property> - <property name="shortcut"> - <string>Ctrl+D</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="timeoutDelay"> - <property name="maximumSize"> - <size> - <width>30</width> - <height>16777215</height> - </size> - </property> - <property name="inputMask"> - <string/> - </property> - <property name="text"> - <string>5</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label"> - <property name="text"> - <string>s.</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QTabWidget" name="tabWidget_2"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_3"> - <attribute name="title"> - <string>Reference Image</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QGraphicsView" name="imageRef"/> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <widget class="QTabWidget" name="tabWidget"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>Result Image</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QGraphicsView" name="imageResult"/> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_2"> - <property name="font"> - <font> - <kerning>true</kerning> - </font> - </property> - <attribute name="title"> - <string>Text</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <property name="spacing"> - <number>0</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QTextBrowser" name="textBrowser"> - <property name="html"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:9pt;">Test</span></p></body></html></string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>658</width> - <height>22</height> - </rect> - </property> - </widget> - <widget class="QStatusBar" name="statusbar"/> - </widget> - <resources> - <include location="../demo.qrc"/> - </resources> - <connections> - <connection> - <sender>filepath</sender> - <signal>returnPressed()</signal> - <receiver>displayBtn</receiver> - <slot>click()</slot> - <hints> - <hint type="sourcelabel"> - <x>213</x> - <y>62</y> - </hint> - <hint type="destinationlabel"> - <x>564</x> - <y>64</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/scribo/demo/review/review.qrc b/scribo/demo/review/review.qrc deleted file mode 100644 index 8492d35..0000000 --- a/scribo/demo/review/review.qrc +++ /dev/null @@ -1,13 +0,0 @@ -<RCC> - <qresource prefix="/" > - <file>icons/go-next.png</file> - <file>icons/view-refresh.png</file> - <file>icons/format-indent-more.png</file> - <file>icons/document-open.png</file> - <file>icons/text-x-generic.png</file> - <file>icons/x-office-spreadsheet.png</file> - <file>icons/image-x-generic.png</file> - <file>icons/edit-find.png</file> - <file>icons/list-add.png</file> - </qresource> -</RCC> diff --git a/scribo/demo/review/src/main.cc b/scribo/demo/review/src/main.cc deleted file mode 100644 index 2a6acaf..0000000 --- a/scribo/demo/review/src/main.cc +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <QApplication> -#include <QtGui> - -#include <src/mainwindow.hh> - -int main(int argc, char *argv[]) -{ - if (argc < 2 || argc > 4) - { - qDebug() << "Usage: " - << argv[0] << " <path_to_scribo_src> [base_img_dir]"; - return 0; - } - - QApplication app(argc, argv); - - scribo::demo::MainWindow win(argv[1]); - - if (argc == 3) - win.set_base_img_dir(argv[2]); - - win.show(); - return app.exec(); -} diff --git a/scribo/demo/review/src/mainwindow.cc b/scribo/demo/review/src/mainwindow.cc deleted file mode 100644 index 0a4ee65..0000000 --- a/scribo/demo/review/src/mainwindow.cc +++ /dev/null @@ -1,569 +0,0 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <QtCore> -#include <QtGui> - -#include "src/mainwindow.hh" - - -const char * modes[][4] = { - { "Text in pictures", "pics", "text_in_picture", "image-x-generic.png" }, - { "Text in docs", "doc", "text_in_doc", "edit-find.png" }, - { (const char *)(1), 0, 0, 0}, // Separator - { "Handwritten text lines", "hsc", "../../milena/sandbox/icdar/2009/hsc/input_to_lines", "text-x-generic.png" }, - { "Handwritten text words", "hsc", "../../milena/sandbox/icdar/2009/hsc/input_to_words", "text-x-generic.png" }, - { (const char *)(1), 0, 0, 0}, // Separator - { "Horizontal and Vertical Lines", "hvl", "extract/primitive/find_discontinued_lines", "list-add.png" }, - { "Tables", "hvl", "table/extract", "x-office-spreadsheet.png" }, - { "Pre-processing", "pproc", "preprocess", "format-indent-more.png" }, - { "OCR", "ocr", "recognition", "edit-find.png" }, - { 0, 0, 0 } // Empty line, do NOT delete. -}; - - -// Allow to set up to 5 extra arguments to the binaries. -// -// A program will be launched as follow: -// -// ./my_program input.pbm output <arg1> <arg2> <arg3> <arg4> <arg5> -// -// Unused arguments are set to 0. -// Each line must be mapped to the related on in the previous -// array "modes". So DO preserve the order. -// -const char *args_list[][6] = { - { "1", "1", "1", "1", "1", 0 }, // Text in Pictures - { 0, 0, 0, 0, 0, 0 }, // Text in Docs - { (const char *)(1), 0, 0, 0, 0, 0 }, // Separator - { "/dev/null", 0, 0, 0, 0, 0 }, // Handwritten text lines - { "/dev/null", 0, 0, 0, 0, 0 }, // Handwritten text words - { (const char *)(1), 0, 0, 0, 0, 0 }, // Separator - { "51", 0, 0, 0, 0, 0 }, // Horizontal and Vertical lines - { "/dev/null", 0, 0, 0, 0, 0 }, // Tables - { 0, 0, 0, 0, 0, 0 }, // Pre-processing - { 0, 0, 0, 0, 0, 0 }, // OCR - // Not empty line needed. -}; - - - -namespace scribo -{ - - namespace demo - { - - MainWindow::MainWindow(const QString& exec_prefix, QWidget *parent) - : QMainWindow(parent), exec_prefix_(exec_prefix + "/"), context_(this) - { - setupUi(this); - - unsigned nmodes = 0; - for (unsigned i = 0; modes[i][0] != 0; ++i) - ++nmodes; - - cached_result_.resize(nmodes); - mainRefItem_ = 0; - mainResultItem_ = 0; - base_img_dir_ = QCoreApplication::applicationDirPath(); - - pdialog_.setRange(0,0); - pdialog_.setLabelText(tr("Please wait while computing...")); - pdialog_.setWindowModality(Qt::WindowModal); - - exec_.setReadChannel(QProcess::StandardOutput); - - qDebug() << "Cache located in " << QDir::tempPath(); - - connect(&pdialog_, SIGNAL(canceled()), this, SLOT(compute_canceled())); - - connect(&context_, SIGNAL(triggered(QAction *)), - this, SLOT(context_changed(QAction *))); - - connect(imageResult->verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_vertical_sliders(int))); - connect(imageResult->horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_horizontal_sliders(int))); - connect(imageRef->verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_vertical_sliders(int))); - connect(imageRef->horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_horizontal_sliders(int))); - connect(&timer_, SIGNAL(timeout()), this, SLOT(timer_timeout())); - - connect_compute_process(); - - context_.setExclusive(true); - - // No status bar. - setStatusBar(0); - - initToolBar(); - setup_scene(); - } - - MainWindow::~MainWindow() - { - for (int i = 0; i < cached_result_.size(); ++i) - foreach(QString value, cached_result_[i]) - { - QFile f(value); - f.remove(); - } - } - - - void MainWindow::set_base_img_dir(const QString& dir) - { - QDir d(dir); - base_img_dir_ = d.absolutePath(); - } - - - void MainWindow::initToolBar() - { - QToolBar *tbar = new QToolBar("Tools"); - tbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); - - for (unsigned i = 0; modes[i][0]; ++i) - { - if (modes[i][0] == (const char *)(1)) - { - tbar->addSeparator(); - continue; - } - - QAction *action = tbar->addAction(modes[i][0]); - context_.addAction(action); - action->setCheckable(true); - action->setData(i); - action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0 + i)); - action->setEnabled(QFile::exists(exec_prefix_ + modes[i][2])); - - if (modes[i][3] != 0) - action->setIcon(QIcon(QString(":/icons/") + modes[i][3])); - } - - addToolBar(Qt::TopToolBarArea, tbar); - context_.actions().first()->trigger(); - } - - - - void MainWindow::on_browseBtn_clicked(bool) - { - QString current_dir = current_mode() + "/"; - - QString - filename = QFileDialog::getOpenFileName(this, - tr("Open Image."), - base_img_dir_ + "/" + current_dir, - tr("Images (*.pbm *.pgm *.ppm *.jpg *.png *.tiff)")); - - prepare_for_run(filename); - } - - void MainWindow::prepare_for_run(const QString& filename) - { - if (!filename.isEmpty()) - { - filepath->setText(filename); - - update_pixmap(imageRef, filename); - update_pixmap(imageResult); - - if (autoRun->isChecked()) - on_runBtn_clicked(); - } - } - - void MainWindow::on_runBtn_clicked() - { - if (useCache->isChecked() - && cached_result_[mode_].contains(filepath->text())) - { - last_output_ = cached_result_[mode_][filepath->text()]; - exec_finished(0, QProcess::NormalExit); - return; - } - - wait_for_result(); - - QStringList args; - - QString input = filepath->text(); - - args << input; - QTemporaryFile f; - f.open(); - args << f.fileName(); - last_output_ = f.fileName(); - - for (unsigned i = 0; args_list[mode_][i]; ++i) - args << args_list[mode_][i]; - -// if (!is_in_ocr_mode()) -// { -// } - -// reset_progress_dialog(); - qDebug() << "Running " << exec_prefix_ + modes[mode_][2] - << " " << args; - - exec_.start(exec_prefix_ + modes[mode_][2], args); - } - - - void MainWindow::on_displayBtn_clicked(bool) - { - update_pixmap(imageRef, filepath->text()); - } - - - void MainWindow::on_filepath_textChanged() - { - bool b = !filepath->text().isEmpty(); - - runBtn->setEnabled(b); - displayBtn->setEnabled(b); - } - - - void MainWindow::on_zoomIn_clicked() - { - imageResult->scale(1.2, 1.2); - imageRef->scale(1.2, 1.2); - } - - void MainWindow::on_zoomOut_clicked() - { - imageResult->scale(1 / 1.2, 1 / 1.2); - imageRef->scale(1 / 1.2, 1 / 1.2); - } - - QGraphicsItem *& MainWindow::view_to_item(QGraphicsView *view) - { - if (view == imageResult) - return mainResultItem_; - else - return mainRefItem_; - } - - void MainWindow::update_pixmap(QGraphicsView* view, const QString& name) - { - if (name.isEmpty()) - { - update_status_message(""); - return; - } - - QGraphicsItem* item = view_to_item(view); - - QPixmap pixmap; - if (!pixmap.load(name)) - { - qDebug() << "Invalid file format!"; - update_status_message(tr("Invalid file format!")); - return; - } - - QFileInfo finfo(name); - if (item != mainResultItem_ && current_mode() != "hsc" - && current_mode() != "pproc" - && (current_mode() != "pics" || finfo.suffix() == "pbm") - && ! is_in_doc_mode()) - { - QImage image(pixmap.toImage()); - image.invertPixels(); - pixmap = QPixmap::fromImage(image); - } - - if (item != 0) - { - view->scene()->removeItem(item); - delete item; - } - item = view->scene()->addPixmap(pixmap); - view->scene()->setSceneRect(item->boundingRect()); - Q_ASSERT(item != 0); - if (pixmap.width() > view->maximumViewportSize().width()) - view->fitInView(item->boundingRect(), Qt::KeepAspectRatio); - view_to_item(view) = item; - - bool b = (mainResultItem_ != 0 || mainRefItem_ != 0); - zoomLabel->setEnabled(b); - zoomIn->setEnabled(b); - zoomOut->setEnabled(b); - zoomFixed->setEnabled(b); - zoomOriginal->setEnabled(b); - } - - - void MainWindow::exec_finished(int rvalue, QProcess::ExitStatus status) - { - pdialog_.hide(); - if (rvalue == 0) - { - if (status != QProcess::CrashExit) - { - if (useCache->isChecked()) - cached_result_[mode_][filepath->text()] = last_output_; - - setEnabled(true); - if (is_in_ocr_mode() || is_in_doc_mode()) - { - QFile f(last_output_); - f.open(QIODevice::ReadOnly); - textBrowser->setText(QString::fromUtf8(f.readAll().data())); -// textBrowser->setText(exec_.readAllStandardOutput()); - on_displayBtn_clicked(true); - tabWidget->setCurrentIndex(1); - } - else - update_pixmap(imageResult, last_output_); - } - // Else : canceled. - } - else - exec_error(tr("Error during last run.")); - - imageResult->setFocus(); - if (autoDemo->isChecked()) - timer_.start(timeoutDelay->text().toInt() * 1000); - } - - - void MainWindow::setup_scene() - { - QGraphicsScene *scene = new QGraphicsScene(); - imageResult->setScene(scene); - - scene = new QGraphicsScene(); - imageRef->setScene(scene); - - update_status_message(tr("1) Choose an algorithm.\n\ -2) Select an image.\n3) Run.")); - - imageResult->show(); - imageRef->show(); - } - - - void MainWindow::wait_for_result() - { - reset_progress_dialog(); - - pdialog_.show(); - setEnabled(false); - - if (!is_in_ocr_mode() && !is_in_ocr_mode()) - update_status_message(""); - } - - - void MainWindow::update_status_message(const QString& msg) - { - if (mainResultItem_ != 0) - { - imageResult->scene()->removeItem(mainResultItem_); - delete mainResultItem_; - } - mainResultItem_ = imageResult->scene()->addText(msg); - } - - - void MainWindow::exec_error(const QString& msg) - { - setEnabled(true); - QMessageBox::critical(0, tr("Error!"), - tr("The result cannot be computed!")); - update_status_message(msg); - qDebug() << exec_.readAllStandardOutput(); - } - - void MainWindow::exec_error(QProcess::ProcessError error) - { - if (error == QProcess::FailedToStart) - exec_error(tr("This program does not exist: ") - + exec_prefix_ + modes[mode_][2]); - else - exec_error(tr("The computation stopped.") - + exec_prefix_ + modes[mode_][2]); - } - - - void MainWindow::context_changed(QAction *action) - { - mode_ = action->data().toInt(); - filepath->clear(); - tabWidget->setTabEnabled(1, is_in_ocr_mode() || is_in_doc_mode()); - } - - - void MainWindow::compute_canceled() - { - setEnabled(true); - - exec_.disconnect(); - exec_.kill(); - connect_compute_process(); - - update_status_message("Computation canceled."); - } - - - bool MainWindow::is_in_ocr_mode() const - { - return current_mode() == "ocr"; - } - - bool MainWindow::is_in_pics_mode() const - { - return current_mode() == "pics"; - } - - bool MainWindow::is_in_doc_mode() const - { - return current_mode() == "doc"; - } - - - void MainWindow::resize_pixmaps(const QRectF& rect) - { - if (mainRefItem_ != 0) - imageRef->fitInView(rect, Qt::KeepAspectRatio); - if (mainResultItem_ != 0) - imageResult->fitInView(rect, Qt::KeepAspectRatio); - } - - void MainWindow::move_vertical_sliders(int value) - { - imageRef->verticalScrollBar()->setValue(value); - imageResult->verticalScrollBar()->setValue(value); - } - - void MainWindow::move_horizontal_sliders(int value) - { - imageRef->horizontalScrollBar()->setValue(value); - imageResult->horizontalScrollBar()->setValue(value); - } - - - void MainWindow::on_zoomFixed_clicked() - { - resize_pixmaps(mainRefItem_->boundingRect()); - } - - void MainWindow::on_zoomOriginal_clicked() - { - resize_pixmaps(imageResult->viewport()->geometry()); - } - - void MainWindow::on_autoDemo_clicked(bool checked) - { - if (checked) - timer_.start(100); - else - timer_.stop(); - } - - void MainWindow::resizeEvent(QResizeEvent * event) - { - if (mainRefItem_ != 0) - resize_pixmaps(mainRefItem_->boundingRect()); - event->ignore(); - } - - void MainWindow::keyPressEvent(QKeyEvent *event) - { - if (event->text() == QString("+")) - { - on_zoomIn_clicked(); - event->accept(); - } - else if (event->text() == QString("-")) - { - on_zoomOut_clicked(); - event->accept(); - } - else - event->ignore(); - } - - QString MainWindow::current_mode() const - { - return modes[mode_][1]; - } - - void MainWindow::timer_timeout() - { - update_auto_demo_dir(); - timer_.stop(); - prepare_for_run(demoDir_.absolutePath() + "/" - + demo_files_[demo_index_]); - demo_index_ = (demo_index_ + 1) % demo_files_.size(); - } - - void MainWindow::update_auto_demo_dir() - { - QString tmp_path = base_img_dir_ + "/" + current_mode(); - if (demoDir_.path() != tmp_path) - { - demoDir_.setPath(tmp_path); - demo_index_ = 0; - demo_files_ = demoDir_.entryList(QDir::NoDotAndDotDot | QDir::Files); - } - } - - - void MainWindow::update_process_status() - { - if (is_in_pics_mode() || is_in_doc_mode()) - pdialog_.setLabelText(tr(exec_.readAllStandardOutput())); - } - - - void MainWindow::reset_progress_dialog() - { - pdialog_.reset(); - pdialog_.setLabelText(tr("Please wait while computing...")); - } - - - void MainWindow::connect_compute_process() - { - connect(&exec_, SIGNAL(finished(int, QProcess::ExitStatus)), - this, SLOT(exec_finished(int, QProcess::ExitStatus))); - connect(&exec_, SIGNAL(error(QProcess::ProcessError)), - this, SLOT(exec_error(QProcess::ProcessError))); - connect(&exec_, SIGNAL(readyReadStandardOutput()), - this, SLOT(update_process_status())); - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/review/src/mainwindow.hh b/scribo/demo/review/src/mainwindow.hh deleted file mode 100644 index 60257f8..0000000 --- a/scribo/demo/review/src/mainwindow.hh +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory -// (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_APPS_DEMO_SRC_MAINWINDOW_HH - -# include <QDir> -# include <QTimer> -# include <QStringList> -# include <QProcess> -# include <QtGui/QWidget> -# include <QProgressDialog> -# include "mainwindow.ui.h" - -namespace scribo -{ - - namespace demo - { - - class MainWindow : public QMainWindow, private Ui::MainWindow - { - Q_OBJECT - - - public: - MainWindow(const QString& exec_prefix, QWidget *parent = 0); - ~MainWindow(); - - void set_base_img_dir(const QString& dir); - - private slots: - void initToolBar(); - - void on_browseBtn_clicked(bool b); - void on_runBtn_clicked(); - void on_displayBtn_clicked(bool b); - void on_filepath_textChanged(); - void on_zoomIn_clicked(); - void on_zoomOut_clicked(); - void on_zoomFixed_clicked(); - void on_zoomOriginal_clicked(); - void on_autoDemo_clicked(bool checked); - - void exec_finished(int rvalue, QProcess::ExitStatus status); - void exec_error(QProcess::ProcessError error); - - void context_changed(QAction *action); - - void compute_canceled(); - - void resize_pixmaps(const QRectF& rect); - - void move_vertical_sliders(int value); - void move_horizontal_sliders(int value); - void timer_timeout(); - - void update_process_status(); - - private: // Members - void setup_scene(); - void update_pixmap(QGraphicsView* view, const QString& name = QString()); - - void exec_error(const QString& msg); - - void wait_for_result(); - - void update_status_message(const QString& msg); - - void prepare_for_run(const QString& filename); - - bool is_in_ocr_mode() const; - bool is_in_pics_mode() const; - bool is_in_doc_mode() const; - - QGraphicsItem *& view_to_item(QGraphicsView *view); - - void resizeEvent(QResizeEvent * event); - void keyPressEvent(QKeyEvent *event); - - QString current_mode() const; - - void update_auto_demo_dir(); - - void reset_progress_dialog(); - - void connect_compute_process(); - - private: // Attributes - QGraphicsItem *mainRefItem_; - QGraphicsItem *mainResultItem_; - QString exec_prefix_; - - QActionGroup context_; - int mode_; - QString last_output_; - QProcess exec_; - - QProgressDialog pdialog_; - - QString base_img_dir_; - - QVector<QHash<QString, QString> > cached_result_; - - /// Related to auto demo. - QTimer timer_; - QDir demoDir_; - unsigned demo_index_; - QStringList demo_files_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - -#endif // ! SCRIBO_APPS_DEMO_SRC_MAINWINDOW_HH diff --git a/scribo/demo/shared/icons/Symbols-Delete-icon.png b/scribo/demo/shared/icons/Symbols-Delete-icon.png deleted file mode 100644 index 3f37439..0000000 Binary files a/scribo/demo/shared/icons/Symbols-Delete-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/accept-icon.png b/scribo/demo/shared/icons/accept-icon.png deleted file mode 100644 index d929648..0000000 Binary files a/scribo/demo/shared/icons/accept-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/close.gif b/scribo/demo/shared/icons/close.gif deleted file mode 100644 index ffcb2e6..0000000 Binary files a/scribo/demo/shared/icons/close.gif and /dev/null differ diff --git a/scribo/demo/shared/icons/crop-icon.png b/scribo/demo/shared/icons/crop-icon.png deleted file mode 100644 index 2e6b290..0000000 Binary files a/scribo/demo/shared/icons/crop-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/image-add-icon.png b/scribo/demo/shared/icons/image-add-icon.png deleted file mode 100644 index 0e4d29c..0000000 Binary files a/scribo/demo/shared/icons/image-add-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/image-edit-icon.png b/scribo/demo/shared/icons/image-edit-icon.png deleted file mode 100644 index 098cfab..0000000 Binary files a/scribo/demo/shared/icons/image-edit-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/image-multi-icon.png b/scribo/demo/shared/icons/image-multi-icon.png deleted file mode 100644 index 60fb23f..0000000 Binary files a/scribo/demo/shared/icons/image-multi-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/image-next-icon.png b/scribo/demo/shared/icons/image-next-icon.png deleted file mode 100644 index e8bc7dd..0000000 Binary files a/scribo/demo/shared/icons/image-next-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/image-remove-icon.png b/scribo/demo/shared/icons/image-remove-icon.png deleted file mode 100644 index 9d2bd94..0000000 Binary files a/scribo/demo/shared/icons/image-remove-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/next-icon.png b/scribo/demo/shared/icons/next-icon.png deleted file mode 100644 index 2d97d3b..0000000 Binary files a/scribo/demo/shared/icons/next-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/olena_smaller.jpg b/scribo/demo/shared/icons/olena_smaller.jpg deleted file mode 100644 index c6b9110..0000000 Binary files a/scribo/demo/shared/icons/olena_smaller.jpg and /dev/null differ diff --git a/scribo/demo/shared/icons/page-down-icon.png b/scribo/demo/shared/icons/page-down-icon.png deleted file mode 100644 index 5418a40..0000000 Binary files a/scribo/demo/shared/icons/page-down-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/page-search-icon.png b/scribo/demo/shared/icons/page-search-icon.png deleted file mode 100644 index 85e1718..0000000 Binary files a/scribo/demo/shared/icons/page-search-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/rotate_ccw.png b/scribo/demo/shared/icons/rotate_ccw.png deleted file mode 100644 index 7adafed..0000000 Binary files a/scribo/demo/shared/icons/rotate_ccw.png and /dev/null differ diff --git a/scribo/demo/shared/icons/rotate_cw.png b/scribo/demo/shared/icons/rotate_cw.png deleted file mode 100644 index 90aee82..0000000 Binary files a/scribo/demo/shared/icons/rotate_cw.png and /dev/null differ diff --git a/scribo/demo/shared/icons/search-add-icon.png b/scribo/demo/shared/icons/search-add-icon.png deleted file mode 100644 index 06c3db2..0000000 Binary files a/scribo/demo/shared/icons/search-add-icon.png and /dev/null differ diff --git a/scribo/demo/shared/icons/search-remove-icon.png b/scribo/demo/shared/icons/search-remove-icon.png deleted file mode 100644 index e770c67..0000000 Binary files a/scribo/demo/shared/icons/search-remove-icon.png and /dev/null differ diff --git a/scribo/demo/shared/shared.qrc b/scribo/demo/shared/shared.qrc deleted file mode 100644 index 3e1fd85..0000000 --- a/scribo/demo/shared/shared.qrc +++ /dev/null @@ -1,21 +0,0 @@ -<RCC> - <qresource prefix="icons"> - <file>icons/olena_smaller.jpg</file> - <file>icons/close.gif</file> - <file>icons/image-next-icon.png</file> - <file>icons/page-down-icon.png</file> - <file>icons/page-search-icon.png</file> - <file>icons/crop-icon.png</file> - <file>icons/image-remove-icon.png</file> - <file>icons/search-add-icon.png</file> - <file>icons/search-remove-icon.png</file> - <file>icons/Symbols-Delete-icon.png</file> - <file>icons/next-icon.png</file> - <file>icons/accept-icon.png</file> - <file>icons/image-add-icon.png</file> - <file>icons/image-multi-icon.png</file> - <file>icons/image-edit-icon.png</file> - <file>icons/rotate_cw.png</file> - <file>icons/rotate_ccw.png</file> - </qresource> -</RCC> diff --git a/scribo/demo/shared/src/bak/crop_item.cc b/scribo/demo/shared/src/bak/crop_item.cc deleted file mode 100644 index 5f22878..0000000 --- a/scribo/demo/shared/src/bak/crop_item.cc +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - - -#include <shared/src/crop_item.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - crop_item::crop_item(QGraphicsItem *parent) - : QGraphicsItem(parent) - { - _mousePress = false; - _cropRect = QRectF(20, 20, 100, 70); - setAcceptHoverEvents(true); - - grabMouse(); - } - - QRectF crop_item::cropRect(void) const - { - return(_cropRect); - } - - - QRectF crop_item::boundingRect(void) const - { - return(parentItem()->boundingRect()); - } - - void crop_item::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) - { - Q_UNUSED(widget); - - painter->save(); - - QPainterPath cropPath; - cropPath.addRect(_cropRect); - - QPainterPath windowPath; - windowPath.addRect(option->rect); - windowPath = windowPath.subtracted(cropPath); - - // Draw Alpha-Black Background. - painter->fillPath(windowPath, QColor(0x33, 0x33, 0x33, 0xcc)); - - // Draw Crop Rect - painter->setPen(QPen(QColor(0xdd, 0xdd, 0xdd), 1)); - painter->drawPath(cropPath); - - int topRightX = _cropRect.x() + _cropRect.width(); - int bottomY = _cropRect.y() + _cropRect.height(); - - // Draw Grid if mouse is Pressed - if (_mousePress) { - qreal f = 1.0f / CROP_GRID_SIZE; - qreal hsize = _cropRect.height() * f; - qreal wsize = _cropRect.width() * f; - - QPainterPath gridPath; - for (uint i = 1; i < CROP_GRID_SIZE; ++i) { - qreal y = _cropRect.y() + i * hsize; - gridPath.moveTo(_cropRect.x(), y); - gridPath.lineTo(topRightX, y); - - for (uint j = 1; j < CROP_GRID_SIZE; ++j) { - qreal x = _cropRect.x() + j * wsize; - gridPath.moveTo(x, _cropRect.y()); - gridPath.lineTo(x, bottomY); - } - } - - // Draw Grid Path - painter->setPen(QPen(QColor(0x99, 0x99, 0x99, 0x80), 1)); - painter->drawPath(gridPath); - } - - QPainterPath borderPath; -// // Top-Left Corner -// borderPath.moveTo(_cropRect.x(), _cropRect.y()); -// borderPath.lineTo(_cropRect.x() + CROP_BORDER_LINE, _cropRect.y()); -// borderPath.moveTo(_cropRect.x(), _cropRect.y()); -// borderPath.lineTo(_cropRect.x(), _cropRect.y() + CROP_BORDER_LINE); - -// // Top-Right Corner -// borderPath.moveTo(topRightX - CROP_BORDER_LINE, _cropRect.y()); -// borderPath.lineTo(topRightX, _cropRect.y()); -// borderPath.moveTo(topRightX, _cropRect.y()); -// borderPath.lineTo(topRightX, _cropRect.y() + CROP_BORDER_LINE); - -// // Bottom-Left Corner -// borderPath.moveTo(_cropRect.x(), bottomY); -// borderPath.lineTo(_cropRect.x() + CROP_BORDER_LINE, bottomY); -// borderPath.moveTo(_cropRect.x(), bottomY - CROP_BORDER_LINE); -// borderPath.lineTo(_cropRect.x(), bottomY); - -// // Bottom-Left Corner -// borderPath.moveTo(topRightX, bottomY); -// borderPath.lineTo(topRightX - CROP_BORDER_LINE, bottomY); -// borderPath.moveTo(topRightX, bottomY - CROP_BORDER_LINE); -// borderPath.lineTo(topRightX, bottomY); - - // Draw Border Path - painter->setPen(QPen(QColor(0xee, 0xee, 0xee), 3)); - painter->drawPath(borderPath); - - painter->restore(); - } - - - void crop_item::mousePressEvent(QGraphicsSceneMouseEvent *event) - { - QGraphicsItem::mousePressEvent(event); - - _mousePress = true; - _cropResize = CropItemResizeNone; - if (event->buttons() & Qt::LeftButton) - { - int lthreshold = (CROP_BORDER_LINE >> 1); - int rthreshold = CROP_BORDER_LINE; - int size = CROP_BORDER_LINE << 1; - - int rightX = _cropRect.x() + _cropRect.width() - rthreshold; - int leftX = _cropRect.x() - lthreshold; - - int bottomY = _cropRect.y() + _cropRect.height() - rthreshold; - int topY = _cropRect.y() - lthreshold; - - QRectF bottomRightCorner(rightX, bottomY, size, size); - QRectF bottomLeftCorner(leftX, bottomY, size, size); - QRectF topRightCorner(rightX, topY, size, size); - QRectF topLeftCorner(leftX, topY, size, size); - - int sideHeight = _cropRect.height() - 2 * size; - int sideWidth = _cropRect.width() - 2 * size; - QRectF leftSide(leftX, topY + size, size, sideHeight); - QRectF rightSide(rightX, topY + size, size, sideHeight); - QRectF topSide(leftX + size, topY, sideWidth, size); - QRectF bottomSide(leftX + size, bottomY, sideWidth, size); - - if (bottomRightCorner.contains(event->pos())) - _cropResize = CropItemResizeBottomRight; - else if (bottomLeftCorner.contains(event->pos())) - _cropResize = CropItemResizeBottomLeft; - else if (topRightCorner.contains(event->pos())) - _cropResize = CropItemResizeTopRight; - else if (topLeftCorner.contains(event->pos())) - _cropResize = CropItemResizeTopLeft; - else if (leftSide.contains(event->pos())) - _cropResize = CropItemResizeLeft; - else if (rightSide.contains(event->pos())) - _cropResize = CropItemResizeRight; - else if (topSide.contains(event->pos())) - _cropResize = CropItemResizeTop; - else if (bottomSide.contains(event->pos())) - _cropResize = CropItemResizeBottom; - } - - update(); - } - - - void crop_item::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) - { - QGraphicsItem::mouseReleaseEvent(event); - - _cropResize = CropItemResizeNone; - _mousePress = false; - - update(); - } - - - void crop_item::updateCursor(QGraphicsSceneMouseEvent *event) - { - int lthreshold = (CROP_BORDER_LINE >> 1); - int rthreshold = CROP_BORDER_LINE; - int size = CROP_BORDER_LINE << 1; - - int rightX = _cropRect.x() + _cropRect.width() - rthreshold; - int leftX = _cropRect.x() - lthreshold; - - int bottomY = _cropRect.y() + _cropRect.height() - rthreshold; - int topY = _cropRect.y() - lthreshold; - - QRectF bottomRightCorner(rightX, bottomY, size, size); - QRectF bottomLeftCorner(leftX, bottomY, size, size); - QRectF topRightCorner(rightX, topY, size, size); - QRectF topLeftCorner(leftX, topY, size, size); - - int sideHeight = _cropRect.height() - 2 * size; - int sideWidth = _cropRect.width() - 2 * size; - QRectF leftSide(leftX, topY + size, size, sideHeight); - QRectF rightSide(rightX, topY + size, size, sideHeight); - QRectF topSide(leftX + size, topY, sideWidth, size); - QRectF bottomSide(leftX + size, bottomY, sideWidth, size); - - if (bottomRightCorner.contains(event->pos())) - setCursor(Qt::SizeFDiagCursor); - else if (bottomLeftCorner.contains(event->pos())) - setCursor(Qt::SizeBDiagCursor); - else if (topRightCorner.contains(event->pos())) - setCursor(Qt::SizeBDiagCursor); - else if (topLeftCorner.contains(event->pos())) - setCursor(Qt::SizeFDiagCursor); - else if (leftSide.contains(event->pos())) - setCursor(Qt::SizeHorCursor); - else if (rightSide.contains(event->pos())) - setCursor(Qt::SizeHorCursor); - else if (topSide.contains(event->pos())) - setCursor(Qt::SizeVerCursor); - else if (bottomSide.contains(event->pos())) - setCursor(Qt::SizeVerCursor); - } - - - void crop_item::mouseMoveEvent(QGraphicsSceneMouseEvent *event) - { - updateCursor(event); - - QGraphicsItem::mouseMoveEvent(event); - - qreal minSize = 4 + (CROP_BORDER_LINE << 1); - - QPointF delta = event->pos() - event->lastPos(); - switch (_cropResize) - { - case CropItemResizeNone: - if (!_cropRect.contains(event->pos())) - return; - - setCursor(Qt::SizeAllCursor); - - if (!(event->buttons() & Qt::LeftButton)) - return; - - _cropRect.translate(delta); - break; - case CropItemResizeTopLeft: - delta.setY(qMin(_cropRect.height() - minSize, delta.y())); - delta.setX(qMin(_cropRect.width() - minSize, delta.x())); - _cropRect.setHeight(_cropRect.height() - delta.y()); - _cropRect.setWidth(_cropRect.width() - delta.x()); - _cropRect.translate(delta); - setCursor(Qt::SizeFDiagCursor); - break; - case CropItemResizeTopRight: - delta.setY(qMin(_cropRect.height() - minSize, delta.y())); - _cropRect.setWidth(_cropRect.width() + delta.x()); - _cropRect.setHeight(_cropRect.height() - delta.y()); - _cropRect.translate(0, delta.y()); - setCursor(Qt::SizeBDiagCursor); - break; - case CropItemResizeBottomLeft: - delta.setX(qMin(_cropRect.width() - minSize, delta.x())); - _cropRect.setHeight(_cropRect.height() + delta.y()); - _cropRect.setWidth(_cropRect.width() - delta.x()); - _cropRect.translate(delta.x(), 0); - setCursor(Qt::SizeBDiagCursor); - break; - case CropItemResizeBottomRight: - _cropRect.setWidth(_cropRect.width() + delta.x()); - _cropRect.setHeight(_cropRect.height() + delta.y()); - setCursor(Qt::SizeFDiagCursor); - break; - case CropItemResizeLeft: - delta.setX(qMin(_cropRect.width() - minSize, delta.x())); - _cropRect.setWidth(_cropRect.width() - delta.x()); - _cropRect.translate(delta.x(), 0); - setCursor(Qt::SizeHorCursor); - break; - case CropItemResizeRight: - _cropRect.setWidth(_cropRect.width() + delta.x()); - setCursor(Qt::SizeHorCursor); - break; - case CropItemResizeTop: - delta.setY(qMin(_cropRect.height() - minSize, delta.y())); - _cropRect.setHeight(_cropRect.height() - delta.y()); - _cropRect.translate(0, delta.y()); - setCursor(Qt::SizeVerCursor); - break; - case CropItemResizeBottom: - _cropRect.setHeight(_cropRect.height() + delta.y()); - setCursor(Qt::SizeVerCursor); - break; - } - - if (_cropRect.width() < minSize) - _cropRect.setWidth(minSize); - if (_cropRect.height() < minSize) - _cropRect.setHeight(minSize); - - update(); - } - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - diff --git a/scribo/demo/shared/src/bak/crop_item.hh b/scribo/demo/shared/src/bak/crop_item.hh deleted file mode 100644 index caf2032..0000000 --- a/scribo/demo/shared/src/bak/crop_item.hh +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. -// -// Based on the code located here: -// http://th30z.netsons.org/2010/01/qt4-image-crop-item/ - -#ifndef SCRIBO_DEMO_SHARED_SRC_CROP_ITEM_HH -# define SCRIBO_DEMO_SHARED_SRC_CROP_ITEM_HH - -#include <QStyleOptionGraphicsItem> -#include <QGraphicsSceneMouseEvent> -#include <QGraphicsScene> -#include <QGraphicsView> -#include <QGraphicsItem> -#include <QApplication> -#include <QPainter> -#include <QtGui> - -#define CROP_BORDER_LINE 10 -#define CROP_GRID_SIZE 3 - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - class crop_item : public QGraphicsItem - { - public: - crop_item(QGraphicsItem *parent); - QRectF cropRect (void) const; - - public: - QRectF boundingRect (void) const; - void paint (QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - - protected: - void mousePressEvent (QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent (QGraphicsSceneMouseEvent *event); - void updateCursor(QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - - private: - enum CropItemResize { - CropItemResizeNone, - - CropItemResizeTopLeft, - CropItemResizeTopRight, - CropItemResizeBottomLeft, - CropItemResizeBottomRight, - - CropItemResizeLeft, - CropItemResizeRight, - CropItemResizeTop, - CropItemResizeBottom - }; - - private: - CropItemResize _cropResize; - QRectF _cropRect; - bool _mousePress; - }; - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_CROP_ITEM_HH diff --git a/scribo/demo/shared/src/bak/image_viewer.cc b/scribo/demo/shared/src/bak/image_viewer.cc deleted file mode 100644 index 89d63d2..0000000 --- a/scribo/demo/shared/src/bak/image_viewer.cc +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory -// (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - - -# include <shared/src/image_viewer.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - image_viewer::image_viewer(QWidget *parent) - : QWidget(parent), item_(0) - { - setupUi(this); - - connect(image_->verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_vertical_sliders(int))); - connect(image_->horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_horizontal_sliders(int))); - - setup_scene(); - - slider->setMinimum(0); - visible_slider(false); - } - - - - image_viewer::~image_viewer() - { - - } - - unsigned image_viewer::current_slice() const - { - return slider->value(); - } - - internal::interactiveScene * image_viewer::scene() - { - return static_cast<internal::interactiveScene *>(image_->scene()); - } - - const internal::interactiveScene * image_viewer::scene() const - { - return static_cast<const internal::interactiveScene *>(image_->scene()); - } - - // Private members - - void image_viewer::setup_scene() - { - QGraphicsScene *scene = new internal::interactiveScene(); - image_->setScene(scene); - image_->show(); - } - - void image_viewer::draw_image(const mln::image2d<dsp_data_t>& ima) - { - QImage - qima = mln::convert::implementation::to_qimage_qt_rgb32_nocopy(ima); - QPixmap pixmap = QPixmap::fromImage(qima); - - if (item_ != 0) - { - image_->scene()->removeItem(item_); - delete item_; - } - - item_ = image_->scene()->addPixmap(pixmap); - image_->scene()->setSceneRect(item_->boundingRect()); - - if (pixmap.width() > image_->maximumViewportSize().width()) - image_->fitInView(item_->boundingRect(), Qt::KeepAspectRatio); - - zoomLabel->setEnabled(true); - zoomIn->setEnabled(true); - zoomOut->setEnabled(true); - zoomFixed->setEnabled(true); - zoomOriginal->setEnabled(true); - - item_->translate(ima.domain().pmin().col(), ima.domain().pmin().row()); - - image_->setSceneRect(item_->sceneBoundingRect()); - } - - - void image_viewer::resize_image(const QRectF& rect) - { - if (item_ != 0) - image_->fitInView(rect, Qt::KeepAspectRatio); - } - - void image_viewer::resizeEvent(QResizeEvent * event) - { - if (item_ != 0) - resize_image(item_->boundingRect()); - event->ignore(); - } - - - void image_viewer::keyPressEvent(QKeyEvent *event) - { - if (event->text() == QString("+")) - { - on_zoomIn_clicked(); - event->accept(); - } - else if (event->text() == QString("-")) - { - on_zoomOut_clicked(); - event->accept(); - } - else if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) - { - if (event->modifiers() == Qt::ControlModifier) - on_zoomFixed_clicked(); - else - on_zoomOriginal_clicked(); - event->accept(); - } - else - event->ignore(); - } - - - // Private slots - - void image_viewer::visible_slider(bool b) - { - slider->setVisible(b); - label_2->setVisible(b); - frame_nb->setVisible(b); - } - - void image_viewer::move_vertical_sliders(int value) - { - image_->verticalScrollBar()->setValue(value); - } - - - void image_viewer::move_horizontal_sliders(int value) - { - image_->horizontalScrollBar()->setValue(value); - } - - - void image_viewer::on_slider_valueChanged(int sli) - { - frame_nb->setText(QString("%1/%2").arg(sli).arg(slider->maximum())); - emit slider_valueChanged(sli); - } - - void image_viewer::update_image(const mln::image2d<dsp_data_t>& ima) - { - draw_image(ima); - } - - void image_viewer::on_zoomIn_clicked() - { - image_->scale(1.2, 1.2); - } - - void image_viewer::on_zoomOut_clicked() - { - image_->scale(1 / 1.2, 1 / 1.2); - } - - void image_viewer::on_zoomFixed_clicked() - { - if (item_ != 0) - resize_image(item_->boundingRect()); - } - - void image_viewer::on_zoomOriginal_clicked() - { - if (item_ != 0) - resize_image(image_->viewport()->geometry()); - } - - - void image_viewer::clear() - { - visible_slider(false); - if (item_ != 0 && item_->scene() == image_->scene()) - { - image_->scene()->removeItem(item_); - delete item_; - item_ = 0; - } - } - - - // Public slots - - void image_viewer::set_image_layer_count(unsigned nslis) - { - visible_slider(nslis > 1); - - slider->setMaximum(nslis - 1); - - unsigned sli = current_slice(); - if (current_slice() >= nslis) - sli = 0; - - slider->setSliderPosition(sli); - on_slider_valueChanged(sli); - } - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/shared/src/bak/image_viewer.hh b/scribo/demo/shared/src/bak/image_viewer.hh deleted file mode 100644 index f18ca3b..0000000 --- a/scribo/demo/shared/src/bak/image_viewer.hh +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH -# define SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH - -# include <QApplication> -# include <QtCore> -# include <QtGui> - -# include <ui_image_viewer.h> - -# include <mln/core/image/image2d.hh> -# include <mln/convert/to_qimage.hh> - -# include <shared/src/types.hh> -# include <shared/src/internal/interactive_scene.hh> - - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - class image_viewer - : public QWidget, private Ui::ImageViewer - { - Q_OBJECT; - - public: - image_viewer(QWidget *parent = 0); - ~image_viewer(); - - unsigned current_slice() const; - - internal::interactiveScene * scene(); - const internal::interactiveScene * scene() const; - - void clear(); - - private: // members - void setup_scene(); - - void draw_image(const mln::image2d<dsp_data_t>& ima); - - void resize_image(const QRectF& rect); - - void keyPressEvent(QKeyEvent *event); - void resizeEvent(QResizeEvent * event); -// void mouseMoveEvent(QMouseEvent *e); -// void mousePressEvent(QMouseEvent *e); -// void mouseReleasedEvent(QMouseEvent *e); - - private slots: - void visible_slider(bool b); - - void move_vertical_sliders(int value); - void move_horizontal_sliders(int value); - - void on_slider_valueChanged(int sli); - - void on_zoomIn_clicked(); - void on_zoomOut_clicked(); - void on_zoomFixed_clicked(); - void on_zoomOriginal_clicked(); - - - public slots: - void set_image_layer_count(unsigned nslis); - void update_image(const mln::image2d<dsp_data_t>& ima); - - - signals: - void slider_valueChanged(int sli); - - private: // attributes - QGraphicsItem *item_; - bool mouse_moving_; - QPoint p_start_; - }; - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH diff --git a/scribo/demo/shared/src/bak/types.hh b/scribo/demo/shared/src/bak/types.hh deleted file mode 100644 index 8edb54a..0000000 --- a/scribo/demo/shared/src/bak/types.hh +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_TYPES_HH -# define SCRIBO_DEMO_SHARED_SRC_TYPES_HH - - -# include <mln/value/qt/rgb32.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - typedef mln::value::qt::rgb32 dsp_data_t; - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // !SCRIBO_DEMO_SHARED_SRC_TYPES_HH diff --git a/scribo/demo/shared/src/browse_widget.cc b/scribo/demo/shared/src/browse_widget.cc deleted file mode 100644 index 67e553a..0000000 --- a/scribo/demo/shared/src/browse_widget.cc +++ /dev/null @@ -1,72 +0,0 @@ -#include <shared/src/browse_widget.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - - browse_widget::browse_widget(QWidget *parent) - : QWidget(parent) - { - setupUi(this); - - QStringList filters; - filters << tr("Any (*.*)"); - setDialogFilter(filters); - - setDialogFileMode(QFileDialog::ExistingFile); - setDialogTitle(tr("Choose an existing file")); - setDescription(tr("Choose a file:")); - } - - void browse_widget::setDescription(const QString& desc) - { - description_->setText(desc); - } - - QString browse_widget::path() const - { - return path_->text(); - } - - void browse_widget::reset() - { - path_->clear(); - } - - void browse_widget::setDialogTitle(const QString& title) - { - dialog_.setLabelText(QFileDialog::LookIn, title); - } - - void browse_widget::setDialogFileMode(const QFileDialog::FileMode& filemode) - { - dialog_.setFileMode(filemode); - } - - void browse_widget::setDialogFilter(const QStringList& filters) - { - dialog_.setNameFilters(filters); - } - - - void browse_widget::on_browseBtn__clicked() - { - if (dialog_.exec()) - { - path_->setText(dialog_.selectedFiles().at(0)); - emit path_updated(); - } - } - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/shared/src/browse_widget.hh b/scribo/demo/shared/src/browse_widget.hh deleted file mode 100644 index d30213c..0000000 --- a/scribo/demo/shared/src/browse_widget.hh +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_BROWSE_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_BROWSE_WIDGET_HH - -# include <QtGui> -# include <ui_browse_widget.h> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - - class browse_widget : public QWidget, protected Ui::BrowseWidget - { - Q_OBJECT; - - Q_PROPERTY(QString path READ path); - - public: - browse_widget(QWidget *parent = 0); - - void setDescription(const QString& desc); - void setDialogTitle(const QString& title); - void setDialogFileMode(const QFileDialog::FileMode& filemode); - void setDialogFilter(const QStringList& filters); - - QString path() const; - - void reset(); - - private slots: - void on_browseBtn__clicked(); - - signals: - void path_updated(); - - private: - QFileDialog dialog_; - }; - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_BROWSE_WIDGET_HH diff --git a/scribo/demo/shared/src/crop_item.cc b/scribo/demo/shared/src/crop_item.cc deleted file mode 100644 index 579eb65..0000000 --- a/scribo/demo/shared/src/crop_item.cc +++ /dev/null @@ -1,396 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - - -#include <shared/src/crop_item.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - - crop_item::crop_item(QGraphicsItem *parent) - : QGraphicsItem(parent) - { - mousePress_ = false; - setAcceptHoverEvents(true); -// draw_rect_ = scene()->sceneRect(); - - reset(); - - grabMouse(); - } - - - // Mouse is pressed. The rectangle must be created and about to - // be enlarged. - crop_item::crop_item(const QPointF& p, QGraphicsItem *parent) - : QGraphicsItem(parent) - { - mousePress_ = true; - setAcceptHoverEvents(true); - -// draw_rect_ = scene()->sceneRect(); - - cropRect_ = QRectF(p, QSize(4, 4)); - cropResize_ = CropItemResizeBottomRight; - - grabMouse(); - } - - crop_item::~crop_item() - { - - } - - void crop_item::reset() - { - cropRect_ = QRect(); -// if (parentItem()) -// cropRect_ = parentItem()->boundingRect(); -// else -// cropRect_ = QRectF(20, 20, 100, 70); - } - - QRectF crop_item::cropRect() const - { - return mapToScene(cropRect_).boundingRect(); - } - - - QRectF crop_item::boundingRect() const - { - return scene()->sceneRect(); -// return draw_rect_; - } - - void crop_item::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) - { - Q_UNUSED(widget); - - painter->save(); - - QPainterPath cropPath; - cropPath.addRect(cropRect_); - - QPainterPath windowPath; - windowPath.addRect(option->rect); -// windowPath.addRect(draw_rect_); - windowPath = windowPath.subtracted(cropPath); - - // Draw Alpha-Black Background. - painter->fillPath(windowPath, QColor(0x33, 0x33, 0x33, 0xcc)); - - // Draw Crop Rect - // QColor(0xdd, 0xdd, 0xdd) - painter->setPen(QPen(Qt::magenta, 3)); - painter->drawPath(cropPath); - - int topRightX = cropRect_.x() + cropRect_.width(); - int bottomY = cropRect_.y() + cropRect_.height(); - - QPainterPath borderPath; - int corner_width = std::min(int(cropRect_.width() / 6.f), 80); - int corner_height = std::min(int(cropRect_.height() / 6.f), 80); - - // Top-Left Corner - painter->drawRect(QRectF(cropRect_.x(), cropRect_.y(), - corner_width, corner_height)); - - - // Top-Right Corner - painter->drawRect(QRectF(topRightX - corner_width, cropRect_.y(), - corner_width, corner_height)); - - // Bottom-Left Corner - painter->drawRect(QRectF(cropRect_.x(), bottomY - corner_height, - corner_width, corner_height)); - - // Bottom-Left Corner - painter->drawRect(QRectF(topRightX - corner_width, - bottomY - corner_height, - corner_width, corner_height)); - - // Draw Border Path - painter->setPen(QPen(QColor(0xee, 0xee, 0xee), 3)); - painter->drawPath(borderPath); - - painter->restore(); - } - - - void crop_item::mousePressEvent(QGraphicsSceneMouseEvent *event) - { - QGraphicsItem::mousePressEvent(event); - - mousePress_ = true; - cropResize_ = CropItemResizeNone; - if (event->buttons() & Qt::LeftButton) - { - if (!cropRect_.isValid()) - { - cropRect_ = QRectF(event->pos(), QSize(4, 4)); - cropResize_ = CropItemResizeBottomRight; - update(); - return; - } - - - int wsize = std::min(int(cropRect_.width() / 6.f), 80); - int hsize = std::min(int(cropRect_.height() / 6.f), 80); - - int rightX = cropRect_.x() + cropRect_.width() - wsize; - int leftX = cropRect_.x(); - - int bottomY = cropRect_.y() + cropRect_.height() - hsize; - int topY = cropRect_.y(); - - QRectF bottomRightCorner(rightX, bottomY, wsize, hsize); - QRectF bottomLeftCorner(leftX, bottomY, wsize, hsize); - QRectF topRightCorner(rightX, topY, wsize, hsize); - QRectF topLeftCorner(leftX, topY, wsize, hsize); - - int sideHeight = cropRect_.height() - 2 * hsize; - int sideWidth = cropRect_.width() - 2 * wsize; - QRectF leftSide(leftX, topY + hsize, wsize, sideHeight); - QRectF rightSide(rightX, topY + hsize, wsize, sideHeight); - QRectF topSide(leftX + wsize, topY, sideWidth, hsize); - QRectF bottomSide(leftX + wsize, bottomY, sideWidth, hsize); - - if (bottomRightCorner.contains(event->pos())) - cropResize_ = CropItemResizeBottomRight; - else if (bottomLeftCorner.contains(event->pos())) - cropResize_ = CropItemResizeBottomLeft; - else if (topRightCorner.contains(event->pos())) - cropResize_ = CropItemResizeTopRight; - else if (topLeftCorner.contains(event->pos())) - cropResize_ = CropItemResizeTopLeft; - else if (leftSide.contains(event->pos())) - cropResize_ = CropItemResizeLeft; - else if (rightSide.contains(event->pos())) - cropResize_ = CropItemResizeRight; - else if (topSide.contains(event->pos())) - cropResize_ = CropItemResizeTop; - else if (bottomSide.contains(event->pos())) - cropResize_ = CropItemResizeBottom; - } - - update(); - } - - - void crop_item::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) - { - QGraphicsItem::mouseReleaseEvent(event); - - cropResize_ = CropItemResizeNone; - mousePress_ = false; - - update(); - } - - -// void crop_item::updateCursor(QGraphicsSceneMouseEvent *event) -// { -// int lthreshold = (CROP_BORDER_LINE >> 1); -// int rthreshold = CROP_BORDER_LINE; -// int size = CROP_BORDER_LINE << 1; - -// int rightX = cropRect_.x() + cropRect_.width() - rthreshold; -// int leftX = cropRect_.x() - lthreshold; - -// int bottomY = cropRect_.y() + cropRect_.height() - rthreshold; -// int topY = cropRect_.y() - lthreshold; - -// QRectF bottomRightCorner(rightX, bottomY, size, size); -// QRectF bottomLeftCorner(leftX, bottomY, size, size); -// QRectF topRightCorner(rightX, topY, size, size); -// QRectF topLeftCorner(leftX, topY, size, size); - -// int sideHeight = cropRect_.height() - 2 * size; -// int sideWidth = cropRect_.width() - 2 * size; -// QRectF leftSide(leftX, topY + size, size, sideHeight); -// QRectF rightSide(rightX, topY + size, size, sideHeight); -// QRectF topSide(leftX + size, topY, sideWidth, size); -// QRectF bottomSide(leftX + size, bottomY, sideWidth, size); - -// if (bottomRightCorner.contains(event->pos())) -// setCursor(Qt::SizeFDiagCursor); -// else if (bottomLeftCorner.contains(event->pos())) -// setCursor(Qt::SizeBDiagCursor); -// else if (topRightCorner.contains(event->pos())) -// setCursor(Qt::SizeBDiagCursor); -// else if (topLeftCorner.contains(event->pos())) -// setCursor(Qt::SizeFDiagCursor); -// else if (leftSide.contains(event->pos())) -// setCursor(Qt::SizeHorCursor); -// else if (rightSide.contains(event->pos())) -// setCursor(Qt::SizeHorCursor); -// else if (topSide.contains(event->pos())) -// setCursor(Qt::SizeVerCursor); -// else if (bottomSide.contains(event->pos())) -// setCursor(Qt::SizeVerCursor); -// } - - - void crop_item::mouseMoveEvent(QGraphicsSceneMouseEvent *event) - { -// updateCursor(event); - - QGraphicsItem::mouseMoveEvent(event); - - QPointF delta = event->pos() - event->lastPos(); - - if (cropResize_ == CropItemResizeNone) - { - if (//!cropRect_.contains(event->pos()) - (!(event->buttons() & Qt::LeftButton))) - return; - - // Moving existing rectangle - setCursor(Qt::SizeAllCursor); - cropRect_.translate(delta); - -// draw_rect_.translate(delta); - update(); - return; - } - - resize(delta); - } - - - void crop_item::resize(const QPointF& delta_) - { - qreal minSize = 4 + (CROP_BORDER_LINE << 1); - QPointF delta = delta_; - - QRectF tmp = cropRect_; - switch (cropResize_) - { - case CropItemResizeTopLeft: - delta.setY(qMin(cropRect_.height() - minSize, delta.y())); - delta.setX(qMin(cropRect_.width() - minSize, delta.x())); - cropRect_.setHeight(cropRect_.height() - delta.y()); - cropRect_.setWidth(cropRect_.width() - delta.x()); - cropRect_.translate(delta); - setCursor(Qt::SizeFDiagCursor); - break; - case CropItemResizeTopRight: - delta.setY(qMin(cropRect_.height() - minSize, delta.y())); - cropRect_.setWidth(cropRect_.width() + delta.x()); - cropRect_.setHeight(cropRect_.height() - delta.y()); - cropRect_.translate(0, delta.y()); - setCursor(Qt::SizeBDiagCursor); - break; - case CropItemResizeBottomLeft: - delta.setX(qMin(cropRect_.width() - minSize, delta.x())); - cropRect_.setHeight(cropRect_.height() + delta.y()); - cropRect_.setWidth(cropRect_.width() - delta.x()); - cropRect_.translate(delta.x(), 0); - setCursor(Qt::SizeBDiagCursor); - break; - - default: - case CropItemResizeBottomRight: - cropRect_.setWidth(cropRect_.width() + delta.x()); - cropRect_.setHeight(cropRect_.height() + delta.y()); - setCursor(Qt::SizeFDiagCursor); - break; - - case CropItemResizeLeft: - delta.setX(qMin(cropRect_.width() - minSize, delta.x())); - cropRect_.setWidth(cropRect_.width() - delta.x()); - cropRect_.translate(delta.x(), 0); - setCursor(Qt::SizeHorCursor); - break; - case CropItemResizeRight: - cropRect_.setWidth(cropRect_.width() + delta.x()); - setCursor(Qt::SizeHorCursor); - break; - case CropItemResizeTop: - delta.setY(qMin(cropRect_.height() - minSize, delta.y())); - cropRect_.setHeight(cropRect_.height() - delta.y()); - cropRect_.translate(0, delta.y()); - setCursor(Qt::SizeVerCursor); - break; - case CropItemResizeBottom: - cropRect_.setHeight(cropRect_.height() + delta.y()); - setCursor(Qt::SizeVerCursor); - break; - } - - if (cropRect_.width() < minSize) - cropRect_.setWidth(minSize); - if (cropRect_.height() < minSize) - cropRect_.setHeight(minSize); - - - // Updating bounding rect. -// if ((cropRect_.width() * cropRect_.height()) < (tmp.width() * tmp.height())) -// draw_rect_ = tmp; -// else -// draw_rect_ = cropRect_; - - update(); - } - - - void crop_item::mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event) - { - QGraphicsItem::mouseDoubleClickEvent(event); - - switch (cropResize_) - { - case CropItemResizeNone: - if (!cropRect_.contains(event->pos())) - return; - - setCursor(Qt::SizeAllCursor); - - if (!(event->buttons() & Qt::LeftButton)) - return; - - emit ready_for_crop(); - break; - - default: - break; - } - } - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - diff --git a/scribo/demo/shared/src/crop_item.hh b/scribo/demo/shared/src/crop_item.hh deleted file mode 100644 index 7978538..0000000 --- a/scribo/demo/shared/src/crop_item.hh +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. -// -// Based on the code located here: -// http://th30z.netsons.org/2010/01/qt4-image-crop-item/ - -#ifndef SCRIBO_DEMO_SHARED_SRC_CROP_ITEM_HH -# define SCRIBO_DEMO_SHARED_SRC_CROP_ITEM_HH - -#include <QStyleOptionGraphicsItem> -#include <QGraphicsSceneMouseEvent> -#include <QGraphicsScene> -#include <QGraphicsView> -#include <QGraphicsItem> -#include <QApplication> -#include <QPainter> -#include <QtGui> - -#define CROP_BORDER_LINE 10 -#define CROP_GRID_SIZE 3 - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - class crop_item : public QObject, public QGraphicsItem - { - Q_OBJECT; - - public: - crop_item(QGraphicsItem *parent); - - // Mouse is pressed. The rectangle must be created and about - // to be enlarged. - crop_item(const QPointF& p, QGraphicsItem *parent); - - virtual ~crop_item(); - - QRectF cropRect() const; - - QRectF boundingRect() const; - void paint (QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - - void reset(); - - void resize(const QPointF& delta); - - protected: - void mousePressEvent (QGraphicsSceneMouseEvent *event); - void mouseReleaseEvent (QGraphicsSceneMouseEvent *event); - void mouseMoveEvent(QGraphicsSceneMouseEvent *event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent * event); - -// void updateCursor(QGraphicsSceneMouseEvent *event); - - signals: - void ready_for_crop(); - - private: - enum CropItemResize - { - CropItemResizeNone, - - CropItemResizeTopLeft, - CropItemResizeTopRight, - CropItemResizeBottomLeft, - CropItemResizeBottomRight, - - CropItemResizeLeft, - CropItemResizeRight, - CropItemResizeTop, - CropItemResizeBottom - }; - - private: - CropItemResize cropResize_; - QRectF cropRect_; - QRectF draw_rect_; - bool mousePress_; - }; - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_CROP_ITEM_HH diff --git a/scribo/demo/shared/src/image_viewer.cc b/scribo/demo/shared/src/image_viewer.cc deleted file mode 100644 index 416f822..0000000 --- a/scribo/demo/shared/src/image_viewer.cc +++ /dev/null @@ -1,410 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory -// (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - - -# include <shared/src/image_viewer.hh> -# include <shared/src/crop_item.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - image_viewer::image_viewer(QWidget *parent) - : QWidget(parent), image_(0), selection_(0), angle_(0), - zoom_fixed_(false) - { - setupUi(this); - - connect(viewer_->verticalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_vertical_sliders(int))); - connect(viewer_->horizontalScrollBar(), SIGNAL(valueChanged(int)), - this, SLOT(move_horizontal_sliders(int))); - - setup_scene(); - - slider->setMinimum(0); - visible_slider(false); - - set_selection_enabled(false); - set_rotation_enabled(false); - - // Set cache limit to 20Mb. - QPixmapCache::setCacheLimit(20480); - } - - - - image_viewer::~image_viewer() - { - - } - - unsigned image_viewer::current_slice() const - { - return slider->value(); - } - - internal::interactiveScene * image_viewer::scene() - { - return static_cast<internal::interactiveScene *>(viewer_->scene()); - } - - const internal::interactiveScene * image_viewer::scene() const - { - return static_cast<const internal::interactiveScene *>(viewer_->scene()); - } - - // Private members - - void image_viewer::setup_scene() - { - QGraphicsScene *scene = new internal::interactiveScene(); - viewer_->setScene(scene); - viewer_->show(); - } - - - void image_viewer::draw_image(const QPixmap& pixmap) - { - draw_image(pixmap, QPoint(0, 0)); - } - - - void image_viewer::draw_image(const QPixmap& pixmap, - const QPoint& origin) - { - bool restore_selection = false; - - if (image_ != 0) - { - viewer_->scene()->removeItem(image_); - delete image_; - - if (selection_) - { - selection_ = 0; - restore_selection = true; - } - } - - image_ = viewer_->scene()->addPixmap(pixmap); - image_->setCacheMode(QGraphicsItem::DeviceCoordinateCache, - QSize(100,100)); - viewer_->scene()->setSceneRect(image_->boundingRect()); - - if (pixmap.width() > viewer_->maximumViewportSize().width()) - viewer_->fitInView(image_->boundingRect(), Qt::KeepAspectRatio); - - enable_widgets(true); - - image_->translate(origin.x(), origin.y()); - - - viewer_->setSceneRect(image_->sceneBoundingRect()); - - // Restore selection mode if needed - setup_selection_tool(restore_selection); - } - - - void image_viewer::resize_image(const QRectF& rect) - { - if (image_ != 0) - viewer_->fitInView(rect, Qt::KeepAspectRatio); - } - - void image_viewer::resizeEvent(QResizeEvent * event) - { - if (zoom_fixed_) - on_zoomFixed_clicked(); - else - on_zoomOriginal_clicked(); - - event->ignore(); - } - - void image_viewer::keyPressEvent(QKeyEvent *event) - { - if (event->text() == QString("+")) - { - on_zoomIn_clicked(); - event->accept(); - } - else if (event->text() == QString("-")) - { - on_zoomOut_clicked(); - event->accept(); - } - else if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) - { - if (event->modifiers() == Qt::ControlModifier) - on_zoomFixed_clicked(); - else - on_zoomOriginal_clicked(); - event->accept(); - } - else - event->ignore(); - } - - - // Private slots - - void image_viewer::visible_slider(bool b) - { - slider->setVisible(b); - label_2->setVisible(b); - frame_nb->setVisible(b); - } - - void image_viewer::move_vertical_sliders(int value) - { - viewer_->verticalScrollBar()->setValue(value); - } - - - void image_viewer::move_horizontal_sliders(int value) - { - viewer_->horizontalScrollBar()->setValue(value); - } - - - void image_viewer::on_slider_valueChanged(int sli) - { - frame_nb->setText(QString("%1/%2").arg(sli).arg(slider->maximum())); - emit slider_valueChanged(sli); - } - - void image_viewer::update_image(const mln::image2d<dsp_data_t>& ima) - { - draw_image(ima); - } - - void image_viewer::on_rotate_cw_btn_clicked() - { - angle_ += 90 % 360; - image_->rotate(90); - viewer_->setSceneRect(image_->sceneBoundingRect()); - } - - void image_viewer::on_rotate_ccw_btn_clicked() - { - angle_ -= 90 % 360; - image_->rotate(-90); - viewer_->setSceneRect(image_->sceneBoundingRect()); - } - - void image_viewer::on_zoomIn_clicked() - { - viewer_->scale(1.2, 1.2); - } - - void image_viewer::on_zoomOut_clicked() - { - viewer_->scale(1 / 1.2, 1 / 1.2); - } - - void image_viewer::on_zoomFixed_clicked() - { - zoom_fixed_ = true; - if (image_ != 0) - resize_image(image_->boundingRect()); - } - - void image_viewer::on_zoomOriginal_clicked() - { - zoom_fixed_ = false; - if (image_ != 0) - resize_image(viewer_->viewport()->geometry()); - } - - - void image_viewer::new_mouse_selection_slot(const QPointF& p) - { - if (selection_) - { - if (selection_->cropRect().contains(p)) - return; - else - { - setup_selection_tool(false); - return; - } - } - - setup_selection_tool(false); // Remove previous selection. - setup_selection_tool(true, p); // Create new selection. - } - - - void image_viewer::new_mouse_released_slot(const QPointF&) - { - if (selection_ && !selection_->cropRect().isValid()) // CAS POURRI!! - setup_selection_tool(false); - } - - - void image_viewer::clear() - { - visible_slider(false); - if (image_ != 0 && image_->scene() == viewer_->scene()) - { - viewer_->scene()->removeItem(image_); - delete image_; - image_ = 0; - } - } - - void image_viewer::setup_selection_tool(bool b, const QPointF& p) - { - if (b) - { - if (viewer_->scene() && selection_ == 0) - { - if (!p.isNull()) - selection_ = new crop_item(p, image_); - else - selection_ = new crop_item(image_); - - // Enable cropping on double click. - connect(selection_, SIGNAL(ready_for_crop()), - this, SIGNAL(ready_for_crop())); - } - } - else - { - delete selection_; - selection_ = 0; - } - } - - - void image_viewer::set_selection_enabled(bool b) - { - if (b) - { - connect(viewer_->scene(), SIGNAL(mouse_pressed(const QPointF&)), - this, SLOT(new_mouse_selection_slot(const QPointF&))); - connect(viewer_->scene(), SIGNAL(mouse_released(const QPointF&)), - this, SLOT(new_mouse_released_slot(const QPointF&))); - } - else - { - disconnect(viewer_->scene(), SIGNAL(mouse_pressed(const QPointF&)), - this, SLOT(new_mouse_selection_slot(const QPointF&))); - disconnect(viewer_->scene(), SIGNAL(mouse_released(const QPointF&)), - this, SLOT(new_mouse_released_slot(const QPointF&))); - } - } - - - void image_viewer::set_rotation_enabled(bool b) - { - angle_ = 0; - rotate_lbl->setVisible(b); - rotate_cw_btn->setVisible(b); - rotate_ccw_btn->setVisible(b); - vline->setVisible(b); - } - - - bool image_viewer::has_selection() const - { - return selection_; - } - - - QRectF image_viewer::selection() const - { - static QRectF invalid_selection; - - if (has_selection()) - return selection_->cropRect(); - - return invalid_selection; - } - - - bool image_viewer::has_rotation() const - { - return rotate_lbl->isVisible(); - } - - - qreal image_viewer::rotation() const - { - mln_assertion(has_rotation()); - - return angle_; - } - - - QPixmap image_viewer::image() const - { - return image_->pixmap(); - } - - // Public slots - - void image_viewer::set_image_layer_count(unsigned nslis) - { - visible_slider(nslis > 1); - - slider->setMaximum(nslis - 1); - - unsigned sli = current_slice(); - if (current_slice() >= nslis) - sli = 0; - - slider->setSliderPosition(sli); - on_slider_valueChanged(sli); - } - - - void image_viewer::enable_widgets(bool b) - { - zoomLabel->setEnabled(b); - zoomIn->setEnabled(b); - zoomOut->setEnabled(b); - zoomFixed->setEnabled(b); - zoomOriginal->setEnabled(b); - - rotate_ccw_btn->setEnabled(b); - rotate_cw_btn->setEnabled(b); - rotate_lbl->setEnabled(b); - } - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/shared/src/image_viewer.hh b/scribo/demo/shared/src/image_viewer.hh deleted file mode 100644 index 539e17d..0000000 --- a/scribo/demo/shared/src/image_viewer.hh +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH -# define SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH - -# include <QApplication> -# include <QtCore> -# include <QtGui> - -# include <ui_image_viewer.h> - -# include <mln/core/image/image2d.hh> -# include <mln/convert/to_qimage_nocopy.hh> - -# include <shared/src/types.hh> -# include <shared/src/internal/interactive_scene.hh> - - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - // Forward declaration. - class crop_item; - - class image_viewer - : public QWidget, private Ui::ImageViewer - { - Q_OBJECT; - - public: - image_viewer(QWidget *parent = 0); - ~image_viewer(); - - template <typename V> - void draw_image(const mln::image2d<V>& ima); - void draw_image(const QPixmap& pixmap); - void draw_image(const QPixmap& pixmap, const QPoint& origin); - - unsigned current_slice() const; - - internal::interactiveScene * scene(); - const internal::interactiveScene * scene() const; - - void clear(); - - void set_selection_enabled(bool b); -// void set_mouse_selection_enabled(bool b); - void set_rotation_enabled(bool b); - - - bool has_selection() const; - QRectF selection() const; - - bool has_rotation() const; - qreal rotation() const; - - QPixmap image() const; - - private: // members - void setup_scene(); - - void resize_image(const QRectF& rect); - - void keyPressEvent(QKeyEvent *event); - void resizeEvent(QResizeEvent * event); - - void enable_widgets(bool b); - - private slots: - void visible_slider(bool b); - - void move_vertical_sliders(int value); - void move_horizontal_sliders(int value); - - void setup_selection_tool(bool b, const QPointF& p = QPointF()); - - void on_slider_valueChanged(int sli); - - void on_rotate_cw_btn_clicked(); - void on_rotate_ccw_btn_clicked(); - - void on_zoomIn_clicked(); - void on_zoomOut_clicked(); - void on_zoomFixed_clicked(); - void on_zoomOriginal_clicked(); - - void new_mouse_selection_slot(const QPointF&); - void new_mouse_released_slot(const QPointF& p); -// void selection_mouse_moved_slot(const QPointF& p); - - public slots: - void set_image_layer_count(unsigned nslis); - void update_image(const mln::image2d<dsp_data_t>& ima); - - signals: - void slider_valueChanged(int sli); - void ready_for_crop(); - - private: // attributes - QGraphicsPixmapItem* image_; - crop_item* selection_; - bool mouse_moving_; - QPoint p_start_; - qreal angle_; - - bool zoom_fixed_; - }; - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -# include <shared/src/image_viewer.hxx> - -#endif // ! SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH diff --git a/scribo/demo/shared/src/image_viewer.hxx b/scribo/demo/shared/src/image_viewer.hxx deleted file mode 100644 index c7008a7..0000000 --- a/scribo/demo/shared/src/image_viewer.hxx +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef SCRIBO_DEMO_SHARED_SRC_IMAGE_VIEWER_HH -# error "This file cannot be included directly." -#endif - - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - - template <typename V> - void image_viewer::draw_image(const mln::image2d<V>& ima) - { - QImage - qima = mln::convert::to_qimage_nocopy(ima); - QPixmap pixmap = QPixmap::fromImage(qima); - - draw_image(pixmap, QPoint(ima.domain().pmin().col(), - ima.domain().pmin().row())); - } - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/shared/src/internal.bak/interactive_scene.cc b/scribo/demo/shared/src/internal.bak/interactive_scene.cc deleted file mode 100644 index b839f6b..0000000 --- a/scribo/demo/shared/src/internal.bak/interactive_scene.cc +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -# include <shared/src/internal/interactive_scene.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - - struct test : public QGraphicsItem - { - test() - { - setZValue(0); - setCursor(Qt::OpenHandCursor); - - } - - void mousePressEvent(QGraphicsSceneMouseEvent *event) - { - setCursor(Qt::ClosedHandCursor); - } - - void mouseMoveEvent(QGraphicsSceneMouseEvent *event) - { - setCursor(Qt::OpenHandCursor); - } - - void mouseReleaseEvent(QGraphicsSceneMouseEvent *) - { - setCursor(Qt::OpenHandCursor); - } - - void paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) - { - painter->setPen(Qt::NoPen); - painter->setBrush(Qt::darkGray); - painter->drawEllipse(-12, -12, 30, 30); - painter->setPen(QPen(Qt::black, 1)); - painter->setBrush(QBrush(Qt::red)); - painter->drawEllipse(-15, -15, 30, 30); - - painter->setBrush(QColor(0, 0, 0, 127)); - painter->drawRect(scene()->sceneRect()); - - } - - QRectF boundingRect() const - { - return QRectF(-15.5, -15.5, 34, 34); - } - - }; - - - - interactiveScene::interactiveScene(QObject * parent) - : QGraphicsScene(parent), mode_(Drawing), - mouse_moved_(false), mouse_pressed_(false), - selectionTracking_(false) - { - rect_.setZValue(1); - - QPen pen; - pen.setColor(QColor(Qt::black)); - pen.setStyle(Qt::SolidLine); - pen.setWidth(1); - - rect_.setPen(pen); - - setSceneRect(QRectF(-150, -150, 300, 300)); - - addItem(new test()); - } - - - void interactiveScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) - { - if (mouse_pressed_) - { - // If selection is enabled. - if (selectionTracking_) - { - switch(mode_) - { - // Moving an existing selection. - case Moving: - { - QPointF p = e->scenePos() - e->lastScenePos(); - rect_.translate(p.x(), p.y()); - e->accept(); - break; - } - - // A new selection must be extended. - case Drawing: - { - rect_.setRect(QRectF(e->buttonDownScenePos(Qt::LeftButton), - e->scenePos())); - e->accept(); - break; - } - - - // Extending an existing selection - case Extending: - { - rect_.update_size(rect_corner_, e->scenePos()); - break; - } - - default: - qDebug() << "interactiveScene::mouseMoveEvent - Invalid mode"; - } - - emit mouse_pressed(e->scenePos()); - mouse_moved_ = true; - } - } - else - super_::mouseMoveEvent(e); - - emit mouse_moved(e->scenePos()); - } - - void interactiveScene::mousePressEvent(QGraphicsSceneMouseEvent *e) - { - mouse_moved_ = false; - mouse_pressed_ = true; - pressed_point_ = e->scenePos(); - - emit mouse_pressed(e->scenePos()); - - // If selection is enabled. - if (selectionTracking_) - { - // About to move an existing rectangle. - QGraphicsItem *item = itemAt(e->scenePos()); - if (item == &rect_) - { - mode_ = Moving; - super_::mousePressEvent(e); - } - else if (item != 0) - { - mode_ = Extending; - rect_corner_ = item; - super_::mousePressEvent(e); - } - // Draw a new rectangle - else - { - mode_ = Drawing; - rect_.resetTransform(); - rect_.setRect(QRectF(e->scenePos(), e->scenePos())); - if (rect_.scene() != this) - addItem(&rect_); - e->accept(); - } - } - } - - void interactiveScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) - { - mouse_pressed_ = false; - - switch(mode_) - { - - case Drawing: - { - if (selectionTracking_ && mouse_moved_) - emit new_selection(rect_.boundingRect()); - else - { - // A mouse click is performed outside the selection - // rectangle. - // Clear selection if exists. - if (mode_ != Moving && rect_.scene() == this) - { - rect_.setRect(sceneRect()); - removeItem(&rect_); - emit selection_cleared(); - } - } - break; - } - - case Moving: - { - if (mouse_moved_) - { - QPointF p = e->scenePos() - pressed_point_; - - - // FIXME: the bounding rectangle size is increasing by - // 0.5 pixels for an unknown reason... - rect_.setRect(rect_.boundingRect().translated(p.x(), p.y())); - rect_.resetTransform(); - } - break; - } - - - case Extending: - { - break; - } - - default: - qDebug() << "interactiveScene::mouseReleaseEvent - invalid mode"; - - } - - - if (!mouse_moved_) - emit mouse_click(e->scenePos()); - - emit mouse_released(e->scenePos()); - - e->accept(); - } - - - void interactiveScene::setSelectionTracking(bool b) - { - selectionTracking_ = b; - } - - bool interactiveScene::has_selection() const - { - return rect_.scene() == this; - } - - QRectF interactiveScene::selection() const - { - return rect_.boundingRect(); - } - - void interactiveScene::clear_selection() - { - if (rect_.scene() == this) - removeItem(&rect_); - } - - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln diff --git a/scribo/demo/shared/src/internal.bak/interactive_scene.hh b/scribo/demo/shared/src/internal.bak/interactive_scene.hh deleted file mode 100644 index 5888152..0000000 --- a/scribo/demo/shared/src/internal.bak/interactive_scene.hh +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_INTERNAL_INTERACTIVE_SCENE_HH -# define SCRIBO_DEMO_SHARED_SRC_INTERNAL_INTERACTIVE_SCENE_HH - -# include <QtGui/QGraphicsScene> -# include <QtGui/QGraphicsSceneMouseEvent> -# include <QtGui/QGraphicsLineItem> -# include <QtCore/QPoint> -# include <QtCore/QDebug> - -# include <shared/src/internal/selection_rectangle.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - enum Mode - { - Moving, - Drawing, - Extending - }; - - class interactiveScene : public QGraphicsScene - { - Q_OBJECT; - - typedef QGraphicsScene super_; - - public: - - interactiveScene(QObject * parent = 0); - - void mouseMoveEvent(QGraphicsSceneMouseEvent *e); - void mousePressEvent(QGraphicsSceneMouseEvent *e); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); - - void setSelectionTracking(bool b); - - bool has_selection() const; - QRectF selection() const; - void clear_selection(); - - signals: - void mouse_click(const QPointF& p); - void mouse_moved(const QPointF& p); - void mouse_pressed(const QPointF& p); - void mouse_released(const QPointF& p); - - void new_selection(const QRectF& rect); - void selection_cleared(); - - private: - selection_rectangle rect_; - - QGraphicsItem* rect_corner_; - - QPointF pressed_point_; - - Mode mode_; - - bool mouse_moved_; - bool mouse_pressed_; - bool selectionTracking_; - }; - - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln - -#endif // ! SCRIBO_DEMO_SHARED_SRC_INTERNAL_INTERACTIVE_SCENE_HH diff --git a/scribo/demo/shared/src/internal.bak/selection_rectangle.cc b/scribo/demo/shared/src/internal.bak/selection_rectangle.cc deleted file mode 100644 index d3f82b7..0000000 --- a/scribo/demo/shared/src/internal.bak/selection_rectangle.cc +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <QtGui> -#include <shared/src/internal/selection_rectangle.hh> - - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - selection_rectangle::selection_rectangle() - { - QPen pen; - pen.setColor(QColor(Qt::red)); - pen.setStyle(Qt::SolidLine); - pen.setWidth(1); - - - rects_.resize(9); - for (int i = 0; i < rects_.size(); ++i) - { - rects_[i] = new QGraphicsRectItem(this); - rects_[i]->setZValue(1); - rects_[i]->setPen(pen); - rects_[i]->show(); - rects_[i]->setAcceptHoverEvents(true); - } - - rects_[1]->setCursor(Qt::SizeFDiagCursor); - rects_[2]->setCursor(Qt::SizeVerCursor); - rects_[3]->setCursor(Qt::SizeBDiagCursor); - rects_[4]->setCursor(Qt::SizeHorCursor); - rects_[5]->setCursor(Qt::SizeHorCursor); - rects_[6]->setCursor(Qt::SizeBDiagCursor); - rects_[7]->setCursor(Qt::SizeVerCursor); - rects_[8]->setCursor(Qt::SizeFDiagCursor); - -// setHandlesChildEvents(true); - setCursor(Qt::SizeAllCursor); - setAcceptHoverEvents(true); - } - - - selection_rectangle::~selection_rectangle() - { - foreach(QGraphicsRectItem *item, rects_) - delete item; - } - - - void selection_rectangle::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) - { - /* - -------------- - |1| 2 |3| - |--========--| - | || || | - | || || | - |4|| ||5| - | || || | - | || || | - |--========--| - |6| 7 |8| - -------------- - */ - - qreal border = 15; - qreal corner_width = qMin(qAbs(1/8.f * brect_.width()), border); - qreal corner_height = qMin(qAbs(1/8.f * brect_.height()), border); - - painter->setBrush(QColor(255, 255, 255, 127)); - painter->drawRect(brect_); - - // Rectangle 1 - QRectF rect1(brect_.topLeft().x(), brect_.topLeft().y(), - corner_width, - corner_height); - rects_[1]->setRect(rect1); - - // Rectangle 2 - QRectF rect2(rect1.topRight().x(), rect1.topRight().y(), - brect_.width() - 2 * corner_width, - corner_height); - rects_[2]->setRect(rect2); - - // Rectangle 3 - QRectF rect3(brect_.topRight().x() - corner_width, - brect_.topRight().y(), - corner_width, - corner_height); - rects_[3]->setRect(rect3); - - - - // Rectangle 4 - QRectF rect4(brect_.topLeft().x(), - brect_.topLeft().y() + corner_height, - corner_width, - brect_.height() - corner_height); - rects_[4]->setRect(rect4); - - // Rectangle 5 - QRectF rect5(brect_.topRight().x() - corner_width, - brect_.topRight().y() + corner_height, - corner_width, - brect_.height() - corner_height); - rects_[5]->setRect(rect5); - - - - // Rectangle 6 - QRectF rect6(brect_.bottomLeft().x(), - brect_.bottomLeft().y() - corner_height, - corner_width, - corner_height); - rects_[6]->setRect(rect6); - - // Rectangle 7 - QRectF rect7(rect6.topRight().x(), rect6.topRight().y(), - brect_.width() - 2 * corner_width, - corner_height); - rects_[7]->setRect(rect7); - - // Rectangle 8 - QRectF rect8(rect7.topRight().x(), rect7.topRight().y(), - corner_width, - corner_height); - rects_[8]->setRect(rect8); - - - painter->setPen(pen()); - painter->drawRect(brect_); - } - - - QRectF selection_rectangle::boundingRect() const - { - qreal penWidth = pen().width(); - return QRectF(brect_.x() - penWidth / 2, brect_.y() - penWidth / 2, - brect_.width() + penWidth / 2, - brect_.height() + penWidth / 2); - } - - - void selection_rectangle::setRect(qreal x, qreal y, - qreal width, qreal height) - { - prepareGeometryChange(); - brect_ = QRectF(x, y, width, height).normalized(); - } - - - void selection_rectangle::setRect(const QRectF & rectangle) - { - prepareGeometryChange(); - brect_ = rectangle.normalized(); - } - - - void selection_rectangle::update_size(QGraphicsItem *item, - const QPointF& p) - { - /* - -------------- - |1| 2 |3| - |--========--| - | || || | - | || || | - |4|| ||5| - | || || | - | || || | - |--========--| - |6| 7 |8| - -------------- - */ - QPointF p_ = p; - - prepareGeometryChange(); - if (rects_[1] == item) - brect_.setTopLeft(p_); - else if (rects_[2] == item) - brect_.setTop(p_.y()); - else if (rects_[3] == item) - brect_.setTopRight(p_); - else if (rects_[4] == item) - brect_.setLeft(p_.x()); - else if (rects_[5] == item) - brect_.setRight(p_.x()); - else if (rects_[6] == item) - brect_.setBottomLeft(p_); - else if (rects_[7] == item) - brect_.setBottom(p_.y()); - else if (rects_[8] == item) - brect_.setBottomRight(p_); - else - qDebug() << "selection_rectangle::update_size - invalid item"; - - brect_ = brect_.normalized(); - } - - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln diff --git a/scribo/demo/shared/src/internal.bak/selection_rectangle.hh b/scribo/demo/shared/src/internal.bak/selection_rectangle.hh deleted file mode 100644 index b58bad2..0000000 --- a/scribo/demo/shared/src/internal.bak/selection_rectangle.hh +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_INTERNAL_SELECTION_RECTANGLE_HH -# define SCRIBO_DEMO_SHARED_SRC_INTERNAL_SELECTION_RECTANGLE_HH - -# include <QtCore> -# include <QtGui> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - class selection_rectangle : public QAbstractGraphicsShapeItem - { - - public: - selection_rectangle(); - ~selection_rectangle(); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - - QRectF boundingRect() const; - - void setRect(qreal x, qreal y, qreal width, qreal height); - void setRect(const QRectF & rectangle); - - void update_size(QGraphicsItem *item, const QPointF& p); - - private: // members - - - private: // attributes - /* - -------------- - |1| 2 |3| - |--========--| - | || || | - | || || | - |4|| ||5| - | || || | - | || || | - |--========--| - |6| 7 |8| - -------------- - */ - QVector<QGraphicsRectItem *> rects_; - QRectF brect_; - - }; - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln - -#endif // !SCRIBO_DEMO_SHARED_SRC_INTERNAL_SELECTION_RECTANGLE_HH diff --git a/scribo/demo/shared/src/internal/interactive_scene.cc b/scribo/demo/shared/src/internal/interactive_scene.cc deleted file mode 100644 index e49b855..0000000 --- a/scribo/demo/shared/src/internal/interactive_scene.cc +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -# include <shared/src/internal/interactive_scene.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - interactiveScene::interactiveScene(QObject * parent) - : QGraphicsScene(parent), mouse_moved_(false) - { - } - - - void interactiveScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) - { - super_::mouseMoveEvent(e); - - -// qDebug() << "interactiveScene::mouseMoveEvent"; - - if (e->buttons() & Qt::LeftButton) - { - emit mouse_moved_and_pressed(e->scenePos()); - mouse_moved_ = true; - } - - emit mouse_moved(e->scenePos()); - - e->ignore(); - } - - void interactiveScene::mousePressEvent(QGraphicsSceneMouseEvent *e) - { - super_::mousePressEvent(e); - - mouse_moved_ = false; - pressed_point_ = e->scenePos(); - - emit mouse_pressed(e->scenePos()); - e->ignore(); - } - - void interactiveScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) - { - super_::mouseReleaseEvent(e); - - if (!mouse_moved_) - emit mouse_click(e->scenePos()); - - emit mouse_released(e->scenePos()); - -// qDebug() << "crop_item::mouseReleaseEvent"; - e->ignore(); - } - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln diff --git a/scribo/demo/shared/src/internal/interactive_scene.hh b/scribo/demo/shared/src/internal/interactive_scene.hh deleted file mode 100644 index 7099265..0000000 --- a/scribo/demo/shared/src/internal/interactive_scene.hh +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_INTERNAL_INTERACTIVE_SCENE_HH -# define SCRIBO_DEMO_SHARED_SRC_INTERNAL_INTERACTIVE_SCENE_HH - -# include <QtGui/QGraphicsScene> -# include <QtGui/QGraphicsSceneMouseEvent> -# include <QtGui/QGraphicsLineItem> -# include <QtCore/QPoint> -# include <QtCore/QDebug> - -# include <shared/src/internal/selection_rectangle.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - class interactiveScene : public QGraphicsScene - { - Q_OBJECT; - - typedef QGraphicsScene super_; - - public: - - interactiveScene(QObject * parent = 0); - - void mouseMoveEvent(QGraphicsSceneMouseEvent *e); - void mousePressEvent(QGraphicsSceneMouseEvent *e); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); - - signals: - void mouse_click(const QPointF& p); - void mouse_moved(const QPointF& p); - void mouse_pressed(const QPointF& p); - void mouse_moved_and_pressed(const QPointF& p); - void mouse_released(const QPointF& p); - - private: - QPointF pressed_point_; - - bool mouse_moved_; - }; - - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln - -#endif // ! SCRIBO_DEMO_SHARED_SRC_INTERNAL_INTERACTIVE_SCENE_HH diff --git a/scribo/demo/shared/src/internal/selection_rectangle.cc b/scribo/demo/shared/src/internal/selection_rectangle.cc deleted file mode 100644 index d3f82b7..0000000 --- a/scribo/demo/shared/src/internal/selection_rectangle.cc +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <QtGui> -#include <shared/src/internal/selection_rectangle.hh> - - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - selection_rectangle::selection_rectangle() - { - QPen pen; - pen.setColor(QColor(Qt::red)); - pen.setStyle(Qt::SolidLine); - pen.setWidth(1); - - - rects_.resize(9); - for (int i = 0; i < rects_.size(); ++i) - { - rects_[i] = new QGraphicsRectItem(this); - rects_[i]->setZValue(1); - rects_[i]->setPen(pen); - rects_[i]->show(); - rects_[i]->setAcceptHoverEvents(true); - } - - rects_[1]->setCursor(Qt::SizeFDiagCursor); - rects_[2]->setCursor(Qt::SizeVerCursor); - rects_[3]->setCursor(Qt::SizeBDiagCursor); - rects_[4]->setCursor(Qt::SizeHorCursor); - rects_[5]->setCursor(Qt::SizeHorCursor); - rects_[6]->setCursor(Qt::SizeBDiagCursor); - rects_[7]->setCursor(Qt::SizeVerCursor); - rects_[8]->setCursor(Qt::SizeFDiagCursor); - -// setHandlesChildEvents(true); - setCursor(Qt::SizeAllCursor); - setAcceptHoverEvents(true); - } - - - selection_rectangle::~selection_rectangle() - { - foreach(QGraphicsRectItem *item, rects_) - delete item; - } - - - void selection_rectangle::paint(QPainter *painter, - const QStyleOptionGraphicsItem *option, - QWidget *widget) - { - /* - -------------- - |1| 2 |3| - |--========--| - | || || | - | || || | - |4|| ||5| - | || || | - | || || | - |--========--| - |6| 7 |8| - -------------- - */ - - qreal border = 15; - qreal corner_width = qMin(qAbs(1/8.f * brect_.width()), border); - qreal corner_height = qMin(qAbs(1/8.f * brect_.height()), border); - - painter->setBrush(QColor(255, 255, 255, 127)); - painter->drawRect(brect_); - - // Rectangle 1 - QRectF rect1(brect_.topLeft().x(), brect_.topLeft().y(), - corner_width, - corner_height); - rects_[1]->setRect(rect1); - - // Rectangle 2 - QRectF rect2(rect1.topRight().x(), rect1.topRight().y(), - brect_.width() - 2 * corner_width, - corner_height); - rects_[2]->setRect(rect2); - - // Rectangle 3 - QRectF rect3(brect_.topRight().x() - corner_width, - brect_.topRight().y(), - corner_width, - corner_height); - rects_[3]->setRect(rect3); - - - - // Rectangle 4 - QRectF rect4(brect_.topLeft().x(), - brect_.topLeft().y() + corner_height, - corner_width, - brect_.height() - corner_height); - rects_[4]->setRect(rect4); - - // Rectangle 5 - QRectF rect5(brect_.topRight().x() - corner_width, - brect_.topRight().y() + corner_height, - corner_width, - brect_.height() - corner_height); - rects_[5]->setRect(rect5); - - - - // Rectangle 6 - QRectF rect6(brect_.bottomLeft().x(), - brect_.bottomLeft().y() - corner_height, - corner_width, - corner_height); - rects_[6]->setRect(rect6); - - // Rectangle 7 - QRectF rect7(rect6.topRight().x(), rect6.topRight().y(), - brect_.width() - 2 * corner_width, - corner_height); - rects_[7]->setRect(rect7); - - // Rectangle 8 - QRectF rect8(rect7.topRight().x(), rect7.topRight().y(), - corner_width, - corner_height); - rects_[8]->setRect(rect8); - - - painter->setPen(pen()); - painter->drawRect(brect_); - } - - - QRectF selection_rectangle::boundingRect() const - { - qreal penWidth = pen().width(); - return QRectF(brect_.x() - penWidth / 2, brect_.y() - penWidth / 2, - brect_.width() + penWidth / 2, - brect_.height() + penWidth / 2); - } - - - void selection_rectangle::setRect(qreal x, qreal y, - qreal width, qreal height) - { - prepareGeometryChange(); - brect_ = QRectF(x, y, width, height).normalized(); - } - - - void selection_rectangle::setRect(const QRectF & rectangle) - { - prepareGeometryChange(); - brect_ = rectangle.normalized(); - } - - - void selection_rectangle::update_size(QGraphicsItem *item, - const QPointF& p) - { - /* - -------------- - |1| 2 |3| - |--========--| - | || || | - | || || | - |4|| ||5| - | || || | - | || || | - |--========--| - |6| 7 |8| - -------------- - */ - QPointF p_ = p; - - prepareGeometryChange(); - if (rects_[1] == item) - brect_.setTopLeft(p_); - else if (rects_[2] == item) - brect_.setTop(p_.y()); - else if (rects_[3] == item) - brect_.setTopRight(p_); - else if (rects_[4] == item) - brect_.setLeft(p_.x()); - else if (rects_[5] == item) - brect_.setRight(p_.x()); - else if (rects_[6] == item) - brect_.setBottomLeft(p_); - else if (rects_[7] == item) - brect_.setBottom(p_.y()); - else if (rects_[8] == item) - brect_.setBottomRight(p_); - else - qDebug() << "selection_rectangle::update_size - invalid item"; - - brect_ = brect_.normalized(); - } - - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln diff --git a/scribo/demo/shared/src/internal/selection_rectangle.hh b/scribo/demo/shared/src/internal/selection_rectangle.hh deleted file mode 100644 index b58bad2..0000000 --- a/scribo/demo/shared/src/internal/selection_rectangle.hh +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_INTERNAL_SELECTION_RECTANGLE_HH -# define SCRIBO_DEMO_SHARED_SRC_INTERNAL_SELECTION_RECTANGLE_HH - -# include <QtCore> -# include <QtGui> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - namespace internal - { - - class selection_rectangle : public QAbstractGraphicsShapeItem - { - - public: - selection_rectangle(); - ~selection_rectangle(); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget); - - QRectF boundingRect() const; - - void setRect(qreal x, qreal y, qreal width, qreal height); - void setRect(const QRectF & rectangle); - - void update_size(QGraphicsItem *item, const QPointF& p); - - private: // members - - - private: // attributes - /* - -------------- - |1| 2 |3| - |--========--| - | || || | - | || || | - |4|| ||5| - | || || | - | || || | - |--========--| - |6| 7 |8| - -------------- - */ - QVector<QGraphicsRectItem *> rects_; - QRectF brect_; - - }; - - } // end of namespace mln::demo::shared::internal - - } // end of namespace mln::demo::shared - - } // end of namespace mln::demo - -} // end of namespace mln - -#endif // !SCRIBO_DEMO_SHARED_SRC_INTERNAL_SELECTION_RECTANGLE_HH diff --git a/scribo/demo/shared/src/to_mln_image.hh b/scribo/demo/shared/src/to_mln_image.hh deleted file mode 100644 index 229f975..0000000 --- a/scribo/demo/shared/src/to_mln_image.hh +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_TO_MLN_IMAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_TO_MLN_IMAGE_HH - -# include <QImage> -# include <QPoint> - -# include <mln/core/image/image2d.hh> -# include <mln/value/qt/rgb32.hh> -# include <mln/make/box2d.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - using namespace mln; - - image2d<value::qt::rgb32> - to_mln_image(const QImage& ima, const QPoint& origin) - { - trace::entering("scribo::demo::shared"); - - mln_assertion(!ima.isNull()); - - image2d<value::qt::rgb32> - output(make::box2d(origin.y(), - origin.x(), - origin.y() + ima.height() - 1, - origin.x() + ima.width() - 1), 0); - - memcpy(output.buffer(), ima.bits(), ima.numBytes()); - - mln_assertion(output.nrows() == (unsigned) ima.height()); - mln_assertion(output.ncols() == (unsigned) ima.width()); - - trace::exiting("scribo::demo::shared"); - return output; - } - - - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_TO_MLN_IMAGE_HH diff --git a/scribo/demo/shared/src/types.hh b/scribo/demo/shared/src/types.hh deleted file mode 100644 index 8edb54a..0000000 --- a/scribo/demo/shared/src/types.hh +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_TYPES_HH -# define SCRIBO_DEMO_SHARED_SRC_TYPES_HH - - -# include <mln/value/qt/rgb32.hh> - -namespace scribo -{ - - namespace demo - { - - namespace shared - { - - typedef mln::value::qt::rgb32 dsp_data_t; - - } // end of namespace scribo::demo::shared - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // !SCRIBO_DEMO_SHARED_SRC_TYPES_HH diff --git a/scribo/demo/shared/ui/browse_widget.ui b/scribo/demo/shared/ui/browse_widget.ui deleted file mode 100644 index fde675c..0000000 --- a/scribo/demo/shared/ui/browse_widget.ui +++ /dev/null @@ -1,106 +0,0 @@ -<ui version="4.0" > - <class>BrowseWidget</class> - <widget class="QWidget" name="BrowseWidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>301</width> - <height>104</height> - </rect> - </property> - <property name="windowTitle" > - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout" > - <property name="margin" > - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout_2" > - <property name="sizeConstraint" > - <enum>QLayout::SetMaximumSize</enum> - </property> - <item row="0" column="1" > - <spacer name="verticalSpacer" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" > - <spacer name="horizontalSpacer" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="1" > - <layout class="QGridLayout" name="gridLayout" > - <property name="sizeConstraint" > - <enum>QLayout::SetMaximumSize</enum> - </property> - <item row="0" column="0" colspan="2" > - <widget class="QLabel" name="description_" > - <property name="text" > - <string>Description</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLineEdit" name="path_" /> - </item> - <item row="1" column="1" > - <widget class="QPushButton" name="browseBtn_" > - <property name="text" > - <string>&Browse</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="2" > - <spacer name="horizontalSpacer_2" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="1" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/scribo/demo/shared/ui/crop_widget.ui b/scribo/demo/shared/ui/crop_widget.ui deleted file mode 100644 index 6b67b2b..0000000 --- a/scribo/demo/shared/ui/crop_widget.ui +++ /dev/null @@ -1,34 +0,0 @@ -<ui version="4.0" > - <class>CropWidget</class> - <widget class="QWidget" name="CropWidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>567</width> - <height>481</height> - </rect> - </property> - <property name="windowTitle" > - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout" > - <property name="margin" > - <number>0</number> - </property> - <item> - <widget class="scribo::demo::shared::image_viewer" native="1" name="viewer_" /> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>scribo::demo::shared::image_viewer</class> - <extends>QWidget</extends> - <header location="global" >shared/src/image_viewer.hh</header> - <container>1</container> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/scribo/demo/shared/ui/image_viewer.ui b/scribo/demo/shared/ui/image_viewer.ui deleted file mode 100644 index fcf1239..0000000 --- a/scribo/demo/shared/ui/image_viewer.ui +++ /dev/null @@ -1,296 +0,0 @@ -<ui version="4.0" > - <class>ImageViewer</class> - <widget class="QWidget" name="ImageViewer" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>553</width> - <height>350</height> - </rect> - </property> - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle" > - <string>Form</string> - </property> - <layout class="QVBoxLayout" > - <item> - <layout class="QVBoxLayout" > - <item> - <layout class="QHBoxLayout" > - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="rotate_lbl" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="text" > - <string>Rotate:</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="rotate_cw_btn" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="toolTip" > - <string>Rotate clock-wise</string> - </property> - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset resource="../shared.qrc" > - <normaloff>:/icons/icons/rotate_cw.png</normaloff>:/icons/icons/rotate_cw.png</iconset> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="rotate_ccw_btn" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="toolTip" > - <string>Rotate counter-clock-wise</string> - </property> - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset resource="../shared.qrc" > - <normaloff>:/icons/icons/rotate_ccw.png</normaloff>:/icons/icons/rotate_ccw.png</iconset> - </property> - </widget> - </item> - <item> - <widget class="Line" name="vline" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="zoomLabel" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="text" > - <string>Zoom:</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomIn" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="maximumSize" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset resource="../shared.qrc" > - <normaloff>:/icons/icons/search-add-icon.png</normaloff>:/icons/icons/search-add-icon.png</iconset> - </property> - <property name="shortcut" > - <string>+</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomOut" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="maximumSize" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset resource="../shared.qrc" > - <normaloff>:/icons/icons/search-remove-icon.png</normaloff>:/icons/icons/search-remove-icon.png</iconset> - </property> - <property name="iconSize" > - <size> - <width>16</width> - <height>16</height> - </size> - </property> - <property name="shortcut" > - <string>-</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomFixed" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="maximumSize" > - <size> - <width>16777215</width> - <height>20</height> - </size> - </property> - <property name="text" > - <string>&Fit to screen</string> - </property> - <property name="shortcut" > - <string>F</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="zoomOriginal" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="maximumSize" > - <size> - <width>16777215</width> - <height>20</height> - </size> - </property> - <property name="text" > - <string>&Original size</string> - </property> - <property name="shortcut" > - <string>O</string> - </property> - </widget> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QGraphicsView" name="viewer_" > - <property name="mouseTracking" > - <bool>true</bool> - </property> - <property name="acceptDrops" > - <bool>false</bool> - </property> - <property name="interactive" > - <bool>true</bool> - </property> - <property name="dragMode" > - <enum>QGraphicsView::NoDrag</enum> - </property> - <property name="viewportUpdateMode" > - <enum>QGraphicsView::BoundingRectViewportUpdate</enum> - </property> - <property name="optimizationFlags" > - <set>QGraphicsView::DontAdjustForAntialiasing|QGraphicsView::DontClipPainter|QGraphicsView::DontSavePainterState</set> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" > - <item> - <widget class="QSlider" name="slider" > - <property name="focusPolicy" > - <enum>Qt::WheelFocus</enum> - </property> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition" > - <enum>QSlider::TicksAbove</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="text" > - <string>Current Frame :</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="frame_nb" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Maximum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>60</width> - <height>0</height> - </size> - </property> - <property name="font" > - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text" > - <string>0</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <resources> - <include location="../shared.qrc" /> - </resources> - <connections/> -</ui> diff --git a/scribo/demo/shared/ui/interactive_scene.cc b/scribo/demo/shared/ui/interactive_scene.cc deleted file mode 100644 index 1ab28a3..0000000 --- a/scribo/demo/shared/ui/interactive_scene.cc +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory -// (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -# include <src/internal/interactive_scene.hh> - -namespace mln -{ - - namespace demo - { - - namespace internal - { - - interactiveScene::interactiveScene(QObject * parent) - : QGraphicsScene(parent), selectionTracking_(false) - { -// line_.setZValue(1); - rect_.setZValue(1); - - QPen pen; - pen.setColor(QColor(Qt::red)); - pen.setStyle(Qt::SolidLine); - pen.setWidth(1); - -// line_.setPen(pen); - rect_.setPen(pen); - } - - - void interactiveScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) - { - if (selectionTracking_ && mouse_pressed_) - rect_.setRect(QRectF(p_start_, e->scenePos())); -// line_.setLine(QLineF(p_start_, e->scenePos())); - - mouse_moved_ = true; - - if (mouse_pressed_) - emit mouse_pressed(e->scenePos()); - - emit mouse_moved(e->scenePos()); - - e->accept(); - } - - void interactiveScene::mousePressEvent(QGraphicsSceneMouseEvent *e) - { - p_start_ = e->scenePos(); - mouse_moved_ = false; - mouse_pressed_ = true; - - if (selectionTracking_) - { -// line_.setLine(QLineF(e->scenePos(), e->scenePos())); -// addItem(&line_); - rect_.setRect(QRectF(e->scenePos(), e->scenePos())); - if (rect_.scene() != this) - addItem(&rect_); - } - - emit mouse_pressed(e->scenePos()); - - e->accept(); - } - - void interactiveScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) - { -// if (selectionTracking_ && line_.scene() == this) -// removeItem(&line_); - - mouse_pressed_ = false; - - if (mouse_moved_ && selectionTracking_) - emit new_selection(rect_.rect()); - else - { - if (rect_.scene() == this) - { - rect_.setRect(sceneRect()); - removeItem(&rect_); - emit selection_cleared(); - } - - emit mouse_click(e->scenePos()); - } - - emit mouse_released(e->scenePos()); - - e->ignore(); - } - - - void interactiveScene::setSelectionTracking(bool b) - { - selectionTracking_ = b; - } - - bool interactiveScene::has_selection() const - { - return rect_.scene() == this; - } - - QRectF interactiveScene::selection() const - { - return rect_.rect(); - } - - void interactiveScene::clear_selection() - { - if (rect_.scene() == this) - removeItem(&rect_); - } - - - } // end of namespace mln::demo::internal - - } // end of namespace mln::demo - -} // end of namespace mln diff --git a/scribo/demo/shared/ui/interactive_scene.hh b/scribo/demo/shared/ui/interactive_scene.hh deleted file mode 100644 index b5d5595..0000000 --- a/scribo/demo/shared/ui/interactive_scene.hh +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef MLN_DEMO_SRC_INTERNAL_INTERACTIVE_SCENE_HH -# define MLN_DEMO_SRC_INTERNAL_INTERACTIVE_SCENE_HH - -# include <QtGui/QGraphicsScene> -# include <QtGui/QGraphicsSceneMouseEvent> -# include <QtGui/QGraphicsLineItem> -# include <QtCore/QPoint> -# include <QtCore/QDebug> - -namespace mln -{ - - namespace demo - { - - namespace internal - { - - class interactiveScene : public QGraphicsScene - { - Q_OBJECT - - public: - - interactiveScene(QObject * parent = 0); - - void mouseMoveEvent(QGraphicsSceneMouseEvent *e); - void mousePressEvent(QGraphicsSceneMouseEvent *e); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); - - void setSelectionTracking(bool b); - - bool has_selection() const; - QRectF selection() const; - void clear_selection(); - - signals: - void mouse_click(const QPointF& p); - void mouse_moved(const QPointF& p); - void mouse_pressed(const QPointF& p); - void mouse_released(const QPointF& p); - - void new_selection(const QRectF& rect); - void selection_cleared(); - - private: - QGraphicsRectItem rect_; - bool mouse_moved_; - bool mouse_pressed_; - QPointF p_start_; - - bool selectionTracking_; - }; - - - } // end of namespace mln::demo::internal - - } // end of namespace mln::demo - -} // end of namespace mln - -#endif // ! MLN_DEMO_SRC_INTERNAL_INTERACTIVE_SCENE_HH diff --git a/scribo/demo/shared/ui/rotate_widget.ui b/scribo/demo/shared/ui/rotate_widget.ui deleted file mode 100644 index 112e713..0000000 --- a/scribo/demo/shared/ui/rotate_widget.ui +++ /dev/null @@ -1,34 +0,0 @@ -<ui version="4.0" > - <class>RotateWidget</class> - <widget class="QWidget" name="RotateWidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>567</width> - <height>481</height> - </rect> - </property> - <property name="windowTitle" > - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout" > - <property name="margin" > - <number>0</number> - </property> - <item> - <widget class="scribo::demo::shared::image_viewer" native="1" name="viewer_" /> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>scribo::demo::shared::image_viewer</class> - <extends>QWidget</extends> - <header location="global" >shared/src/image_viewer.hh</header> - <container>1</container> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/scribo/demo/tip/gui.pro b/scribo/demo/tip/gui.pro deleted file mode 100644 index 7c6aa8e..0000000 --- a/scribo/demo/tip/gui.pro +++ /dev/null @@ -1,19 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Nov 25 13:42:17 2009 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . src ui -INCLUDEPATH += . src - -CONFIG += release - -QMAKE_CXXFLAGS = -g - -# Input -HEADERS += src/main_window.hh src/custom_delegate.hh src/launch_dialog.hh -FORMS += ui/main_window.ui ui/launch_dialog.ui -SOURCES += src/main.cc src/main_window.cc src/custom_delegate.cc src/launch_dialog.cc - -RESOURCES = gui.qrc diff --git a/scribo/demo/tip/gui.qrc b/scribo/demo/tip/gui.qrc deleted file mode 100644 index e5007a8..0000000 --- a/scribo/demo/tip/gui.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> - <qresource prefix="/" > - <file>icons/next.png</file> - <file>icons/ok.png</file> - <file>icons/photos.png</file> - <file>icons/prev.png</file> - <file>icons/remove.png</file> - </qresource> -</RCC> diff --git a/scribo/demo/tip/icons/next.png b/scribo/demo/tip/icons/next.png deleted file mode 100644 index ef6d66d..0000000 Binary files a/scribo/demo/tip/icons/next.png and /dev/null differ diff --git a/scribo/demo/tip/icons/ok.png b/scribo/demo/tip/icons/ok.png deleted file mode 100644 index 217030a..0000000 Binary files a/scribo/demo/tip/icons/ok.png and /dev/null differ diff --git a/scribo/demo/tip/icons/photos.png b/scribo/demo/tip/icons/photos.png deleted file mode 100644 index 65fe33d..0000000 Binary files a/scribo/demo/tip/icons/photos.png and /dev/null differ diff --git a/scribo/demo/tip/icons/prev.png b/scribo/demo/tip/icons/prev.png deleted file mode 100644 index 5f05d74..0000000 Binary files a/scribo/demo/tip/icons/prev.png and /dev/null differ diff --git a/scribo/demo/tip/icons/remove.png b/scribo/demo/tip/icons/remove.png deleted file mode 100644 index 3f37439..0000000 Binary files a/scribo/demo/tip/icons/remove.png and /dev/null differ diff --git a/scribo/demo/tip/src/custom_delegate.cc b/scribo/demo/tip/src/custom_delegate.cc deleted file mode 100644 index cfbb7c3..0000000 --- a/scribo/demo/tip/src/custom_delegate.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <src/custom_delegate.hh> - -#include <QtCore/QtCore> - -namespace mln -{ - - namespace demo - { - - custom_delegate::custom_delegate(QObject * parent) - : QItemDelegate(parent), - bg_(Qt::black, Qt::SolidPattern), - selected_bg_(QColor(255, 100, 0), Qt::Dense5Pattern) - { - display_rect_.setSize(QSize(149, 30)); - decoration_rect_.setSize(QSize(150, 150)); - } - - - custom_delegate::~custom_delegate() - { - } - - void - custom_delegate::drawDecoration(QPainter *painter, - const QStyleOptionViewItem& option, - const QRect& rect, - const QPixmap& pixmap) const - { - decoration_rect_.moveTo(option.rect.x() + 10, option.rect.y() + 10); - painter->fillRect(decoration_rect_, bg_); - super_::drawDecoration(painter, option, decoration_rect_, pixmap); - } - - - void - custom_delegate::drawBackground(QPainter *painter, - const QStyleOptionViewItem& option, - const QModelIndex& index) const - { - super_::drawBackground(painter, option, index); - } - - - void - custom_delegate::drawCheck(QPainter *painter, - const QStyleOptionViewItem& option, - const QRect& rect, - Qt::CheckState state) const - { - super_::drawCheck(painter, option, rect, state); - } - - - void - custom_delegate::drawDisplay(QPainter* painter, - const QStyleOptionViewItem& option, - const QRect& rect, - const QString& text) const - { - display_rect_.moveTo(option.rect.x() + 10, - option.rect.y() + 155); - super_::drawDisplay(painter, option, display_rect_, text); - painter->drawRect(display_rect_); - } - - - void - custom_delegate::drawFocus(QPainter* painter, - const QStyleOptionViewItem& option, - const QRect& rect ) const - { - super_::drawFocus(painter, option, display_rect_); - } - - - } // end of namespace mln::demo - -} // end of namespace mln diff --git a/scribo/demo/tip/src/custom_delegate.hh b/scribo/demo/tip/src/custom_delegate.hh deleted file mode 100644 index 06fb69d..0000000 --- a/scribo/demo/tip/src/custom_delegate.hh +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -# include <QtGui/QtGui> - -namespace mln -{ - - namespace demo - { - - class custom_delegate : public QItemDelegate - { - - typedef QItemDelegate super_; - - public: - - custom_delegate(QObject * parent = 0); - ~custom_delegate(); - - void - drawDecoration(QPainter *painter, - const QStyleOptionViewItem& option, - const QRect& rect, - const QPixmap& pixmap) const; - - void drawBackground(QPainter *painter, - const QStyleOptionViewItem& option, - const QModelIndex& index) const; - - void drawCheck(QPainter *painter, - const QStyleOptionViewItem& option, - const QRect& rect, - Qt::CheckState state) const; - - void - drawDisplay(QPainter* painter, - const QStyleOptionViewItem& option, - const QRect& rect, - const QString& text) const; - - void - drawFocus(QPainter* painter, - const QStyleOptionViewItem& option, - const QRect& rect ) const; - - private: - mutable QRect display_rect_; - mutable QRect decoration_rect_; - QBrush bg_; - QBrush selected_bg_; - - }; - - - } // end of namespace mln::demo - -} // end of namespace mln diff --git a/scribo/demo/tip/src/launch_dialog.cc b/scribo/demo/tip/src/launch_dialog.cc deleted file mode 100644 index 9cd394a..0000000 --- a/scribo/demo/tip/src/launch_dialog.cc +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - - -#include <QtCore> -#include <QtGui> -#include <src/launch_dialog.hh> -#include <src/custom_delegate.hh> - -namespace mln -{ - - namespace demo - { - - launch_dialog::launch_dialog(QWidget *parent) - : QDialog(parent) - { - setupUi(this); - } - - launch_dialog::~launch_dialog() - { - - } - - - void - launch_dialog::on_browseBtn_clicked(bool) - { - QString dirname = QFileDialog::getExistingDirectory(this, ""); - - if (!dirname.isEmpty()) - { - pathToPics->setText(dirname); - } - } - - - void - launch_dialog::on_dialogBtnBox_accepted() - { - emit ok_clicked(pathToPics->text(), get_options()); - } - - - void - launch_dialog::on_pathToPics_textChanged(const QString& str) - { - dialogBtnBox->button(QDialogButtonBox::Ok)->setEnabled(!str.isEmpty()); - } - - - QString launch_dialog::get_options() const - { - if (binarizationMode->currentIndex() == 0) - return "0 0"; - if (binarizationMode->currentIndex() == 1) - return "1 0"; - if (binarizationMode->currentIndex() == 2) - return "0 1"; - if (binarizationMode->currentIndex() == 3) - return "1 1"; - - return ""; - } - - } // end of namespace scribo::demo - -} // end of namespace scribo - - diff --git a/scribo/demo/tip/src/launch_dialog.hh b/scribo/demo/tip/src/launch_dialog.hh deleted file mode 100644 index d3aca98..0000000 --- a/scribo/demo/tip/src/launch_dialog.hh +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef MLN_DEMO_SRC_LAUNCH_DIALOG_HH - -# include <QtGui> -# include <ui_launch_dialog.h> - -namespace mln -{ - - namespace demo - { - - - class launch_dialog : public QDialog, private Ui::LaunchDialog - { - Q_OBJECT - - public: - launch_dialog(QWidget *parent = 0); - ~launch_dialog(); - - private slots: - void on_dialogBtnBox_accepted(); - void on_browseBtn_clicked(bool); - void on_pathToPics_textChanged(const QString& str); - - signals: - void ok_clicked(const QString& path, const QString& options); - - private: // members - QString get_options() const; - }; - - - } // end of namespace mln::demo - -} // end of namespace mln - -#endif // ! MLN_DEMO_SRC_LAUNCH_DIALOG_HH diff --git a/scribo/demo/tip/src/main.cc b/scribo/demo/tip/src/main.cc deleted file mode 100644 index 5349bcb..0000000 --- a/scribo/demo/tip/src/main.cc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <QApplication> -#include <QtGui> - -#include <src/main_window.hh> - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - if (argc < 2) - { - qDebug() << "Usage: " << argv[0] << " <path/text_in_photo_ppm>"; - return 1; - } - - mln::demo::main_window win(argv[1]); - - win.show(); - return app.exec(); -} - diff --git a/scribo/demo/tip/src/main_window.cc b/scribo/demo/tip/src/main_window.cc deleted file mode 100644 index c1d92c1..0000000 --- a/scribo/demo/tip/src/main_window.cc +++ /dev/null @@ -1,526 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - - -#include <QtCore> -#include <QtGui> -#include <src/main_window.hh> -#include <src/launch_dialog.hh> -#include <src/custom_delegate.hh> - -namespace mln -{ - - namespace demo - { - - main_window::main_window(const QString& text_in_photo_ppm, QWidget *parent) - : QMainWindow(parent), text_in_photo_ppm_(text_in_photo_ppm) - { - setupUi(this); - - // Temporary output directory - output_dir_ = "/tmp/"; - - // Setup directory listing - QStringList filters; - filters << "*.ppm" - << "*.pgm" - << "*.pbm" - << "*.jpg" - << "*.png" - << "*.tiff"; - dir_.setNameFilters(filters); - dir_.setFilter(QDir::Files); - dir_.setSorting(QDir::Name); - - // Setup Signal/Slots connections - connect(&process_, SIGNAL(error(QProcess::ProcessError)), - this, SLOT(process__error_slot(QProcess::ProcessError))); - connect(&process_, - SIGNAL(finished(int, QProcess::ExitStatus)), - this, - SLOT(process__finished_slot(int, QProcess::ExitStatus))); - - // Setup graphicsView - graphicsView->setScene(new QGraphicsScene()); - - - // Customize item view delegate for picture with text. - withTextListWidget->setItemDelegate(new custom_delegate()); - - // Setup Toolbar. - toolbar_ = new QToolBar(tr("Action")); - toolbar_->setToolButtonStyle(Qt::ToolButtonIconOnly); - QAction *removeImage = new QAction(QIcon(":/icons/remove.png"), - tr("Tag as image without text"), - toolbar_); - connect(removeImage, SIGNAL(triggered(bool)), - this, SLOT(remove_image(bool))); - toolbar_->addAction(removeImage); - - showHiddenImages_ = new QAction(QIcon(":/icons/photos.png"), - tr("Show hidden photos."), - toolbar_); - showHiddenImages_->setCheckable(true); - connect(showHiddenImages_, SIGNAL(toggled(bool)), - this, SLOT(show_hidden_images(bool))); - toolbar_->addAction(showHiddenImages_); - - - addToolBar(toolbar_); - - - // Setup StatusBar - progressToolBar_ = new QToolBar(tr("ProgressBar")); - - progressToolBar_->addWidget(&progressLabel_); - progressToolBar_->addWidget(&progressBar_); - - QPushButton *cancelBtn = new QPushButton(tr("&Cancel")); - connect(cancelBtn, SIGNAL(clicked(bool)), - this, SLOT(cancel_clicked(bool))); - progressToolBar_->addWidget(cancelBtn); - - addToolBar(progressToolBar_); - progressToolBar_->hide(); - - - - // Hide visualization buttons - textOnlyButton->hide(); - fullImageButton->hide(); - textBoxesButton->hide(); - textMaskButton->hide(); - - // Set default visualization. - textBoxesButton->setChecked(true); - actionText_Boxes->setChecked(true); - QActionGroup * actionGroup = new QActionGroup(this); - actionGroup->addAction(actionText_Boxes); - actionGroup->addAction(actionFull_Image); - actionGroup->addAction(action_Text_Only); - actionGroup->addAction(actionText_Mask); - actionGroup->setExclusive(true); - } - - main_window::~main_window() - { - if (process_.state() == QProcess::Running) - { - process_.disconnect(); - process_.close(); - } - } - - void - main_window::on_actionScan_directory_triggered() - { - launch_dialog *dialog = new launch_dialog(this); - connect(dialog, SIGNAL(ok_clicked(const QString&, const QString&)), - this, SLOT(init_and_start_process(const QString&, const QString&))); - dialog->show(); - } - - void - main_window::init_and_start_process(const QString& dirname, - const QString& options) - { - dir_.setPath(dirname); - - file_list_ = dir_.entryInfoList(); - current_file_ = 0; - - withTextListWidget->clear(); - withoutTextListWidget->clear(); - update_tab_title(); - - progressToolBar_->show(); - progressLabel_.setText(tr("Processing images...")); - progressBar_.setRange(0, file_list_.size()); - progressBar_.setValue(0); - - options_ = options; - - if (current_file_ < file_list_.size()) - start_process(); - else - { - QMessageBox::critical(this, "No image found!", QString("This application could not find any supported images in the provided directory. Supported file types are: %1").arg(dir_.nameFilters().join(" "))); - stop_process(); - } - } - - void - main_window::next_process() - { - ++current_file_; - progressBar_.setValue(current_file_); - - if (current_file_ < file_list_.size()) - start_process(); - else - stop_process(); - } - - - QString - main_window::output_file(const QString& basename) - { - return output_dir_ + basename + "_out_text.ppm"; - } - - QString - main_window::textBoxes_file(const QString& basename) - { - return output_dir_ + basename + "_input_with_bboxes.ppm"; - } - - QString - main_window::textMask_file(const QString& basename) - { - return output_dir_ + basename + "_out.ppm"; - } - - - void - main_window::start_process() - { - QStringList args; - args << file_list_.at(current_file_).absoluteFilePath() // input file. - << textMask_file(file_list_.at(current_file_).baseName()); // output file. - - // Enable/Disable remove background + Enable/Disable sauvola_ms. - QStringList options = options_.split(' '); - foreach(QString option, options) - args << option; - - args << "1" << "1" << "1" // Enable all steps. - << "/tmp/" + file_list_.at(current_file_).baseName(); - - process_.start(text_in_photo_ppm_, args); - } - - void - main_window::stop_process() - { - progressToolBar_->hide(); - emit process_finished(); - } - - void - main_window::process__error_slot(QProcess::ProcessError) - { - qDebug() << "error"; - } - - void - main_window::process__finished_slot(int exitCode, - QProcess::ExitStatus exitStatus) - { - QString filename = file_list_.at(current_file_).fileName(); - - if (exitStatus == QProcess::CrashExit) - { - qDebug() << "Process crashed with file " - << file_list_.at(current_file_).fileName(); - } - else - { - QFileInfo f(filename); - QFileInfo text_image(); - QPixmap pixmap(output_file(f.baseName())); - - QListWidgetItem *item; - if (! pixmap.isNull()) - item = new QListWidgetItem(QIcon(pixmap.scaled(150, 150, Qt::KeepAspectRatio)), filename + QString(" (%1)").arg(exitCode)); - else - item = new QListWidgetItem(filename + QString(" (%1)").arg(exitCode)); - - item->setData(Qt::UserRole, QVariant(current_file_)); - - if (exitCode) - { - item->setCheckState(Qt::Unchecked); - item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - - item->setSizeHint(QSize(170, 200)); - withTextListWidget->addItem(item); - if (withTextListWidget->count() == 1) - { - withTextListWidget->setCurrentRow(0, QItemSelectionModel::SelectCurrent); - on_withTextListWidget_currentItemChanged(withTextListWidget->item(0)); - } - } - else - withoutTextListWidget->addItem(item); - } - - // Update tab title. - update_tab_title(); - - next_process(); - } - - - void - main_window::display_image(const QString& filename) - { - graphicsView->scene()->clear(); - - QPixmap pixmap(filename); - QGraphicsPixmapItem *item = graphicsView->scene()->addPixmap(pixmap); - - graphicsView->setSceneRect(item->boundingRect()); - - if (item->boundingRect().contains(graphicsView->viewport()->geometry())) - graphicsView->fitInView(item->boundingRect(), Qt::KeepAspectRatio); - else - graphicsView->fitInView(graphicsView->viewport()->geometry(), - Qt::KeepAspectRatio); - } - - - void - main_window::on_withTextListWidget_itemClicked(QListWidgetItem * item) - { - on_withTextListWidget_currentItemChanged(item); - } - - void - main_window::on_withTextListWidget_currentItemChanged(QListWidgetItem * item) - { - if (!withTextListWidget->count()) - return; - - if (fullImageButton->isChecked()) - on_fullImageButton_toggled(true); - else if (textOnlyButton->isChecked()) - on_textOnlyButton_toggled(true); - else if (textBoxesButton->isChecked()) - on_textBoxesButton_toggled(true); - else if (textMaskButton->isChecked()) - on_textMaskButton_toggled(true); - else - { - QFileInfo f(item->text()); - display_image(output_file(f.baseName())); - } - } - - void - main_window::on_withoutTextListWidget_itemClicked(QListWidgetItem * item) - { - on_withoutTextListWidget_currentItemChanged(item); - } - - void - main_window::on_withoutTextListWidget_currentItemChanged(QListWidgetItem * item) - { - if (withoutTextListWidget->count() && item) - display_image(file_list_.at(item->data(Qt::UserRole).toInt()).absoluteFilePath()); - } - - void - main_window::on_fullImageButton_toggled(bool) - { - if (withTextListWidget->count() && withTextListWidget->currentItem()) - { - QString filename = file_list_.at(withTextListWidget->currentItem()->data(Qt::UserRole).toInt()).absoluteFilePath(); - display_image(filename); - } - } - - void - main_window::on_textBoxesButton_toggled(bool) - { - if (withTextListWidget->count() && withTextListWidget->currentItem()) - { - QFileInfo f(withTextListWidget->currentItem()->text()); - display_image(textBoxes_file(f.baseName())); - } - } - - void - main_window::on_textMaskButton_toggled(bool) - { - if (withTextListWidget->count() && withTextListWidget->currentItem()) - { - QFileInfo f(withTextListWidget->currentItem()->text()); - display_image(textMask_file(f.baseName())); - } - } - - void - main_window::on_textOnlyButton_toggled(bool) - { - if (withTextListWidget->count() && withTextListWidget->currentItem()) - { - QFileInfo f(withTextListWidget->currentItem()->text()); - display_image(output_file(f.baseName())); - } - } - - - - void - main_window::on_tabWidget_currentChanged(int index) - { - bool b = (index == 0); - fullImageButton->setEnabled(b); - textOnlyButton->setEnabled(b); - textBoxesButton->setEnabled(b); - textMaskButton->setEnabled(b); - toolbar_->setEnabled(b); - - if (index == 1) - { - graphicsView->scene()->clear(); - if (withoutTextListWidget->count()) - { - withoutTextListWidget->setCurrentRow(0, QItemSelectionModel::Select); - on_withoutTextListWidget_currentItemChanged(withoutTextListWidget->item(0)); - } - } - } - - void - main_window::cancel_clicked(bool) - { - process_.disconnect(); - process_.kill(); - process_.waitForFinished(); - progressBar_.setValue(progressBar_.maximum()); - connect_process(); - progressToolBar_->hide(); - } - - void - main_window::remove_image(bool) - { - QList<QListWidgetItem *> items = withTextListWidget->selectedItems(); - foreach(QListWidgetItem *item, items) - { - hidden_.insert(item); - if (! showHiddenImages_->isChecked()) - item->setHidden(true); - } - - update_withtext_count(); -// if (withTextListWidget->count()) -// withTextListWidget->setCurrentRow(0, QItemSelectionModel::Select); - } - - - void - main_window::show_hidden_images(bool b) - { - foreach(QListWidgetItem *item, hidden_) - item->setHidden(! b); - - update_withtext_count(); -// if (withTextListWidget->count()) -// withTextListWidget->setCurrentRow(0, QItemSelectionModel::Select); - } - - - void - main_window::update_withtext_count() - { - unsigned count; - if (! showHiddenImages_->isChecked()) - count = withTextListWidget->count() - hidden_.size(); - else - count = withTextListWidget->count(); - tabWidget->setTabText(0, - QString(tr("With text (%1)")) - .arg(count)); - } - - - void main_window::connect_process() - { - connect(&process_, SIGNAL(error(QProcess::ProcessError)), - this, SLOT(process__error_slot(QProcess::ProcessError))); - connect(&process_, - SIGNAL(finished(int, QProcess::ExitStatus)), - this, - SLOT(process__finished_slot(int, QProcess::ExitStatus))); - } - - - void - main_window::keyPressEvent(QKeyEvent * event) - { - if (tabWidget->currentIndex() == 0) - { - switch(event->key()) - { - case Qt::Key_F1: - on_textOnlyButton_toggled(true); - break; - case Qt::Key_F2: - on_fullImageButton_toggled(true); - break; - case Qt::Key_F3: - on_textBoxesButton_toggled(true); - break; - case Qt::Key_F4: - on_textMaskButton_toggled(true); - break; - } - } - else - event->ignore(); - } - - void - main_window::resizeEvent(QResizeEvent* event) - { - if (graphicsView->scene()->items().size()) - graphicsView->fitInView(graphicsView->scene()->items().at(0)->boundingRect(), - Qt::KeepAspectRatio); - - event->ignore(); - } - - - void - main_window::update_tab_title() - { - tabWidget->setTabText(0, - QString(tr("With text (%1)")) - .arg(withTextListWidget->count())); - tabWidget->setTabText(1, - QString(tr("Without text (%1)")) - .arg(withoutTextListWidget->count())); - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - diff --git a/scribo/demo/tip/src/main_window.hh b/scribo/demo/tip/src/main_window.hh deleted file mode 100644 index 6732f29..0000000 --- a/scribo/demo/tip/src/main_window.hh +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef MLN_DEMO_SRC_MAIN_WINDOW_HH - -# include <QtGui> -# include <ui_main_window.h> - -namespace mln -{ - - namespace demo - { - - - class main_window : public QMainWindow, private Ui::MainWindow - { - Q_OBJECT - - public: - main_window(const QString& text_in_photo_ppm, QWidget *parent = 0); - ~main_window(); - - - private slots: - void process__error_slot(QProcess::ProcessError); - void process__finished_slot(int exitCode, - QProcess::ExitStatus exitStatus); - - void on_withTextListWidget_itemClicked(QListWidgetItem * item); - void on_withTextListWidget_currentItemChanged(QListWidgetItem * item); - void on_withoutTextListWidget_itemClicked(QListWidgetItem * item); - void on_withoutTextListWidget_currentItemChanged(QListWidgetItem * item); - - void on_fullImageButton_toggled(bool b); - void on_textBoxesButton_toggled(bool); - void on_textMaskButton_toggled(bool); - void on_textOnlyButton_toggled(bool); - - void on_tabWidget_currentChanged(int index); - void on_actionScan_directory_triggered(); - void init_and_start_process(const QString& dirname, - const QString& options); - void cancel_clicked(bool); - - void remove_image(bool); - void show_hidden_images(bool b); - - void update_tab_title(); - - signals: - void process_finished(); - - private: // Members - void keyPressEvent(QKeyEvent* event); - void resizeEvent(QResizeEvent* event); - - QString output_file(const QString& basename); - QString textBoxes_file(const QString& basename); - QString textMask_file(const QString& basename); - - void display_image(const QString& filename); - void start_process(); - void stop_process(); - void next_process(); - - void connect_process(); - - void update_withtext_count(); - - private: // Attributes - QString output_dir_; - QDir dir_; - QString text_in_photo_ppm_; - QProcess process_; - QString options_; - QSet<QListWidgetItem *> hidden_; - - QFileInfoList file_list_; - int current_file_; - - // Progress tool bar - QToolBar *progressToolBar_; - QLabel progressLabel_; - QProgressBar progressBar_; - - // ToolBar - QToolBar *toolbar_; - QAction *showHiddenImages_; - }; - - - } // end of namespace mln::demo - -} // end of namespace mln - -#endif // ! MLN_DEMO_SRC_MAIN_WINDOW_HH diff --git a/scribo/demo/tip/ui/launch_dialog.ui b/scribo/demo/tip/ui/launch_dialog.ui deleted file mode 100644 index a7aa216..0000000 --- a/scribo/demo/tip/ui/launch_dialog.ui +++ /dev/null @@ -1,117 +0,0 @@ -<ui version="4.0" > - <class>LaunchDialog</class> - <widget class="QDialog" name="LaunchDialog" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>371</width> - <height>160</height> - </rect> - </property> - <property name="windowTitle" > - <string>Dialog</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3" > - <item> - <layout class="QVBoxLayout" name="verticalLayout_2" > - <item> - <layout class="QHBoxLayout" name="horizontalLayout" > - <item> - <widget class="QLineEdit" name="pathToPics" /> - </item> - <item> - <widget class="QPushButton" name="browseBtn" > - <property name="text" > - <string>&Browse</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Options</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout" > - <item> - <widget class="QComboBox" name="binarizationMode" > - <property name="currentIndex" > - <number>3</number> - </property> - <item> - <property name="text" > - <string>Binarization from intensity</string> - </property> - </item> - <item> - <property name="text" > - <string>Binarization from foreground (slower)</string> - </property> - </item> - <item> - <property name="text" > - <string>Multiscale Binarization from intensity </string> - </property> - </item> - <item> - <property name="text" > - <string>Multiscale Binarization from foreground (slower)</string> - </property> - </item> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QDialogButtonBox" name="dialogBtnBox" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons" > - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>dialogBtnBox</sender> - <signal>accepted()</signal> - <receiver>LaunchDialog</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel" > - <x>248</x> - <y>254</y> - </hint> - <hint type="destinationlabel" > - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>dialogBtnBox</sender> - <signal>rejected()</signal> - <receiver>LaunchDialog</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel" > - <x>316</x> - <y>260</y> - </hint> - <hint type="destinationlabel" > - <x>286</x> - <y>274</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/scribo/demo/tip/ui/main_window.ui b/scribo/demo/tip/ui/main_window.ui deleted file mode 100644 index 4162d98..0000000 --- a/scribo/demo/tip/ui/main_window.ui +++ /dev/null @@ -1,656 +0,0 @@ -<ui version="4.0" > - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>708</width> - <height>834</height> - </rect> - </property> - <property name="windowTitle" > - <string>MainWindow</string> - </property> - <property name="dockNestingEnabled" > - <bool>true</bool> - </property> - <property name="dockOptions" > - <set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set> - </property> - <widget class="QWidget" name="centralwidget" > - <layout class="QVBoxLayout" name="verticalLayout_4" > - <item> - <widget class="QSplitter" name="splitter" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <widget class="QTabWidget" name="tabWidget" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="autoFillBackground" > - <bool>false</bool> - </property> - <property name="tabShape" > - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="tab" > - <attribute name="title" > - <string>With text</string> - </attribute> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <layout class="QVBoxLayout" name="verticalLayout_5" > - <item> - <widget class="QListWidget" name="withTextListWidget" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="editTriggers" > - <set>QAbstractItemView::NoEditTriggers</set> - </property> - <property name="tabKeyNavigation" > - <bool>true</bool> - </property> - <property name="showDropIndicator" stdset="0" > - <bool>false</bool> - </property> - <property name="selectionMode" > - <enum>QAbstractItemView::ExtendedSelection</enum> - </property> - <property name="iconSize" > - <size> - <width>150</width> - <height>150</height> - </size> - </property> - <property name="movement" > - <enum>QListView::Static</enum> - </property> - <property name="flow" > - <enum>QListView::LeftToRight</enum> - </property> - <property name="isWrapping" stdset="0" > - <bool>true</bool> - </property> - <property name="resizeMode" > - <enum>QListView::Adjust</enum> - </property> - <property name="layoutMode" > - <enum>QListView::Batched</enum> - </property> - <property name="spacing" > - <number>10</number> - </property> - <property name="gridSize" > - <size> - <width>170</width> - <height>200</height> - </size> - </property> - <property name="viewMode" > - <enum>QListView::IconMode</enum> - </property> - <property name="uniformItemSizes" > - <bool>true</bool> - </property> - <property name="batchSize" > - <number>100</number> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - <property name="selectionRectVisible" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4" > - <item> - <spacer name="horizontalSpacer" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QToolButton" name="prevBtn" > - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset resource="../gui.qrc" > - <normaloff>:/icons/prev.png</normaloff>:/icons/prev.png</iconset> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="comboBox" > - <item> - <property name="text" > - <string>Page 1</string> - </property> - </item> - </widget> - </item> - <item> - <widget class="QToolButton" name="nextBtn" > - <property name="text" > - <string/> - </property> - <property name="icon" > - <iconset resource="../gui.qrc" > - <normaloff>:/icons/next.png</normaloff>:/icons/next.png</iconset> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_2" > - <attribute name="title" > - <string>Without text</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_6" > - <item> - <widget class="QListWidget" name="withoutTextListWidget" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="layoutMode" > - <enum>QListView::Batched</enum> - </property> - <property name="batchSize" > - <number>5</number> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - <widget class="QDockWidget" name="dockWidget" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Maximum" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <widget class="QWidget" name="dockWidgetContents" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="0" column="0" > - <layout class="QVBoxLayout" name="verticalLayout_7" > - <item> - <spacer name="verticalSpacer_3" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <spacer name="verticalSpacer_4" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGraphicsView" name="graphicsView" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>350</width> - <height>512</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>16777215</width> - <height>512</height> - </size> - </property> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_3" > - <item> - <layout class="QHBoxLayout" name="horizontalLayout" > - <item> - <layout class="QVBoxLayout" name="verticalLayout_2" > - <property name="sizeConstraint" > - <enum>QLayout::SetNoConstraint</enum> - </property> - <item> - <widget class="QLabel" name="label" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Maximum" hsizetype="Maximum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Annnotations</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <widget class="QTextEdit" name="textEdit" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Maximum" hsizetype="Minimum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize" > - <size> - <width>200</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout" > - <item> - <widget class="QPushButton" name="textOnlyButton" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>View text only</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="autoExclusive" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="fullImageButton" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>View full image</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="autoExclusive" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="textBoxesButton" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>View text boxes</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="autoExclusive" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="textMaskButton" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Minimum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>View text mask</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="autoExclusive" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_2" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <item> - <spacer name="horizontalSpacer_3" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="pushButton_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Maximum" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Validate</string> - </property> - <property name="icon" > - <iconset resource="../gui.qrc" > - <normaloff>:/icons/ok.png</normaloff>:/icons/ok.png</iconset> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </item> - <item row="1" column="0" > - <spacer name="verticalSpacer_5" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>708</width> - <height>24</height> - </rect> - </property> - <widget class="QMenu" name="menuFile" > - <property name="title" > - <string>&File</string> - </property> - <addaction name="actionScan_directory" /> - <addaction name="separator" /> - <addaction name="action_Quit" /> - </widget> - <widget class="QMenu" name="menu_View" > - <property name="title" > - <string>&View</string> - </property> - <addaction name="actionFull_Image" /> - <addaction name="actionText_Boxes" /> - <addaction name="separator" /> - <addaction name="action_Text_Only" /> - <addaction name="actionText_Mask" /> - </widget> - <addaction name="menuFile" /> - <addaction name="menu_View" /> - </widget> - <widget class="QStatusBar" name="statusbar" /> - <action name="actionScan_directory" > - <property name="icon" > - <iconset resource="../gui.qrc" > - <normaloff>:/icons/photos.png</normaloff>:/icons/photos.png</iconset> - </property> - <property name="text" > - <string>&Scan directory...</string> - </property> - </action> - <action name="action_Text_Only" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="text" > - <string>&Text only</string> - </property> - </action> - <action name="actionFull_Image" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="text" > - <string>Full image</string> - </property> - </action> - <action name="actionText_Boxes" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="text" > - <string>Text boxes</string> - </property> - </action> - <action name="actionText_Mask" > - <property name="checkable" > - <bool>true</bool> - </property> - <property name="text" > - <string>Text mask</string> - </property> - </action> - <action name="action_Quit" > - <property name="text" > - <string>&Quit</string> - </property> - </action> - </widget> - <resources> - <include location="../gui.qrc" /> - </resources> - <connections> - <connection> - <sender>action_Quit</sender> - <signal>activated()</signal> - <receiver>MainWindow</receiver> - <slot>close()</slot> - <hints> - <hint type="sourcelabel" > - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel" > - <x>353</x> - <y>335</y> - </hint> - </hints> - </connection> - <connection> - <sender>actionFull_Image</sender> - <signal>activated()</signal> - <receiver>fullImageButton</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel" > - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel" > - <x>634</x> - <y>492</y> - </hint> - </hints> - </connection> - <connection> - <sender>action_Text_Only</sender> - <signal>activated()</signal> - <receiver>textOnlyButton</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel" > - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel" > - <x>634</x> - <y>457</y> - </hint> - </hints> - </connection> - <connection> - <sender>actionText_Boxes</sender> - <signal>activated()</signal> - <receiver>textBoxesButton</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel" > - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel" > - <x>634</x> - <y>527</y> - </hint> - </hints> - </connection> - <connection> - <sender>actionText_Mask</sender> - <signal>activated()</signal> - <receiver>textMaskButton</receiver> - <slot>toggle()</slot> - <hints> - <hint type="sourcelabel" > - <x>-1</x> - <y>-1</y> - </hint> - <hint type="destinationlabel" > - <x>634</x> - <y>562</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/scribo/demo/wizard/images/dematerialization.png b/scribo/demo/wizard/images/dematerialization.png deleted file mode 100644 index bcae3c4..0000000 Binary files a/scribo/demo/wizard/images/dematerialization.png and /dev/null differ diff --git a/scribo/demo/wizard/src/crop_page.cc b/scribo/demo/wizard/src/crop_page.cc deleted file mode 100644 index ea3ca71..0000000 --- a/scribo/demo/wizard/src/crop_page.cc +++ /dev/null @@ -1,48 +0,0 @@ -#include <src/crop_page.hh> - -namespace scribo -{ - - namespace demo - { - - - crop_page::crop_page(QWidget *parent) - : QWizardPage(parent) - { - widget_ = new crop_widget(this); - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(widget_); - setLayout(layout); - - setTitle("Region of interest"); - setSubTitle("Select a region of interest"); - - } - - - void crop_page::cleanupPage() - { - setField("load.input_dsp", - QPixmap(field("load.file_path").toString())); - - } - - - void crop_page::initializePage() - { - widget_->load_image(field("load.input_dsp").value<QPixmap>()); - } - - - bool crop_page::validatePage() - { - setField("load.input_dsp", widget_->image()); - return true; - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/crop_page.hh b/scribo/demo/wizard/src/crop_page.hh deleted file mode 100644 index 9891a7e..0000000 --- a/scribo/demo/wizard/src/crop_page.hh +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH - -# include <QtGui> -# include <src/crop_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - class crop_page : public QWizardPage - { - Q_OBJECT; - - public: - crop_page(QWidget *parent = 0); - - virtual void cleanupPage(); - virtual void initializePage(); - virtual bool validatePage(); - - private: - crop_widget *widget_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_CROP_PAGE_HH diff --git a/scribo/demo/wizard/src/crop_widget.cc b/scribo/demo/wizard/src/crop_widget.cc deleted file mode 100644 index 8067fda..0000000 --- a/scribo/demo/wizard/src/crop_widget.cc +++ /dev/null @@ -1,37 +0,0 @@ -#include <src/crop_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - crop_widget::crop_widget(QWidget *parent) - : QWidget(parent) - { - setupUi(this); - } - - - void crop_widget::load_image(const QPixmap& pixmap) - { - viewer_->draw_image(pixmap); - viewer_->set_selection_enabled(true); - } - - - const QRectF& crop_widget::crop_area() const - { - return viewer_->selection(); - } - - - QPixmap crop_widget::image() const - { - return viewer_->image().copy(crop_area().toRect().intersected(viewer_->image().rect())); - } - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/crop_widget.hh b/scribo/demo/wizard/src/crop_widget.hh deleted file mode 100644 index 8d1f80b..0000000 --- a/scribo/demo/wizard/src/crop_widget.hh +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_CROP_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_CROP_WIDGET_HH - -# include <QtGui> -# include <ui_crop_widget.h> - -namespace scribo -{ - - namespace demo - { - - - class crop_widget : public QWidget, private Ui::CropWidget - { - Q_OBJECT; - - Q_PROPERTY(QRectF crop_area READ crop_area); - - public: - crop_widget(QWidget *parent = 0); - - void load_image(const QPixmap& pixmap); - - const QRectF& crop_area() const; - - QPixmap image() const; - - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_CROP_WIDGET_HH diff --git a/scribo/demo/wizard/src/doc_type.hh b/scribo/demo/wizard/src/doc_type.hh deleted file mode 100644 index 320cd19..0000000 --- a/scribo/demo/wizard/src/doc_type.hh +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_HH -# define SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_HH - - -namespace scribo -{ - - namespace demo - { - - enum Doc_Type - { - Text_Doc, - Picture, - Mixed_Doc, - - Invalid_Doc - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // !SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_HH diff --git a/scribo/demo/wizard/src/doc_type_page.cc b/scribo/demo/wizard/src/doc_type_page.cc deleted file mode 100644 index 7245569..0000000 --- a/scribo/demo/wizard/src/doc_type_page.cc +++ /dev/null @@ -1,48 +0,0 @@ -#include <src/doc_type_page.hh> -#include <src/doc_type_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - doc_type_page::doc_type_page(QWidget *parent) - : QWizardPage(parent) - { - widget_ = new doc_type_widget(this); - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(widget_); - setLayout(layout); - - setSubTitle("Please choose the document type."); - setTitle("Document type"); - - registerField("doc_type.type_mixed_doc", widget_, "type_mixed_doc", SIGNAL(toggled(bool))); - registerField("doc_type.type_picture", widget_, "type_picture", SIGNAL(toggled(bool))); - registerField("doc_type.type_text_doc", widget_, "type_text_doc", SIGNAL(toggled(bool))); - } - - - void doc_type_page::cleanupPage() - { - widget_->reset(); - } - - - void doc_type_page::initializePage() - { - } - - - bool doc_type_page::isComplete() - { - return true; - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/doc_type_page.hh b/scribo/demo/wizard/src/doc_type_page.hh deleted file mode 100644 index f0d751b..0000000 --- a/scribo/demo/wizard/src/doc_type_page.hh +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_PAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_PAGE_HH - -# include <QtGui> - -namespace scribo -{ - - namespace demo - { - - // Forward declaration. - class doc_type_widget; - - class doc_type_page : public QWizardPage - { - Q_OBJECT; - - public: - doc_type_page(QWidget *parent = 0); - - virtual void cleanupPage(); - virtual void initializePage(); - virtual bool isComplete(); - - private: - doc_type_widget *widget_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_PAGE_HH diff --git a/scribo/demo/wizard/src/doc_type_widget.cc b/scribo/demo/wizard/src/doc_type_widget.cc deleted file mode 100644 index c8453d4..0000000 --- a/scribo/demo/wizard/src/doc_type_widget.cc +++ /dev/null @@ -1,38 +0,0 @@ -#include <src/doc_type_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - doc_type_widget::doc_type_widget(QWidget *parent) - : QWidget(parent) - { - setupUi(this); - } - - void doc_type_widget::reset() - { - type_text_doc_->setChecked(true); - } - - bool doc_type_widget::type_mixed_doc() const - { - return type_mixed_doc_->isChecked(); - } - - bool doc_type_widget::type_picture() const - { - return type_picture_->isChecked(); - } - - bool doc_type_widget::type_text_doc() const - { - return type_text_doc_->isChecked(); - } - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/doc_type_widget.hh b/scribo/demo/wizard/src/doc_type_widget.hh deleted file mode 100644 index ccd5324..0000000 --- a/scribo/demo/wizard/src/doc_type_widget.hh +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_WIDGET_HH - -# include <QtGui> -# include <ui_doc_type_widget.h> - -namespace scribo -{ - - namespace demo - { - - - class doc_type_widget : public QWidget, private Ui::DocTypeWidget - { - Q_OBJECT; - - Q_PROPERTY(bool type_mixed_doc READ type_mixed_doc); - Q_PROPERTY(bool type_picture READ type_picture); - Q_PROPERTY(bool type_text_doc READ type_text_doc); - - public: - doc_type_widget(QWidget *parent = 0); - - void reset(); - - bool type_mixed_doc() const; - bool type_picture() const; - bool type_text_doc() const; - - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_DOC_TYPE_WIDGET_HH diff --git a/scribo/demo/wizard/src/load_page.cc b/scribo/demo/wizard/src/load_page.cc deleted file mode 100644 index 69c2f7f..0000000 --- a/scribo/demo/wizard/src/load_page.cc +++ /dev/null @@ -1,71 +0,0 @@ -#include <src/load_page.hh> - -namespace scribo -{ - - namespace demo - { - - - load_page::load_page(QWidget *parent) - : QWizardPage(parent) - { - widget_ = new load_widget(this); - - QStringList filters; - filters << tr("PNG image (*.png)") - << tr("JPEG image (*.jpg *.jpeg *.jpe)") - << tr("PNM image (*.pnm *.pbm *.pgm *.ppm)"); - widget_->setDialogFilter(filters); - - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(widget_); - setLayout(layout); - - setSubTitle("Choose a file to load"); - setTitle("Image loading"); - - registerField("load.file_path*", widget_, - "path", SIGNAL(path_updated())); - - registerField("load.must_crop", widget_, "must_crop"); - registerField("load.must_rotate", widget_, "must_rotate"); - - registerField("load.input_dsp", this, "input_dsp"); - - } - - - void load_page::cleanupPage() - { - widget_->reset(); - } - - - void load_page::initializePage() - { - cleanupPage(); - } - - - bool load_page::validatePage() - { - input_dsp_ = QPixmap(widget_->path()); - return true; - } - - - const QPixmap& load_page::input_dsp() const - { - return input_dsp_; - } - - void load_page::set_input_dsp(const QPixmap& pixmap) - { - input_dsp_ = pixmap; - } - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/load_page.hh b/scribo/demo/wizard/src/load_page.hh deleted file mode 100644 index f3b5ec8..0000000 --- a/scribo/demo/wizard/src/load_page.hh +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_LOAD_PAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_LOAD_PAGE_HH - -# include <QtGui> -# include <src/load_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - class load_page : public QWizardPage - { - Q_OBJECT; - - Q_PROPERTY(QPixmap input_dsp READ input_dsp WRITE set_input_dsp); - - public: - load_page(QWidget *parent = 0); - - virtual void cleanupPage(); - virtual void initializePage(); - virtual bool validatePage(); -// virtual bool isComplete(); - - const QPixmap& input_dsp() const; - void set_input_dsp(const QPixmap& pixmap); - - private: - load_widget *widget_; - QPixmap input_dsp_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_LOAD_PAGE_HH diff --git a/scribo/demo/wizard/src/load_widget.cc b/scribo/demo/wizard/src/load_widget.cc deleted file mode 100644 index 1f327af..0000000 --- a/scribo/demo/wizard/src/load_widget.cc +++ /dev/null @@ -1,56 +0,0 @@ -#include <src/load_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - load_widget::load_widget(QWidget *parent) - : browse_widget(parent) - { - QGroupBox *group_box = new QGroupBox(tr("Options"), this); - - QVBoxLayout *layout = new QVBoxLayout(group_box); - layout->setSizeConstraint(QLayout::SetMaximumSize); - must_crop_ = new QCheckBox(tr("Select a region of interest"), - group_box); - must_rotate_ = new QCheckBox(tr("Perform a manual rotation"), - group_box); - - layout->addWidget(must_crop_); - layout->addWidget(must_rotate_); - - - QSpacerItem* - vspacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, - QSizePolicy::Expanding); - - gridLayout_2->addWidget(group_box, 2, 1); - gridLayout_2->addItem(vspacer, 3, 1, 1, 1); - - gridLayout_2->setSizeConstraint(QLayout::SetMaximumSize); - } - - void load_widget::reset() - { - browse_widget::reset(); - must_crop_->setChecked(false); - must_rotate_->setChecked(false); - } - - bool load_widget::must_crop() const - { - return must_crop_->isChecked(); - } - - bool load_widget::must_rotate() const - { - return must_rotate_->isChecked(); - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/load_widget.hh b/scribo/demo/wizard/src/load_widget.hh deleted file mode 100644 index d7cf4e5..0000000 --- a/scribo/demo/wizard/src/load_widget.hh +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_LOAD_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_LOAD_WIDGET_HH - -# include <QtGui> -# include <shared/src/browse_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - class load_widget : public shared::browse_widget - { - Q_OBJECT; - - Q_PROPERTY(bool must_crop READ must_crop); - Q_PROPERTY(bool must_rotate READ must_rotate); - - public: - load_widget(QWidget *parent = 0); - void reset(); - - bool must_crop() const; - bool must_rotate() const; - - private: // attributes. - QCheckBox *must_crop_; - QCheckBox *must_rotate_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_LOAD_WIDGET_HH diff --git a/scribo/demo/wizard/src/main.cc b/scribo/demo/wizard/src/main.cc deleted file mode 100644 index 5b771e2..0000000 --- a/scribo/demo/wizard/src/main.cc +++ /dev/null @@ -1,28 +0,0 @@ -#include <QtGui> -#include <src/main_window.hh> -#include <src/preprocessing_task.hh> - -namespace scribo { namespace demo {extern QString basedir_; } } - -int main(int argc, char* argv[]) -{ - QApplication app(argc, argv); - - qRegisterMetaType<preprocessing_task_set_t>("preprocessing_task_set_t"); - - - if (argc == 2) - { - scribo::demo::basedir_ = argv[1]; - } - else - { - qDebug() << "Usage: " << argv[0] << " <path_to_scribo/src>"; - return 1; - } - - scribo::demo::wizard::main_window win; - win.show(); - - return app.exec(); -} diff --git a/scribo/demo/wizard/src/main_window.cc b/scribo/demo/wizard/src/main_window.cc deleted file mode 100644 index 2af6c82..0000000 --- a/scribo/demo/wizard/src/main_window.cc +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#include <src/main_window.hh> - -#include <src/load_page.hh> -#include <src/doc_type_page.hh> -#include <src/crop_page.hh> -#include <src/preprocessing_page.hh> -#include <src/process_page.hh> -#include <src/rotate_page.hh> -#include <src/result_page.hh> - -namespace scribo -{ - - namespace demo - { - - namespace wizard - { - - - main_window::main_window() - : QWizard(0, Qt::Window) - { -// QPixmap bg_pixmap(":/images/images/dematerialization.png"); -// setPixmap(QWizard::WatermarkPixmap, bg_pixmap); -// setPixmap(QWizard::BackgroundPixmap, bg_pixmap); - - - connect(this, SIGNAL(currentIdChanged(int)), - this, SLOT(showCustomButton_slot(int))); - - - // Page_Load - load_page* page_load = new load_page(this); - addPage(page_load); - - // Page_Task - doc_type_page* page_doc_type = new doc_type_page(this); - addPage(page_doc_type); - - // Page_Crop - crop_page* page_crop = new crop_page(this); - addPage(page_crop); - - // Page_Crop - rotate_page* page_rotate = new rotate_page(this); - addPage(page_rotate); - - // Page_Preprocessing - preprocessing_page* - page_preprocessing = new preprocessing_page(this); - addPage(page_preprocessing); - - // Page_Processing - process_page *page_process = new process_page(this); - addPage(page_process); - - // Page_Result - addPage(new result_page(this)); - } - - - int main_window::nextId() const - { - switch (currentId()) - { - case Page_Load: - if (field("load.must_crop").toBool()) - return Page_Crop; - else if (field("load.must_rotate").toBool()) - return Page_Rotate; - else - return Page_Task; - - case Page_Crop: - if (field("load.must_rotate").toBool()) - return Page_Rotate; - else - return Page_Task; - - case Page_Rotate: - return Page_Task; - - case Page_Task: - return Page_Preprocessing; - - case Page_Preprocessing: - return Page_Process; - - case Page_Process: - return Page_Result; - - case Page_Result: - return -1; - - default: - qDebug() << "Warning: using default nextId() case."; - return currentId() + 1; - } - } - - - void main_window::showCustomButton_slot(int id) - { - if (id == Page_Result) - setOptions(options() | QWizard::HaveCustomButton1); - else - { - setOptions(QWizard::NoBackButtonOnStartPage -// | QWizard::DisabledBackButtonOnLastPage - | QWizard::NoCancelButton); - } - } - - } // end of namespace scribo::demo::wizard - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/main_window.hh b/scribo/demo/wizard/src/main_window.hh deleted file mode 100644 index 44e6d92..0000000 --- a/scribo/demo/wizard/src/main_window.hh +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_WIZARD_SRC_MAIN_WINDOW_HH -# define SCRIBO_DEMO_WIZARD_SRC_MAIN_WINDOW_HH - -# include <QtGui/QWizard> -//# include <ui_main_window.h> - -namespace scribo -{ - - namespace demo - { - - namespace wizard - { - - - class main_window : public QWizard - { - Q_OBJECT; - - public: - main_window(); - - virtual int nextId() const; - - private slots: - void showCustomButton_slot(int id); - - private: - enum { Page_Load, - Page_Task, - Page_Crop, - Page_Rotate, - Page_Preprocessing, - Page_Process, - Page_Result }; - }; - - - } // end of namespace scribo::demo::wizard - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_WIZARD_SRC_MAIN_WINDOW_HH diff --git a/scribo/demo/wizard/src/mln_widgets.cc b/scribo/demo/wizard/src/mln_widgets.cc deleted file mode 100644 index 621cc6f..0000000 --- a/scribo/demo/wizard/src/mln_widgets.cc +++ /dev/null @@ -1,7 +0,0 @@ -#undef MLN_INCLUDE_ONLY - -// Widgets -#include <shared/src/image_viewer.cc> - -// Misc -#include <src/runner.cc> diff --git a/scribo/demo/wizard/src/preprocessing_page.cc b/scribo/demo/wizard/src/preprocessing_page.cc deleted file mode 100644 index f727581..0000000 --- a/scribo/demo/wizard/src/preprocessing_page.cc +++ /dev/null @@ -1,61 +0,0 @@ -#include <src/preprocessing_page.hh> - -namespace scribo -{ - - namespace demo - { - - - preprocessing_page::preprocessing_page(QWidget *parent) - : QWizardPage(parent) - { - widget_ = new preprocessing_widget(this); - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(widget_); - setLayout(layout); - - setTitle("Preprocessing tasks"); - setSubTitle("Choose preprocessing algorithms."); - - registerField("preprocessing.tasks", this, "tasks"); - } - - - void preprocessing_page::cleanupPage() - { - widget_->reset(); - } - - - void preprocessing_page::initializePage() - { - if (field("doc_type.type_text_doc").toBool()) - widget_->setup_text_doc(); - else if (field("doc_type.type_mixed_doc").toBool()) - widget_->setup_mixed_doc(); - else if (field("doc_type.type_picture").toBool()) - widget_->setup_picture(); - else - qDebug() << "preprocessing_page - initializePage - invalid document type"; - } - - - const preprocessing_task_set_t& preprocessing_page::tasks() const - { - return tasks_; - } - - - bool preprocessing_page::validatePage() - { - tasks_ = widget_->tasks(); - return true; - } - - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/preprocessing_page.hh b/scribo/demo/wizard/src/preprocessing_page.hh deleted file mode 100644 index 1cfbea9..0000000 --- a/scribo/demo/wizard/src/preprocessing_page.hh +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_PAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_PAGE_HH - -# include <QtGui> -# include <src/preprocessing_widget.hh> -# include <src/preprocessing_task.hh> - -namespace scribo -{ - - namespace demo - { - - - class preprocessing_page : public QWizardPage - { - Q_OBJECT; - - Q_PROPERTY(preprocessing_task_set_t tasks READ tasks); - - public: - preprocessing_page(QWidget *parent = 0); - - virtual void cleanupPage(); - virtual void initializePage(); - virtual bool validatePage(); - - const preprocessing_task_set_t& tasks() const; - - private: - preprocessing_widget *widget_; - preprocessing_task_set_t tasks_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_PAGE_HH diff --git a/scribo/demo/wizard/src/preprocessing_task.hh b/scribo/demo/wizard/src/preprocessing_task.hh deleted file mode 100644 index 5c335b7..0000000 --- a/scribo/demo/wizard/src/preprocessing_task.hh +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_TASK_HH -# define SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_TASK_HH - -# include <QSet> - - -namespace scribo -{ - - namespace demo - { - - enum Preprocessing_Task - { - RemoveBg = 0, - Unskew, - RemoveNoise, - ImproveContrast, - ReduceSize, - - BinarizationSimple, - BinarizationSauvola, - BinarizationSauvolaMs, - - PREPROCESSING_TASK_COUNT // Invalid task. - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - -typedef QSet<scribo::demo::Preprocessing_Task> preprocessing_task_set_t; -Q_DECLARE_METATYPE(preprocessing_task_set_t); - -#endif // !SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_TASK_HH diff --git a/scribo/demo/wizard/src/preprocessing_widget.cc b/scribo/demo/wizard/src/preprocessing_widget.cc deleted file mode 100644 index 7c66719..0000000 --- a/scribo/demo/wizard/src/preprocessing_widget.cc +++ /dev/null @@ -1,93 +0,0 @@ -#include <src/preprocessing_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - preprocessing_widget::preprocessing_widget(QWidget *parent) - : QWidget(parent) - { - setupUi(this); - } - - void preprocessing_widget::reset() - { - binarizationCBox->setCurrentIndex(2); // Sauvola ms - clear_checked(); - } - - void preprocessing_widget::setup_picture() - { - qDebug() << "setup picture"; - - removeBg->setChecked(true); - } - - void preprocessing_widget::setup_mixed_doc() - { - qDebug() << "setup mixed doc"; - } - - void preprocessing_widget::setup_text_doc() - { - qDebug() << "setup text doc"; - - // Disabled - removeBg->setChecked(false); - unskew->setChecked(false); - - // Enabled - removeNoise->setChecked(true); - improveContrast->setChecked(true); - } - - - void preprocessing_widget::clear_checked() - { - // Enabled - - // Disabled - removeBg->setChecked(false); - unskew->setChecked(false); - removeNoise->setChecked(false); - improveContrast->setChecked(false); - reduceSize->setChecked(false); - } - - - preprocessing_task_set_t preprocessing_widget::tasks() const - { - preprocessing_task_set_t tasks; - - if (removeBg->isChecked()) - tasks.insert(RemoveBg); - - if (unskew->isChecked()) - tasks.insert(Unskew); - - if (removeNoise->isChecked()) - tasks.insert(RemoveNoise); - - if (improveContrast->isChecked()) - tasks.insert(ImproveContrast); - - if (reduceSize->isChecked()) - tasks.insert(ReduceSize); - - if (binarizationCBox->currentIndex() == 0) - tasks.insert(BinarizationSimple); - else if (binarizationCBox->currentIndex() == 1) - tasks.insert(BinarizationSauvola); - else if (binarizationCBox->currentIndex() == 2) - tasks.insert(BinarizationSauvolaMs); - - return tasks; - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/preprocessing_widget.hh b/scribo/demo/wizard/src/preprocessing_widget.hh deleted file mode 100644 index fff268d..0000000 --- a/scribo/demo/wizard/src/preprocessing_widget.hh +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_WIDGET_HH - -# include <QtGui> -# include <ui_preprocessing_widget.h> -# include <src/preprocessing_task.hh> - -namespace scribo -{ - - namespace demo - { - - - class preprocessing_widget : public QWidget, - private Ui::PreprocessingWidget - { - Q_OBJECT; - - public: - preprocessing_widget(QWidget *parent = 0); - void reset(); - - void setup_picture(); - void setup_mixed_doc(); - void setup_text_doc(); - - preprocessing_task_set_t tasks() const; - - private: // members - void clear_checked(); - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_PREPROCESSING_WIDGET_HH diff --git a/scribo/demo/wizard/src/process_page.cc b/scribo/demo/wizard/src/process_page.cc deleted file mode 100644 index bff087a..0000000 --- a/scribo/demo/wizard/src/process_page.cc +++ /dev/null @@ -1,68 +0,0 @@ -#include <src/process_page.hh> -#include <src/process_widget.hh> -#include <src/preprocessing_task.hh> - - -namespace scribo -{ - - namespace demo - { - - - process_page::process_page(QWidget *parent) - : QWizardPage(parent) - { - widget_ = new process_widget(this); - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(widget_); - setLayout(layout); - - setSubTitle("Processing..."); - setTitle("Please wait while computing results."); - - connect(&runner_, SIGNAL(new_intermediate_result(const QImage&)), - widget_, SLOT(update_pixmap(const QImage&))); - - connect(&runner_, SIGNAL(new_progress_max_value(unsigned)), - widget_, SLOT(set_progress_max_value(unsigned))); - - connect(&runner_, SIGNAL(new_progress_label(const QString&)), - widget_, SLOT(update_progress_label(const QString&))); - - connect(&runner_, SIGNAL(progress(unsigned)), - widget_, SLOT(progress(unsigned))); - } - - - void process_page::cleanupPage() - { - widget_->reset(); - runner_.stop(); - } - - - void process_page::initializePage() - { - runner_.start(field("load.input_dsp").value<QPixmap>().toImage(), - get_doc_type(), - field("preprocessing.tasks").value<preprocessing_task_set_t>()); - } - - - Doc_Type process_page::get_doc_type() - { - if (field("doc_type.type_text_doc").toBool()) - return Text_Doc; - else if (field("doc_type.type_picture").toBool()) - return Picture; - else if (field("doc_type.type_mixed_doc").toBool()) - return Mixed_Doc; - - return Invalid_Doc; - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/process_page.hh b/scribo/demo/wizard/src/process_page.hh deleted file mode 100644 index 6425a53..0000000 --- a/scribo/demo/wizard/src/process_page.hh +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_PROCESS_PAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_PROCESS_PAGE_HH - -# include <QtGui> -# include <src/process_widget.hh> -# include <src/runner.hh> - -namespace scribo -{ - - namespace demo - { - - - class process_page : public QWizardPage - { - Q_OBJECT; - - public: - process_page(QWidget *parent = 0); - - virtual void cleanupPage(); - virtual void initializePage(); - - private: // members - Doc_Type get_doc_type(); - - private: // attributes - process_widget* widget_; - runner runner_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_PROCESS_PAGE_HH diff --git a/scribo/demo/wizard/src/process_widget.cc b/scribo/demo/wizard/src/process_widget.cc deleted file mode 100644 index c0d652f..0000000 --- a/scribo/demo/wizard/src/process_widget.cc +++ /dev/null @@ -1,80 +0,0 @@ -#include <src/process_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - process_widget::process_widget(QWidget *parent) - : QWidget(parent) - { - view_ = new QGraphicsView(this); - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(view_); - setLayout(layout); - - QVBoxLayout *progress_layout = new QVBoxLayout; - progress_bar_ = new QProgressBar(this); - progress_bar_->setMinimum(0); - progress_label_ = new QLabel("Processing..."); - progress_layout->addWidget(progress_bar_); - progress_layout->addWidget(progress_label_); - - progress_dialog_ = new QWidget(); - progress_dialog_->setLayout(progress_layout); - - view_->setScene(new QGraphicsScene()); - progress_ = view_->scene()->addWidget(progress_dialog_); - progress_->setZValue(1); - - image_ = view_->scene()->addPixmap(QPixmap()); - } - - void process_widget::reset() - { - progress_bar_->show(); - progress_bar_->setValue(0); - progress_bar_->setMaximum(0); - image_->setPixmap(QPixmap()); - } - - void process_widget::set_progress_max_value(unsigned max) - { - progress_bar_->setMaximum(max); - } - - void process_widget::update_pixmap(const QImage& image) - { - image_->setPixmap(QPixmap::fromImage(image)); - } - - void process_widget::progress(unsigned i) - { - progress_bar_->setValue(progress_bar_->value() + i); - - if (progress_bar_->value() == progress_bar_->maximum()) - progress_->hide(); - } - - void process_widget::update_progress_label(const QString& msg) - { - progress_label_->setText(msg); - } - - void process_widget::resizeEvent(QResizeEvent* event) - { - QPoint tmp(view_->geometry().center().x() - - progress_->boundingRect().width() / 2, - view_->geometry().center().y() - - progress_->boundingRect().height() / 2); - - progress_->setPos(view_->mapToScene(tmp)); - - event->ignore(); - } - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/process_widget.hh b/scribo/demo/wizard/src/process_widget.hh deleted file mode 100644 index 8c0ed88..0000000 --- a/scribo/demo/wizard/src/process_widget.hh +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_PROCESS_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_PROCESS_WIDGET_HH - -# include <QtGui> - -namespace scribo -{ - - namespace demo - { - - - class process_widget : public QWidget - { - Q_OBJECT; - - public: - process_widget(QWidget *parent = 0); - void reset(); - - public slots: - void set_progress_max_value(unsigned max); - void update_pixmap(const QImage& image); - void progress(unsigned i); - void update_progress_label(const QString& msg); - - virtual void resizeEvent(QResizeEvent* event); - - private: - QGraphicsView *view_; - QGraphicsPixmapItem *image_; - - QLabel *progress_label_; - QProgressBar* progress_bar_; - QWidget* progress_dialog_; - - QGraphicsProxyWidget* progress_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_PROCESS_WIDGET_HH diff --git a/scribo/demo/wizard/src/result_page.cc b/scribo/demo/wizard/src/result_page.cc deleted file mode 100644 index 1bb08d8..0000000 --- a/scribo/demo/wizard/src/result_page.cc +++ /dev/null @@ -1,43 +0,0 @@ -#include <src/result_page.hh> -#include <src/result_widget.hh> - - -namespace scribo -{ - - namespace demo - { - - - result_page::result_page(QWidget *parent) - : QWizardPage(parent) - { - widget_ = new result_widget(this); - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(widget_); - setLayout(layout); - - setTitle("Result"); - setSubTitle("Copy and paste the recognized text."); - - connect(parent, SIGNAL(customButtonClicked(int)), - parent, SLOT(restart())); - } - - - void result_page::cleanupPage() - { - widget_->reset(); - } - - - void result_page::initializePage() - { - setButtonText(QWizard::CustomButton1, "restart"); - widget_->load("/tmp/out.txt"); - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/result_page.hh b/scribo/demo/wizard/src/result_page.hh deleted file mode 100644 index c6f02b9..0000000 --- a/scribo/demo/wizard/src/result_page.hh +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_RESULT_PAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_RESULT_PAGE_HH - -# include <QtGui> -# include <src/result_widget.hh> -# include <src/runner.hh> - -namespace scribo -{ - - namespace demo - { - - - class result_page : public QWizardPage - { - Q_OBJECT; - - public: - result_page(QWidget *parent = 0); - - virtual void cleanupPage(); - virtual void initializePage(); - - private: // attributes - result_widget* widget_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_RESULT_PAGE_HH diff --git a/scribo/demo/wizard/src/result_widget.cc b/scribo/demo/wizard/src/result_widget.cc deleted file mode 100644 index 889ba4b..0000000 --- a/scribo/demo/wizard/src/result_widget.cc +++ /dev/null @@ -1,43 +0,0 @@ -#include <src/result_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - result_widget::result_widget(QWidget *parent) - : QWidget(parent) - { - text_ = new QTextEdit(this); - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(text_); - setLayout(layout); - } - - void result_widget::load(const QString& filename) - { - QFile file(filename); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) - return; - - QTextStream in(&file); - in.setCodec("UTF-8"); - while (!in.atEnd()) - { - QString line = in.readLine(); - text_->append(line); - } - - } - - void result_widget::reset() - { - text_->clear(); - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/result_widget.hh b/scribo/demo/wizard/src/result_widget.hh deleted file mode 100644 index 4472238..0000000 --- a/scribo/demo/wizard/src/result_widget.hh +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_RESULT_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_RESULT_WIDGET_HH - -# include <QtGui> - -namespace scribo -{ - - namespace demo - { - - - class result_widget : public QWidget - { - Q_OBJECT; - - public: - result_widget(QWidget *parent = 0); - void reset(); - - void load(const QString& filename); - - private: - QTextEdit *text_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_RESULT_WIDGET_HH diff --git a/scribo/demo/wizard/src/rotate_page.cc b/scribo/demo/wizard/src/rotate_page.cc deleted file mode 100644 index 9b17a5d..0000000 --- a/scribo/demo/wizard/src/rotate_page.cc +++ /dev/null @@ -1,45 +0,0 @@ -#include <src/rotate_page.hh> - -namespace scribo -{ - - namespace demo - { - - - rotate_page::rotate_page(QWidget *parent) - : QWizardPage(parent) - { - widget_ = new rotate_widget(this); - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(widget_); - setLayout(layout); - - setTitle("Rotation."); - setSubTitle("Rotate the input image using the buttons above."); - - } - - - void rotate_page::cleanupPage() - { - } - - - void rotate_page::initializePage() - { - widget_->load_image(field("load.input_dsp").value<QPixmap>()); - } - - - bool rotate_page::isComplete() - { - setField("load.input_dsp", widget_->image()); - return true; - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/rotate_page.hh b/scribo/demo/wizard/src/rotate_page.hh deleted file mode 100644 index 21c2074..0000000 --- a/scribo/demo/wizard/src/rotate_page.hh +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_ROTATE_PAGE_HH -# define SCRIBO_DEMO_SHARED_SRC_ROTATE_PAGE_HH - -# include <QtGui> -# include <src/rotate_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - class rotate_page : public QWizardPage - { - Q_OBJECT; - - public: - rotate_page(QWidget *parent = 0); - - virtual void cleanupPage(); - virtual void initializePage(); - virtual bool isComplete(); - - private: - rotate_widget *widget_; - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_ROTATE_PAGE_HH diff --git a/scribo/demo/wizard/src/rotate_widget.cc b/scribo/demo/wizard/src/rotate_widget.cc deleted file mode 100644 index 41de670..0000000 --- a/scribo/demo/wizard/src/rotate_widget.cc +++ /dev/null @@ -1,38 +0,0 @@ -#include <src/rotate_widget.hh> - -namespace scribo -{ - - namespace demo - { - - - rotate_widget::rotate_widget(QWidget *parent) - : QWidget(parent) - { - setupUi(this); - } - - - void rotate_widget::load_image(const QPixmap& pixmap) - { - viewer_->draw_image(pixmap); - viewer_->set_rotation_enabled(true); - } - - - const QRectF& rotate_widget::rotate_area() const - { - return viewer_->selection(); - } - - - QPixmap rotate_widget::image() const - { - return viewer_->image(); - } - - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/rotate_widget.hh b/scribo/demo/wizard/src/rotate_widget.hh deleted file mode 100644 index 8465f98..0000000 --- a/scribo/demo/wizard/src/rotate_widget.hh +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_ROTATE_WIDGET_HH -# define SCRIBO_DEMO_SHARED_SRC_ROTATE_WIDGET_HH - -# include <QtGui> -# include <ui_rotate_widget.h> - -namespace scribo -{ - - namespace demo - { - - - class rotate_widget : public QWidget, private Ui::RotateWidget - { - Q_OBJECT; - - Q_PROPERTY(QRectF rotate_area READ rotate_area); - - public: - rotate_widget(QWidget *parent = 0); - - void load_image(const QPixmap& pixmap); - - const QRectF& rotate_area() const; - - QPixmap image() const; - - }; - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_ROTATE_WIDGET_HH diff --git a/scribo/demo/wizard/src/runner.cc b/scribo/demo/wizard/src/runner.cc deleted file mode 100644 index 7e888f6..0000000 --- a/scribo/demo/wizard/src/runner.cc +++ /dev/null @@ -1,296 +0,0 @@ -#include <src/runner.hh> - -#include <shared/src/to_mln_image.hh> -#include <src/preprocessing_task.hh> -#include <src/doc_type.hh> - -#include <mln/convert/to_qimage.hh> -#include <mln/convert/to_qimage_nocopy.hh> -#include <mln/fun/v2v/rgb_to_int_u.hh> -#include <mln/value/int_u8.hh> -#include <mln/data/convert.hh> -#include <mln/io/pbm/save.hh> - -#include <scribo/preprocessing/split_bg_fg.hh> -#include <scribo/preprocessing/denoise.hh> -#include <scribo/preprocessing/homogeneous_contrast.hh> -#include <scribo/preprocessing/unskew.hh> -#include <scribo/binarization/sauvola.hh> -#include <scribo/binarization/sauvola_ms.hh> -#include <scribo/binarization/global_threshold_auto.hh> - -#include <mln/logical/not.hh> - -namespace scribo -{ - - namespace demo - { - - QString basedir_ = ""; - - runner::runner(QObject *parent) - : QThread(parent) - { - process_.moveToThread(this); - } - - - void runner::start(const QImage& input, - const Doc_Type& doc_type, - const preprocessing_task_set_t& tasks) - { - input_ = input; - doc_type_ = doc_type; - tasks_ = tasks; - - QThread::start(); - } - - - void runner::run() - { - // Notification of the number of tasks. - emit new_progress_max_value(tasks_.size() + 2); - - qDebug() << "progress steps : " << tasks_.size() + 2; - - image2d<value::qt::rgb32> ima = load(); - - preprocess(ima); - - process(); - } - - - image2d<value::qt::rgb32> runner::load() - { - emit new_progress_label("Loading image"); - - // FIXME: specify the right top left corner. - // This is relevant when the image is cropped... - image2d<value::qt::rgb32> - output = shared::to_mln_image(input_, QPoint(0, 0)); - - QImage q_ima = convert::to_qimage_nocopy(output); - q_ima.save("/tmp/tmp.ppm"); - -// io::magick::load(output, filename_.toStdString()); - - emit progress(1); - emit new_intermediate_result(input_); - - return output; - } - - - void runner::preprocess(const image2d<value::qt::rgb32>& ima) - { - - image2d<value::rgb8> tmp_color; - io::ppm::load(tmp_color, "/tmp/tmp.ppm"); - - image2d<bool> out_bool; - - - //================== - // Remove background - //================== - if (tasks_.contains(RemoveBg)) - { - std::cout << "Foreground extraction" << std::endl; - emit new_progress_label("Foreground Extraction"); - - QStringList args; - args << "/tmp/tmp.ppm" << "10000" << "32" - << "/tmp/tmp.ppm" << "/dev/null"; - if (process_.execute(basedir_ + "/preprocessing/split_bg_fg", args)) - { - qDebug() << "Error running split_bg_fg"; - return; - } - - emit progress(1); - emit new_intermediate_result(mln::convert::to_qimage(tmp_color)); - } - - - //============================================= - // Convert to grayscale image (always happens). - //============================================= - emit new_progress_label("Convert to gray-scale image"); - image2d<value::int_u8> - intensity_ima = data::transform(tmp_color, - mln::fun::v2v::rgb_to_int_u<8>()); - emit progress(1); - - - //============================= - // Improve contrast homogeneity - //============================= - if (tasks_.contains(ImproveContrast)) - { - std::cout << "Improve contrast homogeneity" << std::endl; - emit new_progress_label("Improve contrast homogeneity"); - - intensity_ima = arith::revert(preprocessing::homogeneous_contrast(intensity_ima, 75)); - - image2d<value::qt::rgb32> - tmp_color32 = data::convert(value::qt::rgb32(), intensity_ima); - emit new_intermediate_result(convert::to_qimage(tmp_color32)); - emit progress(1); - } - - - //============================== - // Binarization (always happens) - //============================== - emit new_progress_label("Binarization"); - - if (tasks_.contains(BinarizationSauvola)) - { - // FIXME: sauvola should not negate the image. - std::cout << "Binarization Sauvola" << std::endl; - out_bool = binarization::sauvola(intensity_ima); - } - else if (tasks_.contains(BinarizationSauvolaMs)) - { - // FIXME: sauvola should not negate the image. - std::cout << "Binarization Sauvola_ms" << std::endl; - out_bool = binarization::sauvola_ms(intensity_ima, 51, 2); - } - else if (tasks_.contains(BinarizationSimple)) - { - std::cout << "Binarization Simple" << std::endl; - out_bool = scribo::binarization::global_threshold_auto(intensity_ima); - } - else - { - std::cout << "Binary image conversion" << std::endl; - out_bool = data::convert(bool(), intensity_ima); - } - - image2d<value::qt::rgb32> - tmp_color32 = data::convert(value::qt::rgb32(), out_bool); - emit new_intermediate_result(convert::to_qimage(tmp_color32)); - emit progress(1); - - - // FIXME: remove! - logical::not_inplace(out_bool); - - //======== - // Denoise - //======== -// if (tasks_.contains(RemoveNoise)) -// { -// std::cout << "Remove noise" << std::endl; -// emit new_progress_label("Remove noise"); - -// out_bool = preprocessing::denoise(out_bool, c8(), 2, 2); - -// image2d<value::qt::rgb32> -// tmp_color32 = data::convert(value::qt::rgb32(), out_bool); -// emit new_intermediate_result(convert::to_qimage(tmp_color32)); -// emit progress(1); -// } - - //======= - // Unskew - //======= - if (tasks_.contains(Unskew)) - { - std::cout << "Unskew" << std::endl; - emit new_progress_label("Unskew"); - - out_bool = scribo::preprocessing::unskew(out_bool).first(); - - image2d<value::qt::rgb32> - tmp_color32 = data::convert(value::qt::rgb32(), out_bool); - emit new_intermediate_result(convert::to_qimage(tmp_color32)); - emit progress(1); - } - - - //========================= - // Save preprocessed image. - //========================= - io::pbm::save(out_bool, "/tmp/tmp.pbm"); - } - - - void runner::process() - { - QStringList args; - - - // FIXME: require binaries to ask for a filename for bboxes - // output files. - switch(doc_type_) - { - case Text_Doc: - emit new_progress_label("Finding text in document..."); - qDebug() << "Running text_in_article_pbm"; - args << "/tmp/tmp.pbm" << "/tmp/out.txt"; - - // Denoise. - if (! tasks_.contains(RemoveNoise)) - args << "0"; - else - { - args << "1"; - emit progress(1); // Consider denoising as done even though it is performed later. - } - - args << "/tmp/"; - - if (process_.execute(basedir_ + "/text_in_article_pbm", args)) - { - qDebug() << "Error while running text_in_article_pbm."; - return; - } - break; - - case Picture: - emit new_progress_label("Finding text in picture..."); - qDebug() << "Running text_in_photo_pbm_fast"; - args << "/tmp/tmp.pbm" << "/tmp/out.ppm" << "1" << "1" << "1"; - if (process_.execute(basedir_ + "/text_in_photo_pbm_fast", args)) - { - qDebug() << "Error while running text_in_photo_pbm_fast."; - return; - } - break; - - case Mixed_Doc: - qDebug() << "Running pbm_text_in_mixed_doc"; - if (process_.execute(basedir_ + "/pbm_text_in_mixed_doc", args)) - { - qDebug() << "Error while running pbm_text_in_mixed_doc."; - return; - } - break; - - default: - case Invalid_Doc: - qDebug() << "runner - Invalid doc type..."; - return; - } - - process_.waitForFinished(-1); - - emit progress(1); - emit new_intermediate_result(QImage("/tmp/_09_step2_bboxes.ppm")); - qDebug() << "Done"; - } - - - void runner::stop() - { - process_.kill(); - terminate(); - } - - } // end of namespace scribo::demo - -} // end of namespace scribo diff --git a/scribo/demo/wizard/src/runner.hh b/scribo/demo/wizard/src/runner.hh deleted file mode 100644 index 4dcedc0..0000000 --- a/scribo/demo/wizard/src/runner.hh +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE) -// -// This file is part of Olena. -// -// Olena is free software: you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation, version 2 of the License. -// -// Olena is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Olena. If not, see <http://www.gnu.org/licenses/>. -// -// As a special exception, you may use this file as part of a free -// software project without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to produce -// an executable, this file does not by itself cause the resulting -// executable to be covered by the GNU General Public License. This -// exception does not however invalidate any other reasons why the -// executable file might be covered by the GNU General Public License. - -#ifndef SCRIBO_DEMO_SHARED_SRC_RUNNER_HH -# define SCRIBO_DEMO_SHARED_SRC_RUNNER_HH - -# include <QtGui> -# include <QProcess> - -# include <src/preprocessing_task.hh> -# include <src/doc_type.hh> - -# include <mln/core/image/image2d.hh> -# include <mln/value/qt/rgb32.hh> - -namespace scribo -{ - - namespace demo - { - - - class runner : public QThread - { - Q_OBJECT; - - public: - runner(QObject *parent = 0); - - void start(const QImage& input, - const Doc_Type& doc_type, - const preprocessing_task_set_t& tasks); - - void stop(); - - signals: - void new_intermediate_result(const QImage& ima); - void new_progress_max_value(unsigned i); - void new_progress_label(const QString& msg); - void progress(unsigned i); - - private: // members - mln::image2d<mln::value::qt::rgb32> load(); - void preprocess(const mln::image2d<mln::value::qt::rgb32>& ima); - void process(); - virtual void run(); - - private: // attributes - QProcess process_; - Doc_Type doc_type_; - QSet<Preprocessing_Task> tasks_; - QImage input_; - }; - - - - } // end of namespace scribo::demo - -} // end of namespace scribo - - -#endif // ! SCRIBO_DEMO_SHARED_SRC_RUNNER_HH diff --git a/scribo/demo/wizard/src/test.cc b/scribo/demo/wizard/src/test.cc deleted file mode 100644 index 3d95db6..0000000 --- a/scribo/demo/wizard/src/test.cc +++ /dev/null @@ -1,16 +0,0 @@ -#include <QtGui> -#include <shared/src/image_viewer.hh> -#include <shared/src/crop_item.hh> - -int main(int argc, char* argv[]) -{ - QApplication app(argc, argv); - - scribo::demo::shared::image_viewer win; - win.show(); - win.draw_image(QPixmap("image.jpg"), QPoint(0,0)); - - win.setSelectionEnabled(true); - - return app.exec(); -} diff --git a/scribo/demo/wizard/ui/doc_type_widget.ui b/scribo/demo/wizard/ui/doc_type_widget.ui deleted file mode 100644 index 39c8422..0000000 --- a/scribo/demo/wizard/ui/doc_type_widget.ui +++ /dev/null @@ -1,115 +0,0 @@ -<ui version="4.0" > - <class>DocTypeWidget</class> - <widget class="QWidget" name="DocTypeWidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>166</width> - <height>140</height> - </rect> - </property> - <property name="windowTitle" > - <string>Form</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout" > - <property name="margin" > - <number>0</number> - </property> - <item> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="1" > - <spacer name="verticalSpacer" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" > - <spacer name="horizontalSpacer_2" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="1" > - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Document type</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3" > - <item> - <widget class="QRadioButton" name="type_text_doc_" > - <property name="text" > - <string>Text Document </string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="type_picture_" > - <property name="text" > - <string>Picture</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="type_mixed_doc_" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="text" > - <string>Mixed document</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="2" > - <spacer name="horizontalSpacer_3" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="1" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/scribo/demo/wizard/ui/load_widget.ui b/scribo/demo/wizard/ui/load_widget.ui deleted file mode 100644 index db0dbc4..0000000 --- a/scribo/demo/wizard/ui/load_widget.ui +++ /dev/null @@ -1,110 +0,0 @@ -<ui version="4.0" > - <class>Form</class> - <widget class="QWidget" name="Form" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>300</height> - </rect> - </property> - <property name="windowTitle" > - <string>Form</string> - </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="1" > - <spacer name="verticalSpacer" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>76</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" > - <spacer name="horizontalSpacer" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>83</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="1" colspan="2" > - <layout class="QVBoxLayout" name="verticalLayout" > - <item> - <widget class="scribo::demo::shared::browse_widget" native="1" name="widget" /> - </item> - <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Options</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2" > - <item> - <widget class="QCheckBox" name="checkBox" > - <property name="text" > - <string>Select a region of interest</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="checkBox_2" > - <property name="text" > - <string>Perform a manual rotation</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item row="1" column="3" > - <spacer name="horizontalSpacer_2" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>83</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="1" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>76</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>scribo::demo::shared::browse_widget</class> - <extends>QWidget</extends> - <header location="global" >shared/src/browse_widget.hh</header> - <container>1</container> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/scribo/demo/wizard/ui/main_window.ui b/scribo/demo/wizard/ui/main_window.ui deleted file mode 100644 index 0facd09..0000000 --- a/scribo/demo/wizard/ui/main_window.ui +++ /dev/null @@ -1,216 +0,0 @@ -<ui version="4.0" > - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>507</width> - <height>476</height> - </rect> - </property> - <property name="windowTitle" > - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget" > - <layout class="QVBoxLayout" name="verticalLayout" > - <property name="margin" > - <number>0</number> - </property> - <item> - <widget class="QStackedWidget" name="stackedWidget" > - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="page_3" > - <layout class="QVBoxLayout" name="verticalLayout_2" > - <item> - <widget class="scribo::demo::shared::wizard_title_widget" native="1" name="title_0" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item> - <widget class="scribo::demo::shared::browse_widget" native="1" name="widget_1" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page" > - <layout class="QVBoxLayout" name="verticalLayout_4" > - <item> - <widget class="scribo::demo::shared::wizard_title_widget" native="1" name="title_2" /> - </item> - <item> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="1" > - <spacer name="verticalSpacer" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" > - <spacer name="horizontalSpacer_2" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="1" > - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string/> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3" > - <item> - <widget class="QRadioButton" name="radioButton_4" > - <property name="text" > - <string>Extract all (Text, tables, images...)</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton" > - <property name="text" > - <string>Find text</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton_2" > - <property name="text" > - <string>Extract tables</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton_3" > - <property name="text" > - <string>Detect text</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="1" column="2" > - <spacer name="horizontalSpacer_3" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="1" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_2" /> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout" > - <item> - <spacer name="horizontalSpacer" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="prevBtn" > - <property name="enabled" > - <bool>false</bool> - </property> - <property name="text" > - <string>&Previous</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="nextBtn" > - <property name="text" > - <string>&Next</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>507</width> - <height>31</height> - </rect> - </property> - </widget> - <widget class="QStatusBar" name="statusbar" /> - </widget> - <customwidgets> - <customwidget> - <class>scribo::demo::shared::wizard_title_widget</class> - <extends>QWidget</extends> - <header location="global" >shared/src/wizard_title_widget.hh</header> - <container>1</container> - </customwidget> - <customwidget> - <class>scribo::demo::shared::browse_widget</class> - <extends>QWidget</extends> - <header location="global" >shared/src/browse_widget.hh</header> - <container>1</container> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/scribo/demo/wizard/ui/preprocessing_widget.ui b/scribo/demo/wizard/ui/preprocessing_widget.ui deleted file mode 100644 index 6b9c178..0000000 --- a/scribo/demo/wizard/ui/preprocessing_widget.ui +++ /dev/null @@ -1,223 +0,0 @@ -<ui version="4.0" > - <class>PreprocessingWidget</class> - <widget class="QWidget" name="PreprocessingWidget" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>398</width> - <height>318</height> - </rect> - </property> - <property name="windowTitle" > - <string>Form</string> - </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="1" > - <spacer name="verticalSpacer_2" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>1</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0" > - <spacer name="horizontalSpacer_2" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>1</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="1" > - <layout class="QVBoxLayout" name="verticalLayout_3" > - <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Preprocessing</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2" > - <item> - <widget class="QCheckBox" name="removeBg" > - <property name="text" > - <string>Remove background (slow)</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="unskew" > - <property name="text" > - <string>Unskew</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="removeNoise" > - <property name="enabled" > - <bool>true</bool> - </property> - <property name="text" > - <string>Remove noise</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="improveContrast" > - <property name="enabled" > - <bool>true</bool> - </property> - <property name="text" > - <string>Improve brightness/contrast</string> - </property> - <property name="checked" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <item> - <widget class="QCheckBox" name="reduceSize" > - <property name="text" > - <string>Reduce size by</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinBox" > - <property name="minimum" > - <number>2</number> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2" > - <property name="title" > - <string>Advanced options</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout" > - <item> - <layout class="QHBoxLayout" name="horizontalLayout" > - <item> - <widget class="QLabel" name="binarizeLbl" > - <property name="text" > - <string>Binarization method:</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QComboBox" name="binarizationCBox" > - <property name="currentIndex" > - <number>2</number> - </property> - <item> - <property name="text" > - <string>Simple</string> - </property> - </item> - <item> - <property name="text" > - <string>Sauvola</string> - </property> - </item> - <item> - <property name="text" > - <string>Sauvola multi-scale</string> - </property> - </item> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </item> - <item row="1" column="2" > - <spacer name="horizontalSpacer_3" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>1</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="2" column="1" > - <spacer name="verticalSpacer_3" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>2</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/scribo/demo/wizard/wizard.pro b/scribo/demo/wizard/wizard.pro deleted file mode 100644 index e517b4a..0000000 --- a/scribo/demo/wizard/wizard.pro +++ /dev/null @@ -1,71 +0,0 @@ -# -*- c++ -*- -###################################################################### -# Automatically generated by qmake (2.01a) Tue Feb 9 12:02:10 2010 -###################################################################### - -TEMPLATE = app -TARGET = -DEPENDPATH += . src -INCLUDEPATH += . ../ ../shared $(OLN)/milena $(OLN)/scribo - -DEFINES += NDEBUG MLN_INCLUDE_ONLY - -# Input - HEADERS += \ - ../shared/src/image_viewer.hh \ - ../shared/src/internal/interactive_scene.hh \ - ../shared/src/crop_item.hh \ - ../shared/src/browse_widget.hh \ - src/load_page.hh \ - src/load_widget.hh \ - src/doc_type_widget.hh \ - src/doc_type_page.hh \ - src/crop_widget.hh \ - src/crop_page.hh \ - src/rotate_widget.hh \ - src/rotate_page.hh \ - src/preprocessing_widget.hh \ - src/preprocessing_page.hh \ - src/process_page.hh \ - src/process_widget.hh \ - src/runner.hh \ - src/preprocessing_task.hh \ - src/doc_type.hh \ - src/main_window.hh \ - src/result_page.hh \ - src/result_widget.hh - - -SOURCES += \ - ../shared/src/crop_item.cc \ - ../shared/src/internal/interactive_scene.cc \ - ../shared/src/browse_widget.cc \ - src/main.cc \ - src/main_window.cc \ - src/doc_type_widget.cc \ - src/doc_type_page.cc \ - src/load_page.cc \ - src/load_widget.cc \ - src/crop_widget.cc \ - src/crop_page.cc \ - src/rotate_widget.cc \ - src/rotate_page.cc \ - src/preprocessing_widget.cc \ - src/preprocessing_page.cc \ - src/process_page.cc \ - src/process_widget.cc \ - src/mln_widgets.cc \ - src/result_page.cc \ - src/result_widget.cc - -FORMS += \ - ../shared/ui/browse_widget.ui \ - ../shared/ui/crop_widget.ui \ - ../shared/ui/rotate_widget.ui \ - ../shared/ui/image_viewer.ui \ - ui/preprocessing_widget.ui \ - ui/doc_type_widget.ui \ - ui/main_window.ui - - -RESOURCES += ../shared/shared.qrc wizard.qrc diff --git a/scribo/demo/wizard/wizard.qrc b/scribo/demo/wizard/wizard.qrc deleted file mode 100644 index bd6b146..0000000 --- a/scribo/demo/wizard/wizard.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="images" > - <file>images/dematerialization.png</file> - </qresource> -</RCC> -- 1.7.2.5