本文整理汇总了C++中CatalogItemPtr类的典型用法代码示例。如果您正苦于以下问题:C++ CatalogItemPtr类的具体用法?C++ CatalogItemPtr怎么用?C++ CatalogItemPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CatalogItemPtr类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Check
int QAChecker::Check(CatalogItemPtr item)
{
int issues = 0;
for (auto& c: m_checks)
{
if (item->GetString().empty() || (item->HasPlural() && item->GetPluralString().empty()))
continue;
if (c->CheckItem(item))
issues++;
}
return issues;
}
示例2: Update
void Update(const CatalogItemPtr& item) override
{
auto text = CommentDialog::RemoveStartHash(item->GetComment());
text.Trim();
m_comment->SetLanguage(m_parent->GetCurrentLanguage());
m_comment->SetAndWrapText(text);
}
示例3: CheckString
bool CheckString(CatalogItemPtr item, const wxString& source, const wxString& translation) override
{
if (u_isupper(source[0]) && u_islower(translation[0]))
{
item->SetIssue(CatalogItem::Issue::Warning, _("The translation should start as a sentence."));
return true;
}
if (u_islower(source[0]) && u_isupper(translation[0]))
{
if (m_lang != "de")
{
item->SetIssue(CatalogItem::Issue::Warning, _("The translation should start with a lowercase character."));
return true;
}
// else: German nouns start uppercased, this would cause too many false positives
}
return false;
}
示例4: Update
void Update(const CatalogItemPtr& item) override
{
#ifdef __WXMSW__
auto add = _("Add comment");
auto edit = _("Edit comment");
#else
auto add = _("Add Comment");
auto edit = _("Edit Comment");
#endif
m_btn->SetLabel(item->HasComment() ? edit : add);
}
示例5: CheckItem
bool CheckItem(CatalogItemPtr item) override
{
if (!item->HasPlural())
return false;
bool foundTranslated = false;
bool foundEmpty = false;
for (auto& s: item->GetTranslations())
{
if (s.empty())
foundEmpty = true;
else
foundTranslated = true;
}
if (foundEmpty && foundTranslated)
{
item->SetIssue(CatalogItem::Issue::Warning, _("Not all plural forms are translated."));
return true;
}
return false;
}
示例6: QueryProvider
void SuggestionsSidebarBlock::QueryProvider(SuggestionsBackend& backend, const CatalogItemPtr& item, uint64_t queryId)
{
m_pendingQueries++;
// we need something to talk to GUI thread through that is guaranteed
// to exist, and the app object is a good choice:
auto backendPtr = &backend;
std::weak_ptr<SuggestionsSidebarBlock> weakSelf = std::dynamic_pointer_cast<SuggestionsSidebarBlock>(shared_from_this());
m_provider->SuggestTranslation
(
backend,
m_parent->GetCurrentSourceLanguage(),
m_parent->GetCurrentLanguage(),
item->GetString().ToStdWstring(),
// when receiving data
[=](const SuggestionsList& hits){
call_on_main_thread([weakSelf,queryId,hits]{
auto self = weakSelf.lock();
// maybe this call is already out of date:
if (!self || self->m_latestQueryId != queryId)
return;
self->UpdateSuggestions(hits);
if (--self->m_pendingQueries == 0)
self->OnQueriesFinished();
});
},
// on error:
[=](std::exception_ptr e){
call_on_main_thread([weakSelf,queryId,backendPtr,e]{
auto self = weakSelf.lock();
// maybe this call is already out of date:
if (!self || self->m_latestQueryId != queryId)
return;
self->ReportError(backendPtr, e);
if (--self->m_pendingQueries == 0)
self->OnQueriesFinished();
});
}
);
}
示例7: ShouldShowForItem
bool ShouldShowForItem(const CatalogItemPtr& item) const override
{
return item->HasComment();
}