Merge pull request #11 from andrewlalis/development

Release 1.0 Ready!
This commit is contained in:
Andrew Lalis 2018-04-01 09:31:08 +02:00 committed by GitHub
commit c7b39cda21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 278 additions and 119 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="14.2">
<zoom_level>10</zoom_level>
<element>
<id>UMLClass</id>
<coordinates>
<x>60</x>
<y>160</y>
<w>230</w>
<h>140</h>
</coordinates>
<panel_attributes>recipe
--
recipeId INTEGER PRIMARY KEY
name varchar UNIQUE
authorName varchar
createdDate date
prepTime time
cookTime time
servingCount real</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>60</x>
<y>310</y>
<w>260</w>
<h>80</h>
</coordinates>
<panel_attributes>ingredient
--
ingredientId INTEGER PRIMARY KEY
foodGroup varchar
name varchar UNIQUE</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>60</x>
<y>400</y>
<w>270</w>
<h>110</h>
</coordinates>
<panel_attributes>unitOfMeasure
--
name varchar UNIQUE PRIMARY KEY
plural varchar
abbreviation varchar
type int
metricCoefficient real</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>430</x>
<y>160</y>
<w>280</w>
<h>70</h>
</coordinates>
<panel_attributes>recipeTag
--
recipeId int FOREIGN recipe(recipeId)
tagName varchar</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>430</x>
<y>240</y>
<w>360</w>
<h>110</h>
</coordinates>
<panel_attributes>recipeIngredient
--
recipeId FOREIGN recipe(recipeId)
ingredientId FOREIGN ingredient(ingredientId)
unitName varchar FOREIGN unitOfMeasure(name)
quantity real
comment varchar</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>280</x>
<y>180</y>
<w>170</w>
<h>30</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;150.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>340</x>
<y>180</y>
<w>110</w>
<h>110</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;90.0;90.0;90.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>310</x>
<y>280</y>
<w>140</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;60.0;80.0;60.0;80.0;10.0;120.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>320</x>
<y>300</y>
<w>130</w>
<h>150</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;130.0;90.0;130.0;90.0;10.0;110.0;10.0</additional_attributes>
</element>
<element>
<id>UMLPackage</id>
<coordinates>
<x>40</x>
<y>120</y>
<w>770</w>
<h>410</h>
</coordinates>
<panel_attributes>RecipeDatabase</panel_attributes>
<additional_attributes/>
</element>
</diagram>

View File

@ -79,4 +79,4 @@ DISTFILES += \
.gitignore
RESOURCES += \
images.qrc
res.qrc

BIN
fonts/NotoSans-Light.ttf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -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<RecipeTag> 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(){

View File

@ -19,6 +19,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Noto Sans</family>
</font>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
@ -26,13 +31,19 @@
<string>RecipeDB</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="windowOpacity">
<double>1.000000000000000</double>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="mainWidget">
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
@ -113,9 +124,7 @@
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>20</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="autoFillBackground">
@ -157,9 +166,7 @@ QPushButton#newButton:pressed{
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>20</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="styleSheet">
@ -192,9 +199,7 @@ QPushButton#openButton:pressed{
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>20</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="autoFillBackground">
@ -236,9 +241,7 @@ QPushButton#editButton:pressed{
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>20</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="autoFillBackground">
@ -345,11 +348,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>30</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
@ -374,9 +373,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>14</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
@ -442,8 +439,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<widget class="QLabel" name="prepTimeLabel">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
@ -461,8 +457,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
@ -477,8 +472,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<widget class="QLabel" name="servingsLabel">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
@ -562,8 +556,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Thin</family>
<pointsize>18</pointsize>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
@ -587,9 +580,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="styleSheet">
@ -673,8 +664,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
</property>
<property name="font">
<font>
<family>Noto Sans CJK KR Thin</family>
<pointsize>18</pointsize>
<pointsize>14</pointsize>
</font>
</property>
<property name="styleSheet">
@ -692,8 +682,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<widget class="QTextEdit" name="instructionsTextEdit">
<property name="font">
<font>
<family>Noto Sans CJK KR Medium</family>
<stylestrategy>PreferAntialias</stylestrategy>
<pointsize>12</pointsize>
</font>
</property>
<property name="styleSheet">
@ -727,7 +716,7 @@ font: &quot;Noto Sans CJK KR&quot;;</string>
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans CJK KR Medium'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Liberation Serif Bold'; font-size:12pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; color:#00ff40;&quot;&gt;This is some &lt;/span&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:16pt; color:#a33c3e;&quot;&gt;colored text and &lt;/span&gt;&lt;a href=&quot;https://www.google.com&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;link&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
@ -810,7 +799,7 @@ p, li { white-space: pre-wrap; }
</size>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/images/no_image.png</pixmap>
<pixmap resource="../res.qrc">:/images/images/no_image.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
@ -851,9 +840,7 @@ p, li { white-space: pre-wrap; }
<widget class="QLabel" name="tagsLabel">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>16</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
@ -866,13 +853,6 @@ p, li { white-space: pre-wrap; }
</item>
<item>
<widget class="QListView" name="tagsListView">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
<stylestrategy>PreferAntialias</stylestrategy>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
@ -908,7 +888,7 @@ p, li { white-space: pre-wrap; }
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -19,15 +19,17 @@
<string>New Food Group</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<iconset resource="../../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
</font>
</property>
@ -43,7 +45,6 @@
<widget class="QLineEdit" name="lineEdit">
<property name="font">
<font>
<family>Noto Sans CJK KR Light</family>
<pointsize>12</pointsize>
</font>
</property>
@ -62,7 +63,7 @@
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
<include location="../../res.qrc"/>
</resources>
<connections>
<connection>

View File

@ -14,7 +14,7 @@
<string>New Ingredient</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<iconset resource="../../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="modal">
@ -81,7 +81,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<iconset resource="../../res.qrc">
<normaloff>:/images/images/plus_icon.png</normaloff>:/images/images/plus_icon.png</iconset>
</property>
</widget>
@ -92,7 +92,7 @@
<string/>
</property>
<property name="icon">
<iconset resource="../../images.qrc">
<iconset resource="../../res.qrc">
<normaloff>:/images/images/minus_icon.png</normaloff>:/images/images/minus_icon.png</iconset>
</property>
</widget>
@ -119,7 +119,7 @@
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
<include location="../../res.qrc"/>
</resources>
<connections>
<connection>

View File

@ -14,11 +14,11 @@
<string>New Tag</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<iconset resource="../../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR Light&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -32,7 +32,7 @@
<property name="font">
<font>
<pointsize>13</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -50,7 +50,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -73,7 +73,7 @@
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
<include location="../../res.qrc"/>
</resources>
<connections>
<connection>

View File

@ -14,11 +14,11 @@
<string>New Unit</string>
</property>
<property name="windowIcon">
<iconset resource="../../images.qrc">
<iconset resource="../../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR Light&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -32,7 +32,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -53,7 +53,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -74,7 +74,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -116,7 +116,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -147,7 +147,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -189,7 +189,7 @@
</layout>
</widget>
<resources>
<include location="../../images.qrc"/>
<include location="../../res.qrc"/>
</resources>
<connections>
<connection>

View File

@ -23,11 +23,11 @@
<string>New Recipe</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -104,7 +104,7 @@
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -128,7 +128,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -175,7 +175,7 @@
<second>0</second>
<year>1999</year>
<month>12</month>
<day>22</day>
<day>21</day>
</datetime>
</property>
<property name="currentSection">
@ -326,7 +326,7 @@
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/plus_icon.png</normaloff>:/images/images/plus_icon.png</iconset>
</property>
</widget>
@ -340,7 +340,7 @@
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/minus_icon.png</normaloff>:/images/images/minus_icon.png</iconset>
</property>
</widget>
@ -578,7 +578,7 @@ QPushButton#deleteTagButton:pressed{
<string>Create a new ingredient</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/plus_icon.png</normaloff>:/images/images/plus_icon.png</iconset>
</property>
</widget>
@ -592,7 +592,7 @@ QPushButton#deleteTagButton:pressed{
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/minus_icon.png</normaloff>:/images/images/minus_icon.png</iconset>
</property>
</widget>
@ -628,7 +628,7 @@ QPushButton#deleteTagButton:pressed{
<widget class="QLabel" name="amountLabel">
<property name="font">
<font>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -676,7 +676,7 @@ QPushButton#deleteTagButton:pressed{
<string>Create a new unit of measure</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/plus_icon.png</normaloff>:/images/images/plus_icon.png</iconset>
</property>
</widget>
@ -690,7 +690,7 @@ QPushButton#deleteTagButton:pressed{
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/minus_icon.png</normaloff>:/images/images/minus_icon.png</iconset>
</property>
</widget>
@ -864,7 +864,7 @@ QPushButton#removeIngredientButton:pressed{
<string/>
</property>
<property name="pixmap">
<pixmap resource="../images.qrc">:/images/images/no_image.png</pixmap>
<pixmap resource="../res.qrc">:/images/images/no_image.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
@ -900,7 +900,7 @@ QPushButton#removeIngredientButton:pressed{
<widget class="QToolButton" name="italicsButton">
<property name="font">
<font>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -920,7 +920,7 @@ QPushButton#removeIngredientButton:pressed{
<widget class="QToolButton" name="boldButton">
<property name="font">
<font>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -990,7 +990,7 @@ QPushButton#removeIngredientButton:pressed{
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -14,11 +14,11 @@
<string>Open Recipe</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="styleSheet">
<string notr="true">font: 25 &quot;Noto Sans CJK KR Light&quot;;</string>
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
@ -63,11 +63,11 @@
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>2</number>
</property>
<widget class="QWidget" name="Tags">
<attribute name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/tag.png</normaloff>:/images/images/tag.png</iconset>
</attribute>
<attribute name="title">
@ -121,7 +121,7 @@
</widget>
<widget class="QWidget" name="ingredientsTab">
<attribute name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/ingredients.png</normaloff>:/images/images/ingredients.png</iconset>
</attribute>
<attribute name="title">
@ -175,7 +175,7 @@
</widget>
<widget class="QWidget" name="foodGroups">
<attribute name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/foodPyramid.png</normaloff>:/images/images/foodPyramid.png</iconset>
</attribute>
<attribute name="title">
@ -238,7 +238,7 @@
<property name="font">
<font>
<pointsize>12</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -315,7 +315,7 @@ QPushButton#deleteRecipeButton:pressed{
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<iconset resource="../res.qrc">
<normaloff>:/images/images/trash.png</normaloff>:/images/images/trash.png</iconset>
</property>
</widget>
@ -371,7 +371,7 @@ QPushButton#exitButton:pressed{
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>3</weight>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -411,7 +411,7 @@ QPushButton#exitButton:pressed{
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -1,38 +1,13 @@
#include "gui/mainwindow.h"
#include "gui/newrecipedialog.h"
#include <QApplication>
#include <QFontDatabase>
#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<RecipeIngredient> 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;
}

View File

@ -5,6 +5,7 @@ IngredientListModel::IngredientListModel(){
}
int IngredientListModel::rowCount(const QModelIndex &parent) const{
Q_UNUSED(parent);
return this->ingredients.size();
}

View File

@ -5,6 +5,7 @@ RecipeIngredientListModel::RecipeIngredientListModel(){
}
int RecipeIngredientListModel::rowCount(const QModelIndex &parent) const{
Q_UNUSED(parent);
return this->ingredients.size();
}

View File

@ -5,6 +5,7 @@ TagListModel::TagListModel(){
}
int TagListModel::rowCount(const QModelIndex &parent) const{
Q_UNUSED(parent);
return this->tags.size();
}

View File

@ -10,4 +10,8 @@
<file>images/foodPyramid.png</file>
<file>images/ingredients.png</file>
</qresource>
<qresource prefix="/fonts">
<file>fonts/NotoSans-Light.ttf</file>
<file>fonts/NotoSans-LightItalic.ttf</file>
</qresource>
</RCC>

9
staticBuilder.sh Executable file
View File

@ -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!"

View File

@ -31,6 +31,7 @@ QPixmap AspectRatioPixmapLabel::scaledPixmap() const
void AspectRatioPixmapLabel::resizeEvent(QResizeEvent * e)
{
Q_UNUSED(e);
if(!pix.isNull())
QLabel::setPixmap(scaledPixmap());
}