scantool增加崩溃日志

This commit is contained in:
yangjiaxuan 2024-05-22 16:34:09 +08:00
parent d731b3e1d1
commit 47adcb9a49
3 changed files with 23 additions and 0 deletions

View File

@ -67,6 +67,7 @@ MainWindow::MainWindow(QWidget *parent)
ui->btnOpenFilePath->setEnabled(false);
ui->btnUpgrade->setEnabled(false);
ui->btnClearRollCount->setEnabled(false);
ui->pushButton_restoreSettings->setEnabled(false);
ui->comboBox_colorMode->setEnabled(false);
ui->comboBox_dpi->setEnabled(false);
@ -538,6 +539,7 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
ui->btnOpenFilePath->setEnabled(false);
ui->btnUpgrade->setEnabled(false);
ui->btnClearRollCount->setEnabled(false);
ui->pushButton_restoreSettings->setEnabled(false);
ui->comboBox_colorMode->setEnabled(false);
ui->comboBox_dpi->setEnabled(false);
@ -619,6 +621,7 @@ void MainWindow::on_comboDevList_currentIndexChanged(int index)
}
ui->btnOpenFilePath->setEnabled(true);
ui->btnClearRollCount->setEnabled(true);
ui->pushButton_restoreSettings->setEnabled(true);
bool isAndroid = isAndroidDevice();
ui->comboBox_colorMode->setEnabled(!isAndroid);

View File

@ -7,6 +7,7 @@
#include "base/HGTime.h"
#include "base/HGUtility.h"
#include "base/HGBase64.h"
#include "base/HGCrash.h"
#include "imgproc/HGImgProc.h"
#include "imgproc/HGOCR.h"
#include "dialog_scaninfo.h"
@ -32,6 +33,8 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this);
this->setWindowIcon(QIcon(":images/image_rsc/png/logo.png"));
HGBase_RegisterCrashFunc(CrashFunc, this);
ui->pushButtonScan->setEnabled(false);
ui->pushButtonAdd->setEnabled(false);
ui->pushButtonModify->setEnabled(false);
@ -1216,6 +1219,22 @@ void MainWindow::ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg *msg, HGPointer p
}
}
void MainWindow::CrashFunc(HGPointer crashAddr, HGPointer param)
{
HGChar crashName[256];
HGBase_GetLogFilePath(crashName, 256);
strcat(crashName, "crash.dmp");
if (HGBASE_ERR_OK == HGBase_MakeCrashFile(crashName))
{
HGChar excpStr[64];
#ifdef HG_64BIT
sprintf(excpStr, "0x%016p", crashAddr);
#else
sprintf(excpStr, "0x%08p", crashAddr);
#endif
}
}
void MainWindow::closeEvent(QCloseEvent *e)
{
if (m_trayIcon->isVisible()) //托盘是显示的

View File

@ -45,6 +45,7 @@ private:
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
static void HGAPI ocrThreadFunc(HGThread thread, HGPointer param);
static void HGAPI ocrMsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param);
protected:
virtual void closeEvent(QCloseEvent *e) override;