diff --git a/RecipeDB.pro b/RecipeDB.pro
index 791ba66..b170e61 100644
--- a/RecipeDB.pro
+++ b/RecipeDB.pro
@@ -33,7 +33,7 @@ SOURCES += model/recipe/instruction.cpp \
gui/newDialogs/newunitdialog.cpp \
utils/aspectratiopixmaplabel.cpp \
utils/stringutils.cpp \
- openrecipedialog.cpp
+ gui/openrecipedialog.cpp
HEADERS += model/recipe/instruction.h \
model/recipe/recipe.h \
@@ -56,7 +56,7 @@ HEADERS += model/recipe/instruction.h \
gui/newDialogs/newunitdialog.h \
utils/aspectratiopixmaplabel.h \
utils/stringutils.h \
- openrecipedialog.h
+ gui/openrecipedialog.h
LIBS += -ldl \
@@ -65,7 +65,7 @@ FORMS += gui/mainwindow.ui \
gui/newDialogs/newingredientdialog.ui \
gui/newDialogs/newtagdialog.ui \
gui/newDialogs/newunitdialog.ui \
- openrecipedialog.ui
+ gui/openrecipedialog.ui
DISTFILES += \
.gitignore
diff --git a/gui/newDialogs/newunitdialog.cpp b/gui/newDialogs/newunitdialog.cpp
index d89acaf..e7be030 100644
--- a/gui/newDialogs/newunitdialog.cpp
+++ b/gui/newDialogs/newunitdialog.cpp
@@ -8,10 +8,8 @@ NewUnitDialog::NewUnitDialog(QWidget *parent) :
ui->setupUi(this);
ui->typeComboBox->clear();
- ui->typeComboBox->setItemData(0, "Mass");
- ui->typeComboBox->setItemData(1, "Volume");
- ui->typeComboBox->setItemData(2, "Length");
- ui->typeComboBox->setItemData(3, "Misc");
+ QStringList list({"Mass", "Volume", "Length", "Misc"});
+ ui->typeComboBox->insertItems(0, list);
}
@@ -23,7 +21,7 @@ NewUnitDialog::~NewUnitDialog()
UnitOfMeasure NewUnitDialog::getUnit(){
return UnitOfMeasure(ui->unitNameEdit->text().toLower().toStdString(),
ui->pluralNameEdit->text().toLower().toStdString(),
- ui->abbreviationEdit->text().toLower().toStdString(),
+ ui->abbreviationEdit->text().toStdString(),
this->getSelectedType(),
ui->coefficientSpinBox->value());
}
diff --git a/gui/newrecipedialog.cpp b/gui/newrecipedialog.cpp
index 93e3ffa..99459dc 100644
--- a/gui/newrecipedialog.cpp
+++ b/gui/newrecipedialog.cpp
@@ -173,7 +173,7 @@ void NewRecipeDialog::on_newUnitButton_clicked(){
d.show();
if (d.exec() == QDialog::Accepted){
UnitOfMeasure u = d.getUnit();
- if (!this->recipeDB->storeUnitOfMeasure(u)){
+ if (!this->recipeDB->storeUnitOfMeasure(u) || u.getName().empty() || u.getNamePlural().empty() || u.getAbbreviation().empty()){
QMessageBox::critical(this, "Error", "Unable to store new unit.");
} else {
this->populateUnitsBox();
diff --git a/gui/newrecipedialog.ui b/gui/newrecipedialog.ui
index e7ef5e9..a470909 100644
--- a/gui/newrecipedialog.ui
+++ b/gui/newrecipedialog.ui
@@ -26,6 +26,9 @@
:/images/images/icon.png:/images/images/icon.png
+
+ font: 25 "Noto Sans CJK KR";
+
true
@@ -97,9 +100,7 @@
- Noto Sans CJK KR
- 14
- 50
+ 3
false
false
@@ -116,7 +117,9 @@
- PreferAntialias
+ 3
+ false
+ false
@@ -532,9 +535,7 @@
- Noto Sans CJK KR
- 14
- 50
+ 3
false
false
@@ -745,9 +746,9 @@
- Liberation Serif
- 12
- true
+ 3
+ false
+ false
@@ -765,10 +766,9 @@
- Liberation Serif
- 12
- 75
- true
+ 3
+ false
+ false
diff --git a/openrecipedialog.cpp b/gui/openrecipedialog.cpp
similarity index 100%
rename from openrecipedialog.cpp
rename to gui/openrecipedialog.cpp
diff --git a/openrecipedialog.h b/gui/openrecipedialog.h
similarity index 100%
rename from openrecipedialog.h
rename to gui/openrecipedialog.h
diff --git a/gui/openrecipedialog.ui b/gui/openrecipedialog.ui
new file mode 100644
index 0000000..d0fca63
--- /dev/null
+++ b/gui/openrecipedialog.ui
@@ -0,0 +1,111 @@
+
+
+ OpenRecipeDialog
+
+
+
+ 0
+ 0
+ 640
+ 480
+
+
+
+ Open Recipe
+
+
+
+ :/images/images/icon.png:/images/images/icon.png
+
+
+ true
+
+
+ -
+
+
+
-
+
+
+
-
+
+
+ Name
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
-
+
+
+ Tag
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
-
+
+
+ Ingredient
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+ :/images/images/search_icon.png:/images/images/search_icon.png
+
+
+
+
+
+
+ -
+
+
+
-
+
+
+ QFrame::NoFrame
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/images.qrc b/images.qrc
index 2391914..8b12ebf 100644
--- a/images.qrc
+++ b/images.qrc
@@ -4,5 +4,6 @@
images/icon.png
images/plus_icon.png
images/minus_icon.png
+ images/search_icon.png
diff --git a/images/search_icon.png b/images/search_icon.png
new file mode 100644
index 0000000..9cac3e7
Binary files /dev/null and b/images/search_icon.png differ
diff --git a/openrecipedialog.ui b/openrecipedialog.ui
deleted file mode 100644
index 31f318f..0000000
--- a/openrecipedialog.ui
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- OpenRecipeDialog
-
-
-
- 0
- 0
- 640
- 480
-
-
-
- Dialog
-
-
-
-
-