Actually Usable Version #7

Merged
andrewlalis merged 7 commits from development into master 2018-03-29 14:11:27 +00:00
10 changed files with 133 additions and 42 deletions
Showing only changes of commit cc802e5d0d - Show all commits

View File

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

View File

@ -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());
}

View File

@ -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();

View File

@ -26,6 +26,9 @@
<iconset resource="../images.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>
</property>
<property name="modal">
<bool>true</bool>
</property>
@ -97,9 +100,7 @@
<widget class="QLabel" name="recipeNameLabel">
<property name="font">
<font>
<family>Noto Sans CJK KR</family>
<pointsize>14</pointsize>
<weight>50</weight>
<weight>3</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -116,7 +117,9 @@
<widget class="QLineEdit" name="recipeNameEdit">
<property name="font">
<font>
<stylestrategy>PreferAntialias</stylestrategy>
<weight>3</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="alignment">
@ -532,9 +535,7 @@
<widget class="QLabel" name="amountLabel">
<property name="font">
<font>
<family>Noto Sans CJK KR</family>
<pointsize>14</pointsize>
<weight>50</weight>
<weight>3</weight>
<italic>false</italic>
<bold>false</bold>
</font>
@ -745,9 +746,9 @@
<widget class="QToolButton" name="italicsButton">
<property name="font">
<font>
<family>Liberation Serif</family>
<pointsize>12</pointsize>
<italic>true</italic>
<weight>3</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">
@ -765,10 +766,9 @@
<widget class="QToolButton" name="boldButton">
<property name="font">
<font>
<family>Liberation Serif</family>
<pointsize>12</pointsize>
<weight>75</weight>
<bold>true</bold>
<weight>3</weight>
<italic>false</italic>
<bold>false</bold>
</font>
</property>
<property name="text">

111
gui/openrecipedialog.ui Normal file
View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OpenRecipeDialog</class>
<widget class="QDialog" name="OpenRecipeDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Open Recipe</string>
</property>
<property name="windowIcon">
<iconset resource="../images.qrc">
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item alignment="Qt::AlignTop">
<widget class="QWidget" name="searchPanel" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QWidget" name="nameSearchPanel" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="nameEdit"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="tagsSearchpanel" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="tagLabel">
<property name="text">
<string>Tag</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="tagEdit"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="ingredientSearchPanel" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="ingredientLabel">
<property name="text">
<string>Ingredient</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="ingredientEdit"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QPushButton" name="searchButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/images/search_icon.png</normaloff>:/images/images/search_icon.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="contentPanel" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTableView" name="recipeTableView">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -4,5 +4,6 @@
<file>images/icon.png</file>
<file>images/plus_icon.png</file>
<file>images/minus_icon.png</file>
<file>images/search_icon.png</file>
</qresource>
</RCC>

BIN
images/search_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -1,19 +0,0 @@
<?xml version='1.0'?>
<ui version="4.0">
<class>OpenRecipeDialog</class>
<widget name="OpenRecipeDialog" class="QDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
</widget>
<resources/>
<connections/>
</ui>