From cd501d27cb7a394653beba0d36c28615adf7e194 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Tue, 22 May 2018 21:02:08 +0200 Subject: [PATCH] Updated new recipe dialog, Ingredient class. --- gui/newrecipedialog.ui | 177 +----------------------- model/recipe/ingredients/ingredient.cpp | 27 +--- model/recipe/ingredients/ingredient.h | 17 +-- 3 files changed, 18 insertions(+), 203 deletions(-) diff --git a/gui/newrecipedialog.ui b/gui/newrecipedialog.ui index 9759320..d59410c 100644 --- a/gui/newrecipedialog.ui +++ b/gui/newrecipedialog.ui @@ -175,7 +175,7 @@ 0 1999 12 - 21 + 20 @@ -530,176 +530,7 @@ QPushButton#deleteTagButton:pressed{ - - - - 2 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - background-color: rgb(113, 119, 255); - - - false - - - - - - QComboBox::InsertAlphabetically - - - true - - - - - - - Create a new ingredient - - - - :/images/images/plus_icon.png:/images/images/plus_icon.png - - - - - - - Delete this ingredient - - - - - - - :/images/images/minus_icon.png:/images/images/minus_icon.png - - - - - - - - - - - 0 - 36 - - - - - 2 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 50 - false - false - - - - Amount - - - - - - - - 0 - 0 - - - - 10000.000000000000000 - - - 1.000000000000000 - - - - - - - - 0 - 0 - - - - background-color: rgb(113, 119, 255); - - - QComboBox::InsertAlphabetically - - - - - - - Create a new unit of measure - - - - :/images/images/plus_icon.png:/images/images/plus_icon.png - - - - - - - Delete this unit of measure - - - - - - - :/images/images/minus_icon.png:/images/images/minus_icon.png - - - - - - - - + 0 @@ -710,10 +541,10 @@ QPushButton#deleteTagButton:pressed{ false - Qt::AlignCenter + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - Comments + Write ingredient here... false diff --git a/model/recipe/ingredients/ingredient.cpp b/model/recipe/ingredients/ingredient.cpp index 8942e11..bf58fa6 100644 --- a/model/recipe/ingredients/ingredient.cpp +++ b/model/recipe/ingredients/ingredient.cpp @@ -1,31 +1,18 @@ #include "model/recipe/ingredients/ingredient.h" Ingredient::Ingredient(){ - setName("NULL"); - setFoodGroup("NULL"); + setContent("NULL"); } -Ingredient::Ingredient(string name, string foodGroup){ - setName(name); - setFoodGroup(foodGroup); +Ingredient::Ingredient(string content){ + setContent(content); } -string Ingredient::getName() const{ - return this->name; +string Ingredient::getContent() const{ + return this->content; } -string Ingredient::getFoodGroup() const{ - return this->foodGroup; +void Ingredient::setContent(string newContent){ + this->content = newContent; } -void Ingredient::setName(string newName){ - this->name = newName; -} - -void Ingredient::setFoodGroup(string newFoodGroup){ - this->foodGroup = newFoodGroup; -} - -string Ingredient::toString(){ - return this->getName(); -} diff --git a/model/recipe/ingredients/ingredient.h b/model/recipe/ingredients/ingredient.h index 88a7ec7..f83fc76 100644 --- a/model/recipe/ingredients/ingredient.h +++ b/model/recipe/ingredients/ingredient.h @@ -6,28 +6,25 @@ using namespace std; /** - * @brief The Ingredient class represents an ingredient, which is classified by a food group, and has a name and an ID. - * An ingredient cannot be included on its own in a recipe, and must be paired with a Unit in a RecipeIngredient Object. + * @brief The Ingredient class represents an ingredient, which is a string representing one component of a recipe. + * The user is free to compose a recipe string however they like. However, the program will restrict obviously + * invalid input, and try to be smart about determining if an ingredient is valid. */ class Ingredient { public: Ingredient(); - Ingredient(string name, string foodGroup); + Ingredient(string content); //Getters - string getName() const; - string getFoodGroup() const; + string getContent() const; //Setters - void setName(string newName); - void setFoodGroup(string newFoodGroup); + void setContent(string newContent); - string toString(); protected: - string name; - string foodGroup; + string content; }; #endif // INGREDIENT_H