2018-02-02 12:27:57 +00:00
|
|
|
#include "userInterface/mainwindow.h"
|
2018-02-02 09:00:46 +00:00
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
QMainWindow(parent),
|
2018-02-12 13:24:11 +00:00
|
|
|
ui(new Ui::MainWindow){
|
2018-02-02 09:00:46 +00:00
|
|
|
ui->setupUi(this);
|
2018-02-12 19:39:24 +00:00
|
|
|
|
|
|
|
//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);
|
2018-02-02 09:00:46 +00:00
|
|
|
}
|
|
|
|
|
2018-02-12 13:24:11 +00:00
|
|
|
MainWindow::~MainWindow(){
|
2018-02-02 09:00:46 +00:00
|
|
|
delete ui;
|
|
|
|
}
|
2018-02-12 13:24:11 +00:00
|
|
|
|
|
|
|
void MainWindow::loadFromRecipe(Recipe recipe){
|
|
|
|
setRecipeName(recipe.getName());
|
2018-02-12 14:15:04 +00:00
|
|
|
setInstruction(recipe.getInstruction());
|
2018-02-12 13:24:11 +00:00
|
|
|
setIngredients(recipe.getIngredients());
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::setRecipeName(string name){
|
|
|
|
ui->recipeNameLabel->setText(QString::fromStdString(name));
|
|
|
|
}
|
|
|
|
|
2018-02-12 14:15:04 +00:00
|
|
|
void MainWindow::setInstruction(Instruction instruction){
|
2018-02-12 19:39:24 +00:00
|
|
|
ui->instructionsTextEdit->setHtml(QString::fromStdString(instruction.getHTML()));
|
2018-02-12 13:24:11 +00:00
|
|
|
}
|
|
|
|
|
2018-02-12 14:15:04 +00:00
|
|
|
void MainWindow::setIngredients(vector<RecipeIngredient> ingredients){
|
2018-02-12 19:39:24 +00:00
|
|
|
///TODO: Implement this.
|
2018-02-12 13:24:11 +00:00
|
|
|
}
|