本文整理汇总了C++中COptions::SetOption方法的典型用法代码示例。如果您正苦于以下问题:C++ COptions::SetOption方法的具体用法?C++ COptions::SetOption怎么用?C++ COptions::SetOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COptions
的用法示例。
在下文中一共展示了COptions::SetOption方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SavePage
bool COptionsPageEdit::SavePage()
{
COptions* pOptions = COptions::Get();
if (GetRCheck(XRCID("ID_DEFAULT_CUSTOM")))
pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, _T("2") + GetText(XRCID("ID_EDITOR")));
else
pOptions->SetOption(OPTION_EDIT_DEFAULTEDITOR, GetRCheck(XRCID("ID_DEFAULT_TEXT")) ? _T("1") : _T("0"));
if (GetRCheck(XRCID("ID_USEDEFAULT")))
pOptions->SetOption(OPTION_EDIT_ALWAYSDEFAULT, 1);
else
pOptions->SetOption(OPTION_EDIT_ALWAYSDEFAULT, 0);
SetOptionFromCheck(XRCID("ID_EDIT_TRACK_LOCAL"), OPTION_EDIT_TRACK_LOCAL);
return true;
}
示例2: DisplayUpdateAvailability
void CUpdateWizard::DisplayUpdateAvailability(bool showDialog)
{
COptions* pOptions = COptions::Get();
if (CBuildInfo::GetVersion() == _T("custom build"))
return;
const wxString& newVersion = pOptions->GetOption(OPTION_UPDATECHECK_NEWVERSION);
if (newVersion == _T(""))
return;
wxLongLong v = CBuildInfo::ConvertToVersionNumber(newVersion);
if (v <= CBuildInfo::ConvertToVersionNumber(CBuildInfo::GetVersion()))
{
pOptions->SetOption(OPTION_UPDATECHECK_NEWVERSION, _T(""));
return;
}
if (!m_menuUpdated)
{
m_menuUpdated = true;
#ifdef __WXMSW__
// All open menus need to be closed or app will become unresponsive.
::EndMenu();
#endif
CMainFrame* pFrame = (CMainFrame*)m_parent;
wxMenu* pMenu = new wxMenu();
const wxString& name = wxString::Format(_("&Version %s"), pOptions->GetOption(OPTION_UPDATECHECK_NEWVERSION).c_str());
pMenu->Append(XRCID("ID_CHECKFORUPDATES"), name);
wxMenuBar* pMenuBar = pFrame->GetMenuBar();
if (pMenuBar)
pMenuBar->Append(pMenu, _("&New version available!"));
}
if (showDialog && !m_updateShown)
{
if (wxDialogEx::ShownDialogs())
{
m_busy_timer.Start(1000, true);
return;
}
m_updateShown = true;
#ifdef __WXMSW__
// All open menus need to be closed or app will become unresponsive.
::EndMenu();
#endif
CUpdateWizard dlg(m_parent);
if (dlg.Load())
dlg.Run();
}
}
示例3: SavePage
bool COptionsPageEditAssociations::SavePage()
{
COptions* pOptions = COptions::Get();
SetOptionFromText(XRCID("ID_ASSOCIATIONS"), OPTION_EDIT_CUSTOMASSOCIATIONS);
pOptions->SetOption(OPTION_EDIT_INHERITASSOCIATIONS, GetCheck(XRCID("ID_INHERIT")) ? 1 : 0);
return true;
}
示例4: InitAutoUpdateCheck
void CUpdateWizard::InitAutoUpdateCheck()
{
COptions* pOptions = COptions::Get();
wxASSERT(pOptions->GetOptionVal(OPTION_UPDATECHECK));
if (CBuildInfo::GetVersion() == _T("custom build"))
return;
// Check every hour if allowed to check for updates
m_autoCheckTimer.Start(1000 * 3600);
if (!CanAutoCheckForUpdateNow())
{
DisplayUpdateAvailability(false);
return;
}
else
{
m_autoUpdateCheckRunning = true;
const wxDateTime& now = wxDateTime::Now();
pOptions->SetOption(OPTION_UPDATECHECK_LASTDATE, now.Format(_T("%Y-%m-%d %H:%M:%S")));
StartUpdateCheck();
}
}
示例5: Run
bool CUpdateWizard::Run()
{
COptions* pOptions = COptions::Get();
if (CBuildInfo::GetVersion() == _T("custom build"))
return false;
const wxString& newVersion = pOptions->GetOption(OPTION_UPDATECHECK_NEWVERSION);
if (newVersion == _T(""))
return RunWizard(m_pages.front());
if (CBuildInfo::ConvertToVersionNumber(newVersion) <= CBuildInfo::ConvertToVersionNumber(CBuildInfo::GetVersion()))
{
pOptions->SetOption(OPTION_UPDATECHECK_NEWVERSION, _T(""));
return RunWizard(m_pages.front());
}
// Force another check
PrepareUpdateCheckPage();
m_start_check = true;
m_currentPage = 0;
return RunWizard(m_pages[0]);
}
示例6: ParseData
//.........这里部分代码省略.........
// Extract version/date
pos = line.Find(' ');
if (pos < 1)
continue;
wxString versionOrDate = line.Left(pos);
line = line.Mid(pos + 1);
// Extract URL
wxString url = line;
if (url == _T("none"))
url = _T("");
pos = url.Find(' ');
if (pos < 1)
newChecksum.clear();
else
{
newChecksum = url.Mid(pos + 1);
url = url.Left(pos);
}
if (type == _T("nightly"))
{
if (!m_loaded)
continue;
if (!XRCCTRL(*this, "ID_CHECKNIGHTLY", wxCheckBox)->GetValue())
continue;
wxDateTime nightlyDate;
if (!nightlyDate.ParseDate(versionOrDate))
continue;
wxDateTime buildDate = CBuildInfo::GetBuildDate();
if (!buildDate.IsValid() || !nightlyDate.IsValid() || nightlyDate <= buildDate)
continue;
if (url == _T(""))
continue;
newVersion = versionOrDate + _T(" Nightly");
newUrl = url;
break;
}
else
{
wxLongLong v = CBuildInfo::ConvertToVersionNumber(versionOrDate);
if (v <= ownVersionNumber)
continue;
}
newVersion = versionOrDate;
newVersionNumber = CBuildInfo::ConvertToVersionNumber(versionOrDate);
newUrl = url;
}
if (!m_loaded)
{
if (newVersion == _T(""))
return;
COptions* pOptions = COptions::Get();
pOptions->SetOption(OPTION_UPDATECHECK_NEWVERSION, newVersion);
DisplayUpdateAvailability(true);
return;
}
else
{
// Since the auto check and the manual check, a newer version might have been published
COptions* pOptions = COptions::Get();
if (!pOptions->GetOption(OPTION_UPDATECHECK_NEWVERSION).empty())
pOptions->SetOption(OPTION_UPDATECHECK_NEWVERSION, newVersion);
}
if (newVersion == _T(""))
{
m_skipPageChanging = true;
ShowPage(m_pages[4]);
m_currentPage = 4;
m_skipPageChanging = false;
}
else
{
PrepareUpdateAvailablePage(newVersion, newUrl, newChecksum);
m_skipPageChanging = true;
ShowPage(m_pages[1]);
m_currentPage = 1;
m_skipPageChanging = false;
}
wxButton* pNext = wxDynamicCast(FindWindow(wxID_FORWARD), wxButton);
pNext->Enable();
wxButton* pPrev = wxDynamicCast(FindWindow(wxID_BACKWARD), wxButton);
pPrev->Disable();
}