Merge pull request #6 from andrewlalis/development
Completed viewing of recipes, beginning of browsing feature.
This commit is contained in:
commit
1af1511779
16
RecipeDB.pro
16
RecipeDB.pro
|
@ -29,7 +29,11 @@ SOURCES += model/recipe/instruction.cpp \
|
||||||
gui/newrecipedialog.cpp \
|
gui/newrecipedialog.cpp \
|
||||||
model/recipe/tags/taglistmodel.cpp \
|
model/recipe/tags/taglistmodel.cpp \
|
||||||
gui/newDialogs/newingredientdialog.cpp \
|
gui/newDialogs/newingredientdialog.cpp \
|
||||||
gui/newDialogs/newtagdialog.cpp
|
gui/newDialogs/newtagdialog.cpp \
|
||||||
|
gui/newDialogs/newunitdialog.cpp \
|
||||||
|
utils/aspectratiopixmaplabel.cpp \
|
||||||
|
utils/stringutils.cpp \
|
||||||
|
openrecipedialog.cpp
|
||||||
|
|
||||||
HEADERS += model/recipe/instruction.h \
|
HEADERS += model/recipe/instruction.h \
|
||||||
model/recipe/recipe.h \
|
model/recipe/recipe.h \
|
||||||
|
@ -48,14 +52,20 @@ HEADERS += model/recipe/instruction.h \
|
||||||
gui/newrecipedialog.h \
|
gui/newrecipedialog.h \
|
||||||
model/recipe/tags/taglistmodel.h \
|
model/recipe/tags/taglistmodel.h \
|
||||||
gui/newDialogs/newingredientdialog.h \
|
gui/newDialogs/newingredientdialog.h \
|
||||||
gui/newDialogs/newtagdialog.h
|
gui/newDialogs/newtagdialog.h \
|
||||||
|
gui/newDialogs/newunitdialog.h \
|
||||||
|
utils/aspectratiopixmaplabel.h \
|
||||||
|
utils/stringutils.h \
|
||||||
|
openrecipedialog.h
|
||||||
|
|
||||||
LIBS += -ldl \
|
LIBS += -ldl \
|
||||||
|
|
||||||
FORMS += gui/mainwindow.ui \
|
FORMS += gui/mainwindow.ui \
|
||||||
gui/newrecipedialog.ui \
|
gui/newrecipedialog.ui \
|
||||||
gui/newDialogs/newingredientdialog.ui \
|
gui/newDialogs/newingredientdialog.ui \
|
||||||
gui/newDialogs/newtagdialog.ui
|
gui/newDialogs/newtagdialog.ui \
|
||||||
|
gui/newDialogs/newunitdialog.ui \
|
||||||
|
openrecipedialog.ui
|
||||||
|
|
||||||
DISTFILES += \
|
DISTFILES += \
|
||||||
.gitignore
|
.gitignore
|
||||||
|
|
|
@ -242,7 +242,7 @@ QPushButton#browseButton:pressed{
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="basicInfoPanel" native="true">
|
<widget class="QWidget" name="titlePanel" native="true">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>50</weight>
|
<weight>50</weight>
|
||||||
|
@ -270,119 +270,6 @@ font: "Noto Sans CJK KR";</string>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item alignment="Qt::AlignLeft">
|
|
||||||
<widget class="QWidget" name="basicInfoSubPanel" native="true">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Noto Sans CJK KR Light</family>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="prepTimePanel" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="prepTimeLabel">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Noto Sans CJK KR Light</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Prep Time:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="cookTimePanel" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="cookTimeLabel">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Noto Sans CJK KR Light</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Cook Time:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="servingsPanel" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="servingsLabel">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Noto Sans CJK KR Light</family>
|
|
||||||
<pointsize>12</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Servings:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="recipeNameLabel">
|
<widget class="QLabel" name="recipeNameLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -419,14 +306,8 @@ font: "Noto Sans CJK KR";</string>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="displayPanelContent" native="true">
|
<widget class="QWidget" name="allInfoPanel" native="true">
|
||||||
<property name="sizePolicy">
|
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -442,219 +323,78 @@ font: "Noto Sans CJK KR";</string>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item alignment="Qt::AlignLeft">
|
|
||||||
<widget class="QWidget" name="ingredientsPanel" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>250</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="ingredientsLabel">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<family>Noto Sans CJK KR Thin</family>
|
|
||||||
<pointsize>18</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(194, 196, 233);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Ingredients</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListView" name="ingredientsListView">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<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(232, 232, 232);</string>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWidth">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::NoSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="isWrapping" stdset="0">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="layoutMode">
|
|
||||||
<enum>QListView::SinglePass</enum>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="instructionsPanel" native="true">
|
<widget class="QWidget" name="basicData" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>400</width>
|
<width>0</width>
|
||||||
<height>0</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(208, 204, 255);</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="topMargin">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item alignment="Qt::AlignTop">
|
<item>
|
||||||
<widget class="QLabel" name="instructionsLabel">
|
<widget class="QLabel" name="prepTimeLabel">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Noto Sans CJK KR Thin</family>
|
<family>Noto Sans CJK KR Light</family>
|
||||||
<pointsize>18</pointsize>
|
<pointsize>12</pointsize>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(218, 219, 234);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Instructions</string>
|
<string>Prep Time:</string>
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextEdit" name="instructionsTextEdit">
|
<widget class="QLabel" name="cookTimeLabel">
|
||||||
<property name="font">
|
<property name="enabled">
|
||||||
<font>
|
|
||||||
<family>Noto Sans CJK KR Medium</family>
|
|
||||||
<stylestrategy>PreferAntialias</stylestrategy>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(244, 244, 244);</string>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Plain</enum>
|
|
||||||
</property>
|
|
||||||
<property name="lineWidth">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalScrollBarPolicy">
|
|
||||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeAdjustPolicy">
|
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
|
||||||
</property>
|
|
||||||
<property name="autoFormatting">
|
|
||||||
<set>QTextEdit::AutoNone</set>
|
|
||||||
</property>
|
|
||||||
<property name="lineWrapMode">
|
|
||||||
<enum>QTextEdit::WidgetWidth</enum>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="html">
|
<property name="font">
|
||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<font>
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<family>Noto Sans CJK KR Light</family>
|
||||||
p, li { white-space: pre-wrap; }
|
<pointsize>12</pointsize>
|
||||||
</style></head><body style=" font-family:'Noto Sans CJK KR Medium'; font-size:11pt; font-weight:400; font-style:normal;">
|
</font>
|
||||||
<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></string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="textInteractionFlags">
|
<property name="text">
|
||||||
<set>Qt::TextSelectableByMouse</set>
|
<string>Cook Time:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="servingsLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Noto Sans CJK KR Light</family>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Servings:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -662,23 +402,14 @@ p, li { white-space: pre-wrap; }
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="imagePanelWidget" native="true">
|
<widget class="QWidget" name="mainInfoPanel" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="imagePanel">
|
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -694,17 +425,372 @@ p, li { white-space: pre-wrap; }
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QWidget" name="ingredientsPanel" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>250</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="ingredientsLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Noto Sans CJK KR Thin</family>
|
||||||
|
<pointsize>18</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(194, 196, 233);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ingredients</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QListView" name="ingredientsListView">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<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(232, 232, 232);</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="isWrapping" stdset="0">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="layoutMode">
|
||||||
|
<enum>QListView::SinglePass</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="imageLabel">
|
<widget class="QWidget" name="instructionsPanel" native="true">
|
||||||
<property name="pixmap">
|
<property name="sizePolicy">
|
||||||
<pixmap resource="../images.qrc">:/images/images/no_image.png</pixmap>
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="scaledContents">
|
<property name="minimumSize">
|
||||||
<bool>false</bool>
|
<size>
|
||||||
|
<width>400</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item alignment="Qt::AlignTop">
|
||||||
|
<widget class="QLabel" name="instructionsLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Noto Sans CJK KR Thin</family>
|
||||||
|
<pointsize>18</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(218, 219, 234);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Instructions</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="instructionsTextEdit">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Noto Sans CJK KR Medium</family>
|
||||||
|
<stylestrategy>PreferAntialias</stylestrategy>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(244, 244, 244);</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="horizontalScrollBarPolicy">
|
||||||
|
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoFormatting">
|
||||||
|
<set>QTextEdit::AutoNone</set>
|
||||||
|
</property>
|
||||||
|
<property name="lineWrapMode">
|
||||||
|
<enum>QTextEdit::WidgetWidth</enum>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="html">
|
||||||
|
<string><!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;">
|
||||||
|
<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></string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignTop">
|
||||||
|
<widget class="QWidget" name="imageAndTags" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="imagePanel">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="imagePanelWidget" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="AspectRatioPixmapLabel" name="imageLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>200</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../images.qrc">:/images/images/no_image.png</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignTop">
|
||||||
|
<widget class="QWidget" name="tagsPanel" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(243, 243, 243);</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="tagsLabel">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Noto Sans CJK KR Light</family>
|
||||||
|
<pointsize>16</pointsize>
|
||||||
|
<stylestrategy>PreferAntialias</stylestrategy>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Tags</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</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>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -720,6 +806,13 @@ p, li { white-space: pre-wrap; }
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>AspectRatioPixmapLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>utils/aspectratiopixmaplabel.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#include "newunitdialog.h"
|
||||||
|
#include "ui_newunitdialog.h"
|
||||||
|
|
||||||
|
NewUnitDialog::NewUnitDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::NewUnitDialog)
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NewUnitDialog::~NewUnitDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnitOfMeasure NewUnitDialog::getUnit(){
|
||||||
|
return UnitOfMeasure(ui->unitNameEdit->text().toLower().toStdString(),
|
||||||
|
ui->pluralNameEdit->text().toLower().toStdString(),
|
||||||
|
ui->abbreviationEdit->text().toLower().toStdString(),
|
||||||
|
this->getSelectedType(),
|
||||||
|
ui->coefficientSpinBox->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
int NewUnitDialog::getSelectedType(){
|
||||||
|
return ui->typeComboBox->currentIndex();
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef NEWUNITDIALOG_H
|
||||||
|
#define NEWUNITDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
#include "model/recipe/ingredients/unitofmeasure.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class NewUnitDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class NewUnitDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit NewUnitDialog(QWidget *parent = 0);
|
||||||
|
~NewUnitDialog();
|
||||||
|
|
||||||
|
UnitOfMeasure getUnit();
|
||||||
|
private:
|
||||||
|
Ui::NewUnitDialog *ui;
|
||||||
|
|
||||||
|
int getSelectedType();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NEWUNITDIALOG_H
|
|
@ -0,0 +1,185 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>NewUnitDialog</class>
|
||||||
|
<widget class="QDialog" name="NewUnitDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>240</width>
|
||||||
|
<height>350</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>New Unit</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="contentPanel" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Unit Name</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="unitNameEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Plural Name</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="pluralNameEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Abbreviation</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="abbreviationEdit"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="unitTypePanel" native="true">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="typeComboBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="coefficientPanel" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Metric Coefficient</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="coefficientSpinBox">
|
||||||
|
<property name="maximum">
|
||||||
|
<double>1000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../images.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>NewUnitDialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>NewUnitDialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -144,6 +144,7 @@ void NewRecipeDialog::on_newTagButton_clicked(){
|
||||||
RecipeTag tag = d.getTag();
|
RecipeTag tag = d.getTag();
|
||||||
//Temporarily add this to the tags list, and it will be saved if the recipe is saved.
|
//Temporarily add this to the tags list, and it will be saved if the recipe is saved.
|
||||||
this->tags.push_back(tag);
|
this->tags.push_back(tag);
|
||||||
|
this->tagsListModel.addTag(tag);
|
||||||
ui->tagsComboBox->clear();
|
ui->tagsComboBox->clear();
|
||||||
for (unsigned int i = 0; i < this->tags.size(); i++){
|
for (unsigned int i = 0; i < this->tags.size(); i++){
|
||||||
QString s = QString::fromStdString(this->tags[i].getValue());
|
QString s = QString::fromStdString(this->tags[i].getValue());
|
||||||
|
@ -166,3 +167,16 @@ void NewRecipeDialog::on_removeTagButton_clicked(){
|
||||||
this->populateTagsBox();
|
this->populateTagsBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewRecipeDialog::on_newUnitButton_clicked(){
|
||||||
|
NewUnitDialog d(this);
|
||||||
|
d.show();
|
||||||
|
if (d.exec() == QDialog::Accepted){
|
||||||
|
UnitOfMeasure u = d.getUnit();
|
||||||
|
if (!this->recipeDB->storeUnitOfMeasure(u)){
|
||||||
|
QMessageBox::critical(this, "Error", "Unable to store new unit.");
|
||||||
|
} else {
|
||||||
|
this->populateUnitsBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "gui/newDialogs/newingredientdialog.h"
|
#include "gui/newDialogs/newingredientdialog.h"
|
||||||
#include "gui/newDialogs/newtagdialog.h"
|
#include "gui/newDialogs/newtagdialog.h"
|
||||||
|
#include "gui/newDialogs/newunitdialog.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class NewRecipeDialog;
|
class NewRecipeDialog;
|
||||||
|
@ -54,6 +55,8 @@ class NewRecipeDialog : public QDialog
|
||||||
|
|
||||||
void on_removeTagButton_clicked();
|
void on_removeTagButton_clicked();
|
||||||
|
|
||||||
|
void on_newUnitButton_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::NewRecipeDialog *ui;
|
Ui::NewRecipeDialog *ui;
|
||||||
RecipeDatabase *recipeDB;
|
RecipeDatabase *recipeDB;
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
<second>0</second>
|
<second>0</second>
|
||||||
<year>1999</year>
|
<year>1999</year>
|
||||||
<month>12</month>
|
<month>12</month>
|
||||||
<day>27</day>
|
<day>26</day>
|
||||||
</datetime>
|
</datetime>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentSection">
|
<property name="currentSection">
|
||||||
|
@ -662,6 +662,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="imagePanel" native="true">
|
<widget class="QWidget" name="imagePanel" native="true">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
|
@ -679,7 +682,13 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="imageDisplayLabel">
|
<widget class="AspectRatioPixmapLabel" name="imageDisplayLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>500</width>
|
<width>500</width>
|
||||||
|
@ -693,7 +702,7 @@
|
||||||
<pixmap resource="../images.qrc">:/images/images/no_image.png</pixmap>
|
<pixmap resource="../images.qrc">:/images/images/no_image.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
<property name="scaledContents">
|
<property name="scaledContents">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
@ -816,6 +825,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>AspectRatioPixmapLabel</class>
|
||||||
|
<extends>QLabel</extends>
|
||||||
|
<header>utils/aspectratiopixmaplabel.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -12,17 +12,7 @@ QVariant IngredientListModel::data(const QModelIndex &index, int role) const{
|
||||||
int row = index.row();
|
int row = index.row();
|
||||||
RecipeIngredient i = this->ingredients[row];
|
RecipeIngredient i = this->ingredients[row];
|
||||||
|
|
||||||
string displayStr;
|
string displayStr = i.toString();
|
||||||
|
|
||||||
if (std::ceil(i.getQuantity()) == i.getQuantity()){
|
|
||||||
//The quantity is an integer and should be casted.
|
|
||||||
displayStr += std::to_string((int)i.getQuantity());
|
|
||||||
} else {
|
|
||||||
float q = i.getQuantity();
|
|
||||||
displayStr += toString(q);
|
|
||||||
}
|
|
||||||
|
|
||||||
displayStr += " " + i.getUnit().getAbbreviation() + " " + i.getName();
|
|
||||||
|
|
||||||
switch(role){
|
switch(role){
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
|
@ -61,17 +51,3 @@ void IngredientListModel::deleteIngredient(int index){
|
||||||
vector<RecipeIngredient> IngredientListModel::getIngredients(){
|
vector<RecipeIngredient> IngredientListModel::getIngredients(){
|
||||||
return this->ingredients;
|
return this->ingredients;
|
||||||
}
|
}
|
||||||
|
|
||||||
string toString(float val){
|
|
||||||
float decimal = std::fmod(val, 1.0f);
|
|
||||||
int places = 1;
|
|
||||||
while (std::fmod(decimal * 10, 1.0f) > 0){
|
|
||||||
decimal *= 10;
|
|
||||||
places++;
|
|
||||||
}
|
|
||||||
char buffer[50];
|
|
||||||
string arg = "%."+std::to_string(places)+"f";
|
|
||||||
sprintf(buffer, arg.c_str(), val);
|
|
||||||
string s = buffer;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
|
@ -28,6 +28,4 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
string toString(float val);
|
|
||||||
|
|
||||||
#endif // INGREDIENTLISTMODEL_H
|
#endif // INGREDIENTLISTMODEL_H
|
||||||
|
|
|
@ -39,5 +39,18 @@ void RecipeIngredient::setUnit(UnitOfMeasure newUnit){
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecipeIngredient::setComment(string newComment){
|
void RecipeIngredient::setComment(string newComment){
|
||||||
this->comment = newComment;
|
this->comment = newComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
string RecipeIngredient::toString(){
|
||||||
|
string result;
|
||||||
|
if (std::ceil(this->getQuantity()) == this->getQuantity()){
|
||||||
|
result += std::to_string((int)this->getQuantity());
|
||||||
|
} else {
|
||||||
|
result += StringUtils::toString(this->getQuantity());
|
||||||
|
}
|
||||||
|
result += " " + this->getUnit().getAbbreviation() + " " + this->getName();
|
||||||
|
if (!this->getComment().empty()) result += " ~" + this->getComment();
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
#define RECIPEINGREDIENT_H
|
#define RECIPEINGREDIENT_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include "model/recipe/ingredients/ingredient.h"
|
#include "model/recipe/ingredients/ingredient.h"
|
||||||
#include "model/recipe/ingredients/unitofmeasure.h"
|
#include "model/recipe/ingredients/unitofmeasure.h"
|
||||||
|
#include "utils/stringutils.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ public:
|
||||||
void setQuantity(float newQuantity);
|
void setQuantity(float newQuantity);
|
||||||
void setUnit(UnitOfMeasure newUnit);
|
void setUnit(UnitOfMeasure newUnit);
|
||||||
void setComment(string newComment);
|
void setComment(string newComment);
|
||||||
|
string toString();
|
||||||
private:
|
private:
|
||||||
float quantity;
|
float quantity;
|
||||||
UnitOfMeasure unit;
|
UnitOfMeasure unit;
|
||||||
|
|
|
@ -13,10 +13,10 @@ class UnitOfMeasure
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//Constants Declarations.
|
//Constants Declarations.
|
||||||
static const int MASS = 1;
|
static const int MASS = 0;
|
||||||
static const int VOLUME = 2;
|
static const int VOLUME = 1;
|
||||||
static const int LENGTH = 3;
|
static const int LENGTH = 2;
|
||||||
static const int MISC = 4;
|
static const int MISC = 3;
|
||||||
|
|
||||||
//Full constructor.
|
//Full constructor.
|
||||||
UnitOfMeasure(string name, string plural, string abbreviation, int type, double coef);
|
UnitOfMeasure(string name, string plural, string abbreviation, int type, double coef);
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "openrecipedialog.h"
|
||||||
|
#include "ui_openrecipedialog.h"
|
||||||
|
|
||||||
|
OpenRecipeDialog::OpenRecipeDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::OpenRecipeDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenRecipeDialog::~OpenRecipeDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef OPENRECIPEDIALOG_H
|
||||||
|
#define OPENRECIPEDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class OpenRecipeDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class OpenRecipeDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit OpenRecipeDialog(QWidget *parent = 0);
|
||||||
|
~OpenRecipeDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::OpenRecipeDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPENRECIPEDIALOG_H
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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>
|
|
@ -7,6 +7,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->ingredientsListView->setModel(&this->ingredientModel);
|
ui->ingredientsListView->setModel(&this->ingredientModel);
|
||||||
|
ui->tagsListView->setModel(&this->tagsListModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::MainWindow(RecipeDatabase *db, QWidget *parent) : MainWindow(parent){
|
MainWindow::MainWindow(RecipeDatabase *db, QWidget *parent) : MainWindow(parent){
|
||||||
|
@ -21,10 +22,15 @@ void MainWindow::loadFromRecipe(Recipe recipe){
|
||||||
setRecipeName(recipe.getName());
|
setRecipeName(recipe.getName());
|
||||||
setInstruction(recipe.getInstruction());
|
setInstruction(recipe.getInstruction());
|
||||||
setIngredients(recipe.getIngredients());
|
setIngredients(recipe.getIngredients());
|
||||||
setImage(recipe.getImage());
|
if (recipe.getImage().isNull()){
|
||||||
|
setImage(QImage(QString(":/images/images/no_image.png")));
|
||||||
|
} else {
|
||||||
|
setImage(recipe.getImage());
|
||||||
|
}
|
||||||
setPrepTime(recipe.getPrepTime());
|
setPrepTime(recipe.getPrepTime());
|
||||||
setCookTime(recipe.getCookTime());
|
setCookTime(recipe.getCookTime());
|
||||||
setServings(recipe.getServings());
|
setServings(recipe.getServings());
|
||||||
|
setTags(recipe.getTags());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setRecipeName(string name){
|
void MainWindow::setRecipeName(string name){
|
||||||
|
@ -52,7 +58,11 @@ void MainWindow::setCookTime(QTime cookTime){
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setServings(float servings){
|
void MainWindow::setServings(float servings){
|
||||||
ui->servingsLabel->setText(QString("Servings: ")+QString::fromStdString(toString(servings)));
|
ui->servingsLabel->setText(QString("Servings: ")+QString::fromStdString(StringUtils::toString(servings)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::setTags(vector<RecipeTag> tags){
|
||||||
|
this->tagsListModel.setTags(tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_newButton_clicked(){
|
void MainWindow::on_newButton_clicked(){
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "model/recipe/recipe.h"
|
#include "model/recipe/recipe.h"
|
||||||
#include "model/recipe/ingredients/ingredientlistmodel.h"
|
#include "model/recipe/ingredients/ingredientlistmodel.h"
|
||||||
#include "gui/newrecipedialog.h"
|
#include "gui/newrecipedialog.h"
|
||||||
|
#include "utils/stringutils.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ public:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
RecipeDatabase *recipeDB;
|
RecipeDatabase *recipeDB;
|
||||||
IngredientListModel ingredientModel;
|
IngredientListModel ingredientModel;
|
||||||
|
TagListModel tagsListModel;
|
||||||
|
|
||||||
//Hidden manipulation methods.
|
//Hidden manipulation methods.
|
||||||
void setRecipeName(string name);
|
void setRecipeName(string name);
|
||||||
|
@ -42,6 +44,7 @@ public:
|
||||||
void setPrepTime(QTime prepTime);
|
void setPrepTime(QTime prepTime);
|
||||||
void setCookTime(QTime cookTime);
|
void setCookTime(QTime cookTime);
|
||||||
void setServings(float servings);
|
void setServings(float servings);
|
||||||
|
void setTags(vector<RecipeTag> tags);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#include "aspectratiopixmaplabel.h"
|
||||||
|
|
||||||
|
AspectRatioPixmapLabel::AspectRatioPixmapLabel(QWidget *parent) :
|
||||||
|
QLabel(parent)
|
||||||
|
{
|
||||||
|
this->setMinimumSize(1,1);
|
||||||
|
setScaledContents(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AspectRatioPixmapLabel::setPixmap ( const QPixmap & p)
|
||||||
|
{
|
||||||
|
pix = p;
|
||||||
|
QLabel::setPixmap(scaledPixmap());
|
||||||
|
}
|
||||||
|
|
||||||
|
int AspectRatioPixmapLabel::heightForWidth( int width ) const
|
||||||
|
{
|
||||||
|
return pix.isNull() ? this->height() : ((qreal)pix.height()*width)/pix.width();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize AspectRatioPixmapLabel::sizeHint() const
|
||||||
|
{
|
||||||
|
int w = this->width();
|
||||||
|
return QSize( w, heightForWidth(w) );
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap AspectRatioPixmapLabel::scaledPixmap() const
|
||||||
|
{
|
||||||
|
return pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AspectRatioPixmapLabel::resizeEvent(QResizeEvent * e)
|
||||||
|
{
|
||||||
|
if(!pix.isNull())
|
||||||
|
QLabel::setPixmap(scaledPixmap());
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef ASPECTRATIOPIXMAPLABEL_H
|
||||||
|
#define ASPECTRATIOPIXMAPLABEL_H
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
|
||||||
|
class AspectRatioPixmapLabel : public QLabel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit AspectRatioPixmapLabel(QWidget *parent = 0);
|
||||||
|
virtual int heightForWidth( int width ) const;
|
||||||
|
virtual QSize sizeHint() const;
|
||||||
|
QPixmap scaledPixmap() const;
|
||||||
|
public slots:
|
||||||
|
void setPixmap ( const QPixmap & );
|
||||||
|
void resizeEvent(QResizeEvent *);
|
||||||
|
private:
|
||||||
|
QPixmap pix;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ASPECTRATIOPIXMAPLABEL_H
|
|
@ -0,0 +1,19 @@
|
||||||
|
#include "stringutils.h"
|
||||||
|
|
||||||
|
namespace StringUtils{
|
||||||
|
|
||||||
|
std::string toString(float val){
|
||||||
|
float decimal = std::fmod(val, 1.0f);
|
||||||
|
int places = 1;
|
||||||
|
while (std::fmod(decimal * 10, 1.0f) > 0){
|
||||||
|
decimal *= 10;
|
||||||
|
places++;
|
||||||
|
}
|
||||||
|
char buffer[50];
|
||||||
|
std::string arg = "%."+std::to_string(places)+"f";
|
||||||
|
sprintf(buffer, arg.c_str(), val);
|
||||||
|
std::string s = buffer;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
#ifndef STRINGUTILS_H
|
||||||
|
#define STRINGUTILS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
namespace StringUtils{
|
||||||
|
|
||||||
|
std::string toString(float val);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // STRINGUTILS_H
|
Loading…
Reference in New Issue