From b3393266d34818884d50eb948b3b0f05553f861a Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Tue, 22 May 2018 23:11:52 +0200 Subject: [PATCH] Removed more dialogs for obsolete units and recipe ingredients. --- RecipeDB.pro | 13 +- gui/newDialogs/newfoodgroupdialog.cpp | 18 --- gui/newDialogs/newfoodgroupdialog.h | 27 ----- gui/newDialogs/newfoodgroupdialog.ui | 102 ---------------- gui/newDialogs/newingredientdialog.cpp | 49 -------- gui/newDialogs/newingredientdialog.h | 39 ------ gui/newDialogs/newingredientdialog.ui | 158 ------------------------- gui/newDialogs/newunitdialog.cpp | 31 ----- 8 files changed, 3 insertions(+), 434 deletions(-) delete mode 100644 gui/newDialogs/newfoodgroupdialog.cpp delete mode 100644 gui/newDialogs/newfoodgroupdialog.h delete mode 100644 gui/newDialogs/newfoodgroupdialog.ui delete mode 100644 gui/newDialogs/newingredientdialog.cpp delete mode 100644 gui/newDialogs/newingredientdialog.h delete mode 100644 gui/newDialogs/newingredientdialog.ui delete mode 100644 gui/newDialogs/newunitdialog.cpp diff --git a/RecipeDB.pro b/RecipeDB.pro index f61213b..3440cb6 100644 --- a/RecipeDB.pro +++ b/RecipeDB.pro @@ -25,15 +25,12 @@ SOURCES += model/recipe/instruction.cpp \ utils/fileutils.cpp \ gui/newrecipedialog.cpp \ model/recipe/tags/taglistmodel.cpp \ - gui/newDialogs/newingredientdialog.cpp \ gui/newDialogs/newtagdialog.cpp \ - gui/newDialogs/newunitdialog.cpp \ utils/aspectratiopixmaplabel.cpp \ utils/stringutils.cpp \ gui/openrecipedialog.cpp \ model/recipe/recipetablemodel.cpp \ - gui/mainwindow.cpp \ - gui/newDialogs/newfoodgroupdialog.cpp + gui/mainwindow.cpp HEADERS += model/recipe/instruction.h \ model/recipe/recipe.h \ @@ -48,24 +45,20 @@ HEADERS += model/recipe/instruction.h \ utils/fileutils.h \ gui/newrecipedialog.h \ model/recipe/tags/taglistmodel.h \ - gui/newDialogs/newingredientdialog.h \ gui/newDialogs/newtagdialog.h \ utils/aspectratiopixmaplabel.h \ utils/stringutils.h \ gui/openrecipedialog.h \ model/recipe/recipetablemodel.h \ - gui/mainwindow.h \ - gui/newDialogs/newfoodgroupdialog.h + gui/mainwindow.h LIBS += -ldl \ FORMS += gui/mainwindow.ui \ gui/newrecipedialog.ui \ - gui/newDialogs/newingredientdialog.ui \ gui/newDialogs/newtagdialog.ui \ gui/openrecipedialog.ui \ - gui/mainwindow.ui \ - gui/newDialogs/newfoodgroupdialog.ui + gui/mainwindow.ui DISTFILES += \ .gitignore diff --git a/gui/newDialogs/newfoodgroupdialog.cpp b/gui/newDialogs/newfoodgroupdialog.cpp deleted file mode 100644 index 8e0277a..0000000 --- a/gui/newDialogs/newfoodgroupdialog.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "newfoodgroupdialog.h" -#include "ui_newfoodgroupdialog.h" - -newFoodGroupDialog::newFoodGroupDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::newFoodGroupDialog) -{ - ui->setupUi(this); -} - -newFoodGroupDialog::~newFoodGroupDialog() -{ - delete ui; -} - -string newFoodGroupDialog::getFoodGroup() const{ - return ui->lineEdit->text().toStdString(); -} diff --git a/gui/newDialogs/newfoodgroupdialog.h b/gui/newDialogs/newfoodgroupdialog.h deleted file mode 100644 index 20c3451..0000000 --- a/gui/newDialogs/newfoodgroupdialog.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef NEWFOODGROUPDIALOG_H -#define NEWFOODGROUPDIALOG_H - -#include -#include - -using namespace std; - -namespace Ui { -class newFoodGroupDialog; -} - -class newFoodGroupDialog : public QDialog -{ - Q_OBJECT - - public: - explicit newFoodGroupDialog(QWidget *parent = 0); - ~newFoodGroupDialog(); - - string getFoodGroup() const; - - private: - Ui::newFoodGroupDialog *ui; -}; - -#endif // NEWFOODGROUPDIALOG_H diff --git a/gui/newDialogs/newfoodgroupdialog.ui b/gui/newDialogs/newfoodgroupdialog.ui deleted file mode 100644 index 42d9030..0000000 --- a/gui/newDialogs/newfoodgroupdialog.ui +++ /dev/null @@ -1,102 +0,0 @@ - - - newFoodGroupDialog - - - - 0 - 0 - 240 - 114 - - - - - 11 - - - - New Food Group - - - - :/images/images/icon.png:/images/images/icon.png - - - - - - - - - - 12 - - - - Add New Food Group - - - Qt::AlignCenter - - - - - - - - 12 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - buttonBox - accepted() - newFoodGroupDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - newFoodGroupDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/gui/newDialogs/newingredientdialog.cpp b/gui/newDialogs/newingredientdialog.cpp deleted file mode 100644 index 693dc1e..0000000 --- a/gui/newDialogs/newingredientdialog.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "newingredientdialog.h" -#include "ui_newingredientdialog.h" - -NewIngredientDialog::NewIngredientDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::NewIngredientDialog) -{ - ui->setupUi(this); -} - -NewIngredientDialog::NewIngredientDialog(RecipeDatabase *recipeDB, QWidget *parent) : NewIngredientDialog(parent){ - this->recipeDB = recipeDB; - this->populateFoodGroupBox(); -} - -NewIngredientDialog::~NewIngredientDialog() -{ - delete ui; -} - -Ingredient NewIngredientDialog::getIngredient(){ - return Ingredient(ui->nameEdit->text().toLower().toStdString(), ui->foodGroupBox->currentText().toStdString()); -} - -void NewIngredientDialog::populateFoodGroupBox(){ - vector foodGroups = this->recipeDB->retrieveAllFoodGroups(); - ui->foodGroupBox->clear(); - for (unsigned int i = 0; i < foodGroups.size(); i++){ - QString s = QString::fromStdString(foodGroups[i]); - ui->foodGroupBox->insertItem(i, s); - } -} - -void NewIngredientDialog::on_addFoodGroupButton_clicked(){ - newFoodGroupDialog d(this); - if (d.exec() == QDialog::Accepted){ - string s = d.getFoodGroup(); - if (!s.empty()){ - ui->foodGroupBox->addItem(QString::fromStdString(s)); - ui->foodGroupBox->setCurrentText(QString::fromStdString(s)); - } else { - QMessageBox::warning(this, "Empty Food Group", "The food group you entered is empty!"); - } - } -} - -void NewIngredientDialog::on_deleteFoodGroupButton_clicked(){ - ui->foodGroupBox->removeItem(ui->foodGroupBox->currentIndex()); -} diff --git a/gui/newDialogs/newingredientdialog.h b/gui/newDialogs/newingredientdialog.h deleted file mode 100644 index e922167..0000000 --- a/gui/newDialogs/newingredientdialog.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef NEWINGREDIENTDIALOG_H -#define NEWINGREDIENTDIALOG_H - -#include -#include - -#include "model/recipe/ingredients/ingredient.h" -#include "model/database/recipedatabase.h" -#include "gui/newDialogs/newfoodgroupdialog.h" - -namespace Ui { -class NewIngredientDialog; -} - -class NewIngredientDialog : public QDialog -{ - Q_OBJECT - - public: - explicit NewIngredientDialog(QWidget *parent = 0); - NewIngredientDialog(RecipeDatabase *recipeDB, QWidget *parent = 0); - ~NewIngredientDialog(); - - //Access values. - Ingredient getIngredient(); - - private slots: - void on_addFoodGroupButton_clicked(); - - void on_deleteFoodGroupButton_clicked(); - - private: - Ui::NewIngredientDialog *ui; - RecipeDatabase *recipeDB; - - void populateFoodGroupBox(); -}; - -#endif // NEWINGREDIENTDIALOG_H diff --git a/gui/newDialogs/newingredientdialog.ui b/gui/newDialogs/newingredientdialog.ui deleted file mode 100644 index 30e9aed..0000000 --- a/gui/newDialogs/newingredientdialog.ui +++ /dev/null @@ -1,158 +0,0 @@ - - - NewIngredientDialog - - - - 0 - 0 - 367 - 228 - - - - New Ingredient - - - - :/images/images/icon.png:/images/images/icon.png - - - true - - - - - - true - - - - - - - - - Name - - - Qt::AlignCenter - - - - - - - - - - - - - - - - Food Group - - - Qt::AlignCenter - - - - - - - - - - - 0 - 0 - - - - QComboBox::InsertAlphabetically - - - - - - - - - - - :/images/images/plus_icon.png:/images/images/plus_icon.png - - - - - - - - - - - :/images/images/minus_icon.png:/images/images/minus_icon.png - - - - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - - buttonBox - accepted() - NewIngredientDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - NewIngredientDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/gui/newDialogs/newunitdialog.cpp b/gui/newDialogs/newunitdialog.cpp deleted file mode 100644 index e7be030..0000000 --- a/gui/newDialogs/newunitdialog.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "newunitdialog.h" -#include "ui_newunitdialog.h" - -NewUnitDialog::NewUnitDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::NewUnitDialog) -{ - ui->setupUi(this); - - ui->typeComboBox->clear(); - QStringList list({"Mass", "Volume", "Length", "Misc"}); - ui->typeComboBox->insertItems(0, list); - -} - -NewUnitDialog::~NewUnitDialog() -{ - delete ui; -} - -UnitOfMeasure NewUnitDialog::getUnit(){ - return UnitOfMeasure(ui->unitNameEdit->text().toLower().toStdString(), - ui->pluralNameEdit->text().toLower().toStdString(), - ui->abbreviationEdit->text().toStdString(), - this->getSelectedType(), - ui->coefficientSpinBox->value()); -} - -int NewUnitDialog::getSelectedType(){ - return ui->typeComboBox->currentIndex(); -}