本文整理汇总了C++中Paths::GetBooksPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Paths::GetBooksPath方法的具体用法?C++ Paths::GetBooksPath怎么用?C++ Paths::GetBooksPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paths
的用法示例。
在下文中一共展示了Paths::GetBooksPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load_available_books
//---------------------------------------------------------------------------------------
void BooksDlg::load_available_books()
{
Paths* pPaths = m_appScope.get_paths();
wxString sPath = pPaths->GetBooksPath();
wxString sPattern = "*.lmb";
wxString sRead = _("Please read the <a-1>Study guide</a-1> for information about \
the best way to use LenMus Phonascus and the books.");
sRead.Replace("<a-1>", "<a href=\"lenmus#study-guide\">'");
sRead.Replace("</a-1>", "'</a>");
wxString sHeader = "<html><body>";
wxString sContent = sHeader +
"<p>" + sRead +
"</p>"
"<h3>" + _("Available books:") + "</h3><ul>";
// wxLogMessage("[BooksDlg::load_available_books] Scanning path <%s>", sPath.wx_str());
wxDir dir(sPath);
if ( !dir.IsOpened() )
{
wxMessageBox( wxString::Format(_("Error when trying to move to folder %s"),
sPath.wx_str() ));
LOMSE_LOG_ERROR(str(boost::format("Error when trying to move to folder %s")
% sPath.wx_str() ));
return;
}
//Scan the books folder and load all books found
wxString filename;
bool fFound = dir.GetFirst(&filename, sPattern, wxDIR_FILES);
while (fFound)
{
if ((filename != "TestingNewExercises.lmb" &&
filename != "L1_Dictation.lmb" &&
filename != "L3_MusicReading.lmb" )
|| m_appScope.are_experimental_features_enabled() )
{
wxFileName oFilename(sPath, filename, wxPATH_NATIVE);
wxString name = get_book_name(oFilename);
wxString link = wxString::Format("book-%s", filename.wx_str());
sContent += "<li><a href=\"lenmus#"
+ link
+ "\">"
+ name
+ "</a></li>";
}
fFound = dir.GetNext(&filename);
}
sContent += "</ul></body></html>";
m_pHtmlWnd->SetPage(sContent);
}
示例2: OnLinkClicked
//---------------------------------------------------------------------------------------
void BooksDlg::OnLinkClicked(wxHtmlLinkEvent& event)
{
const wxHtmlLinkInfo& link = event.GetLinkInfo();
wxString sLocation = link.GetHref();
//study guide
if (sLocation == "lenmus#study-guide")
{
HelpSystem* pHelp = m_appScope.get_help_controller();
pHelp->display_section(10101); //study-guide
//show_html_document("study-guide.htm");
return;
}
//verify if it is a LenMus command link
int iPos = sLocation.Find("lenmus#");
if (iPos == wxNOT_FOUND)
{
// external link
::wxLaunchDefaultBrowser(sLocation);
}
else
{
wxString filename = sLocation.substr(12);
Paths* pPaths = m_appScope.get_paths();
wxString sPath = pPaths->GetBooksPath();
wxFileName oFile(sPath, filename, wxPATH_NATIVE);
if (!oFile.FileExists())
{
//try to use the english version
sPath = pPaths->GetLocaleRootPath();
oFile.AssignDir(sPath);
oFile.AppendDir("en");
oFile.AppendDir("books");
oFile.SetFullName(filename);
if (!oFile.FileExists())
{
wxMessageBox(_("Sorry: File not found!"));
LOMSE_LOG_WARN(str(boost::format("File '%s' not found!")
% oFile.GetFullPath().wx_str() ));
return;
}
}
m_fullName = oFile.GetFullPath();
EndModal(wxID_OK);
}
}