Improve/redesign ingredients #13
|
@ -175,7 +175,7 @@
|
|||
<second>0</second>
|
||||
<year>1999</year>
|
||||
<month>12</month>
|
||||
<day>21</day>
|
||||
<day>20</day>
|
||||
</datetime>
|
||||
</property>
|
||||
<property name="currentSection">
|
||||
|
@ -530,176 +530,7 @@ QPushButton#deleteTagButton:pressed{
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="ingredientNamePanel" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="ingredientNameBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(113, 119, 255);</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAlphabetically</enum>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newIngredientButton">
|
||||
<property name="toolTip">
|
||||
<string>Create a new ingredient</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res.qrc">
|
||||
<normaloff>:/images/images/plus_icon.png</normaloff>:/images/images/plus_icon.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteIngredientButton">
|
||||
<property name="toolTip">
|
||||
<string>Delete this ingredient</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res.qrc">
|
||||
<normaloff>:/images/images/minus_icon.png</normaloff>:/images/images/minus_icon.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="quantityPanel" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="amountLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<italic>false</italic>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Amount</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="quantitySpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="unitComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(113, 119, 255);</string>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAlphabetically</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QPushButton" name="newUnitButton">
|
||||
<property name="toolTip">
|
||||
<string>Create a new unit of measure</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res.qrc">
|
||||
<normaloff>:/images/images/plus_icon.png</normaloff>:/images/images/plus_icon.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteUnitButton">
|
||||
<property name="toolTip">
|
||||
<string>Delete this unit of measure</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../res.qrc">
|
||||
<normaloff>:/images/images/minus_icon.png</normaloff>:/images/images/minus_icon.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="commentsLineEdit">
|
||||
<widget class="QLineEdit" name="ingredientLineEdit">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
|
@ -710,10 +541,10 @@ QPushButton#deleteTagButton:pressed{
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Comments</string>
|
||||
<string>Write ingredient here...</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>false</bool>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue