hrev47760 adds 1 changeset to branch 'master' old head: 2d5dbc78c4178166ef4459480e2fe528c39772bb new head: 4a02fc4f421b27765bd6859c2d8593aa1f47fc9c overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=4a02fc4+%5E2d5dbc7 ---------------------------------------------------------------------------- 4a02fc4: HaikuDepot: Sync defined categories with web-app. Also test all (currently) possible categories when retrieving package info. [ Stephan Aßmus <superstippi@xxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev47760 Commit: 4a02fc4f421b27765bd6859c2d8593aa1f47fc9c URL: http://cgit.haiku-os.org/haiku/commit/?id=4a02fc4 Author: Stephan Aßmus <superstippi@xxxxxx> Date: Fri Aug 29 08:45:54 2014 UTC ---------------------------------------------------------------------------- 2 files changed, 73 insertions(+), 26 deletions(-) src/apps/haikudepot/Model.cpp | 61 ++++++++++++++++++++++++++++++--------- src/apps/haikudepot/Model.h | 38 +++++++++++++++--------- ---------------------------------------------------------------------------- diff --git a/src/apps/haikudepot/Model.cpp b/src/apps/haikudepot/Model.cpp index 3f6d2f1..df005cd 100644 --- a/src/apps/haikudepot/Model.cpp +++ b/src/apps/haikudepot/Model.cpp @@ -266,24 +266,36 @@ Model::Model() fCategoryAudio(new PackageCategory( BitmapRef(), B_TRANSLATE("Audio"), "audio"), true), - fCategoryVideo(new PackageCategory( + fCategoryBusiness(new PackageCategory( BitmapRef(), - B_TRANSLATE("Video"), "video"), true), + B_TRANSLATE("Business"), "business"), true), + fCategoryDevelopment(new PackageCategory( + BitmapRef(), + B_TRANSLATE("Development"), "development"), true), + fCategoryEducation(new PackageCategory( + BitmapRef(), + B_TRANSLATE("Education"), "education"), true), + fCategoryGames(new PackageCategory( + BitmapRef(), + 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), - fCategoryDevelopment(new PackageCategory( + fCategoryScienceAndMathematics(new PackageCategory( BitmapRef(), - B_TRANSLATE("Development"), "development"), true), - fCategoryCommandLine(new PackageCategory( + B_TRANSLATE("Science & Mathematics"), "scienceandmathematics"), true), + fCategorySystemAndUtilities(new PackageCategory( BitmapRef(), - B_TRANSLATE("Command line"), "command-line"), true), - fCategoryGames(new PackageCategory( + B_TRANSLATE("System & Utilities"), "systemandutilities"), true), + fCategoryVideo(new PackageCategory( BitmapRef(), - B_TRANSLATE("Games"), "games"), true), + B_TRANSLATE("Video"), "video"), true), fCategoryFilter(PackageFilterRef(new AnyFilter(), true)), fDepotFilter(""), @@ -296,13 +308,17 @@ Model::Model() fStopPopulatingAllPackages(false) { // Don't forget to add new categories to this list: + fCategories.Add(fCategoryGames); + fCategories.Add(fCategoryBusiness); fCategories.Add(fCategoryAudio); fCategories.Add(fCategoryVideo); fCategories.Add(fCategoryGraphics); + fCategories.Add(fCategoryEducation); fCategories.Add(fCategoryProductivity); + fCategories.Add(fCategorySystemAndUtilities); + fCategories.Add(fCategoryInternetAndNetwork); fCategories.Add(fCategoryDevelopment); - fCategories.Add(fCategoryCommandLine); - fCategories.Add(fCategoryGames); + fCategories.Add(fCategoryScienceAndMathematics); // A category for packages that the user installed. fUserCategories.Add(CategoryRef(new PackageCategory( @@ -645,11 +661,30 @@ Model::_PopulatePackageInfo(const PackageInfoRef& package, bool fromCacheOnly) if (category == "AUDIO") package->AddCategory(CategoryAudio()); - else if (category == "VIDEO") - package->AddCategory(CategoryVideo()); + else if (category == "BUSINESS") + package->AddCategory(CategoryBusiness()); else if (category == "DEVELOPMENT") 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; diff --git a/src/apps/haikudepot/Model.h b/src/apps/haikudepot/Model.h index b3a5798..7c066a9 100644 --- a/src/apps/haikudepot/Model.h +++ b/src/apps/haikudepot/Model.h @@ -41,18 +41,26 @@ public: // Access to global categories const CategoryRef& CategoryAudio() const { return fCategoryAudio; } - const CategoryRef& CategoryVideo() const - { return fCategoryVideo; } - const CategoryRef& CategoryGraphics() const - { return fCategoryGraphics; } - const CategoryRef& CategoryProductivity() const - { return fCategoryProductivity; } + const CategoryRef& CategoryBusiness() const + { return fCategoryBusiness; } const CategoryRef& CategoryDevelopment() const { return fCategoryDevelopment; } - const CategoryRef& CategoryCommandLine() const - { return fCategoryCommandLine; } + const CategoryRef& CategoryEducation() const + { return fCategoryEducation; } + const CategoryRef& CategoryInternetAndNetwork() const + { return fCategoryInternetAndNetwork; } const CategoryRef& CategoryGames() const { return fCategoryGames; } + const CategoryRef& CategoryGraphics() const + { return fCategoryGraphics; } + const CategoryRef& CategoryProductivity() const + { return fCategoryProductivity; } + const CategoryRef& CategoryScienceAndMathematics() const + { return fCategoryScienceAndMathematics; } + const CategoryRef& CategorySystemAndUtilities() const + { return fCategorySystemAndUtilities; } + const CategoryRef& CategoryVideo() const + { return fCategoryVideo; } const CategoryList& Categories() const { return fCategories; } @@ -106,13 +114,17 @@ private: DepotList fDepots; CategoryRef fCategoryAudio; - CategoryRef fCategoryVideo; - CategoryRef fCategoryGraphics; - CategoryRef fCategoryProductivity; + CategoryRef fCategoryBusiness; CategoryRef fCategoryDevelopment; - CategoryRef fCategoryCommandLine; + CategoryRef fCategoryEducation; 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 fUserCategories;