Index: .gitignore =================================================================== diff -u -rd5fd15320ef765fd5225b10e764bca458c2e317c -r501360c5c84079dd290b59ca7904c84bad7e38f9 --- .gitignore (.../.gitignore) (revision d5fd15320ef765fd5225b10e764bca458c2e317c) +++ .gitignore (.../.gitignore) (revision 501360c5c84079dd290b59ca7904c84bad7e38f9) @@ -1,9 +1,12 @@ bin intermediate .vs +.vahashtags ipch *.sdf *.user +*.opendb +*.aps src/ch/help/HTMLDefines.h src/ch/help/*/HTMLDefines.h src/ch/help/*/*.chm Index: src/ch/UpdaterDlg.cpp =================================================================== diff -u -rb46e69bed7377207f670be1fdbe84bc2e3d11e30 -r501360c5c84079dd290b59ca7904c84bad7e38f9 --- src/ch/UpdaterDlg.cpp (.../UpdaterDlg.cpp) (revision b46e69bed7377207f670be1fdbe84bc2e3d11e30) +++ src/ch/UpdaterDlg.cpp (.../UpdaterDlg.cpp) (revision 501360c5c84079dd290b59ca7904c84bad7e38f9) @@ -7,11 +7,15 @@ #include "UpdateChecker.h" #include "../common/version.h" #include "StaticEx.h" +#include +#include #define UPDATER_TIMER 639 BEGIN_MESSAGE_MAP(CUpdaterDlg, ictranslate::CLanguageDialog) ON_BN_CLICKED(IDC_OPEN_WEBPAGE_BUTTON, &CUpdaterDlg::OnBnClickedOpenWebpageButton) + ON_CBN_SELCHANGE(IDC_UPDATESFREQ_COMBO, OnSelchangeFreqCombo) + ON_CBN_SELCHANGE(IDC_UPDATECHANNEL_COMBO, OnSelchangeChannelCombo) ON_WM_TIMER() END_MESSAGE_MAP() @@ -39,13 +43,18 @@ DDX_Control(pDX, IDC_ICON_STATIC, m_ctlImage); DDX_Control(pDX, IDC_MAINUPDATEINFO_CUSTOM, m_ctlMainText); DDX_Control(pDX, IDC_CHANGELOG_RICHEDIT, m_ctlRichEdit); + DDX_Control(pDX, IDC_UPDATESFREQ_COMBO, m_ctlUpdateFreq); + DDX_Control(pDX, IDC_UPDATECHANNEL_COMBO, m_ctlUpdateChannel); + } BOOL CUpdaterDlg::OnInitDialog() { ictranslate::CLanguageDialog::OnInitDialog(); InitRichEdit(); + InitUpdateFreqCombo(); + InitUpdateChannelCombo(); // disable button initially CWnd* pWnd = GetDlgItem(IDC_OPEN_WEBPAGE_BUTTON); @@ -59,7 +68,7 @@ m_ucChecker.AsyncCheckForUpdates(_T(PRODUCT_SITE), GetPropValue(GetConfig()), (UpdateVersionInfo::EVersionType)GetPropValue(GetConfig()), m_bBackgroundMode); // start a timer to display progress - SetTimer(UPDATER_TIMER, 10, NULL); + SetTimer(UPDATER_TIMER, 50, NULL); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE @@ -251,3 +260,65 @@ cf.crTextColor = crTextColor; m_ctlRichEdit.SetDefaultCharFormat(cf); } + +void CUpdaterDlg::InitUpdateChannelCombo() +{ + ictranslate::CResourceManager& rResManager = GetResManager(); + + std::wstring strText = rResManager.LoadString(IDS_CFGUPDATECHANNELITEMS_STRING); + std::vector vItems; + for(std::wstring strItem : boost::split(vItems, strText, boost::is_any_of(L"!"))) + { + m_ctlUpdateChannel.AddString(strItem.c_str()); + } + + UpdateVersionInfo::EVersionType eUpdateChannel = (UpdateVersionInfo::EVersionType)GetPropValue(GetConfig()); + if(eUpdateChannel < vItems.size()) + m_ctlUpdateChannel.SetCurSel(eUpdateChannel); + else + m_ctlUpdateChannel.SetCurSel(0); +} + +void CUpdaterDlg::InitUpdateFreqCombo() +{ + ictranslate::CResourceManager& rResManager = GetResManager(); + + std::wstring strText = rResManager.LoadString(IDS_UPDATE_FREQUENCIES); + std::vector vItems; + for(std::wstring strItem : boost::split(vItems, strText, boost::is_any_of(L"!"))) + { + m_ctlUpdateFreq.AddString(strItem.c_str()); + } + + EUpdatesFrequency eFrequency = (EUpdatesFrequency)GetPropValue(GetConfig()); + if(eFrequency < vItems.size()) + m_ctlUpdateFreq.SetCurSel(eFrequency); + else + m_ctlUpdateFreq.SetCurSel(0); +} + +void CUpdaterDlg::OnSelchangeFreqCombo() +{ + int iCurSel = m_ctlUpdateFreq.GetCurSel(); + if(iCurSel == CB_ERR) + return; + + EUpdatesFrequency eFrequency = eFreq_Weekly; + if(iCurSel < EUpdatesFrequency::eFreq_Max) + eFrequency = (EUpdatesFrequency)iCurSel; + + SetPropValue(GetConfig(), eFrequency); +} + +void CUpdaterDlg::OnSelchangeChannelCombo() +{ + int iCurSel = m_ctlUpdateChannel.GetCurSel(); + if(iCurSel == CB_ERR) + return; + + UpdateVersionInfo::EVersionType eFrequency = UpdateVersionInfo::eReleaseCandidate; + if(iCurSel < UpdateVersionInfo::EVersionType::eMax) + eFrequency = (UpdateVersionInfo::EVersionType)iCurSel; + + SetPropValue(GetConfig(), eFrequency); +} Index: src/ch/UpdaterDlg.h =================================================================== diff -u -rb46e69bed7377207f670be1fdbe84bc2e3d11e30 -r501360c5c84079dd290b59ca7904c84bad7e38f9 --- src/ch/UpdaterDlg.h (.../UpdaterDlg.h) (revision b46e69bed7377207f670be1fdbe84bc2e3d11e30) +++ src/ch/UpdaterDlg.h (.../UpdaterDlg.h) (revision 501360c5c84079dd290b59ca7904c84bad7e38f9) @@ -32,6 +32,8 @@ afx_msg void OnBnClickedOpenWebpageButton(); afx_msg void OnTimer(UINT_PTR nIDEvent); + afx_msg void OnSelchangeFreqCombo(); + afx_msg void OnSelchangeChannelCombo(); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support @@ -43,11 +45,15 @@ void UpdateMainText(const wchar_t* pszText); void UpdateSecondaryText(const wchar_t* pszText); void InitRichEdit(); + void InitUpdateChannelCombo(); + void InitUpdateFreqCombo(); protected: CStatic m_ctlMainText; CStatic m_ctlImage; CRichEditCtrl m_ctlRichEdit; + CComboBox m_ctlUpdateFreq; + CComboBox m_ctlUpdateChannel; CUpdateChecker m_ucChecker; CUpdateChecker::ECheckResult m_eLastState; Index: src/ch/ch.rc =================================================================== diff -u -rb46e69bed7377207f670be1fdbe84bc2e3d11e30 -r501360c5c84079dd290b59ca7904c84bad7e38f9 --- src/ch/ch.rc (.../ch.rc) (revision b46e69bed7377207f670be1fdbe84bc2e3d11e30) +++ src/ch/ch.rc (.../ch.rc) (revision 501360c5c84079dd290b59ca7904c84bad7e38f9) @@ -386,12 +386,12 @@ BEGIN DEFPUSHBUTTON "&Close",IDOK,248,126,50,14 PUSHBUTTON "&Download latest version...",IDC_OPEN_WEBPAGE_BUTTON,130,126,112,14 - COMBOBOX IDC_COMBO1,159,101,139,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_UPDATECHANNEL_COMBO,159,101,139,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Update channel:",IDC_UPDATECHANNEL_STATIC,160,89,138,8 LTEXT "Check for updates:",IDC_CHECKFORUPDATESFREQ_STATIC,7,89,62,8 - COMBOBOX IDC_COMBO2,7,101,142,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_UPDATESFREQ_COMBO,7,101,142,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_CHANGELOG_RICHEDIT,"RichEdit20W",ES_MULTILINE | ES_READONLY | ES_NUMBER | WS_VSCROLL | WS_TABSTOP,51,25,247,56 - ICON "",IDC_ICON_STATIC,15,15,21,20 + ICON "",IDC_ICON_STATIC,15,15,20,20 CONTROL "Custom1",IDC_MAINUPDATEINFO_CUSTOM,"STATICEX",0x30,47,7,251,14 END @@ -965,6 +965,8 @@ IDS_EQ_STRING "=" IDS_GE_STRING ">=" IDS_GT_STRING ">" + IDS_UPDATER_NEW_VERSION_STRING + "Updated version: %officialver (%numericver).\nReleased: %reldate" END STRINGTABLE @@ -981,8 +983,7 @@ IDS_UPDATER_KILLEDERROR "Checking for updates was stopped" IDS_UPDATER_ALREADYNEWESTVERSION "You already have the newest version" IDS_UPDATER_NEWVERSIONEXISTS "There are updates available" - IDS_UPDATER_NEW_VERSION_STRING "Updated version: %officialver (%numericver).\nReleased: %reldate" - IDS_UPDATER_RELEASENOTES "Release notes:" + IDS_UPDATER_RELEASENOTES "Release notes:" END STRINGTABLE Index: src/ch/resource.h =================================================================== diff -u -rb46e69bed7377207f670be1fdbe84bc2e3d11e30 -r501360c5c84079dd290b59ca7904c84bad7e38f9 --- src/ch/resource.h (.../resource.h) (revision b46e69bed7377207f670be1fdbe84bc2e3d11e30) +++ src/ch/resource.h (.../resource.h) (revision 501360c5c84079dd290b59ca7904c84bad7e38f9) @@ -355,7 +355,9 @@ #define IDC_BUFFERCOUNT_SPIN 1324 #define IDC_BUFFERCOUNT_EDIT 1325 #define IDC_COMBO1 1325 +#define IDC_UPDATECHANNEL_COMBO 1325 #define IDC_COMBO2 1326 +#define IDC_UPDATESFREQ_COMBO 1326 #define IDC_LIST1 1327 #define IDC_RICHEDIT21 1329 #define IDC_CHANGELOG_RICHEDIT 1329