├── .github └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── COPYING ├── GPL3.txt ├── README.md ├── cmake ├── CopyToBuildDir.cmake ├── FindCanberra.cmake ├── FindEXIV2.cmake ├── FindPthreads.cmake ├── LibToDLL.cmake ├── PatchFile.cmake ├── SetDefaultBuildType.cmake ├── SetDefaultGccFlags.cmake ├── ToNativePath.cmake ├── UpdateTranslations.cmake ├── cmake_uninstall.cmake.in ├── copy_to_build_dir.cmake.in ├── default_cflags.cmake ├── default_cxxflags.cmake ├── generate_nsi_file.cmake.in ├── move_sym_file.cmake └── prepare_staging_dir.cmake.in ├── config.h.in ├── debian ├── changelog ├── control ├── copyright ├── rules ├── scantailor-universal.desktop ├── scantailor-universal.svg └── source │ └── format ├── src ├── CMakeLists.txt ├── Doxyfile ├── app │ ├── Application.cpp │ ├── Application.h │ ├── AutoSaveTimer.cpp │ ├── AutoSaveTimer.h │ ├── CMakeLists.txt │ ├── CanberraSoundPlayer.cpp │ ├── CanberraSoundPlayer.h │ ├── ExportDialog.cpp │ ├── ExportDialog.h │ ├── FixDpiDialog.cpp │ ├── FixDpiDialog.h │ ├── LoadFilesStatusDialog.cpp │ ├── LoadFilesStatusDialog.h │ ├── MainWindow.cpp │ ├── MainWindow.h │ ├── NewOpenProjectPanel.cpp │ ├── NewOpenProjectPanel.h │ ├── OpenWithMenuProvider.cpp │ ├── OpenWithMenuProvider.h │ ├── OutOfMemoryDialog.cpp │ ├── OutOfMemoryDialog.h │ ├── ProjectCreationContext.cpp │ ├── ProjectCreationContext.h │ ├── ProjectFilesDialog.cpp │ ├── ProjectFilesDialog.h │ ├── ProjectOpeningContext.cpp │ ├── ProjectOpeningContext.h │ ├── RelinkablePathVisualization.cpp │ ├── RelinkablePathVisualization.h │ ├── RelinkingDialog.cpp │ ├── RelinkingDialog.h │ ├── RelinkingListView.cpp │ ├── RelinkingListView.h │ ├── RelinkingModel.cpp │ ├── RelinkingModel.h │ ├── RelinkingSortingModel.cpp │ ├── RelinkingSortingModel.h │ ├── SettingsDialog.cpp │ ├── SettingsDialog.h │ ├── SkinnedButton.cpp │ ├── SkinnedButton.h │ ├── StageListView.cpp │ ├── StageListView.h │ ├── StartBatchProcessingDialog.cpp │ ├── StartBatchProcessingDialog.h │ ├── SystemLoadWidget.cpp │ ├── SystemLoadWidget.h │ ├── ThumbnailSequence.cpp │ ├── ThumbnailSequence.h │ ├── main.cpp │ ├── resources │ │ ├── GPLv3.html │ │ ├── SettingsTreeData.tsv │ │ ├── icons │ │ │ ├── COPYING │ │ │ ├── appicon-about.png │ │ │ ├── aqua-sphere.png │ │ │ ├── aqua-sphere.svg │ │ │ ├── auto-magnet-hor.png │ │ │ ├── auto-magnet-none.png │ │ │ ├── auto-magnet-ver.png │ │ │ ├── auto-magnet.png │ │ │ ├── big-down-arrow.png │ │ │ ├── big-left-arrow.png │ │ │ ├── big-right-arrow.png │ │ │ ├── big-up-arrow.png │ │ │ ├── despeckle-aggressive.png.png │ │ │ ├── despeckle-cautious.png.png │ │ │ ├── despeckle-normal.png.png │ │ │ ├── editclear.png │ │ │ ├── file-16.png │ │ │ ├── folder-16.png │ │ │ ├── gimp-center-none.png │ │ │ ├── gimp-reset.png │ │ │ ├── gimp-undo-history.png │ │ │ ├── insert-after-16.png │ │ │ ├── insert-before-16.png │ │ │ ├── insert-here-16.png │ │ │ ├── keep-in-view.png │ │ │ ├── layout_type_auto.png │ │ │ ├── left_page_plus_offcut.png │ │ │ ├── left_page_plus_offcut_selected.png │ │ │ ├── left_page_thumb.png │ │ │ ├── minus-16.png │ │ │ ├── multi_choice.png │ │ │ ├── multi_choice.svg │ │ │ ├── object-rotate-left.png │ │ │ ├── object-rotate-right.png │ │ │ ├── play-small-hovered.png │ │ │ ├── play-small-pressed.png │ │ │ ├── play-small.png │ │ │ ├── plus-16.png │ │ │ ├── right_page_plus_offcut.png │ │ │ ├── right_page_plus_offcut_selected.png │ │ │ ├── right_page_thumb.png │ │ │ ├── single_page_uncut.png │ │ │ ├── single_page_uncut_selected.png │ │ │ ├── stock-center-24-hor.png │ │ │ ├── stock-center-24-ver.png │ │ │ ├── stock-center-24.png │ │ │ ├── stock-gravity-center-24-hor.png │ │ │ ├── stock-gravity-center-24-ver.png │ │ │ ├── stock-gravity-center-24.png │ │ │ ├── stock-gravity-east-24.png │ │ │ ├── stock-gravity-north-24.png │ │ │ ├── stock-gravity-north-east-24.png │ │ │ ├── stock-gravity-north-west-24.png │ │ │ ├── stock-gravity-south-24.png │ │ │ ├── stock-gravity-south-east-24.png │ │ │ ├── stock-gravity-south-west-24.png │ │ │ ├── stock-gravity-west-24.png │ │ │ ├── stock-vchain-24.png │ │ │ ├── stock-vchain-broken-24.png │ │ │ ├── stop-big-hovered.png │ │ │ ├── stop-big-pressed.png │ │ │ ├── stop-big.png │ │ │ ├── trashed-big.png │ │ │ ├── trashed-small.png │ │ │ ├── two_pages.png │ │ │ ├── two_pages_selected.png │ │ │ ├── undo-22.png │ │ │ ├── untrash-big.png │ │ │ └── user-trash.png │ │ ├── images │ │ │ └── empty-page.png │ │ ├── resources.qrc │ │ └── win32 │ │ │ ├── icon.ico │ │ │ └── resources.rc │ ├── settings │ │ ├── execmenu.cpp │ │ ├── execmenu.h │ │ ├── fancylineedit.cpp │ │ └── fancylineedit.h │ └── ui │ │ ├── AboutDialog.ui │ │ ├── BatchProcessingLowerPanel.ui │ │ ├── CMakeLists.txt │ │ ├── ExportDialog.ui │ │ ├── FixDpiDialog.ui │ │ ├── LoadFilesStatusDialog.ui │ │ ├── MainWindow.ui │ │ ├── NewOpenProjectPanel.ui │ │ ├── OutOfMemoryDialog.ui │ │ ├── ProjectFilesDialog.ui │ │ ├── RelinkingDialog.ui │ │ ├── RemovePagesDialog.ui │ │ ├── SettingsDialog.ui │ │ ├── StartBatchProcessingDialog.ui │ │ └── SystemLoadWidget.ui ├── app_cli │ ├── CMakeLists.txt │ ├── ConsoleBatch.cpp │ ├── ConsoleBatch.h │ └── main-cli.cpp ├── compat │ ├── QAtomicInt │ └── pstdint.h ├── core │ ├── AbstractCommand.h │ ├── AbstractFilter.h │ ├── AbstractFilterDataCollector.h │ ├── AbstractRelinker.h │ ├── ApplyToDialog.cpp │ ├── ApplyToDialog.h │ ├── AtomicFileOverwriter.cpp │ ├── AtomicFileOverwriter.h │ ├── AutoManualMode.h │ ├── BackgroundExecutor.cpp │ ├── BackgroundExecutor.h │ ├── BackgroundTask.cpp │ ├── BackgroundTask.h │ ├── BasicImageView.cpp │ ├── BasicImageView.h │ ├── BeforeOrAfter.h │ ├── BubbleAnimation.cpp │ ├── BubbleAnimation.h │ ├── CMakeLists.txt │ ├── ChangedStateItemDelegate.h │ ├── CommandLine.cpp │ ├── CommandLine.h │ ├── CompositeCacheDrivenTask.h │ ├── ContentBoxCollector.h │ ├── ContentBoxPropagator.cpp │ ├── ContentBoxPropagator.h │ ├── ContentSpanFinder.cpp │ ├── ContentSpanFinder.h │ ├── DebugImageView.cpp │ ├── DebugImageView.h │ ├── DebugImages.cpp │ ├── DebugImages.h │ ├── Despeckle.cpp │ ├── Despeckle.h │ ├── Dpi.cpp │ ├── Dpi.h │ ├── Dpm.cpp │ ├── Dpm.h │ ├── ErrorWidget.cpp │ ├── ErrorWidget.h │ ├── EstimateBackground.cpp │ ├── EstimateBackground.h │ ├── FileNameDisambiguator.cpp │ ├── FileNameDisambiguator.h │ ├── FilterData.cpp │ ├── FilterData.h │ ├── FilterOptionsWidget.cpp │ ├── FilterOptionsWidget.h │ ├── FilterResult.h │ ├── FilterUiInterface.h │ ├── GenericMetadataLoader.cpp │ ├── GenericMetadataLoader.h │ ├── ImageFileInfo.cpp │ ├── ImageFileInfo.h │ ├── ImageId.cpp │ ├── ImageId.h │ ├── ImageInfo.cpp │ ├── ImageInfo.h │ ├── ImageLoader.cpp │ ├── ImageLoader.h │ ├── ImageMetadata.cpp │ ├── ImageMetadata.h │ ├── ImageMetadataLoader.cpp │ ├── ImageMetadataLoader.h │ ├── ImagePixmapUnion.h │ ├── ImagePresentation.h │ ├── ImageTransformation.cpp │ ├── ImageTransformation.h │ ├── ImageViewBase.cpp │ ├── ImageViewBase.h │ ├── IncompleteThumbnail.cpp │ ├── IncompleteThumbnail.h │ ├── Jp2MetadataLoader.cpp │ ├── Jp2MetadataLoader.h │ ├── Jp2Reader.cpp │ ├── Jp2Reader.h │ ├── JpegMetadataLoader.cpp │ ├── JpegMetadataLoader.h │ ├── LoadFileTask.cpp │ ├── LoadFileTask.h │ ├── Margins.h │ ├── NonOwningWidget.cpp │ ├── NonOwningWidget.h │ ├── OpenGLSupport.cpp │ ├── OpenGLSupport.h │ ├── OrthogonalRotation.cpp │ ├── OrthogonalRotation.h │ ├── OutOfMemoryHandler.cpp │ ├── OutOfMemoryHandler.h │ ├── OutputFileNameGenerator.cpp │ ├── OutputFileNameGenerator.h │ ├── PageId.cpp │ ├── PageId.h │ ├── PageInfo.cpp │ ├── PageInfo.h │ ├── PageOrderOption.h │ ├── PageOrderProvider.h │ ├── PageOrientationCollector.h │ ├── PageOrientationPropagator.cpp │ ├── PageOrientationPropagator.h │ ├── PageRange.cpp │ ├── PageRange.h │ ├── PageRangeSelectorWidget.cpp │ ├── PageRangeSelectorWidget.h │ ├── PageSelectionAccessor.cpp │ ├── PageSelectionAccessor.h │ ├── PageSelectionProvider.h │ ├── PageSequence.cpp │ ├── PageSequence.h │ ├── PageView.h │ ├── PayloadEvent.h │ ├── PhysicalTransformation.cpp │ ├── PhysicalTransformation.h │ ├── PixmapRenderer.cpp │ ├── PixmapRenderer.h │ ├── PngMetadataLoader.cpp │ ├── PngMetadataLoader.h │ ├── ProcessingIndicationWidget.cpp │ ├── ProcessingIndicationWidget.h │ ├── ProcessingTaskQueue.cpp │ ├── ProcessingTaskQueue.h │ ├── ProjectPages.cpp │ ├── ProjectPages.h │ ├── ProjectReader.cpp │ ├── ProjectReader.h │ ├── ProjectWriter.cpp │ ├── ProjectWriter.h │ ├── RecentProjects.cpp │ ├── RecentProjects.h │ ├── RegenParams.h │ ├── RelinkablePath.cpp │ ├── RelinkablePath.h │ ├── SelectedPage.cpp │ ├── SelectedPage.h │ ├── SmartFilenameOrdering.cpp │ ├── SmartFilenameOrdering.h │ ├── StageSequence.cpp │ ├── StageSequence.h │ ├── StatusBarProvider.cpp │ ├── StatusBarProvider.h │ ├── TabbedDebugImages.cpp │ ├── TabbedDebugImages.h │ ├── TaskStatus.h │ ├── ThreadPriority.cpp │ ├── ThreadPriority.h │ ├── ThumbnailBase.cpp │ ├── ThumbnailBase.h │ ├── ThumbnailCollector.h │ ├── ThumbnailFactory.cpp │ ├── ThumbnailFactory.h │ ├── ThumbnailLoadResult.h │ ├── ThumbnailPixmapCache.cpp │ ├── ThumbnailPixmapCache.h │ ├── TiffMetadataLoader.cpp │ ├── TiffMetadataLoader.h │ ├── TiffReader.cpp │ ├── TiffReader.h │ ├── TiffWriter.cpp │ ├── TiffWriter.h │ ├── Utils.cpp │ ├── Utils.h │ ├── WorkerThread.cpp │ ├── WorkerThread.h │ ├── XmlMarshaller.cpp │ ├── XmlMarshaller.h │ ├── XmlUnmarshaller.cpp │ ├── XmlUnmarshaller.h │ ├── filters │ │ ├── deskew │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Dependencies.cpp │ │ │ ├── Dependencies.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OrderByAngleProvider.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ └── ui │ │ │ │ └── DeskewOptionsWidget.ui │ │ ├── fix_orientation │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OrderByRotation.cpp │ │ │ ├── OrderByRotation.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ └── ui │ │ │ │ └── OrientationOptionsWidget.ui │ │ ├── output │ │ │ ├── BlackWhiteOptions.cpp │ │ │ ├── BlackWhiteOptions.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── ChangeDewarpingWidget.cpp │ │ │ ├── ChangeDewarpingWidget.h │ │ │ ├── ChangeDpiWidget.cpp │ │ │ ├── ChangeDpiWidget.h │ │ │ ├── ColorGrayscaleOptions.cpp │ │ │ ├── ColorGrayscaleOptions.h │ │ │ ├── ColorParams.cpp │ │ │ ├── ColorParams.h │ │ │ ├── ColorPickupInteraction.cpp │ │ │ ├── ColorPickupInteraction.h │ │ │ ├── DepthPerception.cpp │ │ │ ├── DepthPerception.h │ │ │ ├── DespeckleLevel.cpp │ │ │ ├── DespeckleLevel.h │ │ │ ├── DespeckleState.cpp │ │ │ ├── DespeckleState.h │ │ │ ├── DespeckleView.cpp │ │ │ ├── DespeckleView.h │ │ │ ├── DespeckleVisualization.cpp │ │ │ ├── DespeckleVisualization.h │ │ │ ├── DewarpingMode.cpp │ │ │ ├── DewarpingMode.h │ │ │ ├── DewarpingView.cpp │ │ │ ├── DewarpingView.h │ │ │ ├── FillColorProperty.cpp │ │ │ ├── FillColorProperty.h │ │ │ ├── FillZoneComparator.cpp │ │ │ ├── FillZoneComparator.h │ │ │ ├── FillZoneEditor.cpp │ │ │ ├── FillZoneEditor.h │ │ │ ├── FillZonePropFactory.cpp │ │ │ ├── FillZonePropFactory.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageMetadataCopier.cpp │ │ │ ├── ImageMetadataCopier.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── ImageViewTab.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OrderByDewarpingModeProvider.cpp │ │ │ ├── OrderByDewarpingModeProvider.h │ │ │ ├── OrderByModeProvider.cpp │ │ │ ├── OrderByModeProvider.h │ │ │ ├── OrderBySourceColor.cpp │ │ │ ├── OrderBySourceColor.h │ │ │ ├── OutputFileParams.cpp │ │ │ ├── OutputFileParams.h │ │ │ ├── OutputGenerator.cpp │ │ │ ├── OutputGenerator.h │ │ │ ├── OutputImageParams.cpp │ │ │ ├── OutputImageParams.h │ │ │ ├── OutputMargins.h │ │ │ ├── OutputParams.cpp │ │ │ ├── OutputParams.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── PictureLayerProperty.cpp │ │ │ ├── PictureLayerProperty.h │ │ │ ├── PictureZoneComparator.cpp │ │ │ ├── PictureZoneComparator.h │ │ │ ├── PictureZoneEditor.cpp │ │ │ ├── PictureZoneEditor.h │ │ │ ├── PictureZonePropDialog.cpp │ │ │ ├── PictureZonePropDialog.h │ │ │ ├── PictureZonePropFactory.cpp │ │ │ ├── PictureZonePropFactory.h │ │ │ ├── RenderParams.cpp │ │ │ ├── RenderParams.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── TabbedImageView.cpp │ │ │ ├── TabbedImageView.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── Utils.cpp │ │ │ ├── Utils.h │ │ │ ├── VirtualZoneProperty.cpp │ │ │ ├── VirtualZoneProperty.h │ │ │ ├── ZoneCategoryProperty.cpp │ │ │ ├── ZoneCategoryProperty.h │ │ │ └── ui │ │ │ │ ├── OutputChangeDewarpingWidget.ui │ │ │ │ ├── OutputChangeDpiWidget.ui │ │ │ │ ├── OutputOptionsWidget.ui │ │ │ │ └── PictureZonePropDialog.ui │ │ ├── page_layout │ │ │ ├── Alignment.cpp │ │ │ ├── Alignment.h │ │ │ ├── ApplySettingsWidget.cpp │ │ │ ├── ApplySettingsWidget.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OrderByAlignment.cpp │ │ │ ├── OrderByAlignment.h │ │ │ ├── OrderByHeightProvider.cpp │ │ │ ├── OrderByHeightProvider.h │ │ │ ├── OrderByWidthProvider.cpp │ │ │ ├── OrderByWidthProvider.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── Utils.cpp │ │ │ ├── Utils.h │ │ │ ├── alignmentwidget.cpp │ │ │ ├── alignmentwidget.h │ │ │ └── ui │ │ │ │ ├── PageLayoutApplyWidget.ui │ │ │ │ ├── PageLayoutOptionsWidget.ui │ │ │ │ └── alignmentwidget.ui │ │ ├── page_split │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── Dependencies.cpp │ │ │ ├── Dependencies.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── LayoutType.cpp │ │ │ ├── LayoutType.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OrderByPageSizeProvider.cpp │ │ │ ├── OrderByPageSizeProvider.h │ │ │ ├── OrderBySplitTypeProvider.cpp │ │ │ ├── OrderBySplitTypeProvider.h │ │ │ ├── PageLayout.cpp │ │ │ ├── PageLayout.h │ │ │ ├── PageLayoutEstimator.cpp │ │ │ ├── PageLayoutEstimator.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── SplitLineObject.h │ │ │ ├── SplitModeWidget.cpp │ │ │ ├── SplitModeWidget.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ ├── UnremoveButton.cpp │ │ │ ├── UnremoveButton.h │ │ │ ├── VertLineFinder.cpp │ │ │ ├── VertLineFinder.h │ │ │ └── ui │ │ │ │ ├── PageSplitModeWidget.ui │ │ │ │ └── PageSplitOptionsWidget.ui │ │ └── select_content │ │ │ ├── CMakeLists.txt │ │ │ ├── CacheDrivenTask.cpp │ │ │ ├── CacheDrivenTask.h │ │ │ ├── ContentBoxFinder.cpp │ │ │ ├── ContentBoxFinder.h │ │ │ ├── Dependencies.cpp │ │ │ ├── Dependencies.h │ │ │ ├── Filter.cpp │ │ │ ├── Filter.h │ │ │ ├── ImageView.cpp │ │ │ ├── ImageView.h │ │ │ ├── OptionsWidget.cpp │ │ │ ├── OptionsWidget.h │ │ │ ├── OrderBySizeProvider.cpp │ │ │ ├── OrderBySizeProvider.h │ │ │ ├── PageFinder.cpp │ │ │ ├── PageFinder.h │ │ │ ├── Params.cpp │ │ │ ├── Params.h │ │ │ ├── PhysContentSizeCalc.cpp │ │ │ ├── PhysSizeCalc.cpp │ │ │ ├── PhysSizeCalc.h │ │ │ ├── Settings.cpp │ │ │ ├── Settings.h │ │ │ ├── Task.cpp │ │ │ ├── Task.h │ │ │ ├── Thumbnail.cpp │ │ │ ├── Thumbnail.h │ │ │ └── ui │ │ │ └── SelectContentOptionsWidget.ui │ ├── interaction │ │ ├── CMakeLists.txt │ │ ├── DragHandler.cpp │ │ ├── DragHandler.h │ │ ├── DragWatcher.cpp │ │ ├── DragWatcher.h │ │ ├── DraggableLineSegment.cpp │ │ ├── DraggableLineSegment.h │ │ ├── DraggableObject.h │ │ ├── DraggablePoint.cpp │ │ ├── DraggablePoint.h │ │ ├── DraggablePolygon.cpp │ │ ├── DraggablePolygon.h │ │ ├── InteractionHandler.cpp │ │ ├── InteractionHandler.h │ │ ├── InteractionState.cpp │ │ ├── InteractionState.h │ │ ├── InteractiveXSpline.cpp │ │ ├── InteractiveXSpline.h │ │ ├── ObjectDragHandler.cpp │ │ ├── ObjectDragHandler.h │ │ ├── ZoomHandler.cpp │ │ └── ZoomHandler.h │ ├── resources │ │ ├── TiffCompressionMethods.tsv │ │ └── core_resources.qrc │ ├── settings │ │ ├── TiffCompressionInfo.cpp │ │ ├── TiffCompressionInfo.h │ │ ├── globalstaticsettings.cpp │ │ ├── globalstaticsettings.h │ │ ├── hotkeysmanager.cpp │ │ ├── hotkeysmanager.h │ │ └── ini_keys.h │ ├── tests │ │ ├── CMakeLists.txt │ │ ├── TestContentSpanFinder.cpp │ │ ├── TestMatrixCalc.cpp │ │ ├── TestSmartFilenameOrdering.cpp │ │ └── main.cpp │ ├── ui │ │ ├── ApplyToDialog.ui │ │ ├── CMakeLists.txt │ │ ├── ErrorWidget.ui │ │ └── PageRangeSelectorWidget.ui │ └── zones │ │ ├── BasicSplineVisualizer.cpp │ │ ├── BasicSplineVisualizer.h │ │ ├── CMakeLists.txt │ │ ├── EditableEllipse.cpp │ │ ├── EditableEllipse.h │ │ ├── EditableSpline.cpp │ │ ├── EditableSpline.h │ │ ├── EditableZoneSet.cpp │ │ ├── EditableZoneSet.h │ │ ├── LocalClipboard.cpp │ │ ├── LocalClipboard.h │ │ ├── SerializableEllipse.cpp │ │ ├── SerializableEllipse.h │ │ ├── SerializableSpline.cpp │ │ ├── SerializableSpline.h │ │ ├── SplineSegment.cpp │ │ ├── SplineSegment.h │ │ ├── SplineVertex.cpp │ │ ├── SplineVertex.h │ │ ├── Zone.cpp │ │ ├── Zone.h │ │ ├── ZoneContextMenuInteraction.cpp │ │ ├── ZoneContextMenuInteraction.h │ │ ├── ZoneContextMenuItem.h │ │ ├── ZoneCreationInteraction.cpp │ │ ├── ZoneCreationInteraction.h │ │ ├── ZoneDefaultInteraction.cpp │ │ ├── ZoneDefaultInteraction.h │ │ ├── ZoneDragInteraction.cpp │ │ ├── ZoneDragInteraction.h │ │ ├── ZoneEllipseVertexDragInteraction.cpp │ │ ├── ZoneEllipseVertexDragInteraction.h │ │ ├── ZoneInteractionContext.cpp │ │ ├── ZoneInteractionContext.h │ │ ├── ZoneSet.cpp │ │ ├── ZoneSet.h │ │ ├── ZoneVertexDragInteraction.cpp │ │ └── ZoneVertexDragInteraction.h ├── dewarping │ ├── CMakeLists.txt │ ├── Curve.cpp │ ├── Curve.h │ ├── CylindricalSurfaceDewarper.cpp │ ├── CylindricalSurfaceDewarper.h │ ├── DetectVertContentBounds.cpp │ ├── DetectVertContentBounds.h │ ├── DewarpingPointMapper.cpp │ ├── DewarpingPointMapper.h │ ├── DistortionModel.cpp │ ├── DistortionModel.h │ ├── DistortionModelBuilder.cpp │ ├── DistortionModelBuilder.h │ ├── RasterDewarper.cpp │ ├── RasterDewarper.h │ ├── TextLineRefiner.cpp │ ├── TextLineRefiner.h │ ├── TextLineTracer.cpp │ ├── TextLineTracer.h │ ├── TopBottomEdgeTracer.cpp │ ├── TopBottomEdgeTracer.h │ ├── TowardsLineTracer.cpp │ └── TowardsLineTracer.h ├── exporting │ ├── CMakeLists.txt │ ├── ExportModes.h │ ├── ExportSettings.h │ ├── ExportThread.cpp │ ├── ExportThread.h │ ├── ImageSplitOps.cpp │ └── ImageSplitOps.h ├── foundation │ ├── AlignedArray.h │ ├── AutoRemovingFile.cpp │ ├── AutoRemovingFile.h │ ├── CMakeLists.txt │ ├── DynamicPool.h │ ├── FastQueue.h │ ├── FlagOps.h │ ├── Grid.h │ ├── GridLineTraverser.cpp │ ├── GridLineTraverser.h │ ├── IntrusivePtr.h │ ├── MatMNT.h │ ├── MatT.h │ ├── NonCopyable.h │ ├── NumericTraits.h │ ├── PerformanceTimer.cpp │ ├── PerformanceTimer.h │ ├── PriorityQueue.h │ ├── Property.h │ ├── PropertyFactory.cpp │ ├── PropertyFactory.h │ ├── PropertySet.cpp │ ├── PropertySet.h │ ├── Proximity.cpp │ ├── Proximity.h │ ├── QtSignalForwarder.cpp │ ├── QtSignalForwarder.h │ ├── RefCountable.h │ ├── SafeDeletingQObjectPtr.h │ ├── ScopedDecInc.h │ ├── ScopedIncDec.h │ ├── Span.h │ ├── StaticPool.h │ ├── ValueConv.h │ ├── VecNT.h │ ├── VecT.h │ └── VirtualFunction.h ├── imageproc │ ├── AdjustBrightness.cpp │ ├── AdjustBrightness.h │ ├── BWColor.h │ ├── Binarize.cpp │ ├── Binarize.h │ ├── BinaryImage.cpp │ ├── BinaryImage.h │ ├── BinaryThreshold.cpp │ ├── BinaryThreshold.h │ ├── BitOps.cpp │ ├── BitOps.h │ ├── ByteOrder.h │ ├── CMakeLists.txt │ ├── ColorForId.h │ ├── ColorInterpolation.cpp │ ├── ColorInterpolation.h │ ├── ColorMixer.h │ ├── ConnComp.h │ ├── ConnCompEraser.cpp │ ├── ConnCompEraser.h │ ├── ConnCompEraserExt.cpp │ ├── ConnCompEraserExt.h │ ├── Connectivity.h │ ├── ConnectivityMap.cpp │ ├── ConnectivityMap.h │ ├── Constants.cpp │ ├── Constants.h │ ├── DrawOver.cpp │ ├── DrawOver.h │ ├── FindPeaksGeneric.h │ ├── GaussBlur.cpp │ ├── GaussBlur.h │ ├── GrayImage.cpp │ ├── GrayImage.h │ ├── GrayRasterOp.h │ ├── Grayscale.cpp │ ├── Grayscale.h │ ├── HoughLineDetector.cpp │ ├── HoughLineDetector.h │ ├── InfluenceMap.cpp │ ├── InfluenceMap.h │ ├── IntegralImage.h │ ├── LocalMinMaxGeneric.h │ ├── MaxWhitespaceFinder.cpp │ ├── MaxWhitespaceFinder.h │ ├── MorphGradientDetect.cpp │ ├── MorphGradientDetect.h │ ├── Morphology.cpp │ ├── Morphology.h │ ├── OrthogonalRotation.cpp │ ├── OrthogonalRotation.h │ ├── PolygonRasterizer.cpp │ ├── PolygonRasterizer.h │ ├── PolygonUtils.cpp │ ├── PolygonUtils.h │ ├── PolynomialLine.cpp │ ├── PolynomialLine.h │ ├── PolynomialSurface.cpp │ ├── PolynomialSurface.h │ ├── RastLineFinder.cpp │ ├── RastLineFinder.h │ ├── RasterOp.h │ ├── RasterOpGeneric.h │ ├── ReduceThreshold.cpp │ ├── ReduceThreshold.h │ ├── SEDM.cpp │ ├── SEDM.h │ ├── SavGolFilter.cpp │ ├── SavGolFilter.h │ ├── SavGolKernel.cpp │ ├── SavGolKernel.h │ ├── Scale.cpp │ ├── Scale.h │ ├── SeedFill.cpp │ ├── SeedFill.h │ ├── SeedFillGeneric.cpp │ ├── SeedFillGeneric.h │ ├── Shear.cpp │ ├── Shear.h │ ├── SkewFinder.cpp │ ├── SkewFinder.h │ ├── SlicedHistogram.cpp │ ├── SlicedHistogram.h │ ├── Sobel.h │ ├── Transform.cpp │ ├── Transform.h │ ├── UpscaleIntegerTimes.cpp │ ├── UpscaleIntegerTimes.h │ └── tests │ │ ├── CMakeLists.txt │ │ ├── TestBinarize.cpp │ │ ├── TestBinaryImage.cpp │ │ ├── TestConnCompEraser.cpp │ │ ├── TestConnCompEraserExt.cpp │ │ ├── TestGrayscale.cpp │ │ ├── TestMorphology.cpp │ │ ├── TestOrthogonalRotation.cpp │ │ ├── TestPolygonRasterizer.cpp │ │ ├── TestRastLineFinder.cpp │ │ ├── TestRasterOp.cpp │ │ ├── TestReduceThreshold.cpp │ │ ├── TestSEDM.cpp │ │ ├── TestScale.cpp │ │ ├── TestSeedFill.cpp │ │ ├── TestShear.cpp │ │ ├── TestSkewFinder.cpp │ │ ├── TestSlicedHistogram.cpp │ │ ├── TestTransform.cpp │ │ ├── Utils.cpp │ │ ├── Utils.h │ │ └── main.cpp ├── math │ ├── ArcLengthMapper.cpp │ ├── ArcLengthMapper.h │ ├── CMakeLists.txt │ ├── HomographicTransform.h │ ├── LineBoundedByRect.cpp │ ├── LineBoundedByRect.h │ ├── LineIntersectionScalar.cpp │ ├── LineIntersectionScalar.h │ ├── LinearFunction.cpp │ ├── LinearFunction.h │ ├── LinearSolver.cpp │ ├── LinearSolver.h │ ├── MatrixCalc.h │ ├── PolylineIntersector.cpp │ ├── PolylineIntersector.h │ ├── QuadraticFunction.cpp │ ├── QuadraticFunction.h │ ├── SidesOfLine.cpp │ ├── SidesOfLine.h │ ├── ToLineProjector.cpp │ ├── ToLineProjector.h │ ├── XSpline.cpp │ ├── XSpline.h │ ├── adiff │ │ ├── Function.cpp │ │ ├── Function.h │ │ ├── SparseMap.cpp │ │ ├── SparseMap.h │ │ ├── references.txt │ │ └── tests │ │ │ ├── CMakeLists.txt │ │ │ └── TestHessians.cpp │ └── spfit │ │ ├── ConstraintSet.cpp │ │ ├── ConstraintSet.h │ │ ├── FittableSpline.h │ │ ├── FrenetFrame.cpp │ │ ├── FrenetFrame.h │ │ ├── LinearForceBalancer.cpp │ │ ├── LinearForceBalancer.h │ │ ├── ModelShape.h │ │ ├── OptimizationResult.cpp │ │ ├── OptimizationResult.h │ │ ├── Optimizer.cpp │ │ ├── Optimizer.h │ │ ├── PolylineModelShape.cpp │ │ ├── PolylineModelShape.h │ │ ├── SplineFitter.cpp │ │ ├── SplineFitter.h │ │ ├── SqDistApproximant.cpp │ │ ├── SqDistApproximant.h │ │ ├── references.txt │ │ └── tests │ │ ├── CMakeLists.txt │ │ └── TestSqDistApproximant.cpp ├── packaging │ ├── linux │ │ └── README │ ├── osx │ │ ├── Info.plist.in │ │ ├── ScanTailorUniversal.icns │ │ ├── buildscantailor.sh │ │ ├── makeapp.sh │ │ ├── readme.en.txt │ │ └── user-config.jam │ └── windows │ │ ├── CMakeLists.txt │ │ ├── build_deps │ │ ├── CMakeLists.txt │ │ ├── dump_dll_syms.cmake │ │ ├── export-vars.cmake.in │ │ └── generate_qt_build_script.cmake │ │ ├── patch_libtiff │ │ ├── CMakeLists.txt │ │ └── apply_individual_patches.cmake.in │ │ ├── readme.en.txt │ │ ├── readme.ru.txt │ │ ├── registerExtension.nsh │ │ └── scantailor.nsi.in ├── stylesheets │ ├── CMakeLists.txt │ └── ubuntu.qss └── translations │ ├── crashreporter_ru.ts │ ├── crashreporter_untranslated.ts │ ├── qtbase_ru.qm │ ├── scantailor-universal_ru.ts │ └── scantailor-universal_untranslated.ts └── version.h /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user* 2 | CMakeFiles 3 | *.qm 4 | *.h.moc 5 | build/ 6 | *~ 7 | *.swp 8 | .vimprj/ 9 | *.patch 10 | ScanTailor.config 11 | ScanTailor.creator 12 | ScanTailor.creator.user 13 | ScanTailor.files 14 | ScanTailor.includes 15 | build-*/ 16 | samples/ 17 | 18 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/stylesheets/BreezeStyleSheets"] 2 | path = src/stylesheets/BreezeStyleSheets 3 | url = https://github.com/trufanov-nok/BreezeStyleSheets-for-STU 4 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Scan Tailor is free software: you can redistribute it and/or modify 2 | it under the terms of the GNU General Public License as published by 3 | the Free Software Foundation, either version 3 of the License, or 4 | (at your option) any later version. 5 | 6 | The GNU General Public License version 3 can be found in GPL3.txt 7 | 8 | Some parts of the program are licensed under different, but compatible 9 | with GPL3 terms. For more details, see: 10 | 11 | boost/LICENSE_1_0.txt 12 | resources/icons/COPYING -------------------------------------------------------------------------------- /cmake/FindEXIV2.cmake: -------------------------------------------------------------------------------- 1 | # Find EXIV2 2 | # ~~~~~~~~~~ 3 | # CMake module to search for EXIV2 library 4 | # 5 | # If it's found it sets EXIV2_FOUND to TRUE 6 | # and following variables are set: 7 | # EXIV2_INCLUDE_DIR 8 | # EXIV2_LIBRARY 9 | # 10 | 11 | # A copy of https://github.com/qgis/QGIS/blob/master/cmake/FindEXIV2.cmake 12 | # Under GPL-2.0 License 13 | IF(WIN32) 14 | GET_FILENAME_COMPONENT(build_outer_dir "${PROJECT_BINARY_DIR}/.." ABSOLUTE) 15 | FIND_PATH( 16 | DEPS_BUILD_DIR build-qt.bat 17 | HINTS "${build_outer_dir}/scantailor-universal-deps-build" 18 | DOC "Build directory for Scan Tailor dependencies." 19 | ) 20 | SET(STAGING_LIBS_DIR "${DEPS_BUILD_DIR}/staging/libs") 21 | INCLUDE("${DEPS_BUILD_DIR}/export-vars.cmake") 22 | ENDIF(WIN32) 23 | 24 | FIND_PATH(EXIV2_INCLUDE_DIR exiv2/exiv2.hpp $ENV{LIB_DIR}/include /usr/local/include /usr/include "${EXIV2_DIR}/include") 25 | FIND_LIBRARY(EXIV2_LIBRARY NAMES exiv2 PATHS $ENV{LIB_DIR}/lib /usr/local/lib /usr/lib HINTS ${STAGING_LIBS_DIR}) 26 | 27 | IF (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARY) 28 | SET(EXIV2_FOUND TRUE) 29 | MESSAGE(STATUS "Found exiv2: ${EXIV2_LIBRARY}") 30 | ELSE (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARY) 31 | MESSAGE(EXIV2_INCLUDE_DIR=${EXIV2_INCLUDE_DIR}) 32 | MESSAGE(EXIV2_LIBRARY=${EXIV2_LIBRARY}) 33 | MESSAGE(WARNING "Could not find exiv2") 34 | ENDIF (EXIV2_INCLUDE_DIR AND EXIV2_LIBRARY) 35 | -------------------------------------------------------------------------------- /cmake/LibToDLL.cmake: -------------------------------------------------------------------------------- 1 | # Usage: 2 | # LIB_TO_DLL(output_list_of_dlls ${list_of_dot_lib_files}) 3 | MACRO(LIB_TO_DLL out_list_) 4 | SET(${out_list_} "") 5 | FOREACH(lib_file_ ${ARGN}) 6 | #STRING(REGEX REPLACE "\\.lib$" ".dll" dll_file_ "${lib_file_}") 7 | #IF(NOT "${dll_file_}" STREQUAL "${lib_file_}") 8 | # LIST(APPEND ${out_list_} "${dll_file_}") 9 | #ENDIF() 10 | GET_FILENAME_COMPONENT(lib_file_name_ "${lib_file_}" NAME) 11 | GET_FILENAME_COMPONENT(dir_ "${lib_file_}" PATH) 12 | 13 | STRING(REGEX REPLACE "^lib(.*)\\.a$" "\\1.dll" dll_file_name_ "${lib_file_name_}") 14 | IF("${dll_file_name_}" STREQUAL "${lib_file_name_}") 15 | STRING(REGEX REPLACE "^(.*)\\.lib$" "\\1.dll" dll_file_name_ "${lib_file_name_}") 16 | ENDIF() 17 | 18 | IF(NOT "${dll_file_name_}" STREQUAL "${lib_file_name_}") 19 | LIST(APPEND ${out_list_} "${dir_}/${dll_file_name_}") 20 | ENDIF() 21 | ENDFOREACH() 22 | ENDMACRO() -------------------------------------------------------------------------------- /cmake/SetDefaultBuildType.cmake: -------------------------------------------------------------------------------- 1 | MACRO(ST_SET_DEFAULT_BUILD_TYPE TYPE_) 2 | IF(NOT CMAKE_BUILD_TYPE AND NOT DEFAULT_BUILD_TYPE_SET) 3 | SET(DEFAULT_BUILD_TYPE_SET TRUE CACHE INTERNAL "" FORCE) 4 | SET( 5 | CMAKE_BUILD_TYPE "${TYPE_}" CACHE STRING 6 | "Build type (Release Debug RelWithDebInfo MinSizeRel)" FORCE 7 | ) 8 | ENDIF(NOT CMAKE_BUILD_TYPE AND NOT DEFAULT_BUILD_TYPE_SET) 9 | ENDMACRO(ST_SET_DEFAULT_BUILD_TYPE) 10 | -------------------------------------------------------------------------------- /cmake/ToNativePath.cmake: -------------------------------------------------------------------------------- 1 | # This macro exists because FILE(TO_NATIVE_PATH ...) is broken on MinGW. 2 | MACRO(TO_NATIVE_PATH PATH OUT) 3 | FILE(TO_NATIVE_PATH "${PATH}" "${OUT}") 4 | IF(MINGW) 5 | STRING(REPLACE "/" "\\" "${OUT}" "${${OUT}}") 6 | ENDIF(MINGW) 7 | ENDMACRO(TO_NATIVE_PATH) 8 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif(NOT "${rm_retval}" STREQUAL 0) 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | -------------------------------------------------------------------------------- /cmake/copy_to_build_dir.cmake.in: -------------------------------------------------------------------------------- 1 | SET("COPY_TO_BUILD_DIR_Debug" "@COPY_TO_BUILD_DIR_Debug@") 2 | SET("COPY_TO_BUILD_DIR_Release" "@COPY_TO_BUILD_DIR_Release@") 3 | SET("COPY_TO_BUILD_DIR_MinSizeRel" "@COPY_TO_BUILD_DIR_MinSizeRel@") 4 | SET("COPY_TO_BUILD_DIR_RelWithDebInfo" "@COPY_TO_BUILD_DIR_RelWithDebInfo@") 5 | 6 | FOREACH(src_file ${COPY_TO_BUILD_DIR_${CFG}}) 7 | SET(subdir "") 8 | IF(src_file MATCHES ".*=>.*") 9 | STRING(REGEX REPLACE ".*=>(.*)" "/\\1" subdir "${src_file}") 10 | STRING(REGEX REPLACE "(.*)=>.*" "\\1" src_file "${src_file}") 11 | ENDIF() 12 | SET(dst_dir "${TARGET_DIR}${subdir}") 13 | 14 | GET_FILENAME_COMPONENT(dst_file "${src_file}" NAME) 15 | 16 | IF("${src_file}" IS_NEWER_THAN "${dst_dir}/${dst_file}") 17 | MESSAGE(STATUS "Copying ${dst_file} to ${CFG}${subdir}") 18 | CONFIGURE_FILE("${src_file}" "${dst_dir}/${dst_file}" COPYONLY) 19 | ENDIF() 20 | ENDFOREACH() -------------------------------------------------------------------------------- /cmake/default_cflags.cmake: -------------------------------------------------------------------------------- 1 | IF(MSVC) 2 | # If we want reliable stack traces, we need /Oy- 3 | # We do it only for RelWithDebInfo 4 | SET(_common "/FS /wd4267") 5 | SET(CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG ${_common}") 6 | SET(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 ${_common}") 7 | SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG /Oy- ${_common}") 8 | SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG ${_common}") 9 | ENDIF() 10 | -------------------------------------------------------------------------------- /cmake/default_cxxflags.cmake: -------------------------------------------------------------------------------- 1 | IF(MSVC) 2 | # If we want reliable stack traces, we need /Oy- 3 | # We do it only for RelWithDebInfo 4 | SET(_common "/FS /wd4267 /std=c++0x") 5 | SET(CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG ${_common}") 6 | SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 ${_common}") 7 | SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG /Oy- ${_common}") 8 | SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG ${_common}") 9 | ELSE() 10 | SET(CMAKE_CXX_FLAGS "-std=c++0x") 11 | SET(QMAKE_CXX_FLAGS "-std=c++0x") 12 | ENDIF() 13 | -------------------------------------------------------------------------------- /cmake/move_sym_file.cmake: -------------------------------------------------------------------------------- 1 | FILE(STRINGS "${SYMBOLS_PATH}/temp.sym" first_line LIMIT_COUNT 1) 2 | SEPARATE_ARGUMENTS(first_line) 3 | LIST(GET first_line 3 module_id) 4 | LIST(GET first_line 4 module_name_pdb) 5 | STRING( 6 | REGEX REPLACE "(.*)\\.pdb" "\\1.sym" 7 | module_name_sym "${module_name_pdb}" 8 | ) 9 | CONFIGURE_FILE( 10 | "${SYMBOLS_PATH}/temp.sym" 11 | "${SYMBOLS_PATH}/${module_name_pdb}/${module_id}/${module_name_sym}" 12 | COPYONLY 13 | ) 14 | FILE(REMOVE "${SYMBOLS_PATH}/temp.sym") 15 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* This file is a template for config.h, for use with CMake. */ 2 | 3 | #ifndef SCANTAILOR_CONFIG_H_ 4 | #define SCANTAILOR_CONFIG_H_ 5 | 6 | #define TRANSLATIONS_DIR_REL "@TRANSLATIONS_DIR_REL@" 7 | #define TRANSLATIONS_DIR_ABS "@TRANSLATIONS_DIR_ABS@" 8 | #define STYLESHEETS_DIR_REL "@STYLESHEETS_DIR_REL@" 9 | #define STYLESHEETS_DIR_ABS "@STYLESHEETS_DIR_ABS@" 10 | 11 | #define PIXMAPS_DIR_ABS "@PIXMAPS_DIR_ABS@" 12 | #define APPLICATION_NAME "Scan Tailor Universal" 13 | #define ORGANIZATION_NAME "Scan Tailor" 14 | #define ORGANIZATION_DOMAIN "github.com/trufanov-nok/scantailor-universal" 15 | 16 | #cmakedefine ENABLE_OPENGL 17 | #cmakedefine ENABLE_OPENJPEG 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: scantailor-universal 2 | Section: graphics 3 | Priority: optional 4 | Maintainer: Alexander Trufanov 5 | Build-Depends: debhelper-compat (= 9), qtbase5-dev (>=5.4), libqt5svg5-dev (>=5.4), libtiff5-dev (>=4.0.3), libjpeg8-dev (>=8c), libgcc1 (>=1.3.0), libc6 (>=2.14), libpng-dev (>=1.6.2), libstdc++6 (>=5.2), qttools5-dev (>=5.4), libboost-dev (>=1.35.0), libboost-test-dev (>=1.35.0), cmake (>=2.8.9), libcanberra-dev(>=0.30), pkg-config, libopenjp2-7-dev (>=2.3), libexiv2-dev (>=0.26) 6 | Standards-Version: 4.5.0 7 | Homepage: https://github.com/trufanov-nok/scantailor-universal 8 | #Vcs-Browser: https://salsa.debian.org/debian/scantailor-universal 9 | #Vcs-Git: https://salsa.debian.org/debian/scantailor-universal.git 10 | Rules-Requires-Root: no 11 | 12 | Package: scantailor-universal 13 | Architecture: any 14 | Depends: ${shlibs:Depends}, ${misc:Depends} 15 | Recommends: qttranslations5-l10n (>=5.4) 16 | Description: Alternative version of ScanTailor: iinteractive post-processing tool for scanned pages 17 | Scan Tailor is an interactive post-processing tool for scanned pages. It 18 | performs operations such as page splitting, deskewing, adding/removing 19 | borders, and others. You give it raw scans, and you get pages ready to be 20 | printed or assembled into a PDF or DJVU file. Scanning, optical character 21 | recognition, and assembling multi-page documents are out of scope of this 22 | project. 23 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | export DH_VERBOSE=1 4 | 5 | DEB_CMAKE_EXTRA_FLAGS := -DCMAKE_BUILD_TYPE=Release 6 | 7 | %: 8 | dh $@ 9 | 10 | # override dh_auto_test bcs of this bug: https://askubuntu.com/questions/1287947/making-deb-with-bzr-qapplication-dependency 11 | override_dh_auto_test: 12 | -------------------------------------------------------------------------------- /debian/scantailor-universal.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Scan Tailor Universal 3 | Version=1.0 4 | Exec=scantailor-universal %f 5 | Comment=Interactive post-processing tool for scanned pages 6 | Icon=scantailor-universal 7 | Type=Application 8 | Terminal=false 9 | StartupNotify=true 10 | Encoding=UTF-8 11 | Categories=2DGraphics;Graphics;RasterGraphics;Scanning;Qt; -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /src/app/Application.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Application.h" 20 | 21 | #include "OutOfMemoryHandler.h" 22 | #include 23 | 24 | Application::Application(int& argc, char** argv) 25 | : QApplication(argc, argv) 26 | { 27 | } 28 | 29 | bool 30 | Application::notify(QObject* receiver, QEvent* e) 31 | { 32 | try { 33 | return QApplication::notify(receiver, e); 34 | } catch (std::bad_alloc const&) { 35 | OutOfMemoryHandler::instance().handleOutOfMemorySituation(); 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/app/Application.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef APPLICATION_H_ 20 | #define APPLICATION_H_ 21 | 22 | #include 23 | 24 | class Application : public QApplication 25 | { 26 | Q_OBJECT 27 | public: 28 | Application(int& argc, char** argv); 29 | 30 | virtual bool notify(QObject* receiver, QEvent* e); 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/app/AutoSaveTimer.h: -------------------------------------------------------------------------------- 1 | #ifndef QAUTOSAVETIMER_H 2 | #define QAUTOSAVETIMER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "ProjectPages.h" 8 | 9 | class MainWindow; 10 | 11 | class QAutoSaveTimer : public QTimer 12 | { 13 | Q_OBJECT 14 | public: 15 | QAutoSaveTimer(MainWindow* obj); 16 | public slots: 17 | void autoSaveProject(); 18 | private: 19 | bool copyFileTo(const QString& sFromPath, const QString& sToPath); 20 | const QString getAutoSaveInputDir(); 21 | private: 22 | MainWindow* m_MW; 23 | }; 24 | 25 | #endif // QAUTOSAVETIMER_H 26 | -------------------------------------------------------------------------------- /src/app/CanberraSoundPlayer.h: -------------------------------------------------------------------------------- 1 | #ifndef CANBERRASOUNDPLAYER_H 2 | #define CANBERRASOUNDPLAYER_H 3 | 4 | #include 5 | 6 | class CanberraSoundPlayer 7 | { 8 | public: 9 | CanberraSoundPlayer(); 10 | ~CanberraSoundPlayer(); 11 | 12 | bool isWorking() const { return m_useCanberra; } 13 | void play(); 14 | private: 15 | static void callback(ca_context *c, unsigned int id, int error_code, void *userdata); 16 | private: 17 | bool m_useCanberra; 18 | ca_context *m_canberraContext; 19 | ca_proplist *m_canberraProperties; 20 | }; 21 | 22 | #endif // CANBERRASOUNDPLAYER_H 23 | -------------------------------------------------------------------------------- /src/app/LoadFilesStatusDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LOAD_FILES_STATUS_DIALOG_H_ 20 | #define LOAD_FILES_STATUS_DIALOG_H_ 21 | 22 | #include "ui_LoadFilesStatusDialog.h" 23 | #include 24 | #include 25 | 26 | class LoadFilesStatusDialog : public QDialog 27 | { 28 | public: 29 | LoadFilesStatusDialog(QWidget* parent = 0); 30 | 31 | void setLoadedFiles(std::vector const& files); 32 | 33 | void setFailedFiles(std::vector const& failed); 34 | 35 | void setOkButtonName(QString const& name); 36 | private: 37 | Ui::LoadFilesStatusDialog ui; 38 | QString m_loadedTabNameTemplate; 39 | QString m_failedTabNameTemplate; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/app/NewOpenProjectPanel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NEW_OPEN_PROJECT_PANEL_H_ 20 | #define NEW_OPEN_PROJECT_PANEL_H_ 21 | 22 | #include "ui_NewOpenProjectPanel.h" 23 | #include 24 | 25 | class QString; 26 | 27 | class NewOpenProjectPanel : public QWidget, private Ui::NewOpenProjectPanel 28 | { 29 | Q_OBJECT 30 | public: 31 | NewOpenProjectPanel(QWidget* parent = 0); 32 | signals: 33 | void newProject(); 34 | 35 | void openProject(); 36 | 37 | void openRecentProject(QString const& project_file); 38 | protected: 39 | virtual void paintEvent(QPaintEvent* event); 40 | private: 41 | void addRecentProject(QString const& file_path); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/app/OpenWithMenuProvider.h: -------------------------------------------------------------------------------- 1 | #ifndef OPENWITHMENUPROVIDER_H 2 | #define OPENWITHMENUPROVIDER_H 3 | 4 | #include 5 | 6 | class OpenWithMenuProvider 7 | { 8 | public: 9 | static QMenu* getOpenWithMenu(const QString& mime_type); 10 | }; 11 | 12 | #endif // OPENWITHMENUPROVIDER_H 13 | -------------------------------------------------------------------------------- /src/app/RelinkingListView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RELINKING_LIST_VIEW_H_ 20 | #define RELINKING_LIST_VIEW_H_ 21 | 22 | #include 23 | 24 | class QPainter; 25 | class QRect; 26 | class QModelIndex; 27 | 28 | class RelinkingListView : public QListView 29 | { 30 | public: 31 | RelinkingListView(QWidget* parent = 0); 32 | protected: 33 | virtual void paintEvent(QPaintEvent* e); 34 | private: 35 | class Delegate; 36 | class IndicationGroup; 37 | class GroupAggregator; 38 | 39 | void maybeDrawStatusLayer(QPainter* painter, 40 | QModelIndex const& item_index, QRect const& item_paint_rect); 41 | 42 | void drawStatusLayer(QPainter* painter); 43 | 44 | bool m_statusLayerDrawn; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/app/RelinkingSortingModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RELINKING_SORTING_MODEL_H_ 20 | #define RELINKING_SORTING_MODEL_H_ 21 | 22 | #include 23 | 24 | class RelinkingSortingModel : public QSortFilterProxyModel 25 | { 26 | public: 27 | RelinkingSortingModel(QObject* parent = 0); 28 | protected: 29 | virtual bool lessThan(QModelIndex const& left, QModelIndex const& right) const; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/app/StartBatchProcessingDialog.cpp: -------------------------------------------------------------------------------- 1 | #include "StartBatchProcessingDialog.h" 2 | 3 | #include "ui_StartBatchProcessingDialog.h" 4 | 5 | #include "settings/ini_keys.h" 6 | 7 | StartBatchProcessingDialog::StartBatchProcessingDialog(QWidget* parent, bool isAllPages) : 8 | QDialog(parent), 9 | ui(new Ui::StartBatchProcessingDialog) 10 | { 11 | ui->setupUi(this); 12 | 13 | ui->allPages->setChecked(isAllPages); 14 | ui->fromSelected->setChecked(!isAllPages); 15 | } 16 | 17 | StartBatchProcessingDialog::~StartBatchProcessingDialog() 18 | { 19 | delete ui; 20 | } 21 | 22 | bool StartBatchProcessingDialog::isAllPagesChecked() const 23 | { 24 | return ui->allPages->isChecked(); 25 | } 26 | 27 | bool StartBatchProcessingDialog::isRememberChoiceChecked() const 28 | { 29 | return ui->rememberChoice->isChecked(); 30 | } 31 | -------------------------------------------------------------------------------- /src/app/StartBatchProcessingDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef STARTBATCHPROCESSINGDIALOG_H 2 | #define STARTBATCHPROCESSINGDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui 7 | { 8 | class StartBatchProcessingDialog; 9 | } 10 | 11 | class StartBatchProcessingDialog : public QDialog 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit StartBatchProcessingDialog(QWidget* parent = 0, bool isAllPages = false); 17 | ~StartBatchProcessingDialog(); 18 | 19 | bool isAllPagesChecked() const; 20 | bool isRememberChoiceChecked() const; 21 | 22 | private: 23 | Ui::StartBatchProcessingDialog* ui; 24 | }; 25 | 26 | #endif // STARTBATCHPROCESSINGDIALOG_H 27 | -------------------------------------------------------------------------------- /src/app/SystemLoadWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SYSTEM_LOAD_WIDGET_H_ 20 | #define SYSTEM_LOAD_WIDGET_H_ 21 | 22 | #include "ui_SystemLoadWidget.h" 23 | #include 24 | 25 | class SystemLoadWidget : public QWidget 26 | { 27 | Q_OBJECT 28 | public: 29 | SystemLoadWidget(QWidget* parent = 0); 30 | private slots: 31 | void sliderPressed(); 32 | 33 | void sliderMoved(int prio); 34 | 35 | void valueChanged(int prio); 36 | 37 | void decreasePriority(); 38 | 39 | void increasePriority(); 40 | private: 41 | void showHideToolTip(int prio); 42 | 43 | static QString tooltipText(int prio); 44 | 45 | Ui::SystemLoadWidget ui; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/app/resources/SettingsTreeData.tsv: -------------------------------------------------------------------------------- 1 | pageGeneral 2 | pageHotKeysManager 3 | pageDocking docking_panels/enabled 0 4 | pageThumbnails 5 | pageAutoSaveProject auto-save_project/enabled 0 6 | pageTiffCompression 7 | pageDebugMode debug_mode/enabled 0 8 | pageFixOrientation 9 | pageSplitPages 10 | pageApplyCut apply_cut/enabled 11 | pageDeskew 12 | pageDeviantDeskew deskew_deviant/enabled 0 13 | pageSelectContent 14 | pagePageDetecton page_detection/enabled 0 15 | pageDeviantContent select_content_deviant/enabled 0 16 | pagePageLayout 17 | pageMargins 18 | pageAlignment 19 | pageDeviantMargins margins_deviant/enabled 0 20 | pageOutput 21 | pageBlackWhiteMode 22 | pageColorGrayscaleMode 23 | pageMixedMode 24 | pageAutoLayer 25 | pagePictureZonesLayer picture_zones_layer/enabled 26 | pageForegroundLayer foreground_layer/enabled 27 | pageFillZones 28 | pageDewarping 29 | pageDespeckling 30 | pageOutputMetadata 31 | -------------------------------------------------------------------------------- /src/app/resources/icons/appicon-about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/appicon-about.png -------------------------------------------------------------------------------- /src/app/resources/icons/aqua-sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/aqua-sphere.png -------------------------------------------------------------------------------- /src/app/resources/icons/auto-magnet-hor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/auto-magnet-hor.png -------------------------------------------------------------------------------- /src/app/resources/icons/auto-magnet-none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/auto-magnet-none.png -------------------------------------------------------------------------------- /src/app/resources/icons/auto-magnet-ver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/auto-magnet-ver.png -------------------------------------------------------------------------------- /src/app/resources/icons/auto-magnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/auto-magnet.png -------------------------------------------------------------------------------- /src/app/resources/icons/big-down-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/big-down-arrow.png -------------------------------------------------------------------------------- /src/app/resources/icons/big-left-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/big-left-arrow.png -------------------------------------------------------------------------------- /src/app/resources/icons/big-right-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/big-right-arrow.png -------------------------------------------------------------------------------- /src/app/resources/icons/big-up-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/big-up-arrow.png -------------------------------------------------------------------------------- /src/app/resources/icons/despeckle-aggressive.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/despeckle-aggressive.png.png -------------------------------------------------------------------------------- /src/app/resources/icons/despeckle-cautious.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/despeckle-cautious.png.png -------------------------------------------------------------------------------- /src/app/resources/icons/despeckle-normal.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/despeckle-normal.png.png -------------------------------------------------------------------------------- /src/app/resources/icons/editclear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/editclear.png -------------------------------------------------------------------------------- /src/app/resources/icons/file-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/file-16.png -------------------------------------------------------------------------------- /src/app/resources/icons/folder-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/folder-16.png -------------------------------------------------------------------------------- /src/app/resources/icons/gimp-center-none.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/gimp-center-none.png -------------------------------------------------------------------------------- /src/app/resources/icons/gimp-reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/gimp-reset.png -------------------------------------------------------------------------------- /src/app/resources/icons/gimp-undo-history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/gimp-undo-history.png -------------------------------------------------------------------------------- /src/app/resources/icons/insert-after-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/insert-after-16.png -------------------------------------------------------------------------------- /src/app/resources/icons/insert-before-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/insert-before-16.png -------------------------------------------------------------------------------- /src/app/resources/icons/insert-here-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/insert-here-16.png -------------------------------------------------------------------------------- /src/app/resources/icons/keep-in-view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/keep-in-view.png -------------------------------------------------------------------------------- /src/app/resources/icons/layout_type_auto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/layout_type_auto.png -------------------------------------------------------------------------------- /src/app/resources/icons/left_page_plus_offcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/left_page_plus_offcut.png -------------------------------------------------------------------------------- /src/app/resources/icons/left_page_plus_offcut_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/left_page_plus_offcut_selected.png -------------------------------------------------------------------------------- /src/app/resources/icons/left_page_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/left_page_thumb.png -------------------------------------------------------------------------------- /src/app/resources/icons/minus-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/minus-16.png -------------------------------------------------------------------------------- /src/app/resources/icons/multi_choice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/multi_choice.png -------------------------------------------------------------------------------- /src/app/resources/icons/object-rotate-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/object-rotate-left.png -------------------------------------------------------------------------------- /src/app/resources/icons/object-rotate-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/object-rotate-right.png -------------------------------------------------------------------------------- /src/app/resources/icons/play-small-hovered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/play-small-hovered.png -------------------------------------------------------------------------------- /src/app/resources/icons/play-small-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/play-small-pressed.png -------------------------------------------------------------------------------- /src/app/resources/icons/play-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/play-small.png -------------------------------------------------------------------------------- /src/app/resources/icons/plus-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/plus-16.png -------------------------------------------------------------------------------- /src/app/resources/icons/right_page_plus_offcut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/right_page_plus_offcut.png -------------------------------------------------------------------------------- /src/app/resources/icons/right_page_plus_offcut_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/right_page_plus_offcut_selected.png -------------------------------------------------------------------------------- /src/app/resources/icons/right_page_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/right_page_thumb.png -------------------------------------------------------------------------------- /src/app/resources/icons/single_page_uncut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/single_page_uncut.png -------------------------------------------------------------------------------- /src/app/resources/icons/single_page_uncut_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/single_page_uncut_selected.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-center-24-hor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-center-24-hor.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-center-24-ver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-center-24-ver.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-center-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-center-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-center-24-hor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-center-24-hor.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-center-24-ver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-center-24-ver.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-center-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-center-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-east-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-east-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-north-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-north-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-north-east-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-north-east-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-north-west-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-north-west-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-south-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-south-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-south-east-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-south-east-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-south-west-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-south-west-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-gravity-west-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-gravity-west-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-vchain-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-vchain-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stock-vchain-broken-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stock-vchain-broken-24.png -------------------------------------------------------------------------------- /src/app/resources/icons/stop-big-hovered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stop-big-hovered.png -------------------------------------------------------------------------------- /src/app/resources/icons/stop-big-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stop-big-pressed.png -------------------------------------------------------------------------------- /src/app/resources/icons/stop-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/stop-big.png -------------------------------------------------------------------------------- /src/app/resources/icons/trashed-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/trashed-big.png -------------------------------------------------------------------------------- /src/app/resources/icons/trashed-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/trashed-small.png -------------------------------------------------------------------------------- /src/app/resources/icons/two_pages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/two_pages.png -------------------------------------------------------------------------------- /src/app/resources/icons/two_pages_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/two_pages_selected.png -------------------------------------------------------------------------------- /src/app/resources/icons/undo-22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/undo-22.png -------------------------------------------------------------------------------- /src/app/resources/icons/untrash-big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/untrash-big.png -------------------------------------------------------------------------------- /src/app/resources/icons/user-trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/icons/user-trash.png -------------------------------------------------------------------------------- /src/app/resources/images/empty-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/images/empty-page.png -------------------------------------------------------------------------------- /src/app/resources/win32/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/app/resources/win32/icon.ico -------------------------------------------------------------------------------- /src/app/resources/win32/resources.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "icon.ico" -------------------------------------------------------------------------------- /src/app/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(toplevel_ui_sources) # Don't rename - it's referenced elsewhere. 2 | 3 | FILE(GLOB ui_files "*.ui") 4 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 5 | 6 | QT5_WRAP_UI(ui_sources ${ui_files}) 7 | ADD_CUSTOM_TARGET(toplevel_ui_sources SOURCES ${ui_sources}) 8 | 9 | TRANSLATION_SOURCES(scantailor-universal ${ui_files}) 10 | -------------------------------------------------------------------------------- /src/app_cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/src/core") 3 | 4 | SET( 5 | cli_only_sources 6 | ConsoleBatch.cpp ConsoleBatch.h 7 | main-cli.cpp 8 | ) 9 | 10 | ADD_EXECUTABLE(scantailor-universal-cli ${cli_only_sources} ) 11 | 12 | TARGET_LINK_LIBRARIES( 13 | scantailor-universal-cli 14 | fix_orientation page_split deskew select_content page_layout output stcore 15 | dewarping zones interaction imageproc math foundation exporting 16 | ) 17 | 18 | # Widgets module is used statically but not at runtime. 19 | TARGET_LINK_LIBRARIES(scantailor-universal-cli Qt5::Widgets Qt5::Xml) 20 | 21 | IF(EXTRA_LIBS) 22 | TARGET_LINK_LIBRARIES(scantailor-universal-cli ${EXTRA_LIBS}) 23 | ENDIF() 24 | 25 | IF(APPLE) 26 | INSTALL(TARGETS scantailor-universal-cli BUNDLE DESTINATION . RUNTIME DESTINATION bin) 27 | ELSE(APPLE) 28 | INSTALL(TARGETS scantailor-universal-cli RUNTIME DESTINATION bin) 29 | ENDIF(APPLE) 30 | 31 | TRANSLATION_SOURCES( 32 | scantailor-universal 33 | ${cli_only_sources} 34 | ) 35 | -------------------------------------------------------------------------------- /src/compat/QAtomicInt: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef QATOMICINT_H_ 20 | #define QATOMICINT_H_ 21 | 22 | #include 23 | 24 | class QAtomicInt 25 | { 26 | public: 27 | QAtomicInt() : m_val(0) {} 28 | 29 | QAtomicInt(int val) : m_val(val) {} 30 | 31 | int fetchAndStoreRelaxed(int new_val) { 32 | return q_atomic_set_int(&m_val, new_val); 33 | } 34 | 35 | int fetchAndAddRelaxed(int delta) { 36 | return q_atomic_fetch_and_add_int(&m_val, delta); 37 | } 38 | 39 | bool ref() { return q_atomic_increment(&m_val) != 0; } 40 | 41 | bool deref() { return q_atomic_decrement(&m_val) != 0; } 42 | private: 43 | int m_val; 44 | }; 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/core/AbstractFilterDataCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ABSTRACTFILTERDATACOLLECTOR_H_ 20 | #define ABSTRACTFILTERDATACOLLECTOR_H_ 21 | 22 | class AbstractFilterDataCollector 23 | { 24 | public: 25 | virtual ~AbstractFilterDataCollector() {} 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/core/AbstractRelinker.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ABSTRACT_RELINKER_H_ 20 | #define ABSTRACT_RELINKER_H_ 21 | 22 | #include "RefCountable.h" 23 | 24 | class RelinkablePath; 25 | class QString; 26 | 27 | class AbstractRelinker : public RefCountable 28 | { 29 | public: 30 | virtual ~AbstractRelinker() {} 31 | 32 | /** 33 | * Returns the path to be used instead of the given path. 34 | * The same path will be returned if no substitution is to be made. 35 | */ 36 | virtual QString substitutionPathFor(RelinkablePath const& orig_path) const = 0; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/core/ApplyToDialog.h: -------------------------------------------------------------------------------- 1 | #ifndef APPLYTODIALOG_H 2 | #define APPLYTODIALOG_H 3 | 4 | #include 5 | #include "PageRangeSelectorWidget.h" 6 | 7 | namespace Ui 8 | { 9 | class ApplyToDialog; 10 | } 11 | 12 | class ApplyToDialog : public QDialog 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit ApplyToDialog(QWidget* parent, PageId const& cur_page, 18 | PageSelectionAccessor const& page_selection_accessor, 19 | const PageView viewType = PageView::PAGE_VIEW); 20 | ~ApplyToDialog(); 21 | 22 | QLayout& initNewLeftSettingsPanel(); 23 | 24 | QLayout& initNewTopSettingsPanel(); 25 | 26 | QLayout& getLeftSettingsPanel() const; 27 | 28 | QLayout& getTopSettingsPanel() const; 29 | 30 | PageRangeSelectorWidget& getPageRangeSelectorWidget() const; 31 | 32 | void showEvent(QShowEvent*) override; 33 | 34 | class Validator 35 | { 36 | public: 37 | virtual bool validate() = 0; 38 | }; 39 | 40 | void registerValidator(Validator* v) 41 | { 42 | if (v) { 43 | m_Validators.append(v); 44 | } 45 | } 46 | 47 | public slots: 48 | void accept() override; 49 | 50 | private: 51 | Ui::ApplyToDialog* ui; 52 | QVector m_Validators; 53 | }; 54 | 55 | #endif // APPLYTODIALOG_H 56 | -------------------------------------------------------------------------------- /src/core/AutoManualMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef AUTOMANUALMODE_H_ 20 | #define AUTOMANUALMODE_H_ 21 | 22 | enum AutoManualMode { 23 | MODE_AUTO, 24 | MODE_MANUAL 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/core/BackgroundTask.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "BackgroundTask.h" 20 | 21 | char const* 22 | BackgroundTask::CancelledException::what() const throw() 23 | { 24 | return "BackgroundTask cancelled"; 25 | } 26 | 27 | void 28 | BackgroundTask::throwIfCancelled() const 29 | { 30 | if (isCancelled()) { 31 | throw CancelledException(); 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/core/BasicImageView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "BasicImageView.h" 20 | 21 | #include "ImageTransformation.h" 22 | #include "ImagePresentation.h" 23 | #include "Dpm.h" 24 | #include "Dpi.h" 25 | 26 | BasicImageView::BasicImageView( 27 | QImage const& image, ImagePixmapUnion const& downscaled_image, Margins const& margins) 28 | : ImageViewBase( 29 | image, downscaled_image, 30 | ImagePresentation(QTransform(), QRectF(image.rect())), margins 31 | ), 32 | m_dragHandler(*this), 33 | m_zoomHandler(*this) 34 | { 35 | rootInteractionHandler().makeLastFollower(m_dragHandler); 36 | rootInteractionHandler().makeLastFollower(m_zoomHandler); 37 | } 38 | 39 | BasicImageView::~BasicImageView() 40 | { 41 | } 42 | -------------------------------------------------------------------------------- /src/core/BasicImageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BASICIMAGEVIEW_H_ 20 | #define BASICIMAGEVIEW_H_ 21 | 22 | #include "ImageViewBase.h" 23 | #include "DragHandler.h" 24 | #include "ZoomHandler.h" 25 | #include "ImagePixmapUnion.h" 26 | #include "Margins.h" 27 | #include 28 | 29 | class BasicImageView : public ImageViewBase 30 | { 31 | Q_OBJECT 32 | public: 33 | BasicImageView( 34 | QImage const& image, 35 | ImagePixmapUnion const& downscaled_image = ImagePixmapUnion(), 36 | Margins const& margins = Margins(0, 0, 0, 0)); 37 | 38 | virtual ~BasicImageView(); 39 | private: 40 | DragHandler m_dragHandler; 41 | ZoomHandler m_zoomHandler; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/core/BeforeOrAfter.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BEFORE_OR_AFTER_H_ 20 | #define BEFORE_OR_AFTER_H_ 21 | 22 | enum BeforeOrAfter { BEFORE, AFTER }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/core/CompositeCacheDrivenTask.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef COMPOSITECACHEDRIVENTASK_H_ 20 | #define COMPOSITECACHEDRIVENTASK_H_ 21 | 22 | #include "RefCountable.h" 23 | 24 | class PageInfo; 25 | class AbstractFilterDataCollector; 26 | 27 | class CompositeCacheDrivenTask : public RefCountable 28 | { 29 | public: 30 | virtual ~CompositeCacheDrivenTask() {} 31 | 32 | virtual void process( 33 | PageInfo const& page_info, 34 | AbstractFilterDataCollector* collector) = 0; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/core/ContentBoxCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef CONTENTBOXCOLLECTOR_H_ 20 | #define CONTENTBOXCOLLECTOR_H_ 21 | 22 | #include "AbstractFilterDataCollector.h" 23 | 24 | class ImageTransformation; 25 | class QRectF; 26 | 27 | class ContentBoxCollector : public AbstractFilterDataCollector 28 | { 29 | public: 30 | virtual void process( 31 | ImageTransformation const& xform, 32 | QRectF const& content_rect) = 0; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/core/Dpi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Dpi.h" 20 | #include "Dpm.h" 21 | #include "imageproc/Constants.h" 22 | #include 23 | 24 | using namespace imageproc; 25 | 26 | Dpi::Dpi(QSize const size) 27 | : m_xDpi(size.width()), 28 | m_yDpi(size.height()) 29 | { 30 | } 31 | 32 | Dpi::Dpi(Dpm const dpm) 33 | : m_xDpi(qRound(dpm.horizontal() * constants::DPM2DPI)), 34 | m_yDpi(qRound(dpm.vertical() * constants::DPM2DPI)) 35 | { 36 | } 37 | 38 | QSize 39 | Dpi::toSize() const 40 | { 41 | if (isNull()) { 42 | return QSize(); 43 | } else { 44 | return QSize(m_xDpi, m_yDpi); 45 | } 46 | } 47 | 48 | bool 49 | Dpi::operator==(Dpi const& other) const 50 | { 51 | return m_xDpi == other.m_xDpi && m_yDpi == other.m_yDpi; 52 | } 53 | -------------------------------------------------------------------------------- /src/core/ErrorWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ErrorWidget.h" 20 | #include "ui_ErrorWidget.h" 21 | 22 | #include 23 | #include 24 | 25 | ErrorWidget::ErrorWidget(QString const& text, Qt::TextFormat fmt): 26 | ui(new Ui::ErrorWidget) 27 | { 28 | ui->setupUi(this); 29 | ui->textLabel->setTextFormat(fmt); 30 | ui->textLabel->setText(text); 31 | QIcon icon(QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning)); 32 | ui->imageLabel->setPixmap(icon.pixmap(48, 48)); 33 | 34 | connect(ui->textLabel, SIGNAL(linkActivated(QString)), SLOT(linkActivated(QString))); 35 | } 36 | 37 | ErrorWidget::~ErrorWidget() 38 | { 39 | delete ui; 40 | } 41 | -------------------------------------------------------------------------------- /src/core/ErrorWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef ERRORWIDGET_H_ 20 | #define ERRORWIDGET_H_ 21 | 22 | #include 23 | #include 24 | 25 | class QString; 26 | 27 | namespace Ui 28 | { 29 | class ErrorWidget; 30 | } 31 | 32 | 33 | class ErrorWidget : public QWidget 34 | { 35 | Q_OBJECT 36 | public: 37 | ErrorWidget(QString const& text, Qt::TextFormat fmt = Qt::AutoText); 38 | ~ErrorWidget(); 39 | private slots: 40 | /** 41 | * \see QLabel::linkActivated() 42 | */ 43 | virtual void linkActivated(QString const& link) {} 44 | private: 45 | Ui::ErrorWidget* ui; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/core/FilterOptionsWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/core/FilterResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FILTERRESULT_H_ 20 | #define FILTERRESULT_H_ 21 | 22 | #include "IntrusivePtr.h" 23 | #include "RefCountable.h" 24 | 25 | class AbstractFilter; 26 | class FilterUiInterface; 27 | 28 | class FilterResult : public RefCountable 29 | { 30 | public: 31 | virtual void updateUI(FilterUiInterface* ui) = 0; 32 | 33 | /** 34 | * \brief Return the filter that generated this result. 35 | * \note Returning a null smart pointer indicates that the result 36 | * was generated by a task that doesn't belong to a filter. 37 | * That would be LoadFileTask. 38 | */ 39 | 40 | virtual IntrusivePtr filter() = 0; 41 | }; 42 | 43 | typedef IntrusivePtr FilterResultPtr; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/GenericMetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef GENERICMETADATALOADER_H_ 20 | #define GENERICMETADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class GenericMetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/ImageFileInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ImageFileInfo.h" 20 | #include 21 | 22 | bool 23 | ImageFileInfo::isDpiOK() const 24 | { 25 | return std::find_if( 26 | m_imageInfo.begin(), m_imageInfo.end(), 27 | [](const ImageMetadata& i) { return !i.isDpiOK(); } 28 | ) == m_imageInfo.end(); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/core/ImageInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ImageInfo.h" 20 | 21 | ImageInfo::ImageInfo() 22 | : m_numSubPages(0), 23 | m_leftHalfRemoved(false), 24 | m_rightHalfRemoved(false) 25 | { 26 | } 27 | 28 | ImageInfo::ImageInfo( 29 | ImageId const& id, ImageMetadata const& metadata, 30 | int num_sub_pages, bool left_half_removed, bool right_half_removed) 31 | : m_id(id), 32 | m_metadata(metadata), 33 | m_numSubPages(num_sub_pages), 34 | m_leftHalfRemoved(left_half_removed), 35 | m_rightHalfRemoved(right_half_removed) 36 | { 37 | } 38 | -------------------------------------------------------------------------------- /src/core/ImageLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGELOADER_H_ 20 | #define IMAGELOADER_H_ 21 | 22 | class ImageId; 23 | class QImage; 24 | class QString; 25 | class QIODevice; 26 | 27 | class ImageLoader 28 | { 29 | public: 30 | static QImage load(QString const& file_path, int page_num = 0); 31 | 32 | static QImage load(ImageId const& image_id); 33 | 34 | static QImage load(QIODevice& io_dev, int page_num); 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/core/ImagePixmapUnion.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGE_PIXMAP_UNION_H_ 20 | #define IMAGE_PIXMAP_UNION_H_ 21 | 22 | #include 23 | #include 24 | 25 | class ImagePixmapUnion 26 | { 27 | // Member-wise copying is OK. 28 | public: 29 | ImagePixmapUnion() {} 30 | 31 | ImagePixmapUnion(QImage const& image) : m_image(image) {} 32 | 33 | ImagePixmapUnion(QPixmap const& pixmap) : m_pixmap(pixmap) {} 34 | 35 | QImage const& image() const 36 | { 37 | return m_image; 38 | } 39 | 40 | QPixmap const& pixmap() const 41 | { 42 | return m_pixmap; 43 | } 44 | 45 | bool isNull() const 46 | { 47 | return m_image.isNull() && m_pixmap.isNull(); 48 | } 49 | private: 50 | QImage m_image; 51 | QPixmap m_pixmap; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/core/Jp2MetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2021 Alexander Trufanov 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef JP2METADATALOADER_H_ 20 | #define JP2METADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class Jp2MetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/JpegMetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef JPEGMETADATALOADER_H_ 20 | #define JPEGMETADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class JpegMetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/NonOwningWidget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "NonOwningWidget.h" 20 | 21 | NonOwningWidget::NonOwningWidget(QWidget* parent) 22 | : QWidget(parent) 23 | { 24 | } 25 | 26 | NonOwningWidget::~NonOwningWidget() 27 | { 28 | for (QObject* child : children()) { 29 | if (QWidget* widget = dynamic_cast(child)) { 30 | widget->setParent(0); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/core/NonOwningWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NON_OWNING_WIDGET_H_ 20 | #define NON_OWNING_WIDGET_H_ 21 | 22 | #include 23 | 24 | /** 25 | * \brief Your normal QWidget, except it doesn't delete its children with itself, 26 | * rather it calls setParent(0) on them. 27 | */ 28 | class NonOwningWidget : public QWidget 29 | { 30 | public: 31 | NonOwningWidget(QWidget* parent = 0); 32 | 33 | virtual ~NonOwningWidget(); 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/core/OpenGLSupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OPENGL_SUPPORT_H_ 20 | #define OPENGL_SUPPORT_H_ 21 | 22 | class OpenGLSupport 23 | { 24 | public: 25 | /** 26 | * \brief Returns true if OpenGL support is present and provides the necessary features. 27 | */ 28 | static bool supported(); 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/core/PageInfo.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PageInfo.h" 20 | 21 | PageInfo::PageInfo() 22 | : m_imageSubPages(0), 23 | m_leftHalfRemoved(false), 24 | m_rightHalfRemoved(false) 25 | { 26 | } 27 | 28 | PageInfo::PageInfo( 29 | PageId const& page_id, ImageMetadata const& metadata, 30 | int image_sub_pages, bool left_half_removed, bool right_half_removed) 31 | : m_pageId(page_id), 32 | m_metadata(metadata), 33 | m_imageSubPages(image_sub_pages), 34 | m_leftHalfRemoved(left_half_removed), 35 | m_rightHalfRemoved(right_half_removed) 36 | { 37 | } 38 | -------------------------------------------------------------------------------- /src/core/PageOrientationCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_ORIENTATION_COLLECTOR_H_ 20 | #define PAGE_ORIENTATION_COLLECTOR_H_ 21 | 22 | #include "AbstractFilterDataCollector.h" 23 | 24 | class OrthogonalRotation; 25 | 26 | class PageOrientationCollector : public AbstractFilterDataCollector 27 | { 28 | public: 29 | virtual void process(OrthogonalRotation const& orientation) = 0; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/core/PageRange.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PageRange.h" 20 | 21 | std::set 22 | PageRange::selectEveryOther(PageId const& base) const 23 | { 24 | std::set selection; 25 | 26 | std::vector::const_iterator it(pages.begin()); 27 | std::vector::const_iterator const end(pages.end()); 28 | for (; it != end && *it != base; ++it) { 29 | // Continue until we have a match. 30 | } 31 | if (it == end) { 32 | return selection; 33 | } 34 | 35 | int const base_idx = it - pages.begin(); 36 | int idx = 0; 37 | for (PageId const& page_id : pages) { 38 | if (((idx - base_idx) & 1) == 0) { 39 | selection.insert(page_id); 40 | } 41 | ++idx; 42 | } 43 | 44 | return selection; 45 | } 46 | -------------------------------------------------------------------------------- /src/core/PageRange.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_RANGE_H_ 20 | #define PAGE_RANGE_H_ 21 | 22 | #include "PageId.h" 23 | #include 24 | #include 25 | 26 | class PageRange 27 | { 28 | public: 29 | /** 30 | * \brief Ordered list of consecutive pages. 31 | */ 32 | std::vector pages; 33 | 34 | std::set selectEveryOther(PageId const& base) const; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/core/PageSelectionProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_SELECTION_PROVIDER_H_ 20 | #define PAGE_SELECTION_PROVIDER_H_ 21 | 22 | #include "RefCountable.h" 23 | #include 24 | #include 25 | #include 26 | 27 | class PageSequence; 28 | class PageId; 29 | class PageRange; 30 | 31 | class PageSelectionProvider : public QObject, public RefCountable 32 | { 33 | public: 34 | virtual PageSequence allPages() const = 0; 35 | virtual std::set selectedPages() const = 0; 36 | virtual std::vector selectedRanges() const = 0; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/core/PageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_VIEW_H_ 20 | #define PAGE_VIEW_H_ 21 | 22 | enum PageView { IMAGE_VIEW, PAGE_VIEW }; 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /src/core/PayloadEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAYLOAD_EVENT_H_ 20 | #define PAYLOAD_EVENT_H_ 21 | 22 | #include 23 | 24 | template 25 | class PayloadEvent : public QEvent 26 | { 27 | public: 28 | PayloadEvent(T const& payload) : QEvent(User), m_payload(payload) {} 29 | 30 | T const& payload() const 31 | { 32 | return m_payload; 33 | } 34 | 35 | T& payload() 36 | { 37 | return m_payload; 38 | } 39 | private: 40 | T m_payload; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/core/PhysicalTransformation.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PhysicalTransformation.h" 20 | #include "Dpi.h" 21 | #include "imageproc/Constants.h" 22 | 23 | using namespace imageproc::constants; 24 | 25 | PhysicalTransformation::PhysicalTransformation(Dpi const& dpi) 26 | { 27 | double const xscale = dpi.horizontal() * (DPI2DPM / 1000.0); 28 | double const yscale = dpi.vertical() * (DPI2DPM / 1000.0); 29 | m_mmToPixels.scale(xscale, yscale); 30 | m_pixelsToMM.scale(1.0 / xscale, 1.0 / yscale); 31 | } 32 | -------------------------------------------------------------------------------- /src/core/PhysicalTransformation.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PHYSICALTRANSFORMATION_H_ 20 | #define PHYSICALTRANSFORMATION_H_ 21 | 22 | #include 23 | 24 | class Dpi; 25 | 26 | class PhysicalTransformation 27 | { 28 | public: 29 | PhysicalTransformation(Dpi const& dpi); 30 | 31 | QTransform const& pixelsToMM() const 32 | { 33 | return m_pixelsToMM; 34 | } 35 | 36 | QTransform const& mmToPixels() const 37 | { 38 | return m_mmToPixels; 39 | } 40 | private: 41 | QTransform m_pixelsToMM; 42 | QTransform m_mmToPixels; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/PixmapRenderer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2015 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PixmapRenderer.h" 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | void 27 | PixmapRenderer::drawPixmap( 28 | QPainter& painter, QPixmap const& pixmap) 29 | { 30 | QTransform const inv_transform(painter.worldTransform().inverted()); 31 | QRectF const src_rect(inv_transform.map(QRectF(painter.viewport())).boundingRect()); 32 | QRectF const bounded_src_rect(src_rect.intersected(pixmap.rect())); 33 | painter.drawPixmap(bounded_src_rect, pixmap, bounded_src_rect); 34 | } 35 | -------------------------------------------------------------------------------- /src/core/PngMetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PNGMETADATALOADER_H_ 20 | #define PNGMETADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class PngMetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/RegenParams.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef REGEN_PARAMS_H_ 20 | #define REGEN_PARAMS_H_ 21 | 22 | class RegenParams 23 | { 24 | public: 25 | 26 | enum Regenerate { 27 | RegenerateNone = 0, 28 | RegeneratePage = 1, 29 | RegenerateThumbnail = 2, 30 | RegenerateAll = 3 31 | }; 32 | 33 | RegenParams(Regenerate val = RegenerateNone): m_forceReprocess(val) {} 34 | 35 | virtual void setForceReprocess(Regenerate val) 36 | { 37 | m_forceReprocess = val; 38 | } 39 | 40 | virtual Regenerate getForceReprocess() const 41 | { 42 | return m_forceReprocess; 43 | } 44 | 45 | private: 46 | Regenerate m_forceReprocess; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /src/core/SelectedPage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "SelectedPage.h" 20 | 21 | SelectedPage::SelectedPage(PageId const& page_id, PageView view) 22 | { 23 | set(page_id, view); 24 | } 25 | 26 | void 27 | SelectedPage::set(PageId const& page_id, PageView view) 28 | { 29 | if (view == PAGE_VIEW || page_id.imageId() != m_pageId.imageId()) { 30 | m_pageId = page_id; 31 | } 32 | } 33 | 34 | PageId 35 | SelectedPage::get(PageView view) const 36 | { 37 | if (view == PAGE_VIEW) { 38 | return m_pageId; 39 | } else { 40 | return PageId(m_pageId.imageId(), PageId::SINGLE_PAGE); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/core/SmartFilenameOrdering.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SMARTFILENAMEORDERING_H_ 20 | #define SMARTFILENAMEORDERING_H_ 21 | 22 | class QFileInfo; 23 | 24 | class SmartFilenameOrdering 25 | { 26 | public: 27 | SmartFilenameOrdering() {} 28 | 29 | /** 30 | * \brief Compare filenames using a set of heuristic rules. 31 | * 32 | * This function tries to mimic the way humans would order filenames. 33 | * For example, "2.png" will go before "12.png". While doing so, 34 | * it still provides the usual guarantees of a comparison predicate, 35 | * such as two different file paths will never be ruled equivalent. 36 | * 37 | * \return true if \p lhs should go before \p rhs. 38 | */ 39 | bool operator()(QFileInfo const& lhs, QFileInfo const& rhs) const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/core/StatusBarProvider.cpp: -------------------------------------------------------------------------------- 1 | #include "StatusBarProvider.h" 2 | 3 | QStatusBar* StatusBarProvider::m_statusBar = nullptr; 4 | int StatusBarProvider::m_filterIdx = 0; 5 | QEvent::Type StatusBarProvider::StatusBarEventType = static_cast(QEvent::registerEventType()); 6 | int StatusBarProvider::m_outputFilterIdx = 0; 7 | StatusLabelPhysSizeDisplayMode StatusBarProvider::statusLabelPhysSizeDisplayMode = Pixels; 8 | 9 | QSizeF StatusBarProvider::m_pageSize = QSizeF(); 10 | QPointF StatusBarProvider::m_mousePos; 11 | Dpi StatusBarProvider::m_originalDpi = Dpi(); 12 | Dpi StatusBarProvider::m_settingsDpi = StatusBarProvider::m_originalDpi; 13 | 14 | void 15 | StatusBarProvider::setPagePhysSize(const QSizeF& _pageSize, const Dpi& _originalDpi) 16 | { 17 | m_pageSize = _pageSize; 18 | m_originalDpi = _originalDpi; 19 | notify(); 20 | } 21 | 22 | void 23 | StatusBarProvider::changeFilterIdx(int idx) 24 | { 25 | m_filterIdx = idx; 26 | if (idx != m_outputFilterIdx) { 27 | m_settingsDpi = m_originalDpi; 28 | notify(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/core/TaskStatus.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef TASKSTATUS_H_ 20 | #define TASKSTATUS_H_ 21 | 22 | class TaskStatus 23 | { 24 | public: 25 | virtual ~TaskStatus() {} 26 | 27 | virtual void cancel() = 0; 28 | 29 | virtual bool isCancelled() const = 0; 30 | 31 | virtual void throwIfCancelled() const = 0; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/core/ThumbnailCollector.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef THUMBNAILCOLLECTOR_H_ 20 | #define THUMBNAILCOLLECTOR_H_ 21 | 22 | #include "AbstractFilterDataCollector.h" 23 | #include 24 | 25 | class ThumbnailPixmapCache; 26 | class QGraphicsItem; 27 | class QSizeF; 28 | 29 | class ThumbnailCollector : public AbstractFilterDataCollector 30 | { 31 | public: 32 | virtual void processThumbnail(std::unique_ptr) = 0; 33 | 34 | virtual IntrusivePtr thumbnailCache() = 0; 35 | 36 | virtual QSizeF maxLogicalThumbSize() const = 0; 37 | }; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/core/TiffMetadataLoader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "TiffMetadataLoader.h" 20 | #include "TiffReader.h" 21 | 22 | void 23 | TiffMetadataLoader::registerMyself() 24 | { 25 | static bool registered = false; 26 | if (!registered) { 27 | ImageMetadataLoader::registerLoader( 28 | IntrusivePtr(new TiffMetadataLoader) 29 | ); 30 | registered = true; 31 | } 32 | } 33 | 34 | ImageMetadataLoader::Status 35 | TiffMetadataLoader::loadMetadata( 36 | QIODevice& io_device, 37 | VirtualFunction1& out) 38 | { 39 | return TiffReader::readMetadata(io_device, out); 40 | } 41 | -------------------------------------------------------------------------------- /src/core/TiffMetadataLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef TIFFMETADATALOADER_H_ 20 | #define TIFFMETADATALOADER_H_ 21 | 22 | #include "ImageMetadataLoader.h" 23 | #include "VirtualFunction.h" 24 | #include 25 | 26 | class QIODevice; 27 | class ImageMetadata; 28 | 29 | class TiffMetadataLoader : public ImageMetadataLoader 30 | { 31 | public: 32 | /** 33 | * \brief Register this loader in the global registry. 34 | * 35 | * The same restrictions apply here as for 36 | * ImageMetadataLoader::registerLoader() 37 | */ 38 | static void registerMyself(); 39 | protected: 40 | virtual Status loadMetadata( 41 | QIODevice& io_device, 42 | VirtualFunction1& out); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/filters/deskew/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Deskew Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | ImageView.cpp ImageView.h 8 | Thumbnail.cpp Thumbnail.h 9 | Filter.cpp Filter.h 10 | OptionsWidget.cpp OptionsWidget.h 11 | Settings.cpp Settings.h 12 | Task.cpp Task.h 13 | CacheDrivenTask.cpp CacheDrivenTask.h 14 | Dependencies.cpp Dependencies.h 15 | Params.cpp Params.h 16 | OrderByAngleProvider.h 17 | ) 18 | SOURCE_GROUP("Sources" FILES ${sources}) 19 | FILE(GLOB ui_files "ui/*.ui") 20 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 21 | 22 | QT5_WRAP_UI(ui_sources ${ui_files}) 23 | 24 | ADD_LIBRARY(deskew STATIC ${sources} ${ui_sources}) 25 | TARGET_LINK_LIBRARIES(deskew Qt5::Widgets Qt5::Xml) 26 | 27 | TRANSLATION_SOURCES(scantailor-universal ${sources} ${ui_files}) 28 | -------------------------------------------------------------------------------- /src/core/filters/fix_orientation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Fix Orientation Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | ImageView.cpp ImageView.h 8 | Filter.cpp Filter.h 9 | OptionsWidget.cpp OptionsWidget.h 10 | Settings.cpp Settings.h 11 | Task.cpp Task.h 12 | CacheDrivenTask.cpp CacheDrivenTask.h 13 | OrderByRotation.cpp OrderByRotation.h 14 | ) 15 | SOURCE_GROUP("Sources" FILES ${sources}) 16 | FILE(GLOB ui_files "ui/*.ui") 17 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 18 | 19 | QT5_WRAP_UI(ui_sources ${ui_files}) 20 | 21 | ADD_LIBRARY(fix_orientation STATIC ${sources} ${ui_sources}) 22 | TARGET_LINK_LIBRARIES(fix_orientation Qt5::Widgets Qt5::Xml) 23 | 24 | TRANSLATION_SOURCES(scantailor-universal ${sources} ${ui_files}) 25 | -------------------------------------------------------------------------------- /src/core/filters/output/ChangeDewarpingWidget.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_CHANGE_DEWARPING_WIDGET_H_ 20 | #define OUTPUT_CHANGE_DEWARPING_WIDGET_H_ 21 | 22 | #include "ui_OutputChangeDewarpingWidget.h" 23 | #include "DewarpingMode.h" 24 | #include "PageId.h" 25 | #include "PageSequence.h" 26 | #include "IntrusivePtr.h" 27 | #include 28 | #include 29 | #include 30 | 31 | namespace output 32 | { 33 | 34 | class ChangeDewarpingWidget : public QWidget 35 | { 36 | Q_OBJECT 37 | public: 38 | ChangeDewarpingWidget(QWidget* parent, DewarpingMode const& mode); 39 | DewarpingMode dewarpingMode() const; 40 | virtual ~ChangeDewarpingWidget(); 41 | private: 42 | Ui::OutputChangeDewarpingWidget ui; 43 | DewarpingMode m_mode; 44 | }; 45 | 46 | } // namespace output 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/core/filters/output/DespeckleLevel.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DESPECKLE_LEVEL_H_ 20 | #define DESPECKLE_LEVEL_H_ 21 | 22 | class QString; 23 | 24 | namespace output 25 | { 26 | 27 | enum DespeckleLevel { 28 | DESPECKLE_OFF, 29 | DESPECKLE_CAUTIOUS, 30 | DESPECKLE_NORMAL, 31 | DESPECKLE_AGGRESSIVE 32 | }; 33 | 34 | QString despeckleLevelToString(DespeckleLevel level); 35 | 36 | DespeckleLevel despeckleLevelFromString(QString const& str); 37 | 38 | } // namespace output 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/core/filters/output/DewarpingMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_DEWARPING_MODE_H_ 20 | #define OUTPUT_DEWARPING_MODE_H_ 21 | 22 | #include 23 | 24 | namespace output 25 | { 26 | 27 | class DewarpingMode 28 | { 29 | public: 30 | enum Mode { OFF, AUTO, MANUAL 31 | //begin of modified by monday2000 32 | //Marginal_Dewarping 33 | , MARGINAL 34 | //end of modified by monday2000 35 | }; 36 | 37 | DewarpingMode(Mode mode = OFF) : m_mode(mode) {} 38 | 39 | explicit DewarpingMode(QString const& str); 40 | 41 | QString toString() const; 42 | 43 | operator Mode() const 44 | { 45 | return m_mode; 46 | } 47 | private: 48 | Mode m_mode; 49 | }; 50 | 51 | } // namespace output 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /src/core/filters/output/FillZoneComparator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FILL_ZONE_COMPARATOR_H_ 20 | #define FILL_ZONE_COMPARATOR_H_ 21 | 22 | class ZoneSet; 23 | class Zone; 24 | class PropertySet; 25 | 26 | namespace output 27 | { 28 | 29 | class FillZoneComparator 30 | { 31 | public: 32 | static bool equal(ZoneSet const& lhs, ZoneSet const& rhs); 33 | 34 | static bool equal(Zone const& lhs, Zone const& rhs); 35 | 36 | static bool equal(PropertySet const& lhs, PropertySet const& rhs); 37 | }; 38 | 39 | } // namespace output 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/core/filters/output/FillZonePropFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "FillZonePropFactory.h" 20 | #include "FillColorProperty.h" 21 | 22 | namespace output 23 | { 24 | 25 | FillZonePropFactory::FillZonePropFactory() 26 | { 27 | FillColorProperty::registerIn(*this); 28 | } 29 | 30 | } // namespace output 31 | -------------------------------------------------------------------------------- /src/core/filters/output/FillZonePropFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_FILL_ZONE_PROP_FACTORY_H_ 20 | #define OUTPUT_FILL_ZONE_PROP_FACTORY_H_ 21 | 22 | #include "PropertyFactory.h" 23 | 24 | namespace output 25 | { 26 | 27 | class FillZonePropFactory : public PropertyFactory 28 | { 29 | public: 30 | FillZonePropFactory(); 31 | }; 32 | 33 | } // namespace output 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/core/filters/output/ImageMetadataCopier.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2021 Alexander Trufanov 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEMETADATACOPIER_H 20 | #define IMAGEMETADATACOPIER_H 21 | 22 | #include 23 | #include 24 | 25 | class ImageMetadataCopier 26 | { 27 | public: 28 | static bool iccProfileDefined(const QString& filename); 29 | static bool copyMetadata(const QString& src_img, const QString& dst_img); 30 | }; 31 | 32 | #endif // IMAGEMETADATACOPIER_H 33 | -------------------------------------------------------------------------------- /src/core/filters/output/ImageView.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ImageView.h" 20 | 21 | #include "ImagePresentation.h" 22 | #include "OutputMargins.h" 23 | 24 | namespace output 25 | { 26 | 27 | ImageView::ImageView(QImage const& image, QImage const& downscaled_image) 28 | : ImageViewBase( 29 | image, downscaled_image, 30 | ImagePresentation(QTransform(), QRectF(image.rect())), 31 | OutputMargins() 32 | ), 33 | m_dragHandler(*this), 34 | m_zoomHandler(*this) 35 | { 36 | rootInteractionHandler().makeLastFollower(m_dragHandler); 37 | rootInteractionHandler().makeLastFollower(m_zoomHandler); 38 | } 39 | 40 | ImageView::~ImageView() 41 | { 42 | } 43 | 44 | } // namespace output 45 | -------------------------------------------------------------------------------- /src/core/filters/output/ImageView.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_IMAGEVIEW_H_ 20 | #define OUTPUT_IMAGEVIEW_H_ 21 | 22 | #include "ImageViewBase.h" 23 | #include "DragHandler.h" 24 | #include "ZoomHandler.h" 25 | #include 26 | 27 | class ImageTransformation; 28 | 29 | namespace output 30 | { 31 | 32 | class ImageView : public ImageViewBase 33 | { 34 | Q_OBJECT 35 | public: 36 | ImageView(QImage const& image, QImage const& downscaled_image); 37 | 38 | virtual ~ImageView(); 39 | private: 40 | DragHandler m_dragHandler; 41 | ZoomHandler m_zoomHandler; 42 | }; 43 | 44 | } // namespace output 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/core/filters/output/ImageViewTab.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_IMAGE_VIEW_TAB_H_ 20 | #define OUTPUT_IMAGE_VIEW_TAB_H_ 21 | 22 | namespace output 23 | { 24 | 25 | enum ImageViewTab { 26 | TAB_OUTPUT, 27 | TAB_PICTURE_ZONES, 28 | TAB_FILL_ZONES, 29 | TAB_DEWARPING, 30 | TAB_DESPECKLING 31 | }; 32 | 33 | } // namespace output 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/core/filters/output/OutputMargins.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_OUTPUT_MARGINS_H_ 20 | #define OUTPUT_OUTPUT_MARGINS_H_ 21 | 22 | #include "Margins.h" 23 | 24 | namespace output 25 | { 26 | 27 | /** 28 | * Having margins on the Output stage is useful when creating zones 29 | * that are meant to cover a corner or an edge of a page. 30 | * We use the same margins on all tabs to preserve their geometrical 31 | * one-to-one relationship. 32 | */ 33 | class OutputMargins : public Margins 34 | { 35 | public: 36 | OutputMargins() : Margins(10.0, 10.0, 10.0, 10.0) {} 37 | }; 38 | 39 | } // namespace output 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZoneComparator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PICTURE_ZONE_COMPARATOR_H_ 20 | #define PICTURE_ZONE_COMPARATOR_H_ 21 | 22 | class ZoneSet; 23 | class Zone; 24 | class PropertySet; 25 | 26 | namespace output 27 | { 28 | 29 | class PictureZoneComparator 30 | { 31 | public: 32 | static bool equal(ZoneSet const& lhs, ZoneSet const& rhs); 33 | 34 | static bool equal(Zone const& lhs, Zone const& rhs); 35 | 36 | static bool equal(PropertySet const& lhs, PropertySet const& rhs); 37 | }; 38 | 39 | } // namespace output 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZonePropDialog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_PICTURE_ZONE_PROP_DIALOG_H_ 20 | #define OUTPUT_PICTURE_ZONE_PROP_DIALOG_H_ 21 | 22 | #include "ui_PictureZonePropDialog.h" 23 | #include "PropertySet.h" 24 | #include "IntrusivePtr.h" 25 | #include 26 | 27 | namespace output 28 | { 29 | 30 | class PictureZonePropDialog : public QDialog 31 | { 32 | Q_OBJECT 33 | public: 34 | PictureZonePropDialog(IntrusivePtr const& props, QWidget* parent = 0); 35 | signals: 36 | void updated(); 37 | private slots: 38 | void itemToggled(bool selected); 39 | private: 40 | Ui::PictureZonePropDialog ui; 41 | IntrusivePtr m_ptrProps; 42 | }; 43 | 44 | } // namespace output 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZonePropFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PictureZonePropFactory.h" 20 | #include "PictureLayerProperty.h" 21 | #include "ZoneCategoryProperty.h" 22 | 23 | namespace output 24 | { 25 | 26 | PictureZonePropFactory::PictureZonePropFactory() 27 | { 28 | PictureLayerProperty::registerIn(*this); 29 | ZoneCategoryProperty::registerIn(*this); 30 | } 31 | 32 | } // namespace output 33 | -------------------------------------------------------------------------------- /src/core/filters/output/PictureZonePropFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_PICTURE_ZONE_PROP_FACTORY_H_ 20 | #define OUTPUT_PICTURE_ZONE_PROP_FACTORY_H_ 21 | 22 | #include "PropertyFactory.h" 23 | 24 | namespace output 25 | { 26 | 27 | class PictureZonePropFactory : public PropertyFactory 28 | { 29 | public: 30 | PictureZonePropFactory(); 31 | }; 32 | 33 | } // namespace output 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/core/filters/output/Thumbnail.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Thumbnail.h" 20 | 21 | namespace output 22 | { 23 | 24 | Thumbnail::Thumbnail( 25 | IntrusivePtr const& thumbnail_cache, 26 | QSizeF const& max_size, ImageId const& image_id, 27 | ImageTransformation const& xform) 28 | : ThumbnailBase(thumbnail_cache, max_size, image_id, xform) 29 | { 30 | } 31 | 32 | } // namespace output 33 | -------------------------------------------------------------------------------- /src/core/filters/output/Thumbnail.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_THUMBNAIL_H_ 20 | #define OUTPUT_THUMBNAIL_H_ 21 | 22 | #include "ThumbnailBase.h" 23 | #include "IntrusivePtr.h" 24 | 25 | class ThumbnailPixmapCache; 26 | class ImageTransformation; 27 | class ImageId; 28 | class QSizeF; 29 | 30 | namespace output 31 | { 32 | 33 | class Thumbnail : public ThumbnailBase 34 | { 35 | public: 36 | Thumbnail(IntrusivePtr const& thumbnail_cache, 37 | QSizeF const& max_size, ImageId const& image_id, 38 | ImageTransformation const& xform); 39 | }; 40 | 41 | } // namespace output 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/core/filters/output/Utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef OUTPUT_UTILS_H_ 20 | #define OUTPUT_UTILS_H_ 21 | 22 | class Dpi; 23 | class QString; 24 | class QTransform; 25 | 26 | namespace output 27 | { 28 | 29 | class Utils 30 | { 31 | public: 32 | static QString automaskDir(QString const& out_dir); 33 | 34 | static QString predespeckleDir(QString const& out_dir); 35 | 36 | static QString specklesDir(QString const& out_dir); 37 | 38 | static QTransform scaleFromToDpi(Dpi const& from, Dpi const& to); 39 | }; 40 | 41 | } // namespace output 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/core/filters/page_layout/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Page Layout Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | Utils.cpp Utils.h 8 | ImageView.cpp ImageView.h 9 | Filter.cpp Filter.h 10 | alignmentwidget.cpp alignmentwidget.h 11 | OptionsWidget.cpp OptionsWidget.h 12 | Task.cpp Task.h 13 | CacheDrivenTask.cpp CacheDrivenTask.h 14 | Params.cpp Params.h 15 | Settings.cpp Settings.h 16 | Thumbnail.cpp Thumbnail.h 17 | ApplySettingsWidget.cpp ApplySettingsWidget.h 18 | Alignment.cpp Alignment.h 19 | OrderByWidthProvider.cpp OrderByWidthProvider.h 20 | OrderByHeightProvider.cpp OrderByHeightProvider.h 21 | OrderByAlignment.cpp OrderByAlignment.h 22 | ) 23 | SOURCE_GROUP("Sources" FILES ${sources}) 24 | FILE(GLOB ui_files "ui/*.ui") 25 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 26 | 27 | QT5_WRAP_UI(ui_sources ${ui_files}) 28 | 29 | ADD_LIBRARY(page_layout STATIC ${sources} ${ui_sources}) 30 | TARGET_LINK_LIBRARIES(page_layout Qt5::Widgets Qt5::Xml) 31 | TRANSLATION_SOURCES(scantailor-universal ${sources} ${ui_files}) 32 | -------------------------------------------------------------------------------- /src/core/filters/page_layout/OrderByAlignment.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_LAYOUT_ORDER_BY_ALIGNMENT_H_ 20 | #define PAGE_LAYOUT_ORDER_BY_ALIGNMENT_H_ 21 | 22 | #include "Settings.h" 23 | #include "IntrusivePtr.h" 24 | #include "PageOrderProvider.h" 25 | 26 | namespace page_layout 27 | { 28 | 29 | class OrderByAlignment : public PageOrderProvider 30 | { 31 | public: 32 | OrderByAlignment(IntrusivePtr const& settings); 33 | 34 | virtual bool precedes( 35 | PageId const& lhs_page, bool lhs_incomplete, 36 | PageId const& rhs_page, bool rhs_incomplete) const; 37 | 38 | virtual QString hint(PageId const& page) const; 39 | private: 40 | IntrusivePtr m_ptrSettings; 41 | }; 42 | 43 | } // namespace page_layout 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/filters/page_layout/OrderByHeightProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_LAYOUT_ORDER_BY_HEIGHT_PROVIDER_H_ 20 | #define PAGE_LAYOUT_ORDER_BY_HEIGHT_PROVIDER_H_ 21 | 22 | #include "Settings.h" 23 | #include "IntrusivePtr.h" 24 | #include "PageOrderProvider.h" 25 | 26 | namespace page_layout 27 | { 28 | 29 | class OrderByHeightProvider : public PageOrderProvider 30 | { 31 | public: 32 | OrderByHeightProvider(IntrusivePtr const& settings); 33 | 34 | virtual bool precedes( 35 | PageId const& lhs_page, bool lhs_incomplete, 36 | PageId const& rhs_page, bool rhs_incomplete) const; 37 | 38 | virtual QString hint(PageId const& page) const; 39 | private: 40 | IntrusivePtr m_ptrSettings; 41 | }; 42 | 43 | } // namespace page_layout 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/filters/page_layout/OrderByWidthProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_LAYOUT_ORDER_BY_WIDTH_PROVIDER_H_ 20 | #define PAGE_LAYOUT_ORDER_BY_WIDTH_PROVIDER_H_ 21 | 22 | #include "Settings.h" 23 | #include "IntrusivePtr.h" 24 | #include "PageOrderProvider.h" 25 | 26 | namespace page_layout 27 | { 28 | 29 | class OrderByWidthProvider : public PageOrderProvider 30 | { 31 | public: 32 | OrderByWidthProvider(IntrusivePtr const& settings); 33 | 34 | virtual bool precedes( 35 | PageId const& lhs_page, bool lhs_incomplete, 36 | PageId const& rhs_page, bool rhs_incomplete) const; 37 | 38 | virtual QString hint(PageId const& page) const; 39 | private: 40 | IntrusivePtr m_ptrSettings; 41 | }; 42 | 43 | } // namespace page_layout 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/core/filters/page_split/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Page Split Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | SplitLineObject.h 8 | ImageView.cpp ImageView.h 9 | Thumbnail.cpp Thumbnail.h 10 | Params.cpp Params.h 11 | Dependencies.cpp Dependencies.h 12 | PageLayout.cpp PageLayout.h 13 | PageLayoutEstimator.cpp PageLayoutEstimator.h 14 | VertLineFinder.cpp VertLineFinder.h 15 | Filter.cpp Filter.h 16 | OptionsWidget.cpp OptionsWidget.h 17 | SplitModeWidget.cpp SplitModeWidget.h 18 | Settings.cpp Settings.h 19 | Task.cpp Task.h 20 | CacheDrivenTask.cpp CacheDrivenTask.h 21 | LayoutType.cpp LayoutType.h 22 | UnremoveButton.cpp UnremoveButton.h 23 | OrderBySplitTypeProvider.cpp OrderBySplitTypeProvider.h 24 | OrderByPageSizeProvider.cpp OrderByPageSizeProvider.h 25 | ) 26 | SOURCE_GROUP("Sources" FILES ${sources}) 27 | FILE(GLOB ui_files "ui/*.ui") 28 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 29 | 30 | QT5_WRAP_UI(ui_sources ${ui_files}) 31 | 32 | ADD_LIBRARY(page_split STATIC ${sources} ${ui_sources}) 33 | TARGET_LINK_LIBRARIES(page_split Qt5::Widgets Qt5::Xml) 34 | TRANSLATION_SOURCES(scantailor-universal ${sources} ${ui_files}) 35 | -------------------------------------------------------------------------------- /src/core/filters/page_split/LayoutType.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PAGE_SPLIT_LAYOUT_TYPE_H_ 20 | #define PAGE_SPLIT_LAYOUT_TYPE_H_ 21 | 22 | #include 23 | 24 | namespace page_split 25 | { 26 | 27 | enum LayoutType { 28 | AUTO_LAYOUT_TYPE, 29 | SINGLE_PAGE_UNCUT, 30 | PAGE_PLUS_OFFCUT, 31 | TWO_PAGES 32 | }; 33 | 34 | QString layoutTypeToString(LayoutType type); 35 | 36 | LayoutType layoutTypeFromString(QString const& layout_type); 37 | 38 | } // namespace page_split 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/core/filters/select_content/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Select Content Filter") 2 | 3 | INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | ImageView.cpp ImageView.h 8 | Filter.cpp Filter.h 9 | OptionsWidget.cpp OptionsWidget.h 10 | ContentBoxFinder.cpp ContentBoxFinder.h 11 | PageFinder.cpp PageFinder.h 12 | Task.cpp Task.h 13 | CacheDrivenTask.cpp CacheDrivenTask.h 14 | Dependencies.cpp Dependencies.h 15 | Params.cpp Params.h 16 | Settings.cpp Settings.h 17 | Thumbnail.cpp Thumbnail.h 18 | PhysSizeCalc.cpp PhysSizeCalc.h 19 | OrderBySizeProvider.cpp OrderBySizeProvider.h 20 | ) 21 | SOURCE_GROUP("Sources" FILES ${sources}) 22 | FILE(GLOB ui_files "ui/*.ui") 23 | SOURCE_GROUP("UI Files" FILES ${ui_files}) 24 | 25 | QT5_WRAP_UI(ui_sources ${ui_files}) 26 | 27 | ADD_LIBRARY(select_content STATIC ${sources} ${ui_sources}) 28 | TARGET_LINK_LIBRARIES(select_content Qt5::Widgets Qt5::Xml) 29 | TRANSLATION_SOURCES(scantailor-universal ${sources} ${ui_files}) 30 | -------------------------------------------------------------------------------- /src/core/filters/select_content/PhysSizeCalc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SELECT_CONTENT_PHYS_SIZE_CALC_H_ 20 | #define SELECT_CONTENT_PHYS_SIZE_CALC_H_ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | class ImageTransformation; 27 | 28 | namespace select_content 29 | { 30 | 31 | class PhysSizeCalc 32 | { 33 | // Member-wise copying is OK. 34 | public: 35 | PhysSizeCalc(); 36 | 37 | explicit PhysSizeCalc(ImageTransformation const& xform); 38 | 39 | QSizeF sizeMM(QRectF const& rect_px) const; 40 | private: 41 | QTransform m_virtToPhys; 42 | }; 43 | 44 | } // namespace select_content 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /src/core/interaction/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(interaction) 2 | 3 | INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | DraggableObject.h 8 | DraggablePoint.cpp DraggablePoint.h 9 | DraggableLineSegment.cpp DraggableLineSegment.h 10 | DraggablePolygon.cpp DraggablePolygon.h 11 | ObjectDragHandler.cpp ObjectDragHandler.h 12 | InteractionHandler.cpp InteractionHandler.h 13 | InteractionState.cpp InteractionState.h 14 | DragHandler.cpp DragHandler.h 15 | DragWatcher.cpp DragWatcher.h 16 | ZoomHandler.cpp ZoomHandler.h 17 | InteractiveXSpline.cpp InteractiveXSpline.h 18 | ) 19 | 20 | SOURCE_GROUP(Sources FILES ${sources}) 21 | 22 | ADD_LIBRARY(interaction STATIC ${sources}) 23 | TARGET_LINK_LIBRARIES(interaction Qt5::Widgets) 24 | TRANSLATION_SOURCES(scantailor-universal ${sources}) 25 | -------------------------------------------------------------------------------- /src/core/interaction/DraggablePolygon.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2019 Joseph Artsimovich , 4lex4 <4lex49@zoho.com> 2 | // Use of this source code is governed by the GNU GPLv3 license that can be found in the LICENSE file. 3 | 4 | #include "DraggablePolygon.h" 5 | 6 | #include 7 | 8 | DraggablePolygon::DraggablePolygon() : m_proximityPriority(0) {} 9 | 10 | int DraggablePolygon::proximityPriority() const { 11 | return m_proximityPriority; 12 | } 13 | 14 | Proximity DraggablePolygon::proximity(const QPointF& mousePos) { 15 | double value = polygonPosition().containsPoint(mousePos, Qt::WindingFill) ? 0 : std::numeric_limits::max(); 16 | return Proximity::fromSqDist(value); 17 | } 18 | 19 | void DraggablePolygon::dragInitiated(const QPointF& mousePos) { 20 | m_initialMousePos = mousePos; 21 | m_initialPolygonPos = polygonPosition(); 22 | } 23 | 24 | void DraggablePolygon::dragContinuation(const QPointF& mousePos, Qt::KeyboardModifiers mask) { 25 | polygonMoveRequest(m_initialPolygonPos.translated(mousePos - m_initialMousePos)); 26 | } 27 | -------------------------------------------------------------------------------- /src/core/resources/TiffCompressionMethods.tsv: -------------------------------------------------------------------------------- 1 | #NAME ID DESCRIPTION NOT FILTERED B/W ONLY 2 | LZW 5 Lempel-Ziv & Welch 1 0 3 | ADOBEDEFLATE 8 Deflate compression (as recognized by Adobe) 1 0 4 | DEFLATE 32946 Deflate compression (legacy libtiff) 0 0 5 | DCS 32947 Kodak DCS encoding 0 0 6 | JBIG 34661 ISO JBIG 0 0 7 | SGILOG 34676 SGI Log 0 0 8 | LZMA 34925 LZMA2 0 0 9 | OJPEG 6 !6.0 JPEG [Old-style JPEG] 0 0 10 | JPEG 7 %JPEG DCT compression 1 0 11 | NEXT 32766 NeXT 2-bit RLE 0 0 12 | PACKBITS 32773 Macintosh RLE 1 0 13 | THUNDERSCAN 32809 ThunderScan RLE 0 0 14 | PIXARLOG 32909 Pixar companded 11bit ZIP 0 0 15 | CCITTRLE 2 CCITT modified Huffman RLE 0 1 16 | CCITTRLEW 32771 #1 w/ word alignment 0 1 17 | CCITTFAX3 3 CCITT Group 3 fax encoding [CCITT T.4 (TIFF 6 name)] 0 1 18 | CCITTFAX4 4 CCITT Group 4 fax encoding [CCITT T.6 (TIFF 6 name)] 1 1 19 | NONE 1 dump mode 1 0 20 | -------------------------------------------------------------------------------- /src/core/resources/core_resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | TiffCompressionMethods.tsv 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/core/settings/TiffCompressionInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "TiffCompressionInfo.h" 2 | 3 | #include 4 | 5 | QMap 6 | init_data() 7 | { 8 | Q_INIT_RESOURCE(core_resources); 9 | 10 | QMap data; 11 | const QResource tiff_data(":/TiffCompressionMethods.tsv"); 12 | const QStringList sl = QString::fromUtf8((char const*)tiff_data.data(), tiff_data.size()).split('\n'); 13 | 14 | QStringList vals; 15 | for (QString const& s: sl) { 16 | vals = s.split('\t'); 17 | if (vals.count() < 5 || 18 | vals[0].startsWith("#")) continue; 19 | TiffCompressionInfo info; 20 | info.name = vals[0]; 21 | info.id = vals[1].toInt(); 22 | info.description = vals[2]; 23 | info.always_shown = vals[3].toInt(); 24 | info.for_bw_only = vals[4].toInt(); 25 | data[info.name] = info; 26 | } 27 | return data; 28 | } 29 | 30 | QMap TiffCompressions::compression_data = init_data(); 31 | 32 | const TiffCompressionInfo& 33 | TiffCompressions::info(QString const& name) 34 | { 35 | return compression_data[name]; 36 | } 37 | -------------------------------------------------------------------------------- /src/core/settings/TiffCompressionInfo.h: -------------------------------------------------------------------------------- 1 | #ifndef TIFFCOMPRESSIONINFO_H 2 | #define TIFFCOMPRESSIONINFO_H 3 | 4 | #include 5 | 6 | struct TiffCompressionInfo 7 | { 8 | QString name; 9 | int id; 10 | QString description; 11 | bool always_shown; 12 | bool for_bw_only; 13 | }; 14 | 15 | class TiffCompressions 16 | { 17 | public: 18 | static const TiffCompressionInfo& info(QString const& name); 19 | static QMap::const_iterator constBegin() { return compression_data.constBegin(); } 20 | static QMap::const_iterator constEnd() { return compression_data.constEnd(); } 21 | private: 22 | static QMap compression_data; 23 | }; 24 | 25 | #endif // TIFFCOMPRESSIONINFO_H 26 | -------------------------------------------------------------------------------- /src/core/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | main.cpp TestContentSpanFinder.cpp 6 | TestSmartFilenameOrdering.cpp 7 | TestMatrixCalc.cpp 8 | ../ContentSpanFinder.cpp ../ContentSpanFinder.h 9 | ../SmartFilenameOrdering.cpp ../SmartFilenameOrdering.h 10 | ) 11 | 12 | SOURCE_GROUP("Sources" FILES ${sources}) 13 | 14 | SET( 15 | libs 16 | imageproc math ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 17 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} ${EXTRA_LIBS} 18 | ) 19 | 20 | ADD_EXECUTABLE(generic_tests ${sources}) 21 | TARGET_LINK_LIBRARIES(generic_tests Qt5::Widgets) 22 | TARGET_LINK_LIBRARIES(generic_tests ${libs}) 23 | 24 | # We want the executable located where we copy all the DLLs. 25 | SET_TARGET_PROPERTIES( 26 | generic_tests PROPERTIES 27 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" 28 | ) 29 | 30 | ADD_TEST(NAME generic_tests COMMAND generic_tests --log_level=message) 31 | -------------------------------------------------------------------------------- /src/core/tests/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #define BOOST_AUTO_TEST_MAIN 24 | 25 | #include 26 | -------------------------------------------------------------------------------- /src/core/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(core_ui_sources) # Don't rename - it's referenced elsewhere. 2 | 3 | FILE(GLOB core_ui_files "*.ui") 4 | SOURCE_GROUP("UI Files" FILES ${core_ui_files}) 5 | 6 | QT5_WRAP_UI(c_ui_sources ${core_ui_files}) 7 | ADD_CUSTOM_TARGET(core_ui_sources SOURCES ${c_ui_sources}) 8 | 9 | TRANSLATION_SOURCES(scantailor-universal ${core_ui_files}) 10 | -------------------------------------------------------------------------------- /src/core/zones/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(zones) 2 | 3 | INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | LocalClipboard.h LocalClipboard.cpp 8 | SplineVertex.cpp SplineVertex.h 9 | SplineSegment.cpp SplineSegment.h 10 | EditableSpline.cpp EditableSpline.h 11 | SerializableSpline.cpp SerializableSpline.h 12 | EditableEllipse.cpp EditableEllipse.h 13 | SerializableEllipse.cpp SerializableEllipse.h 14 | Zone.cpp Zone.h 15 | ZoneSet.cpp ZoneSet.h 16 | EditableZoneSet.cpp EditableZoneSet.h 17 | BasicSplineVisualizer.cpp BasicSplineVisualizer.h 18 | ZoneInteractionContext.cpp ZoneInteractionContext.h 19 | ZoneDefaultInteraction.cpp ZoneDefaultInteraction.h 20 | ZoneCreationInteraction.cpp ZoneCreationInteraction.h 21 | ZoneVertexDragInteraction.cpp ZoneVertexDragInteraction.h 22 | ZoneEllipseVertexDragInteraction.cpp ZoneEllipseVertexDragInteraction.h 23 | ZoneDragInteraction.cpp ZoneDragInteraction.h 24 | ZoneContextMenuInteraction.cpp ZoneContextMenuInteraction.h 25 | ZoneContextMenuItem.h 26 | ) 27 | 28 | SOURCE_GROUP(Sources FILES ${sources}) 29 | 30 | ADD_LIBRARY(zones STATIC ${sources}) 31 | TARGET_LINK_LIBRARIES(zones Qt5::Widgets Qt5::Xml) 32 | TRANSLATION_SOURCES(scantailor-universal ${sources}) 33 | -------------------------------------------------------------------------------- /src/core/zones/SplineSegment.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "SplineSegment.h" 20 | #include 21 | 22 | SplineSegment::SplineSegment( 23 | SplineVertex::Ptr const& prev, SplineVertex::Ptr const& next) 24 | : prev(prev), 25 | next(next) 26 | { 27 | } 28 | 29 | SplineVertex::Ptr 30 | SplineSegment::splitAt(QPointF const& pt) 31 | { 32 | assert(isValid()); 33 | return prev->insertAfter(pt); 34 | } 35 | 36 | bool 37 | SplineSegment::isValid() const 38 | { 39 | return prev && next && prev->next(SplineVertex::LOOP_IF_BRIDGED) == next; 40 | } 41 | -------------------------------------------------------------------------------- /src/core/zones/SplineSegment.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SPLINE_SEGMENT_H_ 20 | #define SPLINE_SEGMENT_H_ 21 | 22 | #include "SplineVertex.h" 23 | #include 24 | #include 25 | 26 | class SplineSegment 27 | { 28 | public: 29 | SplineVertex::Ptr prev; 30 | SplineVertex::Ptr next; 31 | 32 | SplineSegment() {} 33 | 34 | SplineSegment(SplineVertex::Ptr const& prev, SplineVertex::Ptr const& next); 35 | 36 | SplineVertex::Ptr splitAt(QPointF const& pt); 37 | 38 | bool isValid() const; 39 | 40 | bool operator==(SplineSegment const& other) const 41 | { 42 | return prev == other.prev && next == other.next; 43 | } 44 | 45 | QLineF toLine() const 46 | { 47 | return QLineF(prev->point(), next->point()); 48 | } 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /src/dewarping/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Dewarping library") 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/core) 4 | 5 | SET( 6 | sources 7 | Curve.cpp Curve.h 8 | DistortionModel.cpp DistortionModel.h 9 | DistortionModelBuilder.cpp DistortionModelBuilder.h 10 | DetectVertContentBounds.cpp DetectVertContentBounds.h 11 | TowardsLineTracer.cpp TowardsLineTracer.h 12 | TextLineTracer.cpp TextLineTracer.h 13 | TextLineRefiner.cpp TextLineRefiner.h 14 | TopBottomEdgeTracer.cpp TopBottomEdgeTracer.h 15 | CylindricalSurfaceDewarper.cpp CylindricalSurfaceDewarper.h 16 | DewarpingPointMapper.cpp DewarpingPointMapper.h 17 | RasterDewarper.cpp RasterDewarper.h 18 | ) 19 | SOURCE_GROUP("Sources" FILES ${sources}) 20 | 21 | ADD_LIBRARY(dewarping STATIC ${sources}) 22 | TARGET_LINK_LIBRARIES(dewarping Qt5::Widgets Qt5::Xml) 23 | 24 | -------------------------------------------------------------------------------- /src/dewarping/RasterDewarper.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DEWARPING_RASTER_DEWARPER_H_ 20 | #define DEWARPING_RASTER_DEWARPER_H_ 21 | 22 | class QImage; 23 | class QSize; 24 | class QRectF; 25 | class QColor; 26 | 27 | namespace dewarping 28 | { 29 | 30 | class CylindricalSurfaceDewarper; 31 | 32 | class RasterDewarper 33 | { 34 | public: 35 | static QImage dewarp( 36 | QImage const& src, QSize const& dst_size, 37 | CylindricalSurfaceDewarper const& distortion_model, 38 | QRectF const& model_domain, QColor const& background_color 39 | ); 40 | }; 41 | 42 | } // namespace dewarping 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /src/exporting/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Export functionality") 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/core) 4 | 5 | SET( 6 | sources 7 | ExportModes.h ExportSettings.h 8 | ImageSplitOps.h ImageSplitOps.cpp 9 | ExportThread.h ExportThread.cpp 10 | ) 11 | 12 | SOURCE_GROUP("Sources" FILES ${sources}) 13 | 14 | ADD_LIBRARY(exporting STATIC ${sources}) 15 | TARGET_LINK_LIBRARIES(exporting Qt5::Widgets) 16 | TRANSLATION_SOURCES(scantailor-universal ${sources}) 17 | -------------------------------------------------------------------------------- /src/exporting/ExportModes.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor Universal - Interactive post-processing tool for scanned 3 | pages. A fork of Scan Tailor by Joseph Artsimovich. 4 | Copyright (C) 2020 Alexander Trufanov 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef EXPORTMODES_H 21 | #define EXPORTMODES_H 22 | 23 | #include 24 | 25 | namespace exporting { 26 | 27 | enum ExportMode { 28 | None = 0, 29 | Foreground = 1, 30 | Background = 2, 31 | Mask = 4, 32 | Zones = 8, 33 | WholeImage = 16, 34 | AutoMask = 32, 35 | ImageWithoutOutputStage = 64 36 | }; 37 | 38 | Q_DECLARE_FLAGS(ExportModes, ExportMode) 39 | 40 | } 41 | 42 | #endif // EXPORTMODES_H 43 | -------------------------------------------------------------------------------- /src/foundation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT("Foundation library") 2 | 3 | INCLUDE_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}") 4 | 5 | SET( 6 | sources 7 | NonCopyable.h IntrusivePtr.h RefCountable.h 8 | AlignedArray.h 9 | FastQueue.h 10 | SafeDeletingQObjectPtr.h 11 | ScopedIncDec.h ScopedDecInc.h 12 | Span.h VirtualFunction.h FlagOps.h 13 | AutoRemovingFile.cpp AutoRemovingFile.h 14 | Proximity.cpp Proximity.h 15 | Property.h 16 | PropertyFactory.cpp PropertyFactory.h 17 | PropertySet.cpp PropertySet.h 18 | PerformanceTimer.cpp PerformanceTimer.h 19 | QtSignalForwarder.cpp QtSignalForwarder.h 20 | GridLineTraverser.cpp GridLineTraverser.h 21 | StaticPool.h 22 | DynamicPool.h 23 | NumericTraits.h 24 | VecNT.h 25 | VecT.h 26 | MatMNT.h 27 | MatT.h 28 | PriorityQueue.h 29 | Grid.h 30 | ValueConv.h 31 | ) 32 | SOURCE_GROUP("Sources" FILES ${sources}) 33 | 34 | ADD_LIBRARY(foundation STATIC ${sources}) 35 | TARGET_LINK_LIBRARIES(foundation Qt5::Core Qt5::Xml) 36 | -------------------------------------------------------------------------------- /src/foundation/GridLineTraverser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef GRID_LINE_TRAVERSER_H_ 20 | #define GRID_LINE_TRAVERSER_H_ 21 | 22 | #include 23 | 24 | /** 25 | * \brief Traverses a grid along a line segment. 26 | * 27 | * Think about drawing a line on an image. 28 | */ 29 | class GridLineTraverser 30 | { 31 | // Member-wise copying is OK. 32 | public: 33 | GridLineTraverser(QLineF const& line); 34 | 35 | bool hasNext() const 36 | { 37 | return m_stopsDone < m_totalStops; 38 | } 39 | 40 | QPoint next(); 41 | private: 42 | QLineF m_line; 43 | double m_dt; 44 | int m_totalStops; 45 | int m_stopsDone; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/foundation/NonCopyable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef NONCOPYABLE_H_ 20 | #define NONCOPYABLE_H_ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | #define DECLARE_NON_COPYABLE(Class) \ 27 | private: \ 28 | /** \brief Copying is forbidden. */ \ 29 | Class(Class const&); \ 30 | /** \brief Copying is forbidden. */ \ 31 | Class& operator=(Class const&); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/foundation/PerformanceTimer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PerformanceTimer.h" 20 | #include 21 | 22 | void 23 | PerformanceTimer::print(char const* prefix) 24 | { 25 | clock_t const now = clock(); 26 | double const sec = double(now - m_start) / CLOCKS_PER_SEC; 27 | if (sec > 10.0) { 28 | qDebug() << prefix << (long)sec << " sec"; 29 | } else if (sec > 0.01) { 30 | qDebug() << prefix << (long)(sec * 1000) << " msec"; 31 | } else { 32 | qDebug() << prefix << (long)(sec * 1000000) << " usec"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/foundation/PerformanceTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PERFORMANCETIMER_H_ 20 | #define PERFORMANCETIMER_H_ 21 | 22 | #include 23 | 24 | class PerformanceTimer 25 | { 26 | public: 27 | PerformanceTimer() : m_start(clock()) {} 28 | 29 | void print(char const* prefix = ""); 30 | private: 31 | clock_t const m_start; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/foundation/Property.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PROPERTY_H_ 20 | #define PROPERTY_H_ 21 | 22 | #include "RefCountable.h" 23 | #include "IntrusivePtr.h" 24 | 25 | class QDomDocument; 26 | class QDomElement; 27 | 28 | class Property : public RefCountable 29 | { 30 | public: 31 | virtual IntrusivePtr clone() const = 0; 32 | 33 | virtual QDomElement toXml(QDomDocument& doc, QString const& name) const = 0; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/foundation/PropertyFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "PropertyFactory.h" 20 | #include 21 | #include 22 | 23 | void 24 | PropertyFactory::registerProperty(QString const& property, PropertyConstructor constructor) 25 | { 26 | m_registry[property] = constructor; 27 | } 28 | 29 | IntrusivePtr 30 | PropertyFactory::construct(QDomElement const& el) const 31 | { 32 | Registry::const_iterator it(m_registry.find(el.attribute("type"))); 33 | if (it != m_registry.end()) { 34 | return (*it->second)(el); 35 | } else { 36 | return IntrusivePtr(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/foundation/PropertyFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PROPERTY_FACTORY_H_ 20 | #define PROPERTY_FACTORY_H_ 21 | 22 | #include "Property.h" 23 | #include "IntrusivePtr.h" 24 | #include 25 | #include 26 | 27 | class QDomElement; 28 | 29 | class PropertyFactory 30 | { 31 | // Member-wise copying is OK. 32 | public: 33 | virtual ~PropertyFactory() {} 34 | 35 | typedef IntrusivePtr (*PropertyConstructor)(QDomElement const& el); 36 | 37 | void registerProperty(QString const& property, PropertyConstructor constructor); 38 | 39 | IntrusivePtr construct(QDomElement const& el) const; 40 | private: 41 | typedef std::map Registry; 42 | Registry m_registry; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /src/foundation/QtSignalForwarder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "QtSignalForwarder.h" 20 | 21 | 22 | QtSignalForwarder::QtSignalForwarder( 23 | QObject* emitter, char const* signal, boost::function const& slot) 24 | : QObject(emitter), 25 | m_slot(slot) 26 | { 27 | connect(emitter, signal, SLOT(handleSignal())); 28 | } 29 | 30 | void 31 | QtSignalForwarder::handleSignal() 32 | { 33 | m_slot(); 34 | } 35 | -------------------------------------------------------------------------------- /src/foundation/ScopedDecInc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SCOPEDDECINC_H_ 20 | #define SCOPEDDECINC_H_ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | template 27 | class ScopedDecInc 28 | { 29 | public: 30 | ScopedDecInc(T& counter) : m_counter(counter) 31 | { 32 | --counter; 33 | } 34 | 35 | ~ScopedDecInc() 36 | { 37 | ++m_counter; 38 | } 39 | private: 40 | T& m_counter; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/foundation/ScopedIncDec.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SCOPEDINCDEC_H_ 20 | #define SCOPEDINCDEC_H_ 21 | 22 | #ifdef HAVE_CONFIG_H 23 | #include 24 | #endif 25 | 26 | template 27 | class ScopedIncDec 28 | { 29 | public: 30 | ScopedIncDec(T& counter) : m_counter(counter) 31 | { 32 | ++counter; 33 | } 34 | 35 | ~ScopedIncDec() 36 | { 37 | --m_counter; 38 | } 39 | private: 40 | T& m_counter; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/imageproc/BWColor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BWCOLOR_H_ 20 | #define BWCOLOR_H_ 21 | 22 | namespace imageproc 23 | { 24 | 25 | enum BWColor { WHITE = 0, BLACK = 1 }; 26 | 27 | inline BWColor operator!(BWColor c) 28 | { 29 | return static_cast(~c & 1); 30 | } 31 | 32 | } // namespace imageproc 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/imageproc/ByteOrder.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_BYTEORDER_H_ 20 | #define IMAGEPROC_BYTEORDER_H_ 21 | 22 | #ifdef _WIN32 23 | #include 24 | #else 25 | #include 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/imageproc/ColorInterpolation.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "ColorInterpolation.h" 20 | #include 21 | 22 | namespace imageproc 23 | { 24 | 25 | QColor colorInterpolation(QColor const& from, QColor const& to, double dist) 26 | { 27 | dist = qBound(0.0, dist, 1.0); 28 | 29 | qreal r1, g1, b1, a1, r2, g2, b2, a2; 30 | from.getRgbF(&r1, &g1, &b1, &a1); 31 | to.getRgbF(&r2, &g2, &b2, &a2); 32 | 33 | qreal const r = r1 + (r2 - r1) * dist; 34 | qreal const g = g1 + (g2 - g1) * dist; 35 | qreal const b = b1 + (b2 - b1) * dist; 36 | qreal const a = a1 + (a2 - a1) * dist; 37 | 38 | return QColor::fromRgbF(r, g, b, a); 39 | } 40 | 41 | } // namespace imageproc 42 | -------------------------------------------------------------------------------- /src/imageproc/ColorInterpolation.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2009 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_COLORINTERPOLATION_H_ 20 | #define IMAGEPROC_COLORINTERPOLATION_H_ 21 | 22 | #include 23 | 24 | namespace imageproc 25 | { 26 | 27 | /** 28 | * \brief Returns a color between the provided two. 29 | * 30 | * Returns a color between \p from and \p to according to \p dist. 31 | * \p dist 0 corresponds to \p from, while \p dist 1 corresponds to \p to. 32 | */ 33 | QColor colorInterpolation(QColor const& from, QColor const& to, double dist); 34 | 35 | } // namespace imageproc 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/imageproc/Connectivity.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_CONNECTIVITY_H_ 20 | #define IMAGEPROC_CONNECTIVITY_H_ 21 | 22 | namespace imageproc 23 | { 24 | 25 | /** 26 | * \brief Defines which neighbouring pixels are considered to be connected. 27 | */ 28 | enum Connectivity { 29 | /** North, east, south and west neighbours of a pixel 30 | are considered to be connected to it. */ 31 | CONN4, 32 | /** All 8 neighbours are considered to be connected. */ 33 | CONN8 34 | }; 35 | 36 | } // namespace imageproc 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/imageproc/Constants.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Constants.h" 20 | 21 | namespace imageproc 22 | { 23 | 24 | namespace constants 25 | { 26 | 27 | double const SQRT_2 = 1.4142135623730950488016887242097; 28 | 29 | double const PI = 3.141592653589793; 30 | 31 | double const DEG2RAD = PI / 180.0; 32 | 33 | double const RAD2DEG = 180.0 / PI; 34 | 35 | double const INCH2MM = 25.4; 36 | 37 | double const MM2INCH = 1.0 / INCH2MM; 38 | 39 | double const DPM2DPI = 0.0254; 40 | 41 | double const DPI2DPM = 1.0 / DPM2DPI; 42 | 43 | } // namespace constants 44 | 45 | } // namespace imageproc 46 | -------------------------------------------------------------------------------- /src/imageproc/GrayImage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "GrayImage.h" 20 | #include "Grayscale.h" 21 | #include 22 | 23 | namespace imageproc 24 | { 25 | 26 | GrayImage::GrayImage(QSize size) 27 | { 28 | if (size.isEmpty()) { 29 | return; 30 | } 31 | 32 | m_image = QImage(size, QImage::Format_Indexed8); 33 | m_image.setColorTable(createGrayscalePalette()); 34 | if (m_image.isNull()) { 35 | throw std::bad_alloc(); 36 | } 37 | } 38 | 39 | GrayImage::GrayImage(QImage const& image) 40 | : m_image(toGrayscale(image)) 41 | { 42 | } 43 | 44 | } // namespace imageproc 45 | -------------------------------------------------------------------------------- /src/imageproc/Scale.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef IMAGEPROC_SCALE_H_ 20 | #define IMAGEPROC_SCALE_H_ 21 | 22 | class QSize; 23 | 24 | namespace imageproc 25 | { 26 | 27 | class GrayImage; 28 | 29 | /** 30 | * \brief Converts an image to grayscale and scales it to dst_size. 31 | * 32 | * \param src The source image. 33 | * \param dst_size The size to scale the image to. 34 | * \return The scaled image. 35 | * 36 | * This function is a faster replacement for QImage::scaled(), when 37 | * dealing with grayscale images. 38 | */ 39 | GrayImage scaleToGray(GrayImage const& src, QSize const& dst_size); 40 | 41 | } // namespace imageproc 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/imageproc/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | main.cpp 6 | TestBinaryImage.cpp TestReduceThreshold.cpp 7 | TestSlicedHistogram.cpp 8 | TestConnCompEraser.cpp TestConnCompEraserExt.cpp 9 | TestGrayscale.cpp 10 | TestRasterOp.cpp TestShear.cpp 11 | TestOrthogonalRotation.cpp 12 | TestSkewFinder.cpp 13 | TestScale.cpp 14 | TestTransform.cpp 15 | TestMorphology.cpp 16 | TestBinarize.cpp 17 | TestPolygonRasterizer.cpp 18 | TestSeedFill.cpp 19 | TestSEDM.cpp 20 | TestRastLineFinder.cpp 21 | Utils.cpp Utils.h 22 | ) 23 | SOURCE_GROUP("Sources" FILES ${sources}) 24 | 25 | SET( 26 | libs 27 | imageproc math foundation ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 28 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} ${EXTRA_LIBS} 29 | ) 30 | 31 | ADD_EXECUTABLE(imageproc_tests ${sources}) 32 | TARGET_LINK_LIBRARIES(imageproc_tests Qt5::Widgets Qt5::Xml) 33 | TARGET_LINK_LIBRARIES(imageproc_tests ${libs}) 34 | 35 | # We want the executable located where we copy all the DLLs. 36 | SET_TARGET_PROPERTIES( 37 | imageproc_tests PROPERTIES 38 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" 39 | ) 40 | 41 | ADD_TEST(NAME imageproc_tests COMMAND imageproc_tests --log_level=message) 42 | -------------------------------------------------------------------------------- /src/imageproc/tests/TestBinarize.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "Binarize.h" 20 | #include "BinaryImage.h" 21 | #include "Utils.h" 22 | #include 23 | #include 24 | #ifndef Q_MOC_RUN 25 | #include 26 | #endif 27 | 28 | namespace imageproc 29 | { 30 | 31 | namespace tests 32 | { 33 | 34 | using namespace utils; 35 | 36 | BOOST_AUTO_TEST_SUITE(BinarizeTestSuite); 37 | #if 0 38 | BOOST_AUTO_TEST_CASE(test) 39 | { 40 | QImage img("test.png"); 41 | binarizeWolf(img).toQImage().save("out.png"); 42 | } 43 | #endif 44 | BOOST_AUTO_TEST_SUITE_END(); 45 | 46 | } // namespace tests 47 | 48 | } // namespace imageproc 49 | -------------------------------------------------------------------------------- /src/imageproc/tests/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) 2007-2008 Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifdef HAVE_CONFIG_H 20 | #include 21 | #endif 22 | 23 | #define BOOST_AUTO_TEST_MAIN 24 | 25 | #include 26 | -------------------------------------------------------------------------------- /src/math/LineBoundedByRect.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LINE_BOUNDED_BY_RECT_H_ 20 | #define LINE_BOUNDED_BY_RECT_H_ 21 | 22 | #include 23 | #include 24 | 25 | /** 26 | * If \p line (not line segment!) intersects with \p rect, 27 | * writes intersection points as the new \p line endpoints 28 | * and returns true. Otherwise returns false and leaves 29 | * \p line unmodified. 30 | */ 31 | bool lineBoundedByRect(QLineF& line, QRectF const& rect); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/math/LineIntersectionScalar.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef LINE_INTERSECTION_SCALAR_H_ 20 | #define LINE_INTERSECTION_SCALAR_H_ 21 | 22 | #include 23 | 24 | /** 25 | * Finds such scalars s1 and s2, so that "line1.pointAt(s1)" and "line2.pointAt(s2)" 26 | * would be the intersection point between line1 and line2. Returns false if the 27 | * lines are parallel or if any of the lines have zero length and therefore no direction. 28 | */ 29 | bool lineIntersectionScalar(QLineF const& line1, QLineF const& line2, double& s1, double& s2); 30 | 31 | /** 32 | * Same as the one above, but doesn't bother to calculate s2. 33 | */ 34 | bool lineIntersectionScalar(QLineF const& line1, QLineF const& line2, double& s1); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/math/LinearSolver.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "LinearSolver.h" 20 | 21 | LinearSolver::LinearSolver(size_t rows_AB, size_t cols_A_rows_X, size_t cols_BX) 22 | : m_rowsAB(rows_AB), 23 | m_colsArowsX(cols_A_rows_X), 24 | m_colsBX(cols_BX) 25 | { 26 | if (m_rowsAB < m_colsArowsX) { 27 | throw std::runtime_error("LinearSolver: can's solve underdetermined systems"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/math/SidesOfLine.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "SidesOfLine.h" 20 | 21 | qreal sidesOfLine(QLineF const& line, QPointF const& p1, QPointF const& p2) 22 | { 23 | QPointF const normal(line.normalVector().p2() - line.p1()); 24 | QPointF const vec1(p1 - line.p1()); 25 | QPointF const vec2(p2 - line.p1()); 26 | qreal const dot1 = normal.x() * vec1.x() + normal.y() * vec1.y(); 27 | qreal const dot2 = normal.x() * vec2.x() + normal.y() * vec2.y(); 28 | return dot1 * dot2; 29 | } 30 | -------------------------------------------------------------------------------- /src/math/SidesOfLine.h: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SIDES_OF_LINE_H_ 20 | #define SIDES_OF_LINE_H_ 21 | 22 | #include 23 | #include 24 | 25 | /** 26 | * This function allows you to check if a pair of points is on the same 27 | * or different sides of a line. 28 | * 29 | * Returns: 30 | * \li Negative value, if points are on different sides of line. 31 | * \li Positive value, if points are on the same side of line. 32 | * \li Zero, if one or both of the points are on the line. 33 | * 34 | * \note Line's endpoints don't matter - consider the whole line, 35 | * not a line segment. If the line is really a point, zero will 36 | * always be returned. 37 | */ 38 | qreal sidesOfLine(QLineF const& line, QPointF const& p1, QPointF const& p2); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /src/math/adiff/references.txt: -------------------------------------------------------------------------------- 1 | [1] C. H. Bischof, G. F. Corliss, and A. Griewank. Structured second- and 2 | higher-order derivatives through univariate Taylor series. 3 | http://softlib.rice.edu/pub/CRPC-TRs/reports/CRPC-TR92237.pdf -------------------------------------------------------------------------------- /src/math/adiff/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | ${CMAKE_SOURCE_DIR}/src/core/tests/main.cpp 6 | TestHessians.cpp 7 | ) 8 | 9 | SOURCE_GROUP("Sources" FILES ${sources}) 10 | 11 | SET( 12 | libs 13 | math ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 14 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} ${EXTRA_LIBS} 15 | ) 16 | 17 | ADD_EXECUTABLE(adiff_tests ${sources}) 18 | TARGET_LINK_LIBRARIES(adiff_tests ${libs}) 19 | 20 | # We want the executable located where we copy all the DLLs. 21 | SET_TARGET_PROPERTIES( 22 | adiff_tests PROPERTIES 23 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" 24 | ) 25 | 26 | ADD_TEST(NAME adiff_tests COMMAND adiff_tests --log_level=message) 27 | -------------------------------------------------------------------------------- /src/math/spfit/FrenetFrame.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Scan Tailor - Interactive post-processing tool for scanned pages. 3 | Copyright (C) Joseph Artsimovich 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "FrenetFrame.h" 20 | #include 21 | 22 | namespace spfit 23 | { 24 | 25 | FrenetFrame::FrenetFrame(Vec2d const& origin, Vec2d const& tangent_vector, YAxisDirection ydir) 26 | : m_origin(origin) 27 | { 28 | double const sqlen = tangent_vector.squaredNorm(); 29 | if (sqlen > 1e-6) { 30 | m_unitTangent = tangent_vector / sqrt(sqlen); 31 | if (ydir == Y_POINTS_UP) { 32 | m_unitNormal[0] = -m_unitTangent[1]; 33 | m_unitNormal[1] = m_unitTangent[0]; 34 | } else { 35 | m_unitNormal[0] = m_unitTangent[1]; 36 | m_unitNormal[1] = -m_unitTangent[0]; 37 | } 38 | } 39 | } 40 | 41 | } // namespace spfit 42 | -------------------------------------------------------------------------------- /src/math/spfit/references.txt: -------------------------------------------------------------------------------- 1 | [1] Pottmann H, Leopoldseder S. A concept for parametric surface fitting which 2 | avoids the parametrization problem. 3 | http://scholar.google.com/scholar?cluster=7639013126651979063&hl=en&as_sdt=0,5&as_vis=1 4 | 5 | [2] W. Wang, H. Pottmann, Y. Liu, Fitting B-spline curves to point clouds by 6 | squared distance minimization. 7 | http://scholar.google.com/scholar?cluster=5549848162867282704&hl=en&as_sdt=0,5&as_vis=1 -------------------------------------------------------------------------------- /src/math/spfit/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INCLUDE_DIRECTORIES(BEFORE ..) 2 | 3 | SET( 4 | sources 5 | ${CMAKE_SOURCE_DIR}/src/core/tests/main.cpp 6 | TestSqDistApproximant.cpp 7 | ) 8 | 9 | SOURCE_GROUP("Sources" FILES ${sources}) 10 | 11 | SET( 12 | libs 13 | math ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} 14 | ${Boost_PRG_EXECUTION_MONITOR_LIBRARY} ${EXTRA_LIBS} 15 | ) 16 | 17 | ADD_EXECUTABLE(spfit_tests ${sources}) 18 | TARGET_LINK_LIBRARIES(spfit_tests Qt5::Core) 19 | TARGET_LINK_LIBRARIES(spfit_tests ${libs}) 20 | 21 | # We want the executable located where we copy all the DLLs. 22 | SET_TARGET_PROPERTIES( 23 | spfit_tests PROPERTIES 24 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" 25 | ) 26 | 27 | ADD_TEST(NAME spfit_tests COMMAND spfit_tests --log_level=message) 28 | -------------------------------------------------------------------------------- /src/packaging/linux/README: -------------------------------------------------------------------------------- 1 | We switched on building deb packets for Linux according to Ubuntu instructions. 2 | In particular: 3 | https://packaging.ubuntu.com/html/getting-set-up.html 4 | https://packaging.ubuntu.com/html/packaging-new-software.html 5 | 6 | Deb packets are supposed to be published on launchpad: https://launchpad.net/~truf/+archive/ubuntu/scantailor-universal 7 | 8 | You can update your system with packages from this untrusted PPA by adding ppa:truf/scantailor-universal to your system's Software Sources: 9 | 10 | sudo add-apt-repository ppa:truf/scantailor-universal 11 | sudo apt-get update 12 | 13 | If you want to build deb packet by himself you may follow instructions. 14 | I'm leaving some key steps here just as a reminder for myself: 15 | 16 | bzr dh-make scantailor-universal 0.2.9 scantailor-universal-0.2.9.tar.gz 17 | cd scantailor-universal/debian/ 18 | rm *.ex *.EX README.* *.docs 19 | cd .. 20 | bzr builddeb -- -us -uc 21 | bzr builddeb -S 22 | cd ../build-area/ 23 | pbuilder-dist bionic build scantailor-universal_0.2.9-0ubuntu1.dsc 24 | gpg --list-secret-keys 25 | debsign -k 2B79FA6A519BF20289519BBCA2F3EBCE5C719A67 scantailor-universal_0.2.9-0ubuntu1_source.changes 26 | dput ppa:truf/scantailor-universal scantailor-universal_0.2.9-0ubuntu1_source.changes 27 | -------------------------------------------------------------------------------- /src/packaging/osx/Info.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleInfoDictionaryVersion 8 | 6.0 9 | CFBundleExecutable 10 | ScanTailorUniversal 11 | CFBundleName 12 | ScanTailorUniversal 13 | CFBundlePackageType 14 | APPL 15 | CFBundleIdentifier 16 | com.github.ScantailorUniversal 17 | CFBundleSignature 18 | sctlu 19 | CSResourcesFileMapped 20 | 21 | CFBundleIconFile 22 | ScanTailorUniversal.icns 23 | CFBundleShortVersionString 24 | ScanTailorUniversal-@VERSION@ 25 | LSMinimumSystemVersion 26 | 10.4.0 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/packaging/osx/ScanTailorUniversal.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/packaging/osx/ScanTailorUniversal.icns -------------------------------------------------------------------------------- /src/packaging/windows/build_deps/dump_dll_syms.cmake: -------------------------------------------------------------------------------- 1 | # We are operating on files from the current directory. 2 | FILE(GLOB DLL_FILES "*.dll" "*.DLL") 3 | FOREACH(dll_file ${DLL_FILES}) 4 | MESSAGE(STATUS "Dumping symbols from ${dll_file}") 5 | EXECUTE_PROCESS( 6 | COMMAND "${DUMP_SYMS_EXECUTABLE}" "${dll_file}" 7 | OUTPUT_FILE "${SYMBOLS_PATH}/temp.sym" 8 | ) 9 | EXECUTE_PROCESS( 10 | COMMAND "${CMAKE_COMMAND}" "-DSYMBOLS_PATH=${SYMBOLS_PATH}" 11 | -P "${MOVE_SYMBOLS_SCRIPT}" 12 | ) 13 | ENDFOREACH() 14 | -------------------------------------------------------------------------------- /src/packaging/windows/build_deps/export-vars.cmake.in: -------------------------------------------------------------------------------- 1 | SET(JPEG_DIR "@JPEG_DIR@") 2 | SET(ZLIB_DIR "@ZLIB_DIR@") 3 | SET(PNG_DIR "@PNG_DIR@") 4 | SET(TIFF_DIR "@TIFF_DIR@") 5 | SET(JPEG2000_DIR "@JPEG2000_DIR@") 6 | SET(EXIV2_DIR "@EXIV2_DIR@") 7 | SET(BOOST_ROOT "@BOOST_DIR@") 8 | SET(QT_SRC_DIR "@QT_SRC_DIR@") 9 | SET(QT_PREBUILT_DIR "@QT_PREBUILT_DIR@") 10 | -------------------------------------------------------------------------------- /src/packaging/windows/patch_libtiff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) 2 | 3 | PROJECT(patch_libtiff) 4 | 5 | GET_FILENAME_COMPONENT(outer_dir "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE) 6 | 7 | FILE(GLOB tiff_dirs "${outer_dir}/tiff-[0-9]*.[0-9]*.[0-9]*") 8 | FIND_PATH( 9 | TIFF_DIR libtiff/tiff.h PATHS ${tiff_dirs} 10 | DOC "Path to top-level tiff source directory." 11 | ) 12 | 13 | FIND_PROGRAM( 14 | PATCH_EXE patch 15 | PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32;InstallPath]/bin" 16 | DOC "Full path to patch.exe" 17 | ) 18 | 19 | IF(NOT TIFF_DIR) 20 | MESSAGE(FATAL_ERROR "TIFF source directory not found. You may specify it manually.") 21 | ELSEIF(NOT PATCH_EXE) 22 | MESSAGE(FATAL_ERROR "The patch utility wasn't found.") 23 | ENDIF(NOT TIFF_DIR) 24 | 25 | CONFIGURE_FILE( 26 | apply_individual_patches.cmake.in 27 | "${CMAKE_BINARY_DIR}/apply_individual_patches.cmake" @ONLY 28 | ) 29 | 30 | ADD_CUSTOM_TARGET( 31 | apply_patches ALL 32 | COMMAND "${CMAKE_COMMAND}" -P 33 | "${CMAKE_BINARY_DIR}/apply_individual_patches.cmake" 34 | WORKING_DIRECTORY "${TIFF_DIR}" 35 | ) 36 | -------------------------------------------------------------------------------- /src/packaging/windows/patch_libtiff/apply_individual_patches.cmake.in: -------------------------------------------------------------------------------- 1 | FILE(STRINGS "@TIFF_DIR@/debian/patches/series" patch_list) 2 | 3 | FOREACH(patch_file ${patch_list}) 4 | EXECUTE_PROCESS( 5 | COMMAND "@PATCH_EXE@" -p1 --binary -i 6 | "@TIFF_DIR@/debian/patches/${patch_file}" 7 | WORKING_DIRECTORY "@TIFF_DIR@" 8 | ) 9 | ENDFOREACH(patch_file) 10 | -------------------------------------------------------------------------------- /src/stylesheets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB_RECURSE QSS_FILES *.qss) 2 | SET(STYLESHEET_PIXMAP_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/BreezeStyleSheets/Breeze" 3 | "${CMAKE_CURRENT_SOURCE_DIR}/BreezeStyleSheets/BreezeDark") 4 | IF(WIN32 OR APPLE) 5 | # Let QSS_FILES and STYLESHEET_PIXMAP_DIRS be accessible in packaging/windows/ 6 | SET (QSS_FILES ${QSS_FILES} PARENT_SCOPE) 7 | SET (STYLESHEET_PIXMAP_DIRS ${STYLESHEET_PIXMAP_DIRS} PARENT_SCOPE) 8 | ELSE(WIN32 OR APPLE) 9 | SET(QSS_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/share/scantailor-universal/stylesheets") 10 | SET(PIX_INSTALL_PATH ${PIXMAPS_DIR_ABS}) 11 | INSTALL(FILES ${QSS_FILES} DESTINATION ${QSS_INSTALL_PATH}) 12 | INSTALL(DIRECTORY ${STYLESHEET_PIXMAP_DIRS} DESTINATION ${PIX_INSTALL_PATH}) 13 | ENDIF(WIN32 OR APPLE) 14 | -------------------------------------------------------------------------------- /src/translations/qtbase_ru.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trufanov-nok/scantailor-universal/8c2a6925a95a856531067db7292a22f9908da140/src/translations/qtbase_ru.qm --------------------------------------------------------------------------------