Now able to load parts of a Recipe into the user interface.

This commit is contained in:
Andrew Lalis 2018-02-12 20:39:24 +01:00
parent 2e42bafae3
commit e4dcd17e3e
2 changed files with 10 additions and 9 deletions

View File

@ -11,12 +11,5 @@ int main(int argc, char *argv[])
Database db("test.db"); Database db("test.db");
vector<RecipeIngredient> ri;
ri.push_back(RecipeIngredient("flour", "grains", 3.0f, UnitOfMeasure("cup", "cups", "c")));
Recipe rec("Example", ri, Instruction("Hello world"), QImage(), vector<RecipeTag>(), QDate::currentDate(), QTime(0, 30), QTime(0, 25), 10.0f);
return a.exec(); return a.exec();
} }

View File

@ -5,6 +5,14 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow){ ui(new Ui::MainWindow){
ui->setupUi(this); ui->setupUi(this);
//TESTING CODE
vector<RecipeIngredient> ri;
ri.push_back(RecipeIngredient("flour", "grains", 3.0f, UnitOfMeasure("cup", "cups", "c")));
Recipe rec("Example", ri, Instruction("<b>BOLD</b><i>iTaLiCs</i>"), QImage(), vector<RecipeTag>(), QDate::currentDate(), QTime(0, 30), QTime(0, 25), 10.0f);
this->loadFromRecipe(rec);
} }
MainWindow::~MainWindow(){ MainWindow::~MainWindow(){
@ -22,9 +30,9 @@ void MainWindow::setRecipeName(string name){
} }
void MainWindow::setInstruction(Instruction instruction){ void MainWindow::setInstruction(Instruction instruction){
ui->instructionsTextEdit->setHtml(QString::fromStdString(instruction.getHTML()));
} }
void MainWindow::setIngredients(vector<RecipeIngredient> ingredients){ void MainWindow::setIngredients(vector<RecipeIngredient> ingredients){
///TODO: Implement this.
} }