解决一些编译问题

This commit is contained in:
iaom 2023-04-24 18:40:47 +08:00
parent d9db5ff896
commit 94ea037203
3 changed files with 11 additions and 4 deletions

View File

@ -200,7 +200,7 @@ void BatchIndexer::contentIndex()
// bool ocrEnable = FileIndexerConfig::getInstance()->isOCREnable(); // bool ocrEnable = FileIndexerConfig::getInstance()->isOCREnable();
if(FileIndexerConfig::getInstance()->isOCREnable()) { if(FileIndexerConfig::getInstance()->isOCREnable()) {
qDebug() << "OCR enabled."; qDebug() << "OCR enabled.";
suffixMap.insert(targetPhotographTypeMap); suffixMap.INSERT(targetPhotographTypeMap);
} }
if(m_mode == WorkMode::Rebuild) { if(m_mode == WorkMode::Rebuild) {
contentDb.rebuild(); contentDb.rebuild();

View File

@ -19,13 +19,19 @@
*/ */
#ifndef COMPATIBLEDEFINE_H #ifndef COMPATIBLEDEFINE_H
#define COMPATIBLEDEFINE_H #define COMPATIBLEDEFINE_H
#include <QtGlobal>
#endif // COMPATIBLEDEFINE_H #endif // COMPATIBLEDEFINE_H
#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) #if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
//T QAtomicInteger::load() const //T QAtomicInteger::load() const
#define LOAD load() #define LOAD load()
//QMap<Key, T> &QMap::unite(const QMap<Key, T> &other)
#define INSERT(T) unite(T)
#endif #endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
//T QAtomicInteger::loadRelaxed() const //T QAtomicInteger::loadRelaxed() const
#define LOAD loadRelaxed() #define LOAD loadRelaxed()
//void QMap::insert(const QMap<Key, T> &map)
#define INSERT(T) insert(T)
#endif #endif

View File

@ -25,6 +25,7 @@
#include "file-content-indexer.h" #include "file-content-indexer.h"
#include "common.h" #include "common.h"
#include "file-utils.h" #include "file-utils.h"
#include "compatible-define.h"
using namespace UkuiSearch; using namespace UkuiSearch;
IndexUpdater::IndexUpdater(const QVector<PendingFile>& files, QAtomicInt &stop) IndexUpdater::IndexUpdater(const QVector<PendingFile>& files, QAtomicInt &stop)
: m_cache(files), : m_cache(files),
@ -62,7 +63,7 @@ void IndexUpdater::UpdateIndex()
qDebug() << "===finish update basic index==="; qDebug() << "===finish update basic index===";
} }
if(FileIndexerConfig::getInstance()->isContentIndexEnable()) { if(FileIndexerConfig::getInstance()->isContentIndexEnable()) {
if(m_stop->loadRelaxed()) { if(m_stop->LOAD) {
qDebug() << "Index stopped, abort update content index."; qDebug() << "Index stopped, abort update content index.";
return; return;
} }
@ -75,7 +76,7 @@ void IndexUpdater::UpdateIndex()
QMap<QString, bool> suffixMap = targetFileTypeMap; QMap<QString, bool> suffixMap = targetFileTypeMap;
//ocr //ocr
if(FileIndexerConfig::getInstance()->isOCREnable()) { if(FileIndexerConfig::getInstance()->isOCREnable()) {
suffixMap.insert(targetPhotographTypeMap); suffixMap.INSERT(targetPhotographTypeMap);
} }
qDebug() << "===update content index==="; qDebug() << "===update content index===";
int size = 0; int size = 0;
@ -110,7 +111,7 @@ void IndexUpdater::UpdateIndex()
qDebug() << "30 finished."; qDebug() << "30 finished.";
size = 0; size = 0;
} }
if(m_stop->loadRelaxed()) { if(m_stop->LOAD) {
qDebug() << "Index stopped, content index update interrupted"; qDebug() << "Index stopped, content index update interrupted";
m_cache.clear(); m_cache.clear();
m_cache.shrink_to_fit(); m_cache.shrink_to_fit();