First Interaction with User Interface #1
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -1,2 +1,3 @@
 | 
			
		|||
*.pro
 | 
			
		||||
*.pro.user
 | 
			
		||||
*.autosave
 | 
			
		||||
| 
						 | 
				
			
			@ -1,11 +1,11 @@
 | 
			
		|||
#include "model/recipe/ingredients/recipeingredient.h"
 | 
			
		||||
 | 
			
		||||
RecipeIngredient::RecipeIngredient(int id, string name, string foodGroup, int quantity, string unit) : Ingredient(id, name, foodGroup){
 | 
			
		||||
RecipeIngredient::RecipeIngredient(int id, string name, string foodGroup, int quantity, UnitOfMeasure unit) : Ingredient(id, name, foodGroup){
 | 
			
		||||
    setQuantity(quantity);
 | 
			
		||||
    setUnit(unit);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, string unit){
 | 
			
		||||
RecipeIngredient::RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure unit){
 | 
			
		||||
    setId(i.getId());
 | 
			
		||||
    setName(i.getName());
 | 
			
		||||
    setFoodGroup(i.getFoodGroup());
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +21,7 @@ void RecipeIngredient::setQuantity(int newQuantity){
 | 
			
		|||
    this->quantity = newQuantity;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RecipeIngredient::setUnit(string newUnit){
 | 
			
		||||
void RecipeIngredient::setUnit(UnitOfMeasure newUnit){
 | 
			
		||||
    this->unit = newUnit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
#include <string>
 | 
			
		||||
 | 
			
		||||
#include "model/recipe/ingredients/ingredient.h"
 | 
			
		||||
#include "model/recipe/ingredients/unitofmeasure.h"
 | 
			
		||||
 | 
			
		||||
using namespace std;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -14,19 +15,19 @@ using namespace std;
 | 
			
		|||
class RecipeIngredient : public Ingredient
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    RecipeIngredient(int id, string name, string foodGroup, int quantity, string unit);
 | 
			
		||||
    RecipeIngredient(Ingredient i, int quantity, string unit);
 | 
			
		||||
    RecipeIngredient(int id, string name, string foodGroup, int quantity, UnitOfMeasure unit);
 | 
			
		||||
    RecipeIngredient(Ingredient i, int quantity, UnitOfMeasure unit);
 | 
			
		||||
 | 
			
		||||
    int getQuantity();
 | 
			
		||||
    string getUnit();
 | 
			
		||||
    UnitOfMeasure getUnit();
 | 
			
		||||
    string getComment();
 | 
			
		||||
 | 
			
		||||
    void setQuantity(int newQuantity);
 | 
			
		||||
    void setUnit(string newUnit);
 | 
			
		||||
    void setUnit(UnitOfMeasure newUnit);
 | 
			
		||||
    void setComment(string newComment);
 | 
			
		||||
private:
 | 
			
		||||
    int quantity;
 | 
			
		||||
    string unit;
 | 
			
		||||
    UnitOfMeasure unit;
 | 
			
		||||
    string comment;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,19 @@
 | 
			
		|||
#include "unitofmeasure.h"
 | 
			
		||||
 | 
			
		||||
UnitOfMeasure::UnitOfMeasure()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
UnitOfMeasure::UnitOfMeasure(string name, string plural, string abbreviation){
 | 
			
		||||
    this->name = name;
 | 
			
		||||
    this->plural = plural;
 | 
			
		||||
    this->abbreviation = abbreviation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
string UnitOfMeasure::getName(){
 | 
			
		||||
    return this->name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
string UnitOfMeasure::getNamePlural(){
 | 
			
		||||
    return this->plural;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
string UnitOfMeasure::getAbbreviation(){
 | 
			
		||||
    return this->abbreviation;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,12 +12,16 @@ using namespace std;
 | 
			
		|||
class UnitOfMeasure
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
    UnitOfMeasure();
 | 
			
		||||
    UnitOfMeasure(string name, string plural, string abbreviation);
 | 
			
		||||
 | 
			
		||||
    //Getters
 | 
			
		||||
    string getName();
 | 
			
		||||
    string getNamePlural();
 | 
			
		||||
    string getAbbreviation();
 | 
			
		||||
private:
 | 
			
		||||
    string name;                //The name of the unit of measure.
 | 
			
		||||
    string plural;              //The plural name.
 | 
			
		||||
    string abbreviation;        //A short version of the unit.
 | 
			
		||||
    float siBaseUnitEquivalent; //The ratio when compared to the base SI unit for this unit. For example: 1 cup = 237mL.
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // UNITOFMEASURE_H
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,9 +1,28 @@
 | 
			
		|||
#include "model/recipe/recipe.h"
 | 
			
		||||
 | 
			
		||||
Recipe::Recipe(){
 | 
			
		||||
    this->name = "NULL";
 | 
			
		||||
    //Set default values when none are specified.
 | 
			
		||||
    this->name = "Unnamed Recipe";
 | 
			
		||||
    this->ingredients = vector<RecipeIngredient>();
 | 
			
		||||
    this->instruction = Instruction();
 | 
			
		||||
    this->image = QImage();
 | 
			
		||||
    this->tags = vector<string>();
 | 
			
		||||
    this->createdDate = QDate.currentDate();
 | 
			
		||||
    this->prepTime = QTime(1, 0);
 | 
			
		||||
    this->cookTime = QTime(0, 30);
 | 
			
		||||
    this->servings = 10;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Recipe::Recipe(string name, vector<RecipeIngredient> ingredients, Instruction instruction, QImage image, vector<string> tags, QDate createdDate, QTime prepTime, QTime cookTime, float servings){
 | 
			
		||||
    this->name = name;
 | 
			
		||||
    this->ingredients = ingredients;
 | 
			
		||||
    this->instruction = instruction;
 | 
			
		||||
    this->image = image;
 | 
			
		||||
    this->tags = tags;
 | 
			
		||||
    this->createdDate = createdDate;
 | 
			
		||||
    this->prepTime = prepTime;
 | 
			
		||||
    this->cookTime = cookTime;
 | 
			
		||||
    this->servings = servings;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Recipe::Recipe(string name, vector<RecipeIngredient> ingredients, Instruction instruction)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,9 @@
 | 
			
		|||
 | 
			
		||||
#include <vector>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <QDate>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
#include <QImage>
 | 
			
		||||
 | 
			
		||||
#include "model/recipe/ingredients/recipeingredient.h"
 | 
			
		||||
#include "model/recipe/instruction.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -27,17 +30,36 @@ class Recipe
 | 
			
		|||
{
 | 
			
		||||
public:
 | 
			
		||||
    Recipe();
 | 
			
		||||
    Recipe(string name, vector<RecipeIngredient> ingredients, Instruction instruction);
 | 
			
		||||
    //Full constructor
 | 
			
		||||
    Recipe(string name, vector<RecipeIngredient> ingredients, Instruction instruction, QImage image, vector<string> tags);
 | 
			
		||||
 | 
			
		||||
    //Getters
 | 
			
		||||
    string getName();
 | 
			
		||||
    vector<RecipeIngredient> getIngredients();
 | 
			
		||||
    Instruction getInstruction();
 | 
			
		||||
    QImage getImage();
 | 
			
		||||
    vector<string> getTags();
 | 
			
		||||
    QDate getCreatedDate();
 | 
			
		||||
    QTime getPrepTime();
 | 
			
		||||
    QTime getCookTime();
 | 
			
		||||
    QTime getTotalTime();
 | 
			
		||||
    float getServings();
 | 
			
		||||
    //Setters
 | 
			
		||||
    void setName(string newName);
 | 
			
		||||
    void addIngredient(RecipeIngredient newIngredient);
 | 
			
		||||
    void setInstruction(Instruction newInstruction);
 | 
			
		||||
private:
 | 
			
		||||
    string name;
 | 
			
		||||
    vector<string> tags;
 | 
			
		||||
    vector<RecipeIngredient> ingredients;
 | 
			
		||||
    Instruction instruction;
 | 
			
		||||
 | 
			
		||||
    //Main information.
 | 
			
		||||
    string name;                                //The name of the recipe.
 | 
			
		||||
    vector<RecipeIngredient> ingredients;       //The list of ingredients in the recipe.
 | 
			
		||||
    Instruction instruction;                    //The instruction HTML document.
 | 
			
		||||
    QImage image;                               //An image displayed alongside the recipe.
 | 
			
		||||
    //Auxiliary Information.
 | 
			
		||||
    vector<string> tags;                        //The list of tags which can be used to categorize the recipe.
 | 
			
		||||
    QDate createdDate;                          //The date the recipe was created.
 | 
			
		||||
    QTime prepTime;                             //The time taken for preparation.
 | 
			
		||||
    QTime cookTime;                             //The time taken to cook.
 | 
			
		||||
    float servings;                             //The number of servings which this recipe produces.
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // RECIPE_H
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue