2018-03-11 07:57:57 +00:00
|
|
|
#include "openrecipedialog.h"
|
|
|
|
#include "ui_openrecipedialog.h"
|
|
|
|
|
|
|
|
OpenRecipeDialog::OpenRecipeDialog(QWidget *parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::OpenRecipeDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2018-03-11 11:53:30 +00:00
|
|
|
|
|
|
|
ui->recipeTableView->setModel(&this->recipeTableModel);
|
|
|
|
}
|
|
|
|
|
|
|
|
OpenRecipeDialog::OpenRecipeDialog(RecipeDatabase *recipeDB, QWidget *parent) : OpenRecipeDialog(parent){
|
|
|
|
this->recipeDB = recipeDB;
|
|
|
|
this->populateRecipesTable();
|
2018-03-11 07:57:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OpenRecipeDialog::~OpenRecipeDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
2018-03-11 11:53:30 +00:00
|
|
|
|
|
|
|
void OpenRecipeDialog::populateRecipesTable(){
|
|
|
|
vector<Recipe> recipes = this->recipeDB->retrieveAllRecipes();
|
2018-03-29 09:21:00 +00:00
|
|
|
// printf("Found %d recipes:\n", recipes.size());
|
|
|
|
// for (Recipe r : recipes){
|
|
|
|
// r.print();
|
|
|
|
// printf("\n------------------\n");
|
|
|
|
// }
|
2018-03-11 11:53:30 +00:00
|
|
|
this->recipeTableModel.setRecipes(recipes);
|
2018-03-29 07:58:25 +00:00
|
|
|
ui->recipeTableView->show();
|
2018-03-11 11:53:30 +00:00
|
|
|
}
|