diff --git a/Design/recipeDatabaseModel.png b/Design/recipeDatabaseModel.png
new file mode 100644
index 0000000..667888c
Binary files /dev/null and b/Design/recipeDatabaseModel.png differ
diff --git a/Design/recipeDatabaseModel.uxf b/Design/recipeDatabaseModel.uxf
new file mode 100644
index 0000000..a298a76
--- /dev/null
+++ b/Design/recipeDatabaseModel.uxf
@@ -0,0 +1,141 @@
+
+
+ 10
+
+ UMLClass
+
+ 60
+ 160
+ 230
+ 140
+
+ recipe
+--
+recipeId INTEGER PRIMARY KEY
+name varchar UNIQUE
+authorName varchar
+createdDate date
+prepTime time
+cookTime time
+servingCount real
+
+
+
+ UMLClass
+
+ 60
+ 310
+ 260
+ 80
+
+ ingredient
+--
+ingredientId INTEGER PRIMARY KEY
+foodGroup varchar
+name varchar UNIQUE
+
+
+
+ UMLClass
+
+ 60
+ 400
+ 270
+ 110
+
+ unitOfMeasure
+--
+name varchar UNIQUE PRIMARY KEY
+plural varchar
+abbreviation varchar
+type int
+metricCoefficient real
+
+
+
+ UMLClass
+
+ 430
+ 160
+ 280
+ 70
+
+ recipeTag
+--
+recipeId int FOREIGN recipe(recipeId)
+tagName varchar
+
+
+
+ UMLClass
+
+ 430
+ 240
+ 360
+ 110
+
+ recipeIngredient
+--
+recipeId FOREIGN recipe(recipeId)
+ingredientId FOREIGN ingredient(ingredientId)
+unitName varchar FOREIGN unitOfMeasure(name)
+quantity real
+comment varchar
+
+
+
+ Relation
+
+ 280
+ 180
+ 170
+ 30
+
+ lt=<<-
+ 10.0;10.0;150.0;10.0
+
+
+ Relation
+
+ 340
+ 180
+ 110
+ 110
+
+ lt=<<-
+ 10.0;10.0;10.0;90.0;90.0;90.0
+
+
+ Relation
+
+ 310
+ 280
+ 140
+ 80
+
+ lt=<<-
+ 10.0;60.0;80.0;60.0;80.0;10.0;120.0;10.0
+
+
+ Relation
+
+ 320
+ 300
+ 130
+ 150
+
+ lt=<<-
+ 10.0;130.0;90.0;130.0;90.0;10.0;110.0;10.0
+
+
+ UMLPackage
+
+ 40
+ 120
+ 770
+ 410
+
+ RecipeDatabase
+
+
+
diff --git a/RecipeDB.pro b/RecipeDB.pro
index 4727193..fdcef14 100644
--- a/RecipeDB.pro
+++ b/RecipeDB.pro
@@ -79,4 +79,4 @@ DISTFILES += \
.gitignore
RESOURCES += \
- images.qrc
+ res.qrc
diff --git a/fonts/NotoSans-Light.ttf b/fonts/NotoSans-Light.ttf
new file mode 100644
index 0000000..d80909f
Binary files /dev/null and b/fonts/NotoSans-Light.ttf differ
diff --git a/fonts/NotoSans-LightItalic.ttf b/fonts/NotoSans-LightItalic.ttf
new file mode 100644
index 0000000..fe3cb93
Binary files /dev/null and b/fonts/NotoSans-LightItalic.ttf differ
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index c552432..9f8c381 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -24,6 +24,7 @@ void MainWindow::loadFromRecipe(Recipe recipe){
setAuthorName("Click 'New' to get started.");
} else {
setRecipeName(recipe.getName());
+ setAuthorName(recipe.getAuthor());
setInstruction(recipe.getInstruction());
setIngredients(recipe.getIngredients());
if (recipe.getImage().isNull()){
@@ -72,7 +73,11 @@ void MainWindow::setTags(vector tags){
}
void MainWindow::setAuthorName(string name){
- ui->authorLabel->setText(QString::fromStdString(name));
+ if (name.empty()){
+ ui->authorLabel->setText("");
+ } else {
+ ui->authorLabel->setText(QString::fromStdString("By "+name));
+ }
}
void MainWindow::on_newButton_clicked(){
diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui
index 69bddb9..a80624e 100644
--- a/gui/mainwindow.ui
+++ b/gui/mainwindow.ui
@@ -19,6 +19,11 @@
0
+
+
+ Noto Sans
+
+
false
@@ -26,13 +31,19 @@
RecipeDB
-
+
:/images/images/icon.png:/images/images/icon.png
1.000000000000000
+
+
+
+
+
+
0
@@ -113,9 +124,7 @@
- Noto Sans CJK KR Light
20
- PreferAntialias
@@ -157,9 +166,7 @@ QPushButton#newButton:pressed{
- Noto Sans CJK KR Light
20
- PreferAntialias
@@ -192,9 +199,7 @@ QPushButton#openButton:pressed{
- Noto Sans CJK KR Light
20
- PreferAntialias
@@ -236,9 +241,7 @@ QPushButton#editButton:pressed{
- Noto Sans CJK KR Light
20
- PreferAntialias
@@ -345,11 +348,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Light
30
- 50
- false
- false
PreferAntialias
@@ -374,9 +373,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Light
- 14
- PreferAntialias
+ 16
@@ -442,8 +439,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Light
- 12
+ 14
@@ -461,8 +457,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Light
- 12
+ 14
@@ -477,8 +472,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Light
- 12
+ 14
@@ -562,8 +556,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Thin
- 18
+ 14
@@ -587,9 +580,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Light
12
- PreferAntialias
@@ -673,8 +664,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Thin
- 18
+ 14
@@ -692,8 +682,7 @@ font: "Noto Sans CJK KR";
- Noto Sans CJK KR Medium
- PreferAntialias
+ 12
@@ -727,7 +716,7 @@ font: "Noto Sans CJK KR";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Noto Sans CJK KR Medium'; font-size:11pt; font-weight:400; font-style:normal;">
+</style></head><body style=" font-family:'Liberation Serif Bold'; font-size:12pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; color:#00ff40;">This is some </span><span style=" font-family:'MS Shell Dlg 2'; font-size:16pt; color:#a33c3e;">colored text and </span><a href="https://www.google.com"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;">link</span></a></p></body></html>
@@ -810,7 +799,7 @@ p, li { white-space: pre-wrap; }
- :/images/images/no_image.png
+ :/images/images/no_image.png
false
@@ -851,9 +840,7 @@ p, li { white-space: pre-wrap; }
- Noto Sans CJK KR Light
- 16
- PreferAntialias
+ 14
@@ -866,13 +853,6 @@ p, li { white-space: pre-wrap; }
-
-
-
- Noto Sans CJK KR Light
- 12
- PreferAntialias
-
-
background-color: rgb(255, 255, 255);
@@ -908,7 +888,7 @@ p, li { white-space: pre-wrap; }
-
+
diff --git a/gui/newDialogs/newfoodgroupdialog.ui b/gui/newDialogs/newfoodgroupdialog.ui
index bbd72d3..42d9030 100644
--- a/gui/newDialogs/newfoodgroupdialog.ui
+++ b/gui/newDialogs/newfoodgroupdialog.ui
@@ -19,15 +19,17 @@
New Food Group
-
+
:/images/images/icon.png:/images/images/icon.png
+
+
+
-
- Noto Sans CJK KR Light
12
@@ -43,7 +45,6 @@
- Noto Sans CJK KR Light
12
@@ -62,7 +63,7 @@
-
+
diff --git a/gui/newDialogs/newingredientdialog.ui b/gui/newDialogs/newingredientdialog.ui
index 792e239..30e9aed 100644
--- a/gui/newDialogs/newingredientdialog.ui
+++ b/gui/newDialogs/newingredientdialog.ui
@@ -14,7 +14,7 @@
New Ingredient
-
+
:/images/images/icon.png:/images/images/icon.png
@@ -81,7 +81,7 @@
-
+
:/images/images/plus_icon.png:/images/images/plus_icon.png
@@ -92,7 +92,7 @@
-
+
:/images/images/minus_icon.png:/images/images/minus_icon.png
@@ -119,7 +119,7 @@
-
+
diff --git a/gui/newDialogs/newtagdialog.ui b/gui/newDialogs/newtagdialog.ui
index 72ea9f2..92b8d62 100644
--- a/gui/newDialogs/newtagdialog.ui
+++ b/gui/newDialogs/newtagdialog.ui
@@ -14,11 +14,11 @@
New Tag
-
+
:/images/images/icon.png:/images/images/icon.png
- font: 25 "Noto Sans CJK KR Light";
+
true
@@ -32,7 +32,7 @@
13
- 3
+ 50
false
false
@@ -50,7 +50,7 @@
12
- 3
+ 50
false
false
@@ -73,7 +73,7 @@
-
+
diff --git a/gui/newDialogs/newunitdialog.ui b/gui/newDialogs/newunitdialog.ui
index 92fc161..fd3ada6 100644
--- a/gui/newDialogs/newunitdialog.ui
+++ b/gui/newDialogs/newunitdialog.ui
@@ -14,11 +14,11 @@
New Unit
-
+
:/images/images/icon.png:/images/images/icon.png
- font: 25 "Noto Sans CJK KR Light";
+
true
@@ -32,7 +32,7 @@
12
- 3
+ 50
false
false
@@ -53,7 +53,7 @@
12
- 3
+ 50
false
false
@@ -74,7 +74,7 @@
12
- 3
+ 50
false
false
@@ -116,7 +116,7 @@
12
- 3
+ 50
false
false
@@ -147,7 +147,7 @@
12
- 3
+ 50
false
false
@@ -189,7 +189,7 @@
-
+
diff --git a/gui/newrecipedialog.ui b/gui/newrecipedialog.ui
index 50bee64..9759320 100644
--- a/gui/newrecipedialog.ui
+++ b/gui/newrecipedialog.ui
@@ -23,11 +23,11 @@
New Recipe
-
+
:/images/images/icon.png:/images/images/icon.png
- font: 25 "Noto Sans CJK KR";
+
true
@@ -104,7 +104,7 @@
14
- 3
+ 50
false
false
@@ -128,7 +128,7 @@
12
- 3
+ 50
false
false
@@ -175,7 +175,7 @@
0
1999
12
- 22
+ 21
@@ -326,7 +326,7 @@
background-color: rgb(255, 255, 255);
-
+
:/images/images/plus_icon.png:/images/images/plus_icon.png
@@ -340,7 +340,7 @@
background-color: rgb(255, 255, 255);
-
+
:/images/images/minus_icon.png:/images/images/minus_icon.png
@@ -578,7 +578,7 @@ QPushButton#deleteTagButton:pressed{
Create a new ingredient
-
+
:/images/images/plus_icon.png:/images/images/plus_icon.png
@@ -592,7 +592,7 @@ QPushButton#deleteTagButton:pressed{
-
+
:/images/images/minus_icon.png:/images/images/minus_icon.png
@@ -628,7 +628,7 @@ QPushButton#deleteTagButton:pressed{
- 3
+ 50
false
false
@@ -676,7 +676,7 @@ QPushButton#deleteTagButton:pressed{
Create a new unit of measure
-
+
:/images/images/plus_icon.png:/images/images/plus_icon.png
@@ -690,7 +690,7 @@ QPushButton#deleteTagButton:pressed{
-
+
:/images/images/minus_icon.png:/images/images/minus_icon.png
@@ -864,7 +864,7 @@ QPushButton#removeIngredientButton:pressed{
- :/images/images/no_image.png
+ :/images/images/no_image.png
false
@@ -900,7 +900,7 @@ QPushButton#removeIngredientButton:pressed{
- 3
+ 50
false
false
@@ -920,7 +920,7 @@ QPushButton#removeIngredientButton:pressed{
- 3
+ 50
false
false
@@ -990,7 +990,7 @@ QPushButton#removeIngredientButton:pressed{
-
+
diff --git a/gui/openrecipedialog.ui b/gui/openrecipedialog.ui
index 06db1f0..89ae5ea 100644
--- a/gui/openrecipedialog.ui
+++ b/gui/openrecipedialog.ui
@@ -14,11 +14,11 @@
Open Recipe
-
+
:/images/images/icon.png:/images/images/icon.png
- font: 25 "Noto Sans CJK KR Light";
+
true
@@ -63,11 +63,11 @@
QTabWidget::Rounded
- 1
+ 2
-
+
:/images/images/tag.png:/images/images/tag.png
@@ -121,7 +121,7 @@
-
+
:/images/images/ingredients.png:/images/images/ingredients.png
@@ -175,7 +175,7 @@
-
+
:/images/images/foodPyramid.png:/images/images/foodPyramid.png
@@ -238,7 +238,7 @@
12
- 3
+ 50
false
false
@@ -315,7 +315,7 @@ QPushButton#deleteRecipeButton:pressed{
-
+
:/images/images/trash.png:/images/images/trash.png
@@ -371,7 +371,7 @@ QPushButton#exitButton:pressed{
14
- 3
+ 50
false
false
@@ -411,7 +411,7 @@ QPushButton#exitButton:pressed{
-
+
diff --git a/main.cpp b/main.cpp
index cdd2938..bed054e 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,38 +1,13 @@
#include "gui/mainwindow.h"
#include "gui/newrecipedialog.h"
+
#include
+#include
#include "model/database/database.h"
#include "model/database/recipedatabase.h"
#include "utils/fileutils.h"
-void test(RecipeDatabase *recipeDB);
-
-Recipe checkForFirstRun(RecipeDatabase *recipeDB){
- Recipe r = recipeDB->retrieveRandomRecipe();
- if (r.isEmpty()){//There are no recipes in the database.
- //Add some basic units to the units, and some basic ingredients.
- recipeDB->addBasicUnits();
- recipeDB->addBasicIngredients();
- }
- return r;
-}
-
-int main(int argc, char *argv[])
-{
- RecipeDatabase recipeDB(QString(FileUtils::appDataPath+"recipes.db").toStdString());
-
- QApplication a(argc, argv);
- MainWindow w(&recipeDB);
- w.loadFromRecipe(checkForFirstRun(&recipeDB));
- w.show();
-
- a.exec();
- recipeDB.closeConnection();
-
- return 0;
-}
-
void test(RecipeDatabase *recipeDB){
vector ri;
ri.push_back(RecipeIngredient("flour", "grains", 3.0f, UnitOfMeasure("cup", "cups", "c", UnitOfMeasure::VOLUME, 1.0), ""));
@@ -54,3 +29,43 @@ void test(RecipeDatabase *recipeDB){
printf("Storage successful: %d\n", success);
}
+
+Recipe checkForFirstRun(RecipeDatabase *recipeDB){
+ Recipe r = recipeDB->retrieveRandomRecipe();
+ if (r.isEmpty()){//There are no recipes in the database.
+ //Add some basic units to the units, and some basic ingredients.
+ recipeDB->addBasicUnits();
+ recipeDB->addBasicIngredients();
+ }
+ return r;
+}
+
+void loadAndSetFonts(){
+ int id = QFontDatabase::addApplicationFont(":/fonts/fonts/NotoSans-Light.ttf");
+ if (id == -1){
+ return;
+ }
+ QString family = QFontDatabase::applicationFontFamilies(id).at(0);
+}
+
+int main(int argc, char *argv[])
+{
+ RecipeDatabase recipeDB(QString(FileUtils::appDataPath+"recipes.db").toStdString());
+
+ QApplication a(argc, argv);
+
+ loadAndSetFonts();
+ QFont notoFont("Noto Sans");
+ notoFont.setStyleHint(QFont::SansSerif);
+ notoFont.setWeight(QFont::Thin);
+ a.setFont(notoFont);
+
+ MainWindow w(&recipeDB);
+ w.loadFromRecipe(checkForFirstRun(&recipeDB));
+ w.show();
+
+ a.exec();
+ recipeDB.closeConnection();
+
+ return 0;
+}
diff --git a/model/recipe/ingredients/ingredientlistmodel.cpp b/model/recipe/ingredients/ingredientlistmodel.cpp
index 054a4d4..bbafe66 100644
--- a/model/recipe/ingredients/ingredientlistmodel.cpp
+++ b/model/recipe/ingredients/ingredientlistmodel.cpp
@@ -5,6 +5,7 @@ IngredientListModel::IngredientListModel(){
}
int IngredientListModel::rowCount(const QModelIndex &parent) const{
+ Q_UNUSED(parent);
return this->ingredients.size();
}
diff --git a/model/recipe/ingredients/recipeingredientlistmodel.cpp b/model/recipe/ingredients/recipeingredientlistmodel.cpp
index 26e98fd..18cdaa6 100644
--- a/model/recipe/ingredients/recipeingredientlistmodel.cpp
+++ b/model/recipe/ingredients/recipeingredientlistmodel.cpp
@@ -5,6 +5,7 @@ RecipeIngredientListModel::RecipeIngredientListModel(){
}
int RecipeIngredientListModel::rowCount(const QModelIndex &parent) const{
+ Q_UNUSED(parent);
return this->ingredients.size();
}
diff --git a/model/recipe/tags/taglistmodel.cpp b/model/recipe/tags/taglistmodel.cpp
index 149ad3e..4ce77c8 100644
--- a/model/recipe/tags/taglistmodel.cpp
+++ b/model/recipe/tags/taglistmodel.cpp
@@ -5,6 +5,7 @@ TagListModel::TagListModel(){
}
int TagListModel::rowCount(const QModelIndex &parent) const{
+ Q_UNUSED(parent);
return this->tags.size();
}
diff --git a/images.qrc b/res.qrc
similarity index 74%
rename from images.qrc
rename to res.qrc
index de44dca..255f2a7 100644
--- a/images.qrc
+++ b/res.qrc
@@ -10,4 +10,8 @@
images/foodPyramid.png
images/ingredients.png
+
+ fonts/NotoSans-Light.ttf
+ fonts/NotoSans-LightItalic.ttf
+
diff --git a/staticBuilder.sh b/staticBuilder.sh
new file mode 100755
index 0000000..f43baeb
--- /dev/null
+++ b/staticBuilder.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+#Builds a static release of the RecipeDB program for linux.
+echo "Building static release..."
+qmake
+make -C /home/andrew/Programming/Projects/staticRelease/ clean
+PATH=/home/andrew/Programming/Qt5_10static/bin:$PATH
+export PATH
+make -C /home/andrew/Programming/Projects/staticRelease/
+echo "Done!"
\ No newline at end of file
diff --git a/utils/aspectratiopixmaplabel.cpp b/utils/aspectratiopixmaplabel.cpp
index 9347b8e..6a2b9cf 100644
--- a/utils/aspectratiopixmaplabel.cpp
+++ b/utils/aspectratiopixmaplabel.cpp
@@ -31,6 +31,7 @@ QPixmap AspectRatioPixmapLabel::scaledPixmap() const
void AspectRatioPixmapLabel::resizeEvent(QResizeEvent * e)
{
+ Q_UNUSED(e);
if(!pix.isNull())
QLabel::setPixmap(scaledPixmap());
}