HaikuDepot: Add some getters to Model.
For category, depot and search terms filter.
This commit is contained in:
@@ -70,6 +70,11 @@ public:
|
|||||||
return fDepot.Packages().Contains(package);
|
return fDepot.Packages().Contains(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const BString& Depot() const
|
||||||
|
{
|
||||||
|
return fDepot.Name();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DepotInfo fDepot;
|
DepotInfo fDepot;
|
||||||
};
|
};
|
||||||
@@ -99,6 +104,11 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const BString& Category() const
|
||||||
|
{
|
||||||
|
return fCategory;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BString fCategory;
|
BString fCategory;
|
||||||
};
|
};
|
||||||
@@ -235,6 +245,20 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BString SearchTerms() const
|
||||||
|
{
|
||||||
|
BString searchTerms;
|
||||||
|
for (int32 i = 0; i < fSearchTerms.CountItems(); i++) {
|
||||||
|
const BString& term = fSearchTerms.ItemAtFast(i);
|
||||||
|
if (term.IsEmpty())
|
||||||
|
continue;
|
||||||
|
if (!searchTerms.IsEmpty())
|
||||||
|
searchTerms.Append(" ");
|
||||||
|
searchTerms.Append(term);
|
||||||
|
}
|
||||||
|
return searchTerms;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _TextContains(BString text, const BString& string) const
|
bool _TextContains(BString text, const BString& string) const
|
||||||
{
|
{
|
||||||
@@ -244,7 +268,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
List<BString, false> fSearchTerms;
|
StringList fSearchTerms;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -477,6 +501,17 @@ Model::SetCategory(const BString& category)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
Model::Category() const
|
||||||
|
{
|
||||||
|
CategoryFilter* filter
|
||||||
|
= dynamic_cast<CategoryFilter*>(fCategoryFilter.Get());
|
||||||
|
if (filter == NULL)
|
||||||
|
return "";
|
||||||
|
return filter->Category();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::SetDepot(const BString& depot)
|
Model::SetDepot(const BString& depot)
|
||||||
{
|
{
|
||||||
@@ -484,6 +519,13 @@ Model::SetDepot(const BString& depot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
Model::Depot() const
|
||||||
|
{
|
||||||
|
return fDepotFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::SetSearchTerms(const BString& searchTerms)
|
Model::SetSearchTerms(const BString& searchTerms)
|
||||||
{
|
{
|
||||||
@@ -498,6 +540,17 @@ Model::SetSearchTerms(const BString& searchTerms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
Model::SearchTerms() const
|
||||||
|
{
|
||||||
|
SearchTermsFilter* filter
|
||||||
|
= dynamic_cast<SearchTermsFilter*>(fSearchTermsFilter.Get());
|
||||||
|
if (filter == NULL)
|
||||||
|
return "";
|
||||||
|
return filter->SearchTerms();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Model::SetShowAvailablePackages(bool show)
|
Model::SetShowAvailablePackages(bool show)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -91,8 +91,11 @@ public:
|
|||||||
|
|
||||||
// Configure PackageFilters
|
// Configure PackageFilters
|
||||||
void SetCategory(const BString& category);
|
void SetCategory(const BString& category);
|
||||||
|
BString Category() const;
|
||||||
void SetDepot(const BString& depot);
|
void SetDepot(const BString& depot);
|
||||||
|
BString Depot() const;
|
||||||
void SetSearchTerms(const BString& searchTerms);
|
void SetSearchTerms(const BString& searchTerms);
|
||||||
|
BString SearchTerms() const;
|
||||||
|
|
||||||
void SetShowAvailablePackages(bool show);
|
void SetShowAvailablePackages(bool show);
|
||||||
bool ShowAvailablePackages() const
|
bool ShowAvailablePackages() const
|
||||||
|
|||||||
Reference in New Issue
Block a user