| |
1 |
1 |
|
| |
2 |
2 |
|
| |
3 |
3 |
|
| |
4 |
4 |
#include "stdafx.h" |
| |
5 |
5 |
#include "ch.h" |
| |
6 |
6 |
#include "../libchcore/TFileInfo.h" |
| |
7 |
7 |
#include "FeedbackFileErrorDlg.h" |
| |
8 |
8 |
#include "FeedbackHandler.h" |
| |
|
9 |
#include "../libchcore/TWin32ErrorFormatter.h" |
| |
9 |
10 |
|
| |
10 |
11 |
|
| |
11 |
12 |
|
| |
12 |
13 |
IMPLEMENT_DYNAMIC(CFeedbackFileErrorDlg, ictranslate::CLanguageDialog) |
| |
13 |
14 |
|
| |
14 |
15 |
CFeedbackFileErrorDlg::CFeedbackFileErrorDlg(const tchar_t* pszSrcPath, const tchar_t* pszDstPath, ulong_t ulSysError, CWnd* pParent ) |
| |
15 |
16 |
: ictranslate::CLanguageDialog(IDD_FEEDBACK_FILE_ERROR_DIALOG, pParent), |
| |
16 |
17 |
m_bAllItems(FALSE), |
| |
17 |
18 |
m_strSrcPath(pszSrcPath), |
| |
18 |
19 |
m_strDstPath(pszDstPath), |
| |
19 |
20 |
m_ulSysError(ulSysError) |
| |
20 |
21 |
{ |
| |
21 |
|
|
| |
22 |
22 |
} |
| |
23 |
23 |
|
| |
24 |
24 |
CFeedbackFileErrorDlg::~CFeedbackFileErrorDlg() |
| |
25 |
25 |
{ |
| |
26 |
26 |
} |
| |
27 |
27 |
|
| |
28 |
28 |
void CFeedbackFileErrorDlg::DoDataExchange(CDataExchange* pDX) |
| |
29 |
29 |
{ |
| |
30 |
30 |
ictranslate::CLanguageDialog::DoDataExchange(pDX); |
| |
31 |
31 |
DDX_Check(pDX, IDC_ALL_ITEMS_CHECK, m_bAllItems); |
| |
32 |
32 |
DDX_Control(pDX, IDC_INFO_STATIC, m_ctlErrorInfo); |
| |
33 |
33 |
} |
| |
34 |
34 |
|
| |
35 |
35 |
|
| |
36 |
36 |
BEGIN_MESSAGE_MAP(CFeedbackFileErrorDlg, ictranslate::CLanguageDialog) |
| |
37 |
37 |
ON_BN_CLICKED(IDC_RETRY_BUTTON, &CFeedbackFileErrorDlg::OnBnClickedRetryButton) |
| |
38 |
38 |
ON_BN_CLICKED(IDC_SKIP_BUTTON, &CFeedbackFileErrorDlg::OnBnClickedSkipButton) |
| |
39 |
39 |
ON_BN_CLICKED(IDC_PAUSE_BUTTON, &CFeedbackFileErrorDlg::OnBnClickedPauseButton) |
| |
40 |
40 |
ON_BN_CLICKED(IDCANCEL, &CFeedbackFileErrorDlg::OnBnClickedCancel) |
| |
41 |
41 |
END_MESSAGE_MAP() |
|
| |
47 |
47 |
CLanguageDialog::OnInitDialog(); |
| |
48 |
48 |
|
| |
49 |
49 |
AddResizableControl(IDC_001_STATIC, 0.0, 0.0, 0.0, 0.0); |
| |
50 |
50 |
AddResizableControl(IDC_DESC_STATIC, 0.0, 0.0, 1.0, 0.0); |
| |
51 |
51 |
AddResizableControl(IDC_INFO_STATIC, 0.0, 0.0, 1.0, 1.0); |
| |
52 |
52 |
AddResizableControl(IDC_RETRY_BUTTON, 0.0, 1.0, 0.0, 0.0); |
| |
53 |
53 |
AddResizableControl(IDC_SKIP_BUTTON, 0.0, 1.0, 0.0, 0.0); |
| |
54 |
54 |
AddResizableControl(IDC_PAUSE_BUTTON, 0.0, 1.0, 0.0, 0.0); |
| |
55 |
55 |
AddResizableControl(IDCANCEL, 0.0, 1.0, 0.0, 0.0); |
| |
56 |
56 |
AddResizableControl(IDC_ALL_ITEMS_CHECK, 0.0, 1.0, 1.0, 0.0); |
| |
57 |
57 |
|
| |
58 |
58 |
InitializeResizableControls(); |
| |
59 |
59 |
|
| |
60 |
60 |
ictranslate::CResourceManager& rResManager = GetResManager(); |
| |
61 |
61 |
CString strFmt; |
| |
62 |
62 |
strFmt = rResManager.LoadString(m_strDstPath.IsEmpty() ? IDS_INFO_FILE_STRING : IDS_INFO_TWO_FILE_STRING); |
| |
63 |
63 |
strFmt += _T("\r\n"); |
| |
64 |
64 |
strFmt += rResManager.LoadString(IDS_INFO_REASON_STRING); |
| |
65 |
65 |
|
| |
66 |
66 |
|
| |
67 |
|
TCHAR szSystem[1024]; |
| |
68 |
|
DWORD dwPos=FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, m_ulSysError, 0, szSystem, 1023, NULL); |
| |
69 |
|
szSystem[1023] = _T('\0'); |
| |
|
67 |
chcore::TString strError = chcore::TWin32ErrorFormatter::FormatWin32ErrorCode(m_ulSysError, true); |
| |
70 |
68 |
|
| |
71 |
|
|
| |
72 |
|
while(--dwPos && (szSystem[dwPos] == 0x0a || szSystem[dwPos] == 0x0d)) |
| |
73 |
|
szSystem[dwPos]=_T('\0'); |
| |
74 |
|
|
| |
75 |
69 |
ictranslate::CFormat fmt(strFmt); |
| |
76 |
70 |
fmt.SetParam(_t("%filename"), m_strSrcPath); |
| |
77 |
71 |
fmt.SetParam(_t("%dstfilename"), m_strDstPath); |
| |
78 |
|
fmt.SetParam(_t("%reason"), szSystem); |
| |
|
72 |
fmt.SetParam(_t("%reason"), strError.c_str()); |
| |
79 |
73 |
|
| |
80 |
74 |
m_ctlErrorInfo.SetWindowText(fmt); |
| |
81 |
75 |
|
| |
82 |
76 |
return TRUE; |
| |
83 |
77 |
|
| |
84 |
78 |
} |
| |
85 |
79 |
|
| |
86 |
80 |
void CFeedbackFileErrorDlg::OnBnClickedRetryButton() |
| |
87 |
81 |
{ |
| |
88 |
82 |
UpdateData(TRUE); |
| |
89 |
83 |
EndDialog(chcore::EFeedbackResult::eResult_Retry); |
| |
90 |
84 |
} |
| |
91 |
85 |
|
| |
92 |
86 |
void CFeedbackFileErrorDlg::OnBnClickedSkipButton() |
| |
93 |
87 |
{ |
| |
94 |
88 |
UpdateData(TRUE); |
| |
95 |
89 |
EndDialog(chcore::EFeedbackResult::eResult_Skip); |
| |
96 |
90 |
} |
| |
97 |
91 |
|
| |
98 |
92 |
void CFeedbackFileErrorDlg::OnBnClickedPauseButton() |