From e4dcd17e3e44c128948042e2e4db7900b3608068 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Mon, 12 Feb 2018 20:39:24 +0100 Subject: [PATCH] Now able to load parts of a Recipe into the user interface. --- main.cpp | 7 ------- userInterface/mainwindow.cpp | 12 ++++++++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/main.cpp b/main.cpp index 84928f5..4f87ea1 100644 --- a/main.cpp +++ b/main.cpp @@ -11,12 +11,5 @@ int main(int argc, char *argv[]) Database db("test.db"); - vector ri; - ri.push_back(RecipeIngredient("flour", "grains", 3.0f, UnitOfMeasure("cup", "cups", "c"))); - - - - Recipe rec("Example", ri, Instruction("Hello world"), QImage(), vector(), QDate::currentDate(), QTime(0, 30), QTime(0, 25), 10.0f); - return a.exec(); } diff --git a/userInterface/mainwindow.cpp b/userInterface/mainwindow.cpp index 59f2c18..55c857c 100644 --- a/userInterface/mainwindow.cpp +++ b/userInterface/mainwindow.cpp @@ -5,6 +5,14 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); + + //TESTING CODE + vector ri; + ri.push_back(RecipeIngredient("flour", "grains", 3.0f, UnitOfMeasure("cup", "cups", "c"))); + + Recipe rec("Example", ri, Instruction("BOLDiTaLiCs"), QImage(), vector(), QDate::currentDate(), QTime(0, 30), QTime(0, 25), 10.0f); + + this->loadFromRecipe(rec); } MainWindow::~MainWindow(){ @@ -22,9 +30,9 @@ void MainWindow::setRecipeName(string name){ } void MainWindow::setInstruction(Instruction instruction){ - + ui->instructionsTextEdit->setHtml(QString::fromStdString(instruction.getHTML())); } void MainWindow::setIngredients(vector ingredients){ - + ///TODO: Implement this. }