diff --git a/Telegram/SourceFiles/platform/linux/text_recognition_linux.h b/Telegram/SourceFiles/platform/linux/text_recognition_linux.h new file mode 100644 index 0000000000..d2d05be587 --- /dev/null +++ b/Telegram/SourceFiles/platform/linux/text_recognition_linux.h @@ -0,0 +1,24 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#include "platform/platform_text_recognition.h" + +namespace Platform { +namespace TextRecognition { + +inline bool IsAvailable() { + return false; +} + +inline Result RecognizeText(const QImage &image) { + return {}; +} + +} // namespace TextRecognition +} // namespace Platform \ No newline at end of file diff --git a/Telegram/SourceFiles/platform/mac/text_recognition_mac.h b/Telegram/SourceFiles/platform/mac/text_recognition_mac.h new file mode 100644 index 0000000000..34db1906d5 --- /dev/null +++ b/Telegram/SourceFiles/platform/mac/text_recognition_mac.h @@ -0,0 +1,8 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once \ No newline at end of file diff --git a/Telegram/SourceFiles/platform/mac/text_recognition_mac.mm b/Telegram/SourceFiles/platform/mac/text_recognition_mac.mm new file mode 100644 index 0000000000..0437af8e16 --- /dev/null +++ b/Telegram/SourceFiles/platform/mac/text_recognition_mac.mm @@ -0,0 +1,22 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#include "platform/platform_text_recognition.h" + +namespace Platform { +namespace TextRecognition { + +bool IsAvailable() { + return false; +} + +Result RecognizeText(const QImage &image) { + return Result(); +} + +} // namespace TextRecognition +} // namespace Platform \ No newline at end of file diff --git a/Telegram/SourceFiles/platform/platform_text_recognition.h b/Telegram/SourceFiles/platform/platform_text_recognition.h new file mode 100644 index 0000000000..07769a2388 --- /dev/null +++ b/Telegram/SourceFiles/platform/platform_text_recognition.h @@ -0,0 +1,41 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +namespace Platform { +namespace TextRecognition { + +struct RectWithText { + QString text; + QRect rect; +}; + +struct Result { + std::vector items; + bool success = false; + + inline operator bool() const { + return success; + } +}; + +[[nodiscard]] bool IsAvailable(); +[[nodiscard]] Result RecognizeText(const QImage &image); + +} // namespace TextRecognition +} // namespace Platform + +// Platform dependent implementations. + +#if defined Q_OS_WINRT || defined Q_OS_WIN +#include "platform/win/text_recognition_win.h" +#elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN +#include "platform/mac/text_recognition_mac.h" +#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC +#include "platform/linux/text_recognition_linux.h" +#endif // else for Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC \ No newline at end of file diff --git a/Telegram/SourceFiles/platform/win/text_recognition_win.h b/Telegram/SourceFiles/platform/win/text_recognition_win.h new file mode 100644 index 0000000000..d2d05be587 --- /dev/null +++ b/Telegram/SourceFiles/platform/win/text_recognition_win.h @@ -0,0 +1,24 @@ +/* +This file is part of Telegram Desktop, +the official desktop application for the Telegram messaging service. + +For license and copyright information please follow this link: +https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL +*/ +#pragma once + +#include "platform/platform_text_recognition.h" + +namespace Platform { +namespace TextRecognition { + +inline bool IsAvailable() { + return false; +} + +inline Result RecognizeText(const QImage &image) { + return {}; +} + +} // namespace TextRecognition +} // namespace Platform \ No newline at end of file diff --git a/Telegram/cmake/td_ui.cmake b/Telegram/cmake/td_ui.cmake index 99b8664cb7..9dd90296aa 100644 --- a/Telegram/cmake/td_ui.cmake +++ b/Telegram/cmake/td_ui.cmake @@ -239,14 +239,19 @@ PRIVATE platform/linux/current_geo_location_linux.cpp platform/linux/current_geo_location_linux.h + platform/linux/text_recognition_linux.h platform/mac/file_bookmark_mac.h platform/mac/file_bookmark_mac.mm platform/mac/current_geo_location_mac.h platform/mac/current_geo_location_mac.mm + platform/mac/text_recognition_mac.h + platform/mac/text_recognition_mac.mm platform/win/current_geo_location_win.cpp platform/win/current_geo_location_win.h + platform/win/text_recognition_win.h platform/platform_file_bookmark.h platform/platform_current_geo_location.h + platform/platform_text_recognition.h settings/settings_common.cpp settings/settings_common.h