Fixed new unit dialog, added open recipe dialog.
This commit is contained in:
parent
a34d46fa3d
commit
cc802e5d0d
|
@ -33,7 +33,7 @@ SOURCES += model/recipe/instruction.cpp \
|
||||||
gui/newDialogs/newunitdialog.cpp \
|
gui/newDialogs/newunitdialog.cpp \
|
||||||
utils/aspectratiopixmaplabel.cpp \
|
utils/aspectratiopixmaplabel.cpp \
|
||||||
utils/stringutils.cpp \
|
utils/stringutils.cpp \
|
||||||
openrecipedialog.cpp
|
gui/openrecipedialog.cpp
|
||||||
|
|
||||||
HEADERS += model/recipe/instruction.h \
|
HEADERS += model/recipe/instruction.h \
|
||||||
model/recipe/recipe.h \
|
model/recipe/recipe.h \
|
||||||
|
@ -56,7 +56,7 @@ HEADERS += model/recipe/instruction.h \
|
||||||
gui/newDialogs/newunitdialog.h \
|
gui/newDialogs/newunitdialog.h \
|
||||||
utils/aspectratiopixmaplabel.h \
|
utils/aspectratiopixmaplabel.h \
|
||||||
utils/stringutils.h \
|
utils/stringutils.h \
|
||||||
openrecipedialog.h
|
gui/openrecipedialog.h
|
||||||
|
|
||||||
LIBS += -ldl \
|
LIBS += -ldl \
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ FORMS += gui/mainwindow.ui \
|
||||||
gui/newDialogs/newingredientdialog.ui \
|
gui/newDialogs/newingredientdialog.ui \
|
||||||
gui/newDialogs/newtagdialog.ui \
|
gui/newDialogs/newtagdialog.ui \
|
||||||
gui/newDialogs/newunitdialog.ui \
|
gui/newDialogs/newunitdialog.ui \
|
||||||
openrecipedialog.ui
|
gui/openrecipedialog.ui
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
.gitignore
|
.gitignore
|
||||||
|
|
|
@ -8,10 +8,8 @@ NewUnitDialog::NewUnitDialog(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->typeComboBox->clear();
|
ui->typeComboBox->clear();
|
||||||
ui->typeComboBox->setItemData(0, "Mass");
|
QStringList list({"Mass", "Volume", "Length", "Misc"});
|
||||||
ui->typeComboBox->setItemData(1, "Volume");
|
ui->typeComboBox->insertItems(0, list);
|
||||||
ui->typeComboBox->setItemData(2, "Length");
|
|
||||||
ui->typeComboBox->setItemData(3, "Misc");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +21,7 @@ NewUnitDialog::~NewUnitDialog()
|
||||||
UnitOfMeasure NewUnitDialog::getUnit(){
|
UnitOfMeasure NewUnitDialog::getUnit(){
|
||||||
return UnitOfMeasure(ui->unitNameEdit->text().toLower().toStdString(),
|
return UnitOfMeasure(ui->unitNameEdit->text().toLower().toStdString(),
|
||||||
ui->pluralNameEdit->text().toLower().toStdString(),
|
ui->pluralNameEdit->text().toLower().toStdString(),
|
||||||
ui->abbreviationEdit->text().toLower().toStdString(),
|
ui->abbreviationEdit->text().toStdString(),
|
||||||
this->getSelectedType(),
|
this->getSelectedType(),
|
||||||
ui->coefficientSpinBox->value());
|
ui->coefficientSpinBox->value());
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ void NewRecipeDialog::on_newUnitButton_clicked(){
|
||||||
d.show();
|
d.show();
|
||||||
if (d.exec() == QDialog::Accepted){
|
if (d.exec() == QDialog::Accepted){
|
||||||
UnitOfMeasure u = d.getUnit();
|
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.");
|
QMessageBox::critical(this, "Error", "Unable to store new unit.");
|
||||||
} else {
|
} else {
|
||||||
this->populateUnitsBox();
|
this->populateUnitsBox();
|
||||||
|
|
|
@ -26,6 +26,9 @@
|
||||||
<iconset resource="../images.qrc">
|
<iconset resource="../images.qrc">
|
||||||
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
|
<normaloff>:/images/images/icon.png</normaloff>:/images/images/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">font: 25 "Noto Sans CJK KR";</string>
|
||||||
|
</property>
|
||||||
<property name="modal">
|
<property name="modal">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -97,9 +100,7 @@
|
||||||
<widget class="QLabel" name="recipeNameLabel">
|
<widget class="QLabel" name="recipeNameLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Noto Sans CJK KR</family>
|
<weight>3</weight>
|
||||||
<pointsize>14</pointsize>
|
|
||||||
<weight>50</weight>
|
|
||||||
<italic>false</italic>
|
<italic>false</italic>
|
||||||
<bold>false</bold>
|
<bold>false</bold>
|
||||||
</font>
|
</font>
|
||||||
|
@ -116,7 +117,9 @@
|
||||||
<widget class="QLineEdit" name="recipeNameEdit">
|
<widget class="QLineEdit" name="recipeNameEdit">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<stylestrategy>PreferAntialias</stylestrategy>
|
<weight>3</weight>
|
||||||
|
<italic>false</italic>
|
||||||
|
<bold>false</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
|
@ -532,9 +535,7 @@
|
||||||
<widget class="QLabel" name="amountLabel">
|
<widget class="QLabel" name="amountLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Noto Sans CJK KR</family>
|
<weight>3</weight>
|
||||||
<pointsize>14</pointsize>
|
|
||||||
<weight>50</weight>
|
|
||||||
<italic>false</italic>
|
<italic>false</italic>
|
||||||
<bold>false</bold>
|
<bold>false</bold>
|
||||||
</font>
|
</font>
|
||||||
|
@ -745,9 +746,9 @@
|
||||||
<widget class="QToolButton" name="italicsButton">
|
<widget class="QToolButton" name="italicsButton">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Liberation Serif</family>
|
<weight>3</weight>
|
||||||
<pointsize>12</pointsize>
|
<italic>false</italic>
|
||||||
<italic>true</italic>
|
<bold>false</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -765,10 +766,9 @@
|
||||||
<widget class="QToolButton" name="boldButton">
|
<widget class="QToolButton" name="boldButton">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Liberation Serif</family>
|
<weight>3</weight>
|
||||||
<pointsize>12</pointsize>
|
<italic>false</italic>
|
||||||
<weight>75</weight>
|
<bold>false</bold>
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|
|
@ -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>
|
|
@ -4,5 +4,6 @@
|
||||||
<file>images/icon.png</file>
|
<file>images/icon.png</file>
|
||||||
<file>images/plus_icon.png</file>
|
<file>images/plus_icon.png</file>
|
||||||
<file>images/minus_icon.png</file>
|
<file>images/minus_icon.png</file>
|
||||||
|
<file>images/search_icon.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
|
@ -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>
|
|
Loading…
Reference in New Issue