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 07:51:17 +00:00
|
|
|
|
|
|
|
#include "model/database/recipedatabase.h"
|
2018-03-10 09:42:22 +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/newingredientdialog.h"
|
|
|
|
#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-04 08:05:20 +00:00
|
|
|
~NewRecipeDialog();
|
|
|
|
|
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-03-10 11:36:14 +00:00
|
|
|
void on_buttonBox_accepted();
|
|
|
|
|
|
|
|
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-10 13:06:24 +00:00
|
|
|
void on_deleteIngredientButton_clicked();
|
|
|
|
|
|
|
|
void on_newIngredientButton_clicked();
|
|
|
|
|
|
|
|
void on_newTagButton_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;
|
|
|
|
vector<UnitOfMeasure> units;
|
2018-03-10 11:36:14 +00:00
|
|
|
vector<RecipeTag> tags;
|
2018-03-10 09:42:22 +00:00
|
|
|
IngredientListModel ingredientListModel;
|
2018-03-10 11:36:14 +00:00
|
|
|
TagListModel tagsListModel;
|
2018-03-10 12:22:04 +00:00
|
|
|
QImage img;
|
2018-03-10 11:36:14 +00:00
|
|
|
bool accepted = false;
|
2018-03-10 07:51:17 +00:00
|
|
|
|
|
|
|
//Helper functions to fill fields.
|
|
|
|
void populateIngredientsBox();
|
|
|
|
void populateUnitsBox();
|
2018-03-10 11:36:14 +00:00
|
|
|
void populateTagsBox();
|
2018-03-04 08:05:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NEWRECIPEDIALOG_H
|