From 44f89031541a50d3f64a086202584ea87124fd31 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Sat, 10 Mar 2018 16:02:01 +0100 Subject: [PATCH] Added extra stats to user interface. --- gui/mainwindow.ui | 197 ++++++++++++++++++++++++++++++----- main.cpp | 2 + userInterface/mainwindow.cpp | 15 +++ userInterface/mainwindow.h | 3 + 4 files changed, 192 insertions(+), 25 deletions(-) diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index a527789..58638ed 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -241,40 +241,181 @@ QPushButton#browseButton:pressed{ 0 - - - - - 0 - 0 - - - - - 0 - 80 - - + + - Noto Sans CJK KR Light - 24 50 false false - PreferAntialias - true - background-color: rgb(219, 216, 216); - - - Recipe Name - - - Qt::AlignCenter + background-color: rgb(219, 216, 216); +font: "Noto Sans CJK KR"; + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + Noto Sans CJK KR Light + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + Noto Sans CJK KR Light + 12 + + + + Prep Time: + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + Noto Sans CJK KR Light + 12 + + + + Cook Time: + + + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + Noto Sans CJK KR Light + 12 + + + + Servings: + + + + + + + + + + + 0 + 0 + + + + + 0 + 80 + + + + + Noto Sans CJK KR Light + 30 + 50 + false + false + PreferAntialias + + + + Recipe Name + + + Qt::AlignCenter + + + + @@ -417,6 +558,12 @@ QPushButton#browseButton:pressed{ 0 + + + 400 + 0 + + 0 diff --git a/main.cpp b/main.cpp index ab7a5f2..4e49c1e 100644 --- a/main.cpp +++ b/main.cpp @@ -48,5 +48,7 @@ int main(int argc, char *argv[]) // printf("Accepted the dialog.\n"); // } + w.loadFromRecipe(recipeDB.retrieveRecipe("Generic Bread")); + return a.exec(); } diff --git a/userInterface/mainwindow.cpp b/userInterface/mainwindow.cpp index 8d92a70..b39eec6 100644 --- a/userInterface/mainwindow.cpp +++ b/userInterface/mainwindow.cpp @@ -22,6 +22,9 @@ void MainWindow::loadFromRecipe(Recipe recipe){ setInstruction(recipe.getInstruction()); setIngredients(recipe.getIngredients()); setImage(recipe.getImage()); + setPrepTime(recipe.getPrepTime()); + setCookTime(recipe.getCookTime()); + setServings(recipe.getServings()); } void MainWindow::setRecipeName(string name){ @@ -40,6 +43,18 @@ void MainWindow::setImage(QImage img){ ui->imageLabel->setPixmap(QPixmap::fromImage(img)); } +void MainWindow::setPrepTime(QTime prepTime){ + ui->prepTimeLabel->setText(QString("Prep Time: ")+prepTime.toString("hh:mm:ss")); +} + +void MainWindow::setCookTime(QTime cookTime){ + ui->cookTimeLabel->setText(QString("Cook Time: ")+cookTime.toString("hh:mm:ss")); +} + +void MainWindow::setServings(float servings){ + ui->servingsLabel->setText(QString("Servings: ")+QString::fromStdString(toString(servings))); +} + void MainWindow::on_newButton_clicked(){ NewRecipeDialog d(this->recipeDB, this); d.show(); diff --git a/userInterface/mainwindow.h b/userInterface/mainwindow.h index 2f2591b..1605311 100644 --- a/userInterface/mainwindow.h +++ b/userInterface/mainwindow.h @@ -39,6 +39,9 @@ public: void setInstruction(Instruction instruction); void setIngredients(vector ingredients); void setImage(QImage img); + void setPrepTime(QTime prepTime); + void setCookTime(QTime cookTime); + void setServings(float servings); }; #endif // MAINWINDOW_H