File indexing completed on 2024-05-12 04:46:38
0001 #include "textscanner.h" 0002 0003 #ifndef Q_OS_ANDROID 0004 #include <ocs.h> 0005 #endif 0006 0007 TextScanner::TextScanner(QObject *parent) 0008 : QObject{parent} 0009 #ifndef Q_OS_ANDROID 0010 ,m_ocr(new OCS(this)) 0011 #endif 0012 { 0013 0014 } 0015 0016 void TextScanner::setUrl(const QString &url) 0017 { 0018 #ifndef Q_OS_ANDROID 0019 m_url = url; 0020 m_ocr->setFilePath(m_url); 0021 #endif 0022 } 0023 0024 bool TextScanner::containsText(const QString &query) 0025 { 0026 #ifndef Q_OS_ANDROID 0027 0028 if(m_url.isEmpty()) 0029 return false; 0030 0031 QString text = m_ocr->getText(); 0032 0033 return text.contains(query, Qt::CaseInsensitive); 0034 #endif 0035 0036 return false; 0037 } 0038 0039 QString TextScanner::getText() 0040 { 0041 #ifndef Q_OS_ANDROID 0042 0043 if(m_url.isEmpty()) 0044 return QString(); 0045 0046 return m_ocr->getText(); 0047 #endif 0048 0049 return QString(); 0050 }