解决导出日志异常问题,BUG-1183

This commit is contained in:
yangjiaxuan 2024-08-19 15:27:10 +08:00
parent 5aeba0677e
commit 4c8691bb4e
2 changed files with 29 additions and 0 deletions

View File

@ -129,6 +129,11 @@ HGResult DeviceUser::ClearRollerCount()
QString DeviceUser::GetDriverLog()
{
QString fileName = QFileDialog::getSaveFileName(m_wnd, tr("Select log file path"), ".", tr("text(*.txt)"));
if (fileName.isEmpty())
{
return "NULL";
}
std::string f = getStdFileName(fileName).toLocal8Bit().data();
HGResult ret = HGTwain_GetDSDriverLog(m_twainDS, f.c_str());
if (ret == HGBASE_ERR_OK)
@ -145,6 +150,11 @@ HGResult DeviceUser::ClearDriverLog()
QString DeviceUser::GetDeviceLog()
{
QString fileName = QFileDialog::getSaveFileName(m_wnd, tr("Select log file path"), ".", tr("text(*.txt)"));
if (fileName.isEmpty())
{
return "NULL";
}
std::string f = getStdFileName(fileName).toLocal8Bit().data();
HGResult ret = HGTwain_GetDSDeviceLog(m_twainDS, f.c_str());
if (ret == HGBASE_ERR_OK)
@ -344,6 +354,11 @@ int DeviceUser::GetDeviceRollerLife()
QString DeviceUser::GetDriverLog()
{
QString fileName = QFileDialog::getSaveFileName(m_wnd, tr("Select log file path"), ".", tr("text(*.txt)"));
if (fileName.isEmpty())
{
return "NULL";
}
std::string f = getStdFileName(fileName).toLocal8Bit().data();
HGResult ret = HGSane_GetDriverLog(m_saneDev, f.c_str());
if (ret == HGBASE_ERR_OK)
@ -360,6 +375,11 @@ HGResult DeviceUser::ClearDriverLog()
QString DeviceUser::GetDeviceLog()
{
QString fileName = QFileDialog::getSaveFileName(m_wnd, tr("Select log file path"), ".", tr("text(*.txt)"));
if (fileName.isEmpty())
{
return "NULL";
}
std::string f = getStdFileName(fileName).toLocal8Bit().data();
HGResult ret = HGSane_GetDeviceLog(m_saneDev, f.c_str());
if (ret == HGBASE_ERR_OK)

View File

@ -4902,6 +4902,11 @@ void MainWindow::on_act_driver_log_triggered()
if (driverLogPath == "Fail")
{
QMessageBox::information(this, tr("tips"), tr("The device does not support this operation"));
return;
}
else if (driverLogPath == "NULL")
{
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(driverLogPath));
}
@ -4919,6 +4924,10 @@ void MainWindow::on_act_device_log_triggered()
{
QMessageBox::information(this, tr("tips"), tr("The device does not support this operation"));
}
else if (deviceLogPath == "NULL")
{
return;
}
QDesktopServices::openUrl(QUrl::fromLocalFile(deviceLogPath));
}