2018-02-02 09:00:46 +00:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
2018-02-12 13:24:11 +00:00
|
|
|
#include <string>
|
2018-02-12 14:15:04 +00:00
|
|
|
#include <QAbstractListModel>
|
2018-02-12 13:24:11 +00:00
|
|
|
|
|
|
|
#include "model/recipe/recipe.h"
|
2018-03-30 12:33:48 +00:00
|
|
|
#include "model/recipe/ingredients/recipeingredientlistmodel.h"
|
2018-03-10 14:32:26 +00:00
|
|
|
#include "gui/newrecipedialog.h"
|
2018-03-11 11:53:30 +00:00
|
|
|
#include "gui/openrecipedialog.h"
|
2018-03-11 07:57:57 +00:00
|
|
|
#include "utils/stringutils.h"
|
2018-02-12 13:24:11 +00:00
|
|
|
|
|
|
|
using namespace std;
|
2018-02-02 09:00:46 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MainWindow(QWidget *parent = 0);
|
2018-03-10 14:32:26 +00:00
|
|
|
MainWindow(RecipeDatabase *db, QWidget *parent = 0);
|
2018-02-02 09:00:46 +00:00
|
|
|
~MainWindow();
|
|
|
|
|
2018-02-12 13:24:11 +00:00
|
|
|
//Loads all data from a recipe into the GUI components.
|
|
|
|
void loadFromRecipe(Recipe recipe);
|
2018-03-29 07:58:25 +00:00
|
|
|
|
2018-03-10 14:32:26 +00:00
|
|
|
private slots:
|
|
|
|
void on_newButton_clicked();
|
|
|
|
|
2018-03-11 11:53:30 +00:00
|
|
|
void on_openButton_clicked();
|
|
|
|
|
2018-03-29 14:09:58 +00:00
|
|
|
void on_exitButton_clicked();
|
|
|
|
|
2018-03-30 21:25:28 +00:00
|
|
|
void on_editButton_clicked();
|
|
|
|
|
2018-03-10 14:32:26 +00:00
|
|
|
private:
|
2018-02-02 09:00:46 +00:00
|
|
|
Ui::MainWindow *ui;
|
2018-03-10 14:32:26 +00:00
|
|
|
RecipeDatabase *recipeDB;
|
2018-03-30 12:33:48 +00:00
|
|
|
RecipeIngredientListModel ingredientModel;
|
2018-03-11 07:57:57 +00:00
|
|
|
TagListModel tagsListModel;
|
2018-03-30 21:25:28 +00:00
|
|
|
Recipe currentRecipe;
|
2018-02-12 13:24:11 +00:00
|
|
|
|
|
|
|
//Hidden manipulation methods.
|
|
|
|
void setRecipeName(string name);
|
2018-02-12 14:15:04 +00:00
|
|
|
void setInstruction(Instruction instruction);
|
|
|
|
void setIngredients(vector<RecipeIngredient> ingredients);
|
2018-03-10 14:32:26 +00:00
|
|
|
void setImage(QImage img);
|
2018-03-10 15:02:01 +00:00
|
|
|
void setPrepTime(QTime prepTime);
|
|
|
|
void setCookTime(QTime cookTime);
|
|
|
|
void setServings(float servings);
|
2018-03-11 07:57:57 +00:00
|
|
|
void setTags(vector<RecipeTag> tags);
|
2018-03-31 13:02:35 +00:00
|
|
|
void setAuthorName(string name);
|
2018-02-02 09:00:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|