Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for over-merging from Brewken (extra Hop attributes and incorrect conf file name) #696

Merged
merged 2 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/HopEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,10 @@ HopEditor::HopEditor(QWidget * parent) :
//
this->comboBox_hopType->addItem(tr("Bittering" ), Hop::typeStringMapping.enumToString(Hop::Type::Bittering ));
this->comboBox_hopType->addItem(tr("Aroma" ), Hop::typeStringMapping.enumToString(Hop::Type::Aroma ));
this->comboBox_hopType->addItem(tr("Aroma & Bittering" ), Hop::typeStringMapping.enumToString(Hop::Type::AromaAndBittering ));
this->comboBox_hopType->addItem(tr("Flavor" ), Hop::typeStringMapping.enumToString(Hop::Type::Flavor ));
this->comboBox_hopType->addItem(tr("Bittering & Flavor" ), Hop::typeStringMapping.enumToString(Hop::Type::BitteringAndFlavor ));
this->comboBox_hopType->addItem(tr("Aroma & Flavor" ), Hop::typeStringMapping.enumToString(Hop::Type::AromaAndFlavor ));
this->comboBox_hopType->addItem(tr("Aroma, Bittering & Flavor"), Hop::typeStringMapping.enumToString(Hop::Type::AromaBitteringAndFlavor));
this->comboBox_hopType->addItem(tr("Aroma & Bittering" ), Hop::typeStringMapping.enumToString(Hop::Type::Both ));

this->comboBox_hopForm->addItem(tr("Extract" ), Hop::formStringMapping.enumToString(Hop::Form::Extract));
this->comboBox_hopForm->addItem(tr("Leaf" ), Hop::formStringMapping.enumToString(Hop::Form::Leaf ));
this->comboBox_hopForm->addItem(tr("Leaf (wet)"), Hop::formStringMapping.enumToString(Hop::Form::WetLeaf));
this->comboBox_hopForm->addItem(tr("Pellet" ), Hop::formStringMapping.enumToString(Hop::Form::Pellet ));
this->comboBox_hopForm->addItem(tr("Powder" ), Hop::formStringMapping.enumToString(Hop::Form::Powder ));
this->comboBox_hopForm->addItem(tr("Plug" ), Hop::formStringMapping.enumToString(Hop::Form::Plug ));

// Same comment for hop use, even thought it's not stored in BeerJSON
Expand Down
2 changes: 1 addition & 1 deletion src/PersistentSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void PersistentSettings::initialise(QString customUserDataDir) {
configDir.absolutePath();

// Now we can set the full path of the persistent settings file
qSettings = std::make_unique<QSettings>(configDir.absoluteFilePath("brewkenPersistentSettings.conf"),
qSettings = std::make_unique<QSettings>(configDir.absoluteFilePath("brewtargetPersistentSettings.conf"),
QSettings::IniFormat);

// We've done enough now for calls to contains()/insert()/value() etc to work. Mark that we're initialised so we
Expand Down
18 changes: 2 additions & 16 deletions src/model/Hop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,12 @@
EnumStringMapping const Hop::typeStringMapping {
{"aroma", Hop::Type::Aroma},
{"bittering", Hop::Type::Bittering},
{"flavor", Hop::Type::Flavor},
{"aroma/bittering", Hop::Type::AromaAndBittering}, // Previous seralisation (still used for BeerXML) was "Both"
{"bittering/flavor", Hop::Type::BitteringAndFlavor},
{"aroma/flavor", Hop::Type::AromaAndFlavor},
{"aroma/bittering/flavor", Hop::Type::AromaBitteringAndFlavor},
{"both", Hop::Type::Both},
};

EnumStringMapping const Hop::formStringMapping {
{"extract", Hop::Form::Extract},
{"leaf", Hop::Form::Leaf},
{"leaf (wet)", Hop::Form::WetLeaf},
{"pellet", Hop::Form::Pellet},
{"powder", Hop::Form::Powder},
{"plug", Hop::Form::Plug}
};

Expand All @@ -62,20 +55,13 @@ EnumStringMapping const Hop::useStringMapping {
QMap<Hop::Type, QString> const Hop::typeDisplayNames {
{Hop::Type::Aroma, tr("Aroma" )},
{Hop::Type::Bittering, tr("Bittering" )},
{Hop::Type::Flavor, tr("Flavor" )},
{Hop::Type::AromaAndBittering, tr("Aroma & Bittering" )},
{Hop::Type::BitteringAndFlavor, tr("Bittering & Flavor" )},
{Hop::Type::AromaAndFlavor, tr("Aroma & Flavor" )},
{Hop::Type::AromaBitteringAndFlavor, tr("Aroma, Bittering & Flavor")},
{Hop::Type::Both , tr("Aroma & Bittering" )},
};

QMap<Hop::Form, QString> const Hop::formDisplayNames {
{Hop::Form::Leaf, tr("Leaf" )},
{Hop::Form::Pellet, tr("Pellet" )},
{Hop::Form::Plug, tr("Plug" )},
{Hop::Form::Extract, tr("Extract")},
{Hop::Form::WetLeaf, tr("WetLeaf")},
{Hop::Form::Powder, tr("Powder" )},
};

QMap<Hop::Use, QString> const Hop::useDisplayNames {
Expand Down
27 changes: 6 additions & 21 deletions src/model/Hop.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,33 +65,18 @@ class Hop : public NamedEntityWithInventory {

public:

/*!
* \brief The type of hop, meaning for what properties it is used. Arguably we should have three binary flags
* (aroma, bittering and flavor), but keeping a single enum makes the mappings to/from BeerXML and BeerJSON
* easier.
*/
enum class Type {Bittering,
Aroma,
AromaAndBittering, // was Both
Flavor,
BitteringAndFlavor,
AromaAndFlavor,
AromaBitteringAndFlavor};
//! \brief The type of hop, meaning for what properties it is used.
enum class Type {Bittering, Aroma, Both};

/*!
* \brief Mapping between \c Hop::Type and string values suitable for serialisation in DB, BeerJSON, etc (but \b not
* BeerXML)
*/
static EnumStringMapping const typeStringMapping;

/*!
* \brief The form of the hop.
*/
enum class Form {Leaf,
Pellet,
Plug,
Extract,
WetLeaf,
Powder};
//! \brief The form of the hop.
enum class Form {Leaf, Pellet, Plug};

/*!
* \brief Mapping between \c Hop::Form and string values suitable for serialisation in DB, BeerJSON, etc (but \b not
* BeerXML)
Expand Down
2 changes: 1 addition & 1 deletion src/unitTests/Testing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ void Testing::initTestCase() {
this->cascade_4pct->setAlpha_pct(4.0);
this->cascade_4pct->setUse(Hop::Use::Boil);
this->cascade_4pct->setTime_min(60);
this->cascade_4pct->setType(Hop::Type::AromaAndBittering);
this->cascade_4pct->setType(Hop::Type::Both);
this->cascade_4pct->setForm(Hop::Form::Leaf);

// 70% yield, no moisture, 2 SRM
Expand Down
15 changes: 1 addition & 14 deletions src/xml/BeerXml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,25 +87,12 @@ namespace {
EnumStringMapping const BEER_XML_HOP_TYPE_MAPPER {
{"Bittering", Hop::Type::Bittering},
{"Aroma", Hop::Type::Aroma},
{"Both", Hop::Type::AromaAndBittering},
// These other types are in BeerJSON but are not mentioned in the BeerXML 1.0 Standard. They get an approximate
// mapping when we write to BeerXML
// Note that we include a comment here to ensure we don't have multiple mappings for the same strings
{"Aroma<!--Flavor-->", Hop::Type::Flavor},
{"Both<!--BitteringAndFlavor-->", Hop::Type::BitteringAndFlavor},
{"Aroma<!--AromaAndFlavor-->", Hop::Type::AromaAndFlavor},
{"Both<!--AromaBitteringAndFlavor-->", Hop::Type::AromaBitteringAndFlavor}
{"Both", Hop::Type::Both},
};
EnumStringMapping const BEER_XML_HOP_FORM_MAPPER {
{"Pellet", Hop::Form::Pellet},
{"Plug", Hop::Form::Plug},
{"Leaf", Hop::Form::Leaf},
// These other types are in BeerJSON but are not mentioned in the BeerXML 1.0 Standard. They get an approximate
// mapping when we write to BeerXML
// Note that we include a comment here to ensure we don't have multiple mappings for the same strings
{"Pellet<!--Extract-->", Hop::Form::Extract},
{"Leaf<!--WetLeaf-->", Hop::Form::WetLeaf},
{"Pellet<!--Powder-->", Hop::Form::Powder}
};
template<> XmlRecord::FieldDefinitions const BEER_XML_RECORD_FIELDS<Hop> {
// Type XPath Q_PROPERTY Enum Mapper
Expand Down
48 changes: 4 additions & 44 deletions translations/bt_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1387,35 +1387,15 @@ Log file may contain more details.</source>
</message>
<message>
<source>Flavor</source>
<translation type="unfinished">Sabor</translation>
<translation type="obsolete">Sabor</translation>
</message>
<message>
<source>Aroma &amp; Bittering</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma, Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Extract</source>
<translation type="unfinished">Extracte</translation>
</message>
<message>
<source>WetLeaf</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Powder</source>
<translation type="unfinished"></translation>
<translation type="obsolete">Extracte</translation>
</message>
<message>
<source>Post-Boil</source>
Expand Down Expand Up @@ -1485,40 +1465,20 @@ Log file may contain more details.</source>
</message>
<message>
<source>Flavor</source>
<translation type="unfinished">Sabor</translation>
</message>
<message>
<source>Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma, Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
<translation type="obsolete">Sabor</translation>
</message>
<message>
<source>Extract</source>
<translation type="unfinished">Extracte</translation>
<translation type="obsolete">Extracte</translation>
</message>
<message>
<source>Leaf</source>
<translation type="unfinished">Flor</translation>
</message>
<message>
<source>Leaf (wet)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Pellet</source>
<translation type="unfinished">Pèl·let</translation>
</message>
<message>
<source>Powder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Plug</source>
<translation type="unfinished">«Plug»</translation>
Expand Down
48 changes: 4 additions & 44 deletions translations/bt_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1347,35 +1347,15 @@ Log file may contain more details.</source>
</message>
<message>
<source>Flavor</source>
<translation type="unfinished">Příchuť</translation>
<translation type="obsolete">Příchuť</translation>
</message>
<message>
<source>Aroma &amp; Bittering</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma, Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Extract</source>
<translation type="unfinished">Výtažek</translation>
</message>
<message>
<source>WetLeaf</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Powder</source>
<translation type="unfinished"></translation>
<translation type="obsolete">Výtažek</translation>
</message>
<message>
<source>Post-Boil</source>
Expand Down Expand Up @@ -1445,40 +1425,20 @@ Log file may contain more details.</source>
</message>
<message>
<source>Flavor</source>
<translation type="unfinished">Příchuť</translation>
</message>
<message>
<source>Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma, Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
<translation type="obsolete">Příchuť</translation>
</message>
<message>
<source>Extract</source>
<translation type="unfinished">Výtažek</translation>
<translation type="obsolete">Výtažek</translation>
</message>
<message>
<source>Leaf</source>
<translation type="unfinished">Hlávkový</translation>
</message>
<message>
<source>Leaf (wet)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Pellet</source>
<translation type="unfinished">Granulovaný</translation>
</message>
<message>
<source>Powder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Plug</source>
<translation type="unfinished">Lisovaný</translation>
Expand Down
48 changes: 4 additions & 44 deletions translations/bt_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1371,35 +1371,15 @@ Log file may contain more details.</source>
</message>
<message>
<source>Flavor</source>
<translation type="unfinished">Aroma</translation>
<translation type="obsolete">Aroma</translation>
</message>
<message>
<source>Aroma &amp; Bittering</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma, Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Extract</source>
<translation type="unfinished">Extrakt</translation>
</message>
<message>
<source>WetLeaf</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Powder</source>
<translation type="unfinished"></translation>
<translation type="obsolete">Extrakt</translation>
</message>
<message>
<source>Post-Boil</source>
Expand Down Expand Up @@ -1469,40 +1449,20 @@ Log file may contain more details.</source>
</message>
<message>
<source>Flavor</source>
<translation type="unfinished">Aroma</translation>
</message>
<message>
<source>Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma &amp; Flavor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Aroma, Bittering &amp; Flavor</source>
<translation type="unfinished"></translation>
<translation type="obsolete">Aroma</translation>
</message>
<message>
<source>Extract</source>
<translation type="unfinished">Extrakt</translation>
<translation type="obsolete">Extrakt</translation>
</message>
<message>
<source>Leaf</source>
<translation type="unfinished">Blatt</translation>
</message>
<message>
<source>Leaf (wet)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Pellet</source>
<translation type="unfinished">Pellet</translation>
</message>
<message>
<source>Powder</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Plug</source>
<translation type="unfinished"></translation>
Expand Down
Loading