2018-03-04 08:05:20 +00:00
|
|
|
#ifndef NEWRECIPEDIALOG_H
|
|
|
|
#define NEWRECIPEDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2018-03-10 07:51:17 +00:00
|
|
|
#include <QTextCharFormat>
|
2018-03-10 12:22:04 +00:00
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QPixmap>
|
2018-03-10 13:56:43 +00:00
|
|
|
#include <QMessageBox>
|
2018-03-10 07:51:17 +00:00
|
|
|
|
|
|
|
#include "model/database/recipedatabase.h"
|
2018-05-22 19:24:36 +00:00
|
|
|
#include "model/recipe/ingredients/ingredientlistmodel.h"
|
2018-03-10 11:36:14 +00:00
|
|
|
#include "model/recipe/tags/taglistmodel.h"
|
2018-03-04 08:05:20 +00:00
|
|
|
|
2018-03-10 13:06:24 +00:00
|
|
|
#include "gui/newDialogs/newtagdialog.h"
|
|
|
|
|
2018-03-04 08:05:20 +00:00
|
|
|
namespace Ui {
|
|
|
|
class NewRecipeDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NewRecipeDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit NewRecipeDialog(QWidget *parent = 0);
|
2018-03-10 07:51:17 +00:00
|
|
|
NewRecipeDialog(RecipeDatabase *db, QWidget *parent = 0);
|
2018-03-30 21:25:28 +00:00
|
|
|
NewRecipeDialog(RecipeDatabase *db, Recipe recipe, QWidget *parent = 0);
|
2018-03-04 08:05:20 +00:00
|
|
|
~NewRecipeDialog();
|
|
|
|
|
2018-05-22 19:24:36 +00:00
|
|
|
//Extracts a recipe from all the information entered in the ui.
|
2018-03-10 11:36:14 +00:00
|
|
|
Recipe getRecipe();
|
|
|
|
bool isAccepted() const;
|
2018-03-10 07:51:17 +00:00
|
|
|
private slots:
|
2018-03-10 09:42:22 +00:00
|
|
|
void on_addIngredientButton_clicked();
|
|
|
|
|
|
|
|
void on_italicsButton_clicked();
|
|
|
|
|
|
|
|
void on_boldButton_clicked();
|
2018-03-10 07:51:17 +00:00
|
|
|
|
2018-05-22 19:24:36 +00:00
|
|
|
//Sets the dialog as accepted, as in, the user accepts that they want to create the recipe.
|
2018-03-10 11:36:14 +00:00
|
|
|
void on_buttonBox_accepted();
|
|
|
|
|
2018-05-22 19:24:36 +00:00
|
|
|
//The user has rejected the creation of the recipe.
|
2018-03-10 11:36:14 +00:00
|
|
|
void on_buttonBox_rejected();
|
|
|
|
|
|
|
|
void on_addTagButton_clicked();
|
|
|
|
|
2018-03-10 12:22:04 +00:00
|
|
|
void on_deleteTagButton_clicked();
|
|
|
|
|
|
|
|
void on_selectImageButton_clicked();
|
|
|
|
|
2018-03-29 14:09:58 +00:00
|
|
|
void on_removeIngredientButton_clicked();
|
|
|
|
|
2018-03-10 13:06:24 +00:00
|
|
|
void on_newTagButton_clicked();
|
|
|
|
|
2018-03-10 13:56:43 +00:00
|
|
|
void on_removeTagButton_clicked();
|
|
|
|
|
2018-03-04 08:05:20 +00:00
|
|
|
private:
|
|
|
|
Ui::NewRecipeDialog *ui;
|
2018-03-10 07:51:17 +00:00
|
|
|
RecipeDatabase *recipeDB;
|
|
|
|
vector<Ingredient> ingredients;
|
2018-03-10 11:36:14 +00:00
|
|
|
vector<RecipeTag> tags;
|
2018-05-22 19:24:36 +00:00
|
|
|
IngredientListModel ingredientListModel;
|
2018-03-10 11:36:14 +00:00
|
|
|
TagListModel tagsListModel;
|
|
|
|
bool accepted = false;
|
2018-03-10 07:51:17 +00:00
|
|
|
|
|
|
|
//Helper functions to fill fields.
|
2018-03-10 11:36:14 +00:00
|
|
|
void populateTagsBox();
|
2018-03-04 08:05:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NEWRECIPEDIALOG_H
|