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-03-30 12:33:48 +00:00
|
|
|
#include "model/recipe/ingredients/recipeingredientlistmodel.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-11 07:57:57 +00:00
|
|
|
#include "gui/newDialogs/newunitdialog.h"
|
2018-03-10 13:06:24 +00:00
|
|
|
|
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-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-29 14:09:58 +00:00
|
|
|
void on_removeIngredientButton_clicked();
|
|
|
|
|
2018-03-10 13:06:24 +00:00
|
|
|
void on_deleteIngredientButton_clicked();
|
|
|
|
|
|
|
|
void on_newIngredientButton_clicked();
|
|
|
|
|
|
|
|
void on_newTagButton_clicked();
|
|
|
|
|
2018-03-10 13:56:43 +00:00
|
|
|
void on_removeTagButton_clicked();
|
|
|
|
|
2018-03-11 07:57:57 +00:00
|
|
|
void on_newUnitButton_clicked();
|
|
|
|
|
2018-03-29 14:09:58 +00:00
|
|
|
void on_deleteUnitButton_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-30 12:33:48 +00:00
|
|
|
RecipeIngredientListModel 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
|