调整判断磁盘空间
This commit is contained in:
parent
fc8d08af59
commit
5c66827668
|
@ -894,16 +894,36 @@ void MainWindow::on_new_image(void *img, int statu)
|
||||||
|
|
||||||
if (1 == m_scanType)
|
if (1 == m_scanType)
|
||||||
{
|
{
|
||||||
if(m_cacheDirNotify || !judgeDiskSpace(Dialog_ClrCache::getCachePath()))
|
if (m_cacheDirNotify)
|
||||||
{
|
{
|
||||||
m_cacheDirNotify = true;
|
HGBase_DestroyImage(image);
|
||||||
|
|
||||||
on_stopScan();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!judgeDiskSpace(Dialog_ClrCache::getCachePath(), false))
|
||||||
|
{
|
||||||
|
m_cacheDirNotify = true;
|
||||||
|
|
||||||
|
QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time.");
|
||||||
|
m_wndStatusBar->setDeviceStatusInfo(info, true);
|
||||||
|
m_dialogLog->addLog(info, true);
|
||||||
|
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!");
|
||||||
|
QMessageBox::warning(this, tr("warning"), info);
|
||||||
|
|
||||||
|
on_stopScan();
|
||||||
|
HGBase_DestroyImage(image);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString fileName = getCacheFileName(image);
|
QString fileName = getCacheFileName(image);
|
||||||
HGResult ret = HGImgFmt_SaveImage(image, 0, nullptr, getStdString(fileName).c_str());
|
|
||||||
|
HGImgFmtSaveInfo info;
|
||||||
|
info.jpegQuality = 100;
|
||||||
|
info.tiffCompression = HGIMGFMT_TIFFCOMP_LZW;
|
||||||
|
info.tiffJpegQuality = 0;
|
||||||
|
HGResult ret = HGImgFmt_SaveImage(image, 0, &info, getStdString(fileName).c_str());
|
||||||
|
|
||||||
if(ret == HGBASE_ERR_OK)
|
if(ret == HGBASE_ERR_OK)
|
||||||
{
|
{
|
||||||
|
@ -938,13 +958,28 @@ void MainWindow::on_new_image(void *img, int statu)
|
||||||
}
|
}
|
||||||
else if (2 == m_scanType)
|
else if (2 == m_scanType)
|
||||||
{
|
{
|
||||||
if(m_AquirePathNotify || !judgeDiskSpace(m_aquireIntoSaveParam.m_savePath))
|
if (m_AquirePathNotify)
|
||||||
{
|
{
|
||||||
m_AquirePathNotify = true;
|
HGBase_DestroyImage(image);
|
||||||
|
|
||||||
on_stopScan();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!judgeDiskSpace(m_aquireIntoSaveParam.m_savePath, false))
|
||||||
|
{
|
||||||
|
m_AquirePathNotify = true;
|
||||||
|
|
||||||
|
QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time.");
|
||||||
|
m_wndStatusBar->setDeviceStatusInfo(info, true);
|
||||||
|
m_dialogLog->addLog(info, true);
|
||||||
|
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!");
|
||||||
|
QMessageBox::warning(this, tr("warning"), info);
|
||||||
|
|
||||||
|
on_stopScan();
|
||||||
|
HGBase_DestroyImage(image);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
++m_aquireIntoPageIndex;
|
++m_aquireIntoPageIndex;
|
||||||
if ((1 == m_aquireIntoSaveParam.m_fileNameOddEventType && 1 != m_aquireIntoPageIndex % 2)
|
if ((1 == m_aquireIntoSaveParam.m_fileNameOddEventType && 1 != m_aquireIntoPageIndex % 2)
|
||||||
|
@ -3547,7 +3582,7 @@ bool MainWindow::open_scanner(const QString& name, const QString& scheme)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::judgeDiskSpace(QString currentPath)
|
bool MainWindow::judgeDiskSpace(QString currentPath, bool showDlg)
|
||||||
{
|
{
|
||||||
QStorageInfo storage = QStorageInfo::root();
|
QStorageInfo storage = QStorageInfo::root();
|
||||||
storage.refresh();
|
storage.refresh();
|
||||||
|
@ -3556,13 +3591,17 @@ bool MainWindow::judgeDiskSpace(QString currentPath)
|
||||||
|
|
||||||
qint64 available_size = 0;
|
qint64 available_size = 0;
|
||||||
available_size = storage.bytesAvailable()/1024/1024;
|
available_size = storage.bytesAvailable()/1024/1024;
|
||||||
if(available_size < 64)
|
if(available_size < 294 * 1024)
|
||||||
{
|
{
|
||||||
QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time.");
|
if (showDlg)
|
||||||
m_wndStatusBar->setDeviceStatusInfo(info, true);
|
{
|
||||||
m_dialogLog->addLog(info, true);
|
QString info = tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time.");
|
||||||
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!");
|
m_wndStatusBar->setDeviceStatusInfo(info, true);
|
||||||
QMessageBox::warning(this, tr("warning"), info);
|
m_dialogLog->addLog(info, true);
|
||||||
|
HGBase_WriteInfo(HGBASE_INFOTYPE_ERROR, "disk space is unsufficient!");
|
||||||
|
QMessageBox::warning(this, tr("warning"), info);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -260,7 +260,7 @@ private:
|
||||||
QString passwordEncrypt(const QString& password);
|
QString passwordEncrypt(const QString& password);
|
||||||
QString passwordDecrypt(const QString& transcode);
|
QString passwordDecrypt(const QString& transcode);
|
||||||
bool open_scanner(const QString& name, const QString& scheme);
|
bool open_scanner(const QString& name, const QString& scheme);
|
||||||
bool judgeDiskSpace(QString currentPath);
|
bool judgeDiskSpace(QString currentPath, bool showDlg = true);
|
||||||
void upgradeApp(QString pkgPath);
|
void upgradeApp(QString pkgPath);
|
||||||
bool isLimitAccessFolder(QString filePath);
|
bool isLimitAccessFolder(QString filePath);
|
||||||
static QString GetDevType(const QString& fwVersion);
|
static QString GetDevType(const QString& fwVersion);
|
||||||
|
|
Loading…
Reference in New Issue