2018-02-02 12:27:57 +00:00
|
|
|
#include "userInterface/mainwindow.h"
|
2018-03-04 09:19:32 +00:00
|
|
|
#include "gui/newrecipedialog.h"
|
2018-02-02 09:00:46 +00:00
|
|
|
#include <QApplication>
|
2018-02-02 10:41:36 +00:00
|
|
|
|
2018-02-12 13:24:11 +00:00
|
|
|
#include "model/database/database.h"
|
2018-03-01 16:19:13 +00:00
|
|
|
#include "model/database/recipedatabase.h"
|
2018-02-02 09:00:46 +00:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
MainWindow w;
|
|
|
|
w.show();
|
|
|
|
|
2018-03-01 16:19:13 +00:00
|
|
|
//TESTING CODE
|
2018-02-02 10:41:36 +00:00
|
|
|
|
2018-03-01 16:19:13 +00:00
|
|
|
RecipeDatabase recipeDB("recipes");
|
2018-03-02 09:11:26 +00:00
|
|
|
|
2018-03-02 10:30:16 +00:00
|
|
|
//TESTING CODE
|
2018-03-10 07:51:17 +00:00
|
|
|
vector<RecipeIngredient> ri;
|
|
|
|
ri.push_back(RecipeIngredient("flour", "grains", 3.0f, UnitOfMeasure("cup", "cups", "c", UnitOfMeasure::VOLUME, 1.0), ""));
|
2018-03-10 09:42:22 +00:00
|
|
|
ri.push_back(RecipeIngredient("baking powder", "Additives", 1.0f, UnitOfMeasure("teaspoon", "teaspoons", "tsp", UnitOfMeasure::VOLUME, 1.0), ""));
|
2018-03-02 10:30:16 +00:00
|
|
|
|
2018-03-10 07:51:17 +00:00
|
|
|
Recipe rec("Example", ri, Instruction("<b>BOLD</b><i>iTaLiCs</i>"), QImage(), vector<RecipeTag>(), QDate::currentDate(), QTime(0, 30), QTime(0, 25), 10.0f);
|
2018-03-02 10:30:16 +00:00
|
|
|
|
2018-03-10 07:51:17 +00:00
|
|
|
bool success = recipeDB.storeRecipe(rec);
|
|
|
|
printf("Storage successful: %d\n", success);
|
2018-03-02 13:14:56 +00:00
|
|
|
|
2018-03-10 09:42:22 +00:00
|
|
|
recipeDB.storeUnitOfMeasure(UnitOfMeasure("tablespoon", "tablespoons", "tbsp", UnitOfMeasure::VOLUME, 1.0));
|
|
|
|
recipeDB.storeUnitOfMeasure(UnitOfMeasure("pinch", "pinches", "pch", UnitOfMeasure::VOLUME, 1.0));
|
|
|
|
recipeDB.storeUnitOfMeasure(UnitOfMeasure("gram", "grams", "g", UnitOfMeasure::MASS, 1.0));
|
|
|
|
|
2018-03-03 07:48:55 +00:00
|
|
|
Recipe reloadRec = recipeDB.retrieveRecipe("Example");
|
2018-03-03 09:18:38 +00:00
|
|
|
reloadRec.print();
|
2018-03-03 07:48:55 +00:00
|
|
|
|
2018-03-03 09:18:38 +00:00
|
|
|
w.loadFromRecipe(reloadRec);
|
2018-03-01 16:19:13 +00:00
|
|
|
|
2018-03-10 07:51:17 +00:00
|
|
|
NewRecipeDialog d(&recipeDB);
|
2018-03-04 09:19:32 +00:00
|
|
|
d.show();
|
|
|
|
d.exec();
|
|
|
|
|
2018-03-01 16:19:13 +00:00
|
|
|
return a.exec();
|
2018-02-02 09:00:46 +00:00
|
|
|
}
|