解决一些编译问题

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();
if(FileIndexerConfig::getInstance()->isOCREnable()) {
qDebug() << "OCR enabled.";
suffixMap.insert(targetPhotographTypeMap);
suffixMap.INSERT(targetPhotographTypeMap);
}
if(m_mode == WorkMode::Rebuild) {
contentDb.rebuild();

View File

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

View File

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