增加滚轴耗材提示
This commit is contained in:
parent
385ed673ed
commit
1ab3d035d0
|
@ -7,7 +7,15 @@
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include "base/HGBase.h"
|
#include "base/HGBase.h"
|
||||||
|
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
#else
|
||||||
|
#include <grp.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
HGResult GetConfigPath(HGChar* configPath, HGUInt maxLen)
|
HGResult GetConfigPath(HGChar* configPath, HGUInt maxLen)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +25,7 @@ HGResult GetConfigPath(HGChar* configPath, HGUInt maxLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *appName = "HuaGoScan";
|
const char *appName = "HuaGoScan";
|
||||||
|
#if defined(HG_CMP_MSC)
|
||||||
CHAR cfgPath[MAX_PATH] = { 0 };
|
CHAR cfgPath[MAX_PATH] = { 0 };
|
||||||
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
|
BOOL ret = SHGetSpecialFolderPathA(NULL, cfgPath, CSIDL_APPDATA, FALSE);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -27,6 +35,17 @@ HGResult GetConfigPath(HGChar* configPath, HGUInt maxLen)
|
||||||
|
|
||||||
strcat(cfgPath, appName);
|
strcat(cfgPath, appName);
|
||||||
strcat(cfgPath, "\\Cfg\\");
|
strcat(cfgPath, "\\Cfg\\");
|
||||||
|
#else
|
||||||
|
char cfgPath[512] = { 0 };
|
||||||
|
struct passwd* pw = getpwuid(getuid());
|
||||||
|
strcpy(cfgPath, pw->pw_dir);
|
||||||
|
if (cfgPath[strlen(cfgPath) - 1] != '/')
|
||||||
|
strcat(cfgPath, "/");
|
||||||
|
|
||||||
|
strcat(cfgPath, ".");
|
||||||
|
strcat(cfgPath, appName);
|
||||||
|
strcat(cfgPath, "/Cfg/");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (maxLen < strlen(cfgPath) + 1)
|
if (maxLen < strlen(cfgPath) + 1)
|
||||||
return HGBASE_ERR_FAIL;
|
return HGBASE_ERR_FAIL;
|
||||||
|
|
|
@ -3273,8 +3273,6 @@ void MainWindow::on_act_help_triggered()
|
||||||
filename = QApplication::applicationDirPath() + "/HuaGoScan_App_Help_manual.pdf";
|
filename = QApplication::applicationDirPath() + "/HuaGoScan_App_Help_manual.pdf";
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
QString filename;
|
|
||||||
|
|
||||||
std::string osName;
|
std::string osName;
|
||||||
FILE *file = popen("cat /etc/issue | cut -d\' \' -f1", "r");
|
FILE *file = popen("cat /etc/issue | cut -d\' \' -f1", "r");
|
||||||
if (NULL != file)
|
if (NULL != file)
|
||||||
|
|
|
@ -299,6 +299,13 @@ HGResult DeviceUser::ClearRollerCount()
|
||||||
return HGSane_ClearRollerCount(m_saneDev);
|
return HGSane_ClearRollerCount(m_saneDev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DeviceUser::GetDeviceRollerLife()
|
||||||
|
{
|
||||||
|
int rollerLife = 0;
|
||||||
|
HGSane_GetDeviceRollerLife(m_saneDev, &rollerLife);
|
||||||
|
return rollerLife;
|
||||||
|
}
|
||||||
|
|
||||||
QString DeviceUser::GetDriverLog()
|
QString DeviceUser::GetDriverLog()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName(m_wnd, tr("Select log file path"), ".", tr("text(*.txt)"));
|
QString fileName = QFileDialog::getSaveFileName(m_wnd, tr("Select log file path"), ".", tr("text(*.txt)"));
|
||||||
|
|
|
@ -106,6 +106,7 @@ public:
|
||||||
HGResult Login();
|
HGResult Login();
|
||||||
HGResult Logout();
|
HGResult Logout();
|
||||||
HGResult ClearRollerCount();
|
HGResult ClearRollerCount();
|
||||||
|
int GetDeviceRollerLife();
|
||||||
QString GetDriverLog();
|
QString GetDriverLog();
|
||||||
HGResult ClearDriverLog();
|
HGResult ClearDriverLog();
|
||||||
QString GetDeviceLog();
|
QString GetDeviceLog();
|
||||||
|
|
|
@ -389,6 +389,7 @@ MainWindow::MainWindow(const QString& appLang, QWidget *parent)
|
||||||
connect(m_devUser, SIGNAL(scanFinishEvent()), this, SLOT(on_scanFinishEvent()), Qt::QueuedConnection);
|
connect(m_devUser, SIGNAL(scanFinishEvent()), this, SLOT(on_scanFinishEvent()), Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkRollerLife();
|
||||||
updateSideBar();
|
updateSideBar();
|
||||||
updateActionStatus();
|
updateActionStatus();
|
||||||
}
|
}
|
||||||
|
@ -3591,6 +3592,20 @@ void MainWindow::updateSideBar()
|
||||||
m_propertyAnimation2->setDuration(600);
|
m_propertyAnimation2->setDuration(600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::checkRollerLife()
|
||||||
|
{
|
||||||
|
if (m_devUser != nullptr)
|
||||||
|
{
|
||||||
|
int life = m_devUser->GetDeviceRollerLife();
|
||||||
|
HGSaneDeviceCustomInfo info = {0};
|
||||||
|
m_devUser->GetDeviceCustomInfo(&info);
|
||||||
|
if (info.rollerCount >= life)
|
||||||
|
{
|
||||||
|
QMessageBox::information(this, tr("Prompt"), tr("The Device has reached roller life"), QMessageBox::Ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_act_sortPages_triggered()
|
void MainWindow::on_act_sortPages_triggered()
|
||||||
{
|
{
|
||||||
if (m_isScanning)
|
if (m_isScanning)
|
||||||
|
@ -3825,6 +3840,7 @@ void MainWindow::on_act_selectDevice_triggered()
|
||||||
connect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*)), Qt::DirectConnection);
|
connect(m_devUser, SIGNAL(newImage(void*)), this, SLOT(on_newImage(void*)), Qt::DirectConnection);
|
||||||
connect(m_devUser, SIGNAL(scanWorkingEvent()), this, SLOT(on_scanWorkingEvent()), Qt::QueuedConnection);
|
connect(m_devUser, SIGNAL(scanWorkingEvent()), this, SLOT(on_scanWorkingEvent()), Qt::QueuedConnection);
|
||||||
connect(m_devUser, SIGNAL(scanFinishEvent()), this, SLOT(on_scanFinishEvent()), Qt::QueuedConnection);
|
connect(m_devUser, SIGNAL(scanFinishEvent()), this, SLOT(on_scanFinishEvent()), Qt::QueuedConnection);
|
||||||
|
checkRollerLife();
|
||||||
updateActionStatus();
|
updateActionStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,6 +241,7 @@ private:
|
||||||
void deleteUpgradePkg(const QString& cfgFilePath);
|
void deleteUpgradePkg(const QString& cfgFilePath);
|
||||||
void initAcquireIntoComboBox();
|
void initAcquireIntoComboBox();
|
||||||
void updateSideBar();
|
void updateSideBar();
|
||||||
|
void checkRollerLife();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|
|
@ -276,6 +276,17 @@ HGResult HGAPI HGSane_ClearRollerCount(HGSaneDevice dev)
|
||||||
return saneDeviceImpl->ClearRollerCount();
|
return saneDeviceImpl->ClearRollerCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HGResult HGAPI HGSane_GetDeviceRollerLife(HGSaneDevice dev, HGInt *rollerLife)
|
||||||
|
{
|
||||||
|
if (NULL == dev)
|
||||||
|
{
|
||||||
|
return HGBASE_ERR_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
HGSaneDeviceImpl* saneDeviceImpl = (HGSaneDeviceImpl*)dev;
|
||||||
|
return saneDeviceImpl->GetRollerLife(rollerLife);
|
||||||
|
}
|
||||||
|
|
||||||
HGResult HGAPI HGSane_GetDriverLog(HGSaneDevice dev, const HGChar *fileName)
|
HGResult HGAPI HGSane_GetDriverLog(HGSaneDevice dev, const HGChar *fileName)
|
||||||
{
|
{
|
||||||
if (NULL == dev)
|
if (NULL == dev)
|
||||||
|
|
|
@ -84,6 +84,8 @@ HGEXPORT HGResult HGAPI HGSane_Logout(HGSaneDevice dev);
|
||||||
|
|
||||||
HGEXPORT HGResult HGAPI HGSane_ClearRollerCount(HGSaneDevice dev);
|
HGEXPORT HGResult HGAPI HGSane_ClearRollerCount(HGSaneDevice dev);
|
||||||
|
|
||||||
|
HGEXPORT HGResult HGAPI HGSane_GetDeviceRollerLife(HGSaneDevice dev, HGInt *rollerLife);
|
||||||
|
|
||||||
HGEXPORT HGResult HGAPI HGSane_GetDriverLog(HGSaneDevice dev, const HGChar *fileName);
|
HGEXPORT HGResult HGAPI HGSane_GetDriverLog(HGSaneDevice dev, const HGChar *fileName);
|
||||||
|
|
||||||
HGEXPORT HGResult HGAPI HGSane_ClearDriverLog(HGSaneDevice dev);
|
HGEXPORT HGResult HGAPI HGSane_ClearDriverLog(HGSaneDevice dev);
|
||||||
|
|
|
@ -731,6 +731,11 @@ HGResult HGSaneDeviceImpl::ClearRollerCount()
|
||||||
return SetValueInt32(0x9902, 0);
|
return SetValueInt32(0x9902, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HGResult HGSaneDeviceImpl::GetRollerLife(HGInt *rollerLife)
|
||||||
|
{
|
||||||
|
return GetValueInt32(0x885B, rollerLife);
|
||||||
|
}
|
||||||
|
|
||||||
HGResult HGSaneDeviceImpl::GetDriverLog(const HGChar *fileName)
|
HGResult HGSaneDeviceImpl::GetDriverLog(const HGChar *fileName)
|
||||||
{
|
{
|
||||||
if (NULL == fileName || strlen(fileName) >= 256)
|
if (NULL == fileName || strlen(fileName) >= 256)
|
||||||
|
|
|
@ -80,6 +80,7 @@ public:
|
||||||
HGResult Login(const HGChar *user, const HGChar *pwd);
|
HGResult Login(const HGChar *user, const HGChar *pwd);
|
||||||
HGResult Logout();
|
HGResult Logout();
|
||||||
HGResult ClearRollerCount();
|
HGResult ClearRollerCount();
|
||||||
|
HGResult GetRollerLife(HGInt *rollerLife);
|
||||||
HGResult GetDriverLog(const HGChar *fileName);
|
HGResult GetDriverLog(const HGChar *fileName);
|
||||||
HGResult ClearDriverLog();
|
HGResult ClearDriverLog();
|
||||||
HGResult GetDeviceLog(const HGChar *fileName);
|
HGResult GetDeviceLog(const HGChar *fileName);
|
||||||
|
|
Loading…
Reference in New Issue