Added fonts, still need to implement.

This commit is contained in:
Andrew Lalis 2018-03-31 22:01:49 +02:00
parent c84370be11
commit 7696a4ff88
5 changed files with 33 additions and 27 deletions

View File

@ -79,4 +79,6 @@ DISTFILES += \
.gitignore
RESOURCES += \
res.qrc \
images.qrc \
images.qrc

BIN
fonts/NotoSans-Light.ttf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,38 +1,13 @@
#include "gui/mainwindow.h"
#include "gui/newrecipedialog.h"
#include <QApplication>
#include <QFontDatabase>
#include "model/database/database.h"
#include "model/database/recipedatabase.h"
#include "utils/fileutils.h"
void test(RecipeDatabase *recipeDB);
Recipe checkForFirstRun(RecipeDatabase *recipeDB){
Recipe r = recipeDB->retrieveRandomRecipe();
if (r.isEmpty()){//There are no recipes in the database.
//Add some basic units to the units, and some basic ingredients.
recipeDB->addBasicUnits();
recipeDB->addBasicIngredients();
}
return r;
}
int main(int argc, char *argv[])
{
RecipeDatabase recipeDB(QString(FileUtils::appDataPath+"recipes.db").toStdString());
QApplication a(argc, argv);
MainWindow w(&recipeDB);
w.loadFromRecipe(checkForFirstRun(&recipeDB));
w.show();
a.exec();
recipeDB.closeConnection();
return 0;
}
void test(RecipeDatabase *recipeDB){
vector<RecipeIngredient> ri;
ri.push_back(RecipeIngredient("flour", "grains", 3.0f, UnitOfMeasure("cup", "cups", "c", UnitOfMeasure::VOLUME, 1.0), ""));
@ -54,3 +29,32 @@ void test(RecipeDatabase *recipeDB){
printf("Storage successful: %d\n", success);
}
Recipe checkForFirstRun(RecipeDatabase *recipeDB){
Recipe r = recipeDB->retrieveRandomRecipe();
if (r.isEmpty()){//There are no recipes in the database.
//Add some basic units to the units, and some basic ingredients.
recipeDB->addBasicUnits();
recipeDB->addBasicIngredients();
}
return r;
}
void loadAndSetFonts(){
QFontDatabase::
}
int main(int argc, char *argv[])
{
RecipeDatabase recipeDB(QString(FileUtils::appDataPath+"recipes.db").toStdString());
QApplication a(argc, argv);
MainWindow w(&recipeDB);
w.loadFromRecipe(checkForFirstRun(&recipeDB));
w.show();
a.exec();
recipeDB.closeConnection();
return 0;
}

View File