更新调整app日志信息内容

This commit is contained in:
yangjiaxuan 2022-11-24 17:40:18 +08:00
parent 83228be364
commit 5df744133f
3 changed files with 37 additions and 25 deletions

View File

@ -31,7 +31,7 @@ Dialog_ExportImageFile::Dialog_ExportImageFile(const QString &destPath, const QS
ui->progressBar->setValue(0);
connect(this, SIGNAL(updateProgress(int)), this, SLOT(on_updateProgress(int)), Qt::QueuedConnection);
connect(this, SIGNAL(finish()), this, SLOT(on_finish()), Qt::QueuedConnection);
connect(this, SIGNAL(finish(HGResult)), this, SLOT(on_finish(HGResult)), Qt::QueuedConnection);
m_stopThread = false;
HGBase_OpenThread(ThreadFunc, this, &m_thread);
@ -279,7 +279,7 @@ void Dialog_ExportImageFile::on_updateProgress(int value)
void Dialog_ExportImageFile::on_finish(HGResult ret)
{
QString str = (ret == HGBASE_ERR_OK) ? tr("export succeed") : MainWindow::getLogInfo(ret);
QString str = (ret == HGBASE_ERR_OK) ? tr("export succeed") : tr("export failed: ") + MainWindow::getLogInfo(ret);
QMessageBox msg(QMessageBox::Information, tr("tip"), str, QMessageBox::Ok, this);
msg.setButtonText(QMessageBox::Ok, tr("ok"));
msg.exec();

View File

@ -19,7 +19,7 @@ Dialog_MultiRotateImageFile::Dialog_MultiRotateImageFile(const QStringList &file
connect(this, SIGNAL(updateProgress(int)), this, SLOT(on_updateProgress(int)), Qt::QueuedConnection);
connect(this, SIGNAL(updateImageFile(QString)), this, SLOT(on_updateImageFile(QString)), Qt::QueuedConnection);
connect(this, SIGNAL(finish()), this, SLOT(on_finish()), Qt::QueuedConnection);
connect(this, SIGNAL(finish(HGResult)), this, SLOT(on_finish(HGResult)), Qt::QueuedConnection);
m_stopThread = false;
HGBase_OpenThread(ThreadFunc, this, &m_thread);

View File

@ -893,6 +893,9 @@ void MainWindow::on_new_image(void *img, int statu)
if (1 == m_scanType)
{
QString fileName = getCacheFileName(image);
if(!judgeDiskSpace(fileName))
return;
HGResult ret = HGImgFmt_SaveImage(image, 0, nullptr, getStdString(fileName).c_str());
if(ret == HGBASE_ERR_OK)
@ -922,8 +925,8 @@ void MainWindow::on_new_image(void *img, int statu)
}
else
{
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
m_dialogLog->addLog(tr("save image failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("save image failed: ") + getLogInfo(ret), true);
}
}
else if (2 == m_scanType)
@ -957,8 +960,8 @@ void MainWindow::on_new_image(void *img, int statu)
HGResult ret = HGBase_CreateDir(getStdString(m_aquireIntoSaveParam.m_savePath).c_str());
if (ret != HGBASE_ERR_OK)
{
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
m_dialogLog->addLog(tr("create savepath failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("create savepath failed: ") + getLogInfo(ret), true);
}
QString scanFileName;
@ -979,11 +982,14 @@ void MainWindow::on_new_image(void *img, int statu)
}
}
if(!judgeDiskSpace(scanFileName))
return;
ret = HGImgFmt_OpenImageWriter(getStdString(getStdFileName(scanFileName)).c_str(), 0, &m_scanImgFmtWriter);
if(ret != HGBASE_ERR_OK)
{
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
m_dialogLog->addLog(tr("create image doc failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("create image doc failed: ") + getLogInfo(ret), true);
}
if (nullptr != m_scanImgFmtWriter)
@ -1017,8 +1023,8 @@ void MainWindow::on_new_image(void *img, int statu)
HGResult ret = HGImgFmt_SaveImageToWriter(m_scanImgFmtWriter, image, &saveInfo);
if(ret != HGBASE_ERR_OK)
{
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true);
}
++m_aquireIntoMultiPageCount;
@ -1073,8 +1079,8 @@ void MainWindow::on_new_image(void *img, int statu)
HGResult ret = HGBase_CreateDir(getStdString(savePath).c_str());
if(ret != HGBASE_ERR_OK)
{
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
m_dialogLog->addLog(tr("create savepath failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("create savepath failed: ") + getLogInfo(ret), true);
}
QString scanFileName;
@ -1095,6 +1101,9 @@ void MainWindow::on_new_image(void *img, int statu)
}
}
if(!judgeDiskSpace(scanFileName))
return;
HGImgFmtSaveInfo saveInfo;
saveInfo.jpegQuality = (HGUInt)m_aquireIntoSaveParam.m_jpegQuality;
saveInfo.tiffCompression = HGIMGFMT_TIFFCOMP_NONE;
@ -1125,8 +1134,8 @@ void MainWindow::on_new_image(void *img, int statu)
}
else
{
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true);
}
}
}
@ -2064,9 +2073,9 @@ void MainWindow::on_act_save_triggered()
}
else
{
QMessageBox::critical(this, tr("tips"), getLogInfo(ret));
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
QMessageBox::critical(this, tr("tips"), tr("save image doc failed: ") + getLogInfo(ret));
m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true);
}
}
else
@ -2130,9 +2139,9 @@ void MainWindow::on_act_save_triggered()
}
else
{
QMessageBox::critical(this, tr("tips"), getLogInfo(ret));
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
QMessageBox::critical(this, tr("tips"), tr("save image doc failed: ") + getLogInfo(ret));
m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true);
}
}
@ -2212,9 +2221,9 @@ void MainWindow::on_act_saveAs_triggered()
}
else
{
QMessageBox::critical(this, tr("tips"), getLogInfo(ret));
m_dialogLog->addLog(getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(getLogInfo(ret), true);
QMessageBox::critical(this, tr("tips"), tr("save image doc failed: ") + getLogInfo(ret));
m_dialogLog->addLog(tr("save image doc failed: ") + getLogInfo(ret), true);
m_wndStatusBar->setDeviceStatusInfo(tr("save image doc failed: ") + getLogInfo(ret), true);
}
}
else
@ -3532,8 +3541,11 @@ bool MainWindow::judgeDiskSpace(QString currentPath)
available_size = storage.bytesAvailable()/1024/1024;
if(available_size < 64)
{
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"), tr("the disk space in the current path is unsufficient, please select a new path or clear the disk space in time."));
QMessageBox::warning(this, tr("warning"), info);
return false;
}
return true;