修复关于页面读取序列号以及固件版本号不生效问题

This commit is contained in:
lovelyyoung 2020-03-17 21:02:50 +08:00
parent 915e85653a
commit e3d48d0d42
9 changed files with 54 additions and 15 deletions

View File

@ -11,8 +11,10 @@
IMPLEMENT_DYNAMIC(CAboutDlg, CDialogEx) IMPLEMENT_DYNAMIC(CAboutDlg, CDialogEx)
CAboutDlg::CAboutDlg(CWnd* pParent /*=nullptr*/) CAboutDlg::CAboutDlg(std::string hardwareversion, std::string serialnum,CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_ABOUT, pParent) : CDialogEx(IDD_ABOUT, pParent)
,m_hardwareversion(hardwareversion)
,m_serialnum(serialnum)
{ {
} }
@ -28,6 +30,7 @@ void CAboutDlg::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
ON_BN_CLICKED(IDOK, &CAboutDlg::OnBnClickedOk)
END_MESSAGE_MAP() END_MESSAGE_MAP()
@ -39,8 +42,20 @@ BOOL CAboutDlg::OnInitDialog()
CDialogEx::OnInitDialog(); CDialogEx::OnInitDialog();
// TODO: 在此添加额外的初始化 // TODO: 在此添加额外的初始化
CString hardwareversion(m_hardwareversion.c_str());
CString serialnum(m_serialnum.c_str());
SetDlgItemText(IDC_LBSCANNERNAMEVALUE, SCANNERNAME);
SetDlgItemText(IDC_LBHARDWAREVALUE, hardwareversion);
SetDlgItemText(IDC_LBSERIALNUMVALUE, serialnum);
SetDlgItemText(IDC_LBDERIVERVERSON, HG_VERSION_INFO); SetDlgItemText(IDC_LBDERIVERVERSON, HG_VERSION_INFO);
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE // 异常: OCX 属性页应返回 FALSE
} }
void CAboutDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
CDialogEx::OnOK();
}

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include <string>
// CAboutDlg 对话框 // CAboutDlg 对话框
@ -8,7 +8,7 @@ class CAboutDlg : public CDialogEx
DECLARE_DYNAMIC(CAboutDlg) DECLARE_DYNAMIC(CAboutDlg)
public: public:
CAboutDlg(CWnd* pParent = nullptr); // 标准构造函数 CAboutDlg(std::string hardwareversion,std::string serialnum, CWnd* pParent = nullptr); // 标准构造函数
virtual ~CAboutDlg(); virtual ~CAboutDlg();
// 对话框数据 // 对话框数据
@ -22,4 +22,8 @@ protected:
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
afx_msg void OnBnClickedOk();
private:
std::string m_hardwareversion;
std::string m_serialnum;
}; };

View File

@ -6,11 +6,12 @@
#include "afxdialogex.h" #include "afxdialogex.h"
#include "resource.h" #include "resource.h"
#include "CAboutDlg.h" #include "CAboutDlg.h"
#include "CTwainUI.h"
#include "CDiscardBlankSetting.h" #include "CDiscardBlankSetting.h"
#include "Device/JsonConfig.h" #include "Device/JsonConfig.h"
#include <vector> #include <vector>
static std::vector<CString> colorModes = { static std::vector<CString> color_Modes = {
_T("24位彩色"), _T("24位彩色"),
_T("256级灰度"), _T("256级灰度"),
_T("黑白") _T("黑白")
@ -85,7 +86,7 @@ BOOL CBasicPage::OnInitDialog()
m_cmBoxResultion = (CComboBox*)GetDlgItem(IDC_CMBRESLUTION); m_cmBoxResultion = (CComboBox*)GetDlgItem(IDC_CMBRESLUTION);
m_cmBoxDuplex = (CComboBox*)GetDlgItem(IDC_CMBDUPLEX); m_cmBoxDuplex = (CComboBox*)GetDlgItem(IDC_CMBDUPLEX);
for (const CString& colorMode : colorModes) for (const CString& colorMode : color_Modes)
m_cmBoxColorMode->AddString(colorMode); m_cmBoxColorMode->AddString(colorMode);
@ -123,8 +124,7 @@ END_MESSAGE_MAP()
void CBasicPage::OnBnClickedBtnabout() void CBasicPage::OnBnClickedBtnabout()
{ {
// TODO: 在此添加控件通知处理程序代码 CAboutDlg dlg(m_hdVersion, m_serialNum,this);
CAboutDlg dlg;
dlg.DoModal(); dlg.DoModal();
} }
@ -179,3 +179,9 @@ void CBasicPage::OnClickedBtndiscardsetting()
// dbs.GetParams(AreaNum, DevnMax); // dbs.GetParams(AreaNum, DevnMax);
//} //}
} }
void CBasicPage::SetScannerInfo(std::string hdVersion, std::string serialNum)
{
m_hdVersion = hdVersion;
m_serialNum = serialNum;
}

View File

@ -42,4 +42,8 @@ protected:
std::function<void()> m_dataChange; std::function<void()> m_dataChange;
public: public:
afx_msg void OnClickedBtndiscardsetting(); afx_msg void OnClickedBtndiscardsetting();
void SetScannerInfo(std::string hdVersion, std::string serialNum);
private:
std::string m_hdVersion;
std::string m_serialNum;
}; };

View File

@ -16,7 +16,7 @@
IMPLEMENT_DYNAMIC(CTwainUI, CDialogEx) IMPLEMENT_DYNAMIC(CTwainUI, CDialogEx)
CTwainUI::CTwainUI(TwGlue glue, CWnd* pParent /*=nullptr*/) CTwainUI::CTwainUI(TwGlue glue,std::string confirmtitle, std::string hardwareversion, std::string serialnum, CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_TWAINUI, pParent) : CDialogEx(IDD_TWAINUI, pParent)
, m_tabCtrl(new CTabCtrlSSL()) , m_tabCtrl(new CTabCtrlSSL())
, m_pageBrightness(new CBrightnessPage) , m_pageBrightness(new CBrightnessPage)
@ -24,7 +24,10 @@ CTwainUI::CTwainUI(TwGlue glue, CWnd* pParent /*=nullptr*/)
, m_pageImageProc(new CImageProcPage) , m_pageImageProc(new CImageProcPage)
, m_glue(glue) , m_glue(glue)
, settings(new GScanCap) , settings(new GScanCap)
, m_confirmtitle(confirmtitle)
{ {
m_hardwareVersion = hardwareversion;
m_serialnum = serialnum;
memset(settings.get(), 0, sizeof(GScanCap)); memset(settings.get(), 0, sizeof(GScanCap));
} }
@ -54,6 +57,7 @@ BOOL CTwainUI::OnInitDialog()
m_pageBasic.reset(new CBasicPage(dataChangeFunction)); m_pageBasic.reset(new CBasicPage(dataChangeFunction));
m_pageBasic->Create(IDD_PAGEBASIC, this); m_pageBasic->Create(IDD_PAGEBASIC, this);
m_pageBasic->SetScannerInfo(m_hardwareVersion, m_serialnum);
m_tabCtrl->AddSSLPage(_T("基本"), nPageID++, m_pageBasic.get()); m_tabCtrl->AddSSLPage(_T("基本"), nPageID++, m_pageBasic.get());
m_pageBrightness->Create(IDD_PAGEBRIGHTNESS, this); m_pageBrightness->Create(IDD_PAGEBRIGHTNESS, this);
m_tabCtrl->AddSSLPage(_T("亮度"), nPageID++, m_pageBrightness.get()); m_tabCtrl->AddSSLPage(_T("亮度"), nPageID++, m_pageBrightness.get());
@ -61,7 +65,8 @@ BOOL CTwainUI::OnInitDialog()
m_tabCtrl->AddSSLPage(_T("图像处理"), nPageID++, m_pageImageProc.get()); m_tabCtrl->AddSSLPage(_T("图像处理"), nPageID++, m_pageImageProc.get());
m_pageFeedPaper->Create(IDD_PAGEFEEDPAPER, this); m_pageFeedPaper->Create(IDD_PAGEFEEDPAPER, this);
m_tabCtrl->AddSSLPage(_T("送纸"), nPageID++, m_pageFeedPaper.get()); m_tabCtrl->AddSSLPage(_T("送纸"), nPageID++, m_pageFeedPaper.get());
CString title(m_confirmtitle.c_str());
this->GetDlgItem(IDC_CONFIRM)->SetWindowTextW(title);
JsonConfig cfg; JsonConfig cfg;
CONFIGPARAMS configParams = cfg.ReadDefaultConfig(); CONFIGPARAMS configParams = cfg.ReadDefaultConfig();
UpdateUI(configParams); UpdateUI(configParams);

View File

@ -118,7 +118,7 @@ class CTwainUI : public CDialogEx
DECLARE_DYNAMIC(CTwainUI) DECLARE_DYNAMIC(CTwainUI)
public: public:
CTwainUI(TwGlue glue, CWnd* pParent = nullptr); // 标准构造函数 CTwainUI(TwGlue glue,std::string confirmtitle,std::string hardwareversion,std::string serialnum, CWnd* pParent = nullptr); // 标准构造函数
virtual ~CTwainUI(); virtual ~CTwainUI();
void UpdateUI(CONFIGPARAMS configParams); void UpdateUI(CONFIGPARAMS configParams);
@ -132,6 +132,9 @@ public:
#ifdef AFX_DESIGN_TIME #ifdef AFX_DESIGN_TIME
enum { IDD = IDD_TWAINUI }; enum { IDD = IDD_TWAINUI };
#endif #endif
public:
std::string m_hardwareVersion;
std::string m_serialnum;
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
@ -161,4 +164,5 @@ protected:
int getColorModelIndex(int pixtype); int getColorModelIndex(int pixtype);
std::vector<CONFIGINFO> getConfigFiles(); std::vector<CONFIGINFO> getConfigFiles();
std::unique_ptr<GScanCap> settings; std::unique_ptr<GScanCap> settings;
std::string m_confirmtitle;
}; };

View File

@ -1699,10 +1699,11 @@ Twpp::Result HuagaoDs::showTwainUI(Twpp::UserInterface& ui, bool bUiOnly)
TwGlue glue = {scanFunction, cancelFunction }; TwGlue glue = {scanFunction, cancelFunction };
TwGlue glueUiOnly = {confirmFunction, cancelFunction }; TwGlue glueUiOnly = {confirmFunction, cancelFunction };
guiTwain.reset(new CTwainUI(bUiOnly ? glueUiOnly : glue)); std::string serialnum = scanner->GetSerialNum();
guiTwain->Create(IDD_TWAINUI, parent); std::string hardwareversion = scanner->GetFWVersion();
guiTwain->SetDlgItemText(IDC_CONFIRM, bUiOnly ? _T("ȡČĎ") : _T("ɨĂč")); guiTwain.reset(new CTwainUI(bUiOnly ? glueUiOnly : glue, bUiOnly?"È·¶¨":"ɨÃè", hardwareversion, serialnum));
guiTwain->ShowWindow(SW_SHOWNORMAL); guiTwain->Create(IDD_TWAINUI, parent);
guiTwain->ShowWindow(SW_SHOWNORMAL);
return success(); return success();
} }

Binary file not shown.

Binary file not shown.