HaikuDepot: Sync defined categories with web-app.
Also test all (currently) possible categories when retrieving package info.
This commit is contained in:
@@ -266,24 +266,36 @@ Model::Model()
|
|||||||
fCategoryAudio(new PackageCategory(
|
fCategoryAudio(new PackageCategory(
|
||||||
BitmapRef(),
|
BitmapRef(),
|
||||||
B_TRANSLATE("Audio"), "audio"), true),
|
B_TRANSLATE("Audio"), "audio"), true),
|
||||||
fCategoryVideo(new PackageCategory(
|
fCategoryBusiness(new PackageCategory(
|
||||||
BitmapRef(),
|
BitmapRef(),
|
||||||
B_TRANSLATE("Video"), "video"), true),
|
B_TRANSLATE("Business"), "business"), true),
|
||||||
fCategoryGraphics(new PackageCategory(
|
|
||||||
BitmapRef(),
|
|
||||||
B_TRANSLATE("Graphics"), "graphics"), true),
|
|
||||||
fCategoryProductivity(new PackageCategory(
|
|
||||||
BitmapRef(),
|
|
||||||
B_TRANSLATE("Productivity"), "productivity"), true),
|
|
||||||
fCategoryDevelopment(new PackageCategory(
|
fCategoryDevelopment(new PackageCategory(
|
||||||
BitmapRef(),
|
BitmapRef(),
|
||||||
B_TRANSLATE("Development"), "development"), true),
|
B_TRANSLATE("Development"), "development"), true),
|
||||||
fCategoryCommandLine(new PackageCategory(
|
fCategoryEducation(new PackageCategory(
|
||||||
BitmapRef(),
|
BitmapRef(),
|
||||||
B_TRANSLATE("Command line"), "command-line"), true),
|
B_TRANSLATE("Education"), "education"), true),
|
||||||
fCategoryGames(new PackageCategory(
|
fCategoryGames(new PackageCategory(
|
||||||
BitmapRef(),
|
BitmapRef(),
|
||||||
B_TRANSLATE("Games"), "games"), true),
|
B_TRANSLATE("Games"), "games"), true),
|
||||||
|
fCategoryGraphics(new PackageCategory(
|
||||||
|
BitmapRef(),
|
||||||
|
B_TRANSLATE("Graphics"), "graphics"), true),
|
||||||
|
fCategoryInternetAndNetwork(new PackageCategory(
|
||||||
|
BitmapRef(),
|
||||||
|
B_TRANSLATE("Internet & Network"), "internetandnetwork"), true),
|
||||||
|
fCategoryProductivity(new PackageCategory(
|
||||||
|
BitmapRef(),
|
||||||
|
B_TRANSLATE("Productivity"), "productivity"), true),
|
||||||
|
fCategoryScienceAndMathematics(new PackageCategory(
|
||||||
|
BitmapRef(),
|
||||||
|
B_TRANSLATE("Science & Mathematics"), "scienceandmathematics"), true),
|
||||||
|
fCategorySystemAndUtilities(new PackageCategory(
|
||||||
|
BitmapRef(),
|
||||||
|
B_TRANSLATE("System & Utilities"), "systemandutilities"), true),
|
||||||
|
fCategoryVideo(new PackageCategory(
|
||||||
|
BitmapRef(),
|
||||||
|
B_TRANSLATE("Video"), "video"), true),
|
||||||
|
|
||||||
fCategoryFilter(PackageFilterRef(new AnyFilter(), true)),
|
fCategoryFilter(PackageFilterRef(new AnyFilter(), true)),
|
||||||
fDepotFilter(""),
|
fDepotFilter(""),
|
||||||
@@ -296,13 +308,17 @@ Model::Model()
|
|||||||
fStopPopulatingAllPackages(false)
|
fStopPopulatingAllPackages(false)
|
||||||
{
|
{
|
||||||
// Don't forget to add new categories to this list:
|
// Don't forget to add new categories to this list:
|
||||||
|
fCategories.Add(fCategoryGames);
|
||||||
|
fCategories.Add(fCategoryBusiness);
|
||||||
fCategories.Add(fCategoryAudio);
|
fCategories.Add(fCategoryAudio);
|
||||||
fCategories.Add(fCategoryVideo);
|
fCategories.Add(fCategoryVideo);
|
||||||
fCategories.Add(fCategoryGraphics);
|
fCategories.Add(fCategoryGraphics);
|
||||||
|
fCategories.Add(fCategoryEducation);
|
||||||
fCategories.Add(fCategoryProductivity);
|
fCategories.Add(fCategoryProductivity);
|
||||||
|
fCategories.Add(fCategorySystemAndUtilities);
|
||||||
|
fCategories.Add(fCategoryInternetAndNetwork);
|
||||||
fCategories.Add(fCategoryDevelopment);
|
fCategories.Add(fCategoryDevelopment);
|
||||||
fCategories.Add(fCategoryCommandLine);
|
fCategories.Add(fCategoryScienceAndMathematics);
|
||||||
fCategories.Add(fCategoryGames);
|
|
||||||
|
|
||||||
// A category for packages that the user installed.
|
// A category for packages that the user installed.
|
||||||
fUserCategories.Add(CategoryRef(new PackageCategory(
|
fUserCategories.Add(CategoryRef(new PackageCategory(
|
||||||
@@ -645,11 +661,30 @@ Model::_PopulatePackageInfo(const PackageInfoRef& package, bool fromCacheOnly)
|
|||||||
|
|
||||||
if (category == "AUDIO")
|
if (category == "AUDIO")
|
||||||
package->AddCategory(CategoryAudio());
|
package->AddCategory(CategoryAudio());
|
||||||
else if (category == "VIDEO")
|
else if (category == "BUSINESS")
|
||||||
package->AddCategory(CategoryVideo());
|
package->AddCategory(CategoryBusiness());
|
||||||
else if (category == "DEVELOPMENT")
|
else if (category == "DEVELOPMENT")
|
||||||
package->AddCategory(CategoryDevelopment());
|
package->AddCategory(CategoryDevelopment());
|
||||||
// TODO: ...
|
else if (category == "EDUCATION")
|
||||||
|
package->AddCategory(CategoryEducation());
|
||||||
|
else if (category == "GAMES")
|
||||||
|
package->AddCategory(CategoryGames());
|
||||||
|
else if (category == "GRAPHICS")
|
||||||
|
package->AddCategory(CategoryGraphics());
|
||||||
|
else if (category == "INTERNETANDNETWORK")
|
||||||
|
package->AddCategory(CategoryInternetAndNetwork());
|
||||||
|
else if (category == "PRODUCTIVITY")
|
||||||
|
package->AddCategory(CategoryProductivity());
|
||||||
|
else if (category == "SCIENCEANDMATHEMATICS")
|
||||||
|
package->AddCategory(CategoryScienceAndMathematics());
|
||||||
|
else if (category == "SYSTEMANDUTILITIES")
|
||||||
|
package->AddCategory(CategorySystemAndUtilities());
|
||||||
|
else if (category == "VIDEO")
|
||||||
|
package->AddCategory(CategoryVideo());
|
||||||
|
// TODO: The server will eventually support an API to
|
||||||
|
// get the defined categories and their translated names.
|
||||||
|
// This should then be used instead of hard-coded
|
||||||
|
// categories and translations in the app.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double derivedRating;
|
double derivedRating;
|
||||||
|
|||||||
+25
-13
@@ -41,18 +41,26 @@ public:
|
|||||||
// Access to global categories
|
// Access to global categories
|
||||||
const CategoryRef& CategoryAudio() const
|
const CategoryRef& CategoryAudio() const
|
||||||
{ return fCategoryAudio; }
|
{ return fCategoryAudio; }
|
||||||
const CategoryRef& CategoryVideo() const
|
const CategoryRef& CategoryBusiness() const
|
||||||
{ return fCategoryVideo; }
|
{ return fCategoryBusiness; }
|
||||||
|
const CategoryRef& CategoryDevelopment() const
|
||||||
|
{ return fCategoryDevelopment; }
|
||||||
|
const CategoryRef& CategoryEducation() const
|
||||||
|
{ return fCategoryEducation; }
|
||||||
|
const CategoryRef& CategoryInternetAndNetwork() const
|
||||||
|
{ return fCategoryInternetAndNetwork; }
|
||||||
|
const CategoryRef& CategoryGames() const
|
||||||
|
{ return fCategoryGames; }
|
||||||
const CategoryRef& CategoryGraphics() const
|
const CategoryRef& CategoryGraphics() const
|
||||||
{ return fCategoryGraphics; }
|
{ return fCategoryGraphics; }
|
||||||
const CategoryRef& CategoryProductivity() const
|
const CategoryRef& CategoryProductivity() const
|
||||||
{ return fCategoryProductivity; }
|
{ return fCategoryProductivity; }
|
||||||
const CategoryRef& CategoryDevelopment() const
|
const CategoryRef& CategoryScienceAndMathematics() const
|
||||||
{ return fCategoryDevelopment; }
|
{ return fCategoryScienceAndMathematics; }
|
||||||
const CategoryRef& CategoryCommandLine() const
|
const CategoryRef& CategorySystemAndUtilities() const
|
||||||
{ return fCategoryCommandLine; }
|
{ return fCategorySystemAndUtilities; }
|
||||||
const CategoryRef& CategoryGames() const
|
const CategoryRef& CategoryVideo() const
|
||||||
{ return fCategoryGames; }
|
{ return fCategoryVideo; }
|
||||||
|
|
||||||
const CategoryList& Categories() const
|
const CategoryList& Categories() const
|
||||||
{ return fCategories; }
|
{ return fCategories; }
|
||||||
@@ -106,13 +114,17 @@ private:
|
|||||||
DepotList fDepots;
|
DepotList fDepots;
|
||||||
|
|
||||||
CategoryRef fCategoryAudio;
|
CategoryRef fCategoryAudio;
|
||||||
CategoryRef fCategoryVideo;
|
CategoryRef fCategoryBusiness;
|
||||||
CategoryRef fCategoryGraphics;
|
|
||||||
CategoryRef fCategoryProductivity;
|
|
||||||
CategoryRef fCategoryDevelopment;
|
CategoryRef fCategoryDevelopment;
|
||||||
CategoryRef fCategoryCommandLine;
|
CategoryRef fCategoryEducation;
|
||||||
CategoryRef fCategoryGames;
|
CategoryRef fCategoryGames;
|
||||||
// TODO: More categories
|
CategoryRef fCategoryGraphics;
|
||||||
|
CategoryRef fCategoryInternetAndNetwork;
|
||||||
|
CategoryRef fCategoryProductivity;
|
||||||
|
CategoryRef fCategoryScienceAndMathematics;
|
||||||
|
CategoryRef fCategorySystemAndUtilities;
|
||||||
|
CategoryRef fCategoryVideo;
|
||||||
|
// TODO: Dynamic categories retrieved from web-app
|
||||||
|
|
||||||
CategoryList fCategories;
|
CategoryList fCategories;
|
||||||
CategoryList fUserCategories;
|
CategoryList fUserCategories;
|
||||||
|
|||||||
Reference in New Issue
Block a user