This commit is contained in:
13038267101 2023-01-10 09:37:06 +08:00
commit 51ee1076aa
5 changed files with 37 additions and 13 deletions

View File

@ -851,7 +851,7 @@
<message>
<location filename="form_maininterface.cpp" line="466"/>
<source>image pixel: </source>
<translation> </translation>
<translation> </translation>
</message>
<message>
<location filename="form_maininterface.cpp" line="495"/>
@ -1004,7 +1004,7 @@
<location filename="mainwindow.cpp" line="420"/>
<source>Confirm whether the device is reset</source>
<oldsource>Are you sure to connect the new device</oldsource>
<translation type="unfinished"></translation>
<translation></translation>
</message>
<message>
<source>yes</source>

View File

@ -48,7 +48,7 @@ Form_mainInterface::Form_mainInterface(class MainWindow *mainwnd, Dialog_logIn::
connect(this, SIGNAL(testResult(QString)), this, SLOT(on_testResult(QString)), Qt::QueuedConnection);
connect(this, SIGNAL(testResultImg(void*)), this, SLOT(on_testResultImg(void*)), Qt::QueuedConnection);
connect(this, SIGNAL(testDistortion(void*)), this, SLOT(on_testDistortion(void*)), Qt::QueuedConnection);
connect(this, &Form_mainInterface::testDistortion, this, &Form_mainInterface::on_testDistortion);
connect(this, SIGNAL(testCorrectInfo(QString)), this, SLOT(on_testCorrectInfo(QString)), Qt::QueuedConnection);
QString str;
@ -194,11 +194,19 @@ void Form_mainInterface::on_testResultImg(void *img)
HGBase_DestroyImage(image);
}
void Form_mainInterface::on_testDistortion(void *data)
void Form_mainInterface::on_testDistortion(SANE_DISTORTION_VAL data)
{
SANE_DISTORTION_VAL val = *(SANE_DISTORTION_VAL*)data;
ui->label_imgInfo->setText(tr("image pixel: ") + QString::number(val.w, 'f') + " * " + QString::number(val.h, 'f'));
ui->label_destortionInfo->setText(tr("destortion value: ") + QString::number(val.scaleXY, 'f'));
ui->label_imgInfo->setVisible(true);
ui->label_destortionInfo->setVisible(true);
// SANE_DISTORTION_VAL* val = (SANE_DISTORTION_VAL*)data;
// double width = val->w;
// double height = val->h;
// double scaleXY = val->scaleXY;
ui->label_imgInfo->setText(tr("image pixel: ") + QString::number(data.w, 'f') + " * " + QString::number(data.h, 'f'));
ui->label_destortionInfo->setText(tr("destortion value: ") + QString::number(data.scaleXY, 'f'));
// updateImgPixelInfo();
@ -421,7 +429,10 @@ QString Form_mainInterface::getItemStatusStr(HGUInt status)
QString Form_mainInterface::getCachePath()
{
HGChar cachePath[512];
HGBase_GetConfigPath(cachePath, 512);
HGBase_GetDocumentsPath(cachePath, 512);
HGChar procName[512];
HGBase_GetProcessName(procName, 512);
strcat(cachePath, procName);
strcat(cachePath, "/Cache/");
return getStdFileName(StdStringToUtf8(cachePath).c_str());
@ -590,14 +601,20 @@ void Form_mainInterface::on_pbtn_start_clicked()
QString title = item->text();
QString name = m_map_title_name.value(title).name;
int dpi = m_map_title_name.value(title).resolution;
wchar_t buf[5] = {0};
if (dpi > 0)
{
swprintf(buf, L"%d", dpi);
}
if (m_hg != nullptr)
{
updateUiEnabled(false);
m_isTesting = true;
m_mainwnd->addTestingRef();
if (dpi > 0)
func_test_go(name.toStdWString().c_str(), (const wchar_t*)&dpi, m_hg);
if (buf != nullptr && dpi > 0)
func_test_go(name.toStdWString().c_str(), (const wchar_t*)buf, m_hg);
else
func_test_go(name.toStdWString().c_str(), L"null", m_hg);
}

View File

@ -38,13 +38,13 @@ protected:
signals:
void testResult(QString text);
void testResultImg(void* img);
void testDistortion(void *data);
void testDistortion(SANE_DISTORTION_VAL data);
void testCorrectInfo(QString info);
private slots:
void on_testResult(QString text);
void on_testResultImg(void* img);
void on_testDistortion(void *data);
void on_testDistortion(SANE_DISTORTION_VAL data);
void on_testCorrectInfo(QString info);
void on_viewerDblClick();

View File

@ -100,7 +100,14 @@ void hgscanner::test_callback(const wchar_t* name, test_event ev, void* data, si
{
if (data != nullptr)
{
emit m_interface->testDistortion(data);
// qDebug() << ((SANE_DISTORTION_VAL*)data)->w;
// qDebug() << ((SANE_DISTORTION_VAL*)data)->h;
// qDebug() << ((SANE_DISTORTION_VAL*)data)->scaleXY;
if (m_interface != nullptr)
{
emit m_interface->testDistortion(*((SANE_DISTORTION_VAL*)data));
}
}
}
else if (ev == TEST_EVENT_FALT_INFO)