Skip to content

Commit

Permalink
Merge pull request #84 from matty0ung/jsonTidyUp2
Browse files Browse the repository at this point in the history
Minor fixes and new ingredients
  • Loading branch information
matty0ung authored Jul 29, 2024
2 parents 6f15adc + 805cf80 commit 95cd7ef
Show file tree
Hide file tree
Showing 55 changed files with 18,316 additions and 8,227 deletions.
2,413 changes: 2 additions & 2,411 deletions data/DefaultContent001-OriginalDefaultData.xml

Large diffs are not rendered by default.

1,474 changes: 691 additions & 783 deletions data/DefaultContent003-Ingredients-Hops-Yeasts.json

Large diffs are not rendered by default.

7,854 changes: 7,854 additions & 0 deletions data/DefaultContent004-MoreYeasts.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -606,14 +606,10 @@ commonSourceFiles = files([
'src/BtColor.cpp',
'src/BtDatePopup.cpp',
'src/BtFieldType.cpp',
'src/BtFolder.cpp',
'src/BtHorizontalTabs.cpp',
'src/BtSplashScreen.cpp',
'src/BtTabWidget.cpp',
'src/BtTextEdit.cpp',
'src/BtTreeItem.cpp',
'src/BtTreeModel.cpp',
'src/BtTreeView.cpp',
'src/ConverterTool.cpp',
'src/HeatCalculations.cpp',
'src/HelpDialog.cpp',
Expand Down Expand Up @@ -647,8 +643,8 @@ commonSourceFiles = files([
'src/TimerWidget.cpp',
'src/WaterDialog.cpp',
'src/boiltime.cpp',
'src/buttons/EquipmentButton.cpp',
'src/buttons/BoilButton.cpp',
'src/buttons/EquipmentButton.cpp',
'src/buttons/FermentationButton.cpp',
'src/buttons/MashButton.cpp',
'src/buttons/RecipeAttributeButton.cpp',
Expand All @@ -662,9 +658,9 @@ commonSourceFiles = files([
'src/catalogs/YeastCatalog.cpp',
'src/database/BtSqlQuery.cpp',
'src/database/Database.cpp',
'src/database/DefaultContentLoader.cpp',
'src/database/DatabaseSchemaHelper.cpp',
'src/database/DbTransaction.cpp',
'src/database/DefaultContentLoader.cpp',
'src/database/ObjectStore.cpp',
'src/database/ObjectStoreTyped.cpp',
'src/editors/BoilEditor.cpp',
Expand Down Expand Up @@ -712,6 +708,7 @@ commonSourceFiles = files([
'src/model/Fermentable.cpp',
'src/model/Fermentation.cpp',
'src/model/FermentationStep.cpp',
'src/model/Folder.cpp',
'src/model/Hop.cpp',
'src/model/Ingredient.cpp',
'src/model/IngredientInRecipe.cpp',
Expand Down Expand Up @@ -757,7 +754,6 @@ commonSourceFiles = files([
'src/serialization/xml/XmlRecipeRecord.cpp',
'src/serialization/xml/XmlRecord.cpp',
'src/serialization/xml/XmlRecordDefinition.cpp',
'src/sortFilterProxyModels/BtTreeFilterProxyModel.cpp',
'src/sortFilterProxyModels/EquipmentSortFilterProxyModel.cpp',
'src/sortFilterProxyModels/FermentableSortFilterProxyModel.cpp',
'src/sortFilterProxyModels/HopSortFilterProxyModel.cpp',
Expand Down Expand Up @@ -787,6 +783,10 @@ commonSourceFiles = files([
'src/tableModels/StyleTableModel.cpp',
'src/tableModels/WaterTableModel.cpp',
'src/tableModels/YeastTableModel.cpp',
'src/trees/TreeFilterProxyModel.cpp',
'src/trees/TreeModel.cpp',
'src/trees/TreeNode.cpp',
'src/trees/TreeView.cpp',
'src/undoRedo/SimpleUndoableUpdate.cpp',
'src/utils/BtException.cpp',
'src/utils/BtStringConst.cpp',
Expand Down Expand Up @@ -846,12 +846,9 @@ mocHeaders = files([
'src/BrewDayScrollWidget.h',
'src/BrewNoteWidget.h',
'src/BtDatePopup.h',
'src/BtFolder.h',
'src/BtSplashScreen.h',
'src/BtTabWidget.h',
'src/BtTextEdit.h',
'src/BtTreeModel.h',
'src/BtTreeView.h',
'src/ConverterTool.h',
'src/HelpDialog.h',
'src/HydrometerTool.h',
Expand Down Expand Up @@ -928,6 +925,7 @@ mocHeaders = files([
'src/model/Fermentable.h',
'src/model/Fermentation.h',
'src/model/FermentationStep.h',
'src/model/Folder.h',
'src/model/Hop.h',
'src/model/Ingredient.h',
'src/model/IngredientInRecipe.h',
Expand Down Expand Up @@ -958,7 +956,6 @@ mocHeaders = files([
'src/model/Style.h',
'src/model/Water.h',
'src/model/Yeast.h',
'src/sortFilterProxyModels/BtTreeFilterProxyModel.h',
'src/sortFilterProxyModels/EquipmentSortFilterProxyModel.h',
'src/sortFilterProxyModels/FermentableSortFilterProxyModel.h',
'src/sortFilterProxyModels/HopSortFilterProxyModel.h',
Expand Down Expand Up @@ -987,6 +984,9 @@ mocHeaders = files([
'src/tableModels/StyleTableModel.h',
'src/tableModels/WaterTableModel.h',
'src/tableModels/YeastTableModel.h',
'src/trees/TreeFilterProxyModel.h',
'src/trees/TreeModel.h',
'src/trees/TreeView.h',
'src/widgets/Animator.h',
'src/widgets/BtBoolComboBox.h',
'src/widgets/BtComboBox.h',
Expand All @@ -999,7 +999,6 @@ mocHeaders = files([
'src/widgets/SmartLabel.h',
'src/widgets/SmartLineEdit.h',
'src/widgets/ToggleSwitch.h',

])

unitTestMocHeaders = files([
Expand Down Expand Up @@ -1094,7 +1093,8 @@ filesToInstall_data = files([
'data/default_db.sqlite',
'data/DefaultContent001-OriginalDefaultData.xml',
'data/DefaultContent002-BJCP_2021_Styles.json',
'data/DefaultContent003-Ingredients-Hops-Yeasts.json'
'data/DefaultContent003-Ingredients-Hops-Yeasts.json',
'data/DefaultContent004-MoreYeasts.json'
])

filesToInstall_desktop = files([
Expand Down
2 changes: 1 addition & 1 deletion scripts/btUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def abortOnRunFail(runResult: subprocess.CompletedProcess):
log = logging.getLogger(__name__)

# According to https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess,
# CompletedProcess.args (the arguments used to launch the process) "may be a list or a string", but its not clear
# CompletedProcess.args (the arguments used to launch the process) "may be a list or a string", but it's not clear
# when it would be one or the other.
if (isinstance(runResult.args, str)):
log.critical('Error running ' + runResult.args)
Expand Down
19 changes: 14 additions & 5 deletions scripts/buildTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@
log.info('Found pip at: ' + exe_pip)

# Of course, when you run the pip in the venv, it might complain that it is not up-to-date. So we should ensure that
# first.
btUtils.abortOnRunFail(subprocess.run([exe_pip, 'install', '--upgrade', 'pip']))
# first. Note that it is Python we must run to upgrade pip, as pip cannot upgrade itself. (Pip will happily _try_ to
# upgrade itself, but then, on Windows at least, will get stuck when it tries to remove the old version of itself
# because "process cannot access the file because it is being used by another process".)
btUtils.abortOnRunFail(subprocess.run([exe_python, '-m', 'pip', 'install', '--upgrade', 'pip']))

#
# We use the packaging module (see https://pypi.org/project/packaging/) for handling version numbers (as described at
Expand Down Expand Up @@ -767,6 +769,12 @@ def installDependencies():
#
# As noted above, we no longer support 32-bit ('i686') builds and now only support 64-bit ('x86_64') ones.
#
# 2024-07-29: TBD: Not totally sure we need angleproject. It wasn't previously a requirement, but, as of
# recently, windeployqt complains if it can't find it. The alternative would be to pass
# "-no-angle" as a parameter to windeployqt. However, that option seems to not be present
# in Qt 6 (see https://doc.qt.io/qt-6/windows-deployment.html vs
# https://doc.qt.io/qt-5/windows-deployment.html).
#
arch = 'x86_64'
installList = ['base-devel',
'cmake',
Expand All @@ -779,14 +787,15 @@ def installDependencies():
'mingw-w64-' + arch + '-libbacktrace',
'mingw-w64-' + arch + '-meson',
'mingw-w64-' + arch + '-nsis',
'mingw-w64-' + arch + '-freetype', #
'mingw-w64-' + arch + '-harfbuzz', #
'mingw-w64-' + arch + '-freetype',
'mingw-w64-' + arch + '-harfbuzz',
'mingw-w64-' + arch + '-qt5-base',
'mingw-w64-' + arch + '-qt5-static',
'mingw-w64-' + arch + '-qt5',
'mingw-w64-' + arch + '-toolchain',
'mingw-w64-' + arch + '-xalan-c',
'mingw-w64-' + arch + '-xerces-c']
'mingw-w64-' + arch + '-xerces-c',
'mingw-w64-' + arch + '-angleproject'] # See comment above
for packageToInstall in installList:
log.debug('Installing ' + packageToInstall)
btUtils.abortOnRunFail(
Expand Down
28 changes: 13 additions & 15 deletions src/BtTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
#include <QDebug>
#include <QtGui>

#include "BtTreeItem.h"
#include "BtTreeView.h"
//#include "database/Database.h"
#include "trees/TreeNode.h"
#include "database/ObjectStoreWrapper.h"
#include "model/Equipment.h"
#include "model/Fermentable.h"
Expand Down Expand Up @@ -84,35 +82,35 @@ void BtTabWidget::dropEvent(QDropEvent *event) {
QString name;
dStream >> itemTypeRaw >> id >> name;
qDebug() << Q_FUNC_INFO << "Item type #" << itemTypeRaw;
BtTreeItem::Type itemType{itemTypeRaw};
switch (itemType) {
case BtTreeItem::Type::Recipe:
TreeNode::Type nodeType{itemTypeRaw};
switch (nodeType) {
case TreeNode::Type::Recipe:
event->acceptProposedAction();
emit setRecipe(ObjectStoreWrapper::getById<Recipe>(id).get());
return;
case BtTreeItem::Type::Equipment:
case TreeNode::Type::Equipment:
event->acceptProposedAction();
emit setEquipment(ObjectStoreWrapper::getById<Equipment>(id).get());
return;
case BtTreeItem::Type::Style:
case TreeNode::Type::Style:
event->acceptProposedAction();
emit setStyle(ObjectStoreWrapper::getById<Style>(id).get());
return;
case BtTreeItem::Type::Fermentable:
case TreeNode::Type::Fermentable:
ferms.append(ObjectStoreWrapper::getById<Fermentable>(id).get());
break;
case BtTreeItem::Type::Hop:
case TreeNode::Type::Hop:
hops.append(ObjectStoreWrapper::getById<Hop>(id).get());
break;
case BtTreeItem::Type::Misc:
case TreeNode::Type::Misc:
miscs.append(ObjectStoreWrapper::getById<Misc>(id).get());
break;
case BtTreeItem::Type::Yeast:
case TreeNode::Type::Yeast:
yeasts.append(ObjectStoreWrapper::getById<Yeast>(id).get());
break;
case BtTreeItem::Type::BrewNote:
case BtTreeItem::Type::Folder:
case BtTreeItem::Type::Water:
case TreeNode::Type::BrewNote:
case TreeNode::Type::Folder:
case TreeNode::Type::Water:
// These cases shouldn't arise (I think!) but the compiler will emit a warning if we don't explicitly have
// code to handle them (which is good!).
qWarning() << Q_FUNC_INFO << "Unexpected item type" << itemTypeRaw;
Expand Down
Loading

0 comments on commit 95cd7ef

Please sign in to comment.