|
@@ -1,8 +1,4 @@
|
|
|
-#include "stdafx.h"
|
|
|
-//#include "duilib.h"
|
|
|
-
|
|
|
#include "CFrameWnd.h"
|
|
|
-#include "KeyVar.h"
|
|
|
|
|
|
#pragma region 初始化
|
|
|
|
|
@@ -28,64 +24,45 @@ LRESULT CFrameWnd::HomeMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
|
|
|
/// </summary>
|
|
|
void CFrameWnd::NotifyHome(TNotifyUI& msg)
|
|
|
{
|
|
|
+ CDuiString control = msg.pSender->GetName();
|
|
|
+
|
|
|
if (msg.sType == _T("click"))
|
|
|
{
|
|
|
-
|
|
|
//打开路径选择
|
|
|
- if (msg.pSender->GetName() == UI_BtnTextSelectFolder || msg.pSender->GetName() == UI_BtnIconSelectFolder)
|
|
|
+ if (control == UI_BtnTextSelectFolder || control == UI_BtnIconSelectFolder)
|
|
|
{
|
|
|
SetSelectedFolder();
|
|
|
}
|
|
|
|
|
|
- if (msg.pSender->GetName() == UI_BtnTermsService)
|
|
|
+ if (control == UI_BtnTermsService)
|
|
|
{
|
|
|
- GoToLink(TermsOfService);
|
|
|
+ GoToLink(TermsOfServiceLink);
|
|
|
}
|
|
|
|
|
|
- if (msg.pSender->GetName() == UI_BtnPrivacyPolicy)
|
|
|
+ if (control == UI_BtnPrivacyPolicy)
|
|
|
{
|
|
|
- GoToLink(PrivacyPolicy);
|
|
|
+ GoToLink(PrivacyPolicyLink);
|
|
|
}
|
|
|
|
|
|
//点击安装按钮
|
|
|
- if (msg.pSender->GetName() == UI_BtnInstall)
|
|
|
+ if (control == UI_BtnInstall)
|
|
|
{
|
|
|
Install_Click();
|
|
|
}
|
|
|
|
|
|
//显示隐藏自定义安装路径区域
|
|
|
- if (msg.pSender->GetName() == UI_CheckInstallSetting || msg.pSender->GetName() == UI_Lbicon) {
|
|
|
+ if (control == UI_CheckInstallSetting || control == UI_Lbicon) {
|
|
|
{
|
|
|
- if (msg.pSender->GetName() == UI_Lbicon)
|
|
|
+ if (control == UI_Lbicon)
|
|
|
{
|
|
|
m_InstallationPage->CheckInstallSetting->SetCheck(!m_InstallationPage->CheckInstallSetting->IsSelected());
|
|
|
}
|
|
|
|
|
|
- WindowSize();
|
|
|
+ CustomInstallWndSize(m_InstallationPage->CheckInstallSetting->IsSelected());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- if (msg.sType == _T("link"))
|
|
|
- {
|
|
|
- if (msg.pSender->GetName() == UI_TextShowContentLink)
|
|
|
- {
|
|
|
- DuiLib::CTextUI* pText = (DuiLib::CTextUI*)msg.pSender;
|
|
|
- if (msg.wParam == 0)
|
|
|
- {
|
|
|
- DuiLib::CDuiString* str = pText->GetLinkContent(0);
|
|
|
- ShellExecute(NULL, _T("open"), str->GetData(), NULL, NULL, SW_SHOWNORMAL);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DuiLib::CDuiString* str = pText->GetLinkContent(1);
|
|
|
- ShellExecute(NULL, _T("open"), str->GetData(), NULL, NULL, SW_SHOWNORMAL);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -101,112 +78,35 @@ void CFrameWnd::GoToLink(std::wstring linkStr)
|
|
|
|
|
|
}
|
|
|
|
|
|
-void CFrameWnd::WindowSize()
|
|
|
-{
|
|
|
- if (m_InstallationPage->CheckInstallSetting->IsSelected() == true)
|
|
|
- {
|
|
|
- std::wstring textcontent = CLanguage::GetText(TextType::Btn_CutomInstall);
|
|
|
- m_InstallationPage->CheckInstallSetting->SetText(textcontent.c_str());
|
|
|
- m_InstallationPage->Lbicon->SetText(L"▲");
|
|
|
- ::GetClientRect(*this, &start_rect_);
|
|
|
- SetWindowPos(m_hWnd, NULL, 0, 0, XML_WndExpendWidth * dpi, XML_WndExpenHeight * dpi, SWP_NOMOVE);
|
|
|
- ischeckCustom = true;
|
|
|
- m_pm.SetDPI(CurrentDPI);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- std::wstring textcontent = CLanguage::GetText(TextType::Btn_CutomInstall);
|
|
|
- m_InstallationPage->Lbicon->SetText(L"▼");
|
|
|
- m_InstallationPage->CheckInstallSetting->SetText(textcontent.c_str());
|
|
|
- ::GetClientRect(*this, &start_rect_);
|
|
|
- SetWindowPos(m_hWnd, NULL, 0, 0, XML_WndWidth* dpi, XML_WndHeight* dpi, SWP_NOMOVE);
|
|
|
- ischeckCustom = false;
|
|
|
- m_pm.SetDPI(CurrentDPI);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-bool CFrameWnd::IsSpaceDisk()
|
|
|
-{
|
|
|
- auto cdDisk = PathCore::smPath_Install.substr(0, 1);
|
|
|
- wchar_t* ptr = _wcsdup(cdDisk.c_str());
|
|
|
- char* ch = AppCore::GetWideCharToMultiByte(ptr);
|
|
|
- string str = ch;
|
|
|
-
|
|
|
- std::string str_disk_name = str + ":\\";
|
|
|
-
|
|
|
- DWORD64 qwFreeBytesToCaller = 0;
|
|
|
- DWORD64 qwTotalBytes = 0;
|
|
|
- DWORD64 qwFreeBytes = 0;
|
|
|
- ///使用GetDiskFreeSpaceEx获取磁盘信息并打印结果
|
|
|
- BOOL bResult = GetDiskFreeSpaceExA(str_disk_name.c_str(),
|
|
|
- (PULARGE_INTEGER)&qwFreeBytesToCaller,
|
|
|
- (PULARGE_INTEGER)&qwTotalBytes,
|
|
|
- (PULARGE_INTEGER)&qwFreeBytes);
|
|
|
- /// 读取成功
|
|
|
- if (bResult)
|
|
|
- {
|
|
|
- /// 如果还剩下1024M空闲空间,则禁止写入日志
|
|
|
- qwFreeBytesToCaller = qwFreeBytesToCaller/(1024 * 1024);
|
|
|
- if (1024 > qwFreeBytesToCaller)
|
|
|
- return false;
|
|
|
- //printf("使用GetDiskFreeSpaceEx获取磁盘空间信息\n");
|
|
|
- //printf("可获得的空闲空间(字节): \t%I64d\n", qwFreeBytesToCaller);
|
|
|
- //printf("空闲空间(字节): \t\t%I64d\n", qwFreeBytes);
|
|
|
- //printf("磁盘总容量(字节): \t\t%I64d\n", qwTotalBytes);
|
|
|
- }
|
|
|
- /// 读取失败
|
|
|
- else
|
|
|
- return true;
|
|
|
-
|
|
|
- return true;
|
|
|
-}
|
|
|
-
|
|
|
+//点击安装按钮
|
|
|
void CFrameWnd::Install_Click()
|
|
|
{
|
|
|
- DWORD flags;
|
|
|
- BOOL m_bOnline = TRUE;
|
|
|
- m_bOnline = InternetGetConnectedState(&flags, 0);
|
|
|
-
|
|
|
+
|
|
|
if (ischeckCustom)
|
|
|
- {
|
|
|
- m_InstallationPage->CheckInstallSetting->SetCheck(false);
|
|
|
- std::wstring textcontent = CLanguage::GetText(TextType::Btn_CutomInstall);
|
|
|
- m_InstallationPage->Lbicon->SetText(L"▼");
|
|
|
- m_InstallationPage->CheckInstallSetting->SetText(textcontent.c_str());
|
|
|
- ::GetClientRect(*this, &start_rect_);
|
|
|
- SetWindowPos(m_hWnd, NULL, 0, 0, XML_WndWidth* dpi, XML_WndHeight* dpi, SWP_NOMOVE);
|
|
|
- }
|
|
|
+ CustomInstallWndSize(!ischeckCustom);
|
|
|
|
|
|
+ BOOL m_bOnline = NetWorkState::IsNetWorking();
|
|
|
if (m_bOnline)
|
|
|
{
|
|
|
-
|
|
|
- bool isHaveSpace = IsSpaceDisk();
|
|
|
- if (isHaveSpace == false)
|
|
|
+ if (DiskCore::IsEnoughDisk(PathCore::smPath_Install) == false)
|
|
|
{
|
|
|
- CMsgWnd::MessageBox(
|
|
|
- m_hWnd, _T(""), CLanguage::GetText(TextType::MSG_DiskNoSpace).c_str(),
|
|
|
- CLanguage::GetText(TextType::MSG_BtnOK).c_str()
|
|
|
- );
|
|
|
-
|
|
|
+ MessageBoxWnd::Show(m_hWnd, MessageContentType::DiskNoSpace);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- m_InstallingPage->installNotWork->SetText(CLanguage::GetText(TextType::Text_Installing).c_str());
|
|
|
+
|
|
|
+ m_InstallingPage->installNotWork->SetText(CLanguage::GetDuiText(TextType::Text_Installing));
|
|
|
m_isCanInstall = GetVersionState();
|
|
|
|
|
|
if (m_isCanInstall)
|
|
|
{
|
|
|
|
|
|
SelectLayout(LayoutType::Installing);
|
|
|
- KillTimer(m_hWnd, TIMER_BANNER_ID);
|
|
|
- KillTimer(m_hWnd, TIMER_INSTALL_ID);
|
|
|
-
|
|
|
+ KillAllTimer();
|
|
|
SetTimer(m_hWnd, TIMER_BANNER_ID, TIMER_BANNER_TIMES, NULL);
|
|
|
SetTimer(m_hWnd, TIMER_INSTALL_ID, TIMER_INSTALL_TIMES, NULL);
|
|
|
|
|
|
- m_InstallingPage->ConNoNetWork->SetVisible(false);
|
|
|
- m_InstallingPage->pTabSwitch->SetVisible(true);
|
|
|
- m_InstallingPage->InstallingProgress->SetForeColor(0xFF477EDE);
|
|
|
+ m_InstallingPage->NetWorkUI(m_bOnline);
|
|
|
+
|
|
|
thread installingThread(Thread_Installing, m_threadData);
|
|
|
installingThread.detach();
|
|
|
|
|
@@ -215,11 +115,9 @@ void CFrameWnd::Install_Click()
|
|
|
else
|
|
|
{
|
|
|
SetBannerOnTimer();
|
|
|
- m_InstallingPage->ConNoNetWork->SetVisible(true);
|
|
|
- m_InstallingPage->pTabSwitch->SetVisible(false);
|
|
|
+
|
|
|
+ m_InstallingPage->NetWorkUI(m_bOnline);
|
|
|
SelectLayout(LayoutType::Installing);
|
|
|
- m_InstallingPage->installNotWork->SetText(CLanguage::GetText(TextType::Text_NoNetwork).c_str());
|
|
|
- m_InstallingPage->InstallingProgress->SetForeColor(0xFFB5B6B8);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -230,46 +128,25 @@ void CFrameWnd::Install_Click()
|
|
|
/// </summary>
|
|
|
void CFrameWnd::SetSelectedFolder()
|
|
|
{
|
|
|
- BROWSEINFO bi;
|
|
|
- bi.hwndOwner = m_hWnd;
|
|
|
- bi.pidlRoot = CSIDL_DESKTOP;//文件夹的根目录,此处为桌面
|
|
|
- bi.pszDisplayName = NULL;
|
|
|
- bi.lpszTitle = NULL;//显示位于对话框左上部的提示信息
|
|
|
- bi.ulFlags = BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE;//有新建文件夹按钮
|
|
|
- bi.lpfn = NULL;
|
|
|
- bi.iImage = 0;
|
|
|
- LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
|
|
|
- if (pidl == NULL)
|
|
|
- {
|
|
|
- return;
|
|
|
- }
|
|
|
- TCHAR strFolder[MAX_PATH];
|
|
|
- SHGetPathFromIDList(pidl, strFolder);
|
|
|
-
|
|
|
- std::wstring sFolder(strFolder);
|
|
|
-
|
|
|
- std::wstring sFolderTemp = AppCore::ReplaceSubStr(sFolder, L"\\", L"/");
|
|
|
+ wstring sFolder = FolderCore::FolderBrowser(m_hWnd);
|
|
|
|
|
|
- int first2 = sFolder.find(L"\\");
|
|
|
- if (first2 + 1 == sFolder.length())
|
|
|
+ if (FolderCore::IsRootDirectoryW(sFolder) == true)
|
|
|
{
|
|
|
- int first = sFolder.find(L"\\");
|
|
|
- std::wstring newStr = sFolder.substr(0, first + 1);
|
|
|
- sFolder = newStr + L"PDF Reader Pro";
|
|
|
+ sFolder = FolderCore::AddSubFolderFromRootDirW(sFolder, ExeCore::smName_AppName);
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
|
|
|
- }
|
|
|
- m_InstalledPage->LbInstalledPath->SetToolTipWidth(m_InstalledPage->LbInstalledPath->GetWidth());
|
|
|
- m_InstalledPage->LbInstalledPath->SetToolTip(sFolder.c_str());
|
|
|
- m_InstalledPage->LbInstalledPath->SetText(sFolder.c_str());
|
|
|
- bool ii = m_InstalledPage->LbInstalledPath->GetAutoCalcWidth();
|
|
|
- int iii = m_InstalledPage->LbInstalledPath->GetHeight();
|
|
|
+ m_InstalledPage->RefreshInstalledPath(sFolder);
|
|
|
+
|
|
|
PathCore::smPath_Install = sFolder;
|
|
|
m_InstallationPage->EdFilepath->SetText(sFolder.c_str());
|
|
|
}
|
|
|
|
|
|
+void CFrameWnd::Thread_GetVerstion(ThreadData threadData)
|
|
|
+{
|
|
|
+ threadData.pFrame->m_isCanInstall = threadData.pFrame->GetVersionState();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
bool CFrameWnd::GetVersionState()
|
|
|
{
|
|
|
|
|
@@ -307,9 +184,4 @@ bool CFrameWnd::GetVersionState()
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-void CFrameWnd::Thread_GetVerstion(ThreadData threadData)
|
|
|
-{
|
|
|
- threadData.pFrame->m_isCanInstall = threadData.pFrame->GetVersionState();
|
|
|
-
|
|
|
-}
|
|
|
|