解决删除【扫描至配置方案】指定路径下的文稿后再次进行“扫描至”操作,提示异常、缩略图显示异常的问题;BUG-865

解决打开扫描软件扫描图片后,再重新打开扫描软件然后关闭,已打开的软件扫描的图片被删除的问题;BUG-866
This commit is contained in:
yangjiaxuan 2023-12-19 14:50:34 +08:00
parent 07f129c534
commit 1e659f35ff
3 changed files with 48 additions and 3 deletions

View File

@ -2126,6 +2126,29 @@ HGResult HGImgThumb::refreshAllItems()
return HGBASE_ERR_OK;
}
HGResult HGImgThumb::reloadAllItems()
{
if (MouseStatus_Null != m_mousePressStatus || 0 != m_operate || m_draging || m_frameSelection)
{
return HGBASE_ERR_FAIL;
}
std::vector<int> index;
for (int i = 0; i < m_frontItems.size(); i++)
{
QString fileName = m_frontItems[i]->fileName;
QFile file(fileName);
if (!file.exists())
{
index.push_back(i);
}
}
removeItems(index, ThumbRemoveFlag_NULL);
return HGBASE_ERR_OK;
}
void HGImgThumb::notify_mouse_leave(void)
{
leaveEvent(nullptr);

View File

@ -74,6 +74,7 @@ public:
HGResult refreshItem(int index);
HGResult refreshItem(const QString &fileName);
HGResult refreshAllItems();
HGResult reloadAllItems();
void notify_mouse_leave(void);

View File

@ -91,6 +91,10 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
{
ui->setupUi(this);
HGChar cacheUuid[256] = { 0 };
HGBase_GetUuid(cacheUuid, 256);
m_cacheUuid = cacheUuid;
m_lockPreviewImage = nullptr;
HGBase_CreateLock(&m_lockPreviewImage);
m_aquireIntoSaveParam.m_fileNameStartIndex = -1;
@ -992,6 +996,7 @@ void MainWindow::on_currItemChanged(int index)
if (fileInfo.isFile())
{
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
else
{
@ -1007,6 +1012,7 @@ void MainWindow::on_currItemChanged(int index)
m_thumb->updateItem(*iter, newFileName, false);
m_curBatchFileList.push_back(newFileName);
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
}
}
@ -1289,6 +1295,7 @@ void MainWindow::on_newImage(void *image)
if (fileInfo.isFile())
{
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
else
{
@ -1354,7 +1361,10 @@ void MainWindow::on_newImage(void *image)
emit post_new_image(m_scanFileName);
m_scanFileName.clear();
if (-1 == m_scanInsertPos)
{
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
m_aquireIntoMultiPageCount = 0;
}
else
@ -1420,6 +1430,7 @@ void MainWindow::on_newImage(void *image)
if (fileInfo.isFile())
{
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
else
{
@ -1469,7 +1480,10 @@ void MainWindow::on_newImage(void *image)
{
emit post_new_image(m_scanFileName);
if (-1 == m_scanInsertPos)
{
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
}
m_scanFileName.clear();
@ -1492,6 +1506,8 @@ void MainWindow::on_abnormalImage(void *image, HGUInt *result)
void MainWindow::on_scanWorkingEvent()
{
m_thumb->reloadAllItems();
m_view->enableHighQuality(false);
m_isScanning = true;
updateActionStatus();
@ -1524,7 +1540,10 @@ void MainWindow::on_scanFinishEvent()
emit post_new_image(m_scanFileName);
m_scanFileName.clear();
if (-1 == m_scanInsertPos)
{
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
m_aquireIntoMultiPageCount = 0;
}
@ -1683,6 +1702,7 @@ void MainWindow::on_scanFinishEvent()
if (fileInfo.isFile())
{
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
else
{
@ -1698,6 +1718,7 @@ void MainWindow::on_scanFinishEvent()
m_thumb->updateItem(*iter, newFileName, false);
m_curBatchFileList.push_back(newFileName);
++m_aquireIntoSaveParam.m_fileNameStartIndex;
saveCfgValue(m_cbtn_acquireIntoCfg->currentText().toLocal8Bit().toStdString().c_str(), "startIndex", m_aquireIntoSaveParam.m_fileNameStartIndex);
}
}
}
@ -1853,7 +1874,7 @@ QString MainWindow::getCacheFileName(HGImage img)
HGImageInfo imgInfo;
HGBase_GetImageInfo(img, &imgInfo);
QString cachePath = Dialog_ClrCache::getCachePath();
QString cachePath = Dialog_ClrCache::getCachePath() + m_cacheUuid + "/";
HGBase_CreateDir(getStdString(cachePath).c_str());
char uuid[256] = {0};
@ -2915,9 +2936,9 @@ void MainWindow::closeEvent(QCloseEvent *e)
}
}
QString cachePath = Dialog_ClrCache::getCachePath();
QString cachePath = Dialog_ClrCache::getCachePath() + m_cacheUuid + "/";
QDir dir = QDir(cachePath);
if (dir.exists() && (cachePath.endsWith("Cache/") || cachePath.endsWith("Cache\\")))
if (dir.exists())
dir.removeRecursively();
m_versionDll->PostUserCloseInfo(HGVERSION_APPNAME_SCANNER, m_oemName);