Skip to content

Commit

Permalink
Add vertical splitter on Recipe tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Young committed Oct 13, 2024
1 parent ee32db5 commit d7dc360
Show file tree
Hide file tree
Showing 28 changed files with 270 additions and 106 deletions.
1 change: 1 addition & 0 deletions CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Bug fixes and minor enhancements.
### Bug Fixes
* Some input fields not wide enough on various editors [849](https://github.com/Brewtarget/brewtarget/issues/849)
* Upgrade to Qt 6 [841](https://github.com/Brewtarget/brewtarget/issues/841)
* Equipment should be optional in Recipes in BeerXML [853](https://github.com/Brewtarget/brewtarget/issues/853)

### Release Timestamp
Fri, 11 Oct 2024 04:00:07 +0100
Expand Down
9 changes: 4 additions & 5 deletions src/editors/EditorBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,13 @@ template<class Derived> class EditorPhantom;
template<class Derived, class NE,
EditorBaseOptions editorBaseOptions>
class EditorBase : public CuriouslyRecurringTemplateBase<EditorPhantom, Derived> {
public:
friend Derived;
private:
/**
* \brief Constructor
*
* Often with CRTP it's good to make the constructor private and Derived a friend, so that only Derived can
* call the CRTP base constructor. This stops errors with incorrect inheritance - eg makes a compile error if
* we write `class FooEditor : ... public EditorBase<BarEditor, Bar>` instead of
* `class FooEditor : ... public EditorBase<FooEditor, Foo>`. However, since we want EditorWithRecipeBase to
* inherit from EditorBase, we can't do that trick here.
* call the CRTP base constructor.
*
* Note that we cannot initialise this->m_fields here, as the parameters themselves won't get constructed
* until Derived calls setupUi().
Expand All @@ -183,6 +181,7 @@ class EditorBase : public CuriouslyRecurringTemplateBase<EditorPhantom, Derived>
m_liveEditItem{nullptr} {
return;
}
public:
~EditorBase() = default;

//! No-op version
Expand Down
78 changes: 40 additions & 38 deletions src/editors/EquipmentEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,45 +53,47 @@ EquipmentEditor::EquipmentEditor(QWidget* parent, QString const editorName) :
this->setupUi(this);
this->tabWidget_editor->tabBar()->setStyle(new BtHorizontalTabs);
this->postSetupUiInit({
EDITOR_FIELD_NORM(Equipment, label_name , lineEdit_name , NamedEntity::name ),
EDITOR_FIELD_NORM(Equipment, label_mashTunSpecificHeat , lineEdit_mashTunSpecificHeat , Equipment::mashTunSpecificHeat_calGC ),
EDITOR_FIELD_NORM(Equipment, label_mashTunGrainAbsorption , lineEdit_mashTunGrainAbsorption , Equipment::mashTunGrainAbsorption_LKg ),
EDITOR_FIELD_NORM(Equipment, label_hopUtilization , lineEdit_hopUtilization , Equipment::hopUtilization_pct , 0),
EDITOR_FIELD_NORM(Equipment, label_mashTunWeight , lineEdit_mashTunWeight , Equipment::mashTunWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_boilingPoint , lineEdit_boilingPoint , Equipment::boilingPoint_c , 1),
EDITOR_FIELD_NORM(Equipment, label_boilTime , lineEdit_boilTime , Equipment::boilTime_min ),
EDITOR_FIELD_NORM(Equipment, label_fermenterBatchSize , lineEdit_fermenterBatchSize , Equipment::fermenterBatchSize_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleBoilSize , lineEdit_kettleBoilSize , Equipment::kettleBoilSize_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleEvaporationPerHour, lineEdit_kettleEvaporationPerHour, Equipment::kettleEvaporationPerHour_l ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunDeadspaceLoss , lineEdit_lauterTunDeadspaceLoss , Equipment::lauterTunDeadspaceLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_topUpKettle , lineEdit_topUpKettle , Equipment::topUpKettle_l ),
EDITOR_FIELD_NORM(Equipment, label_topUpWater , lineEdit_topUpWater , Equipment::topUpWater_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleTrubChillerLoss , lineEdit_kettleTrubChillerLoss , Equipment::kettleTrubChillerLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_mashTunVolume , lineEdit_mashTunVolume , Equipment::mashTunVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_name , lineEdit_name , NamedEntity::name ),
EDITOR_FIELD_NORM(Equipment, label_mashTunSpecificHeat , lineEdit_mashTunSpecificHeat , Equipment::mashTunSpecificHeat_calGC ),
EDITOR_FIELD_NORM(Equipment, label_mashTunGrainAbsorption , lineEdit_mashTunGrainAbsorption , Equipment::mashTunGrainAbsorption_LKg ),
EDITOR_FIELD_NORM(Equipment, label_hopUtilization , lineEdit_hopUtilization , Equipment::hopUtilization_pct , 0),
EDITOR_FIELD_NORM(Equipment, label_mashTunWeight , lineEdit_mashTunWeight , Equipment::mashTunWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_boilingPoint , lineEdit_boilingPoint , Equipment::boilingPoint_c , 1),
EDITOR_FIELD_NORM(Equipment, label_boilTime , lineEdit_boilTime , Equipment::boilTime_min ),
EDITOR_FIELD_NORM(Equipment, label_fermenterBatchSize , lineEdit_fermenterBatchSize , Equipment::fermenterBatchSize_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleBoilSize , lineEdit_kettleBoilSize , Equipment::kettleBoilSize_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleEvaporationPerHour, lineEdit_kettleEvaporationPerHour, Equipment::kettleEvaporationPerHour_l ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunDeadspaceLoss , lineEdit_lauterTunDeadspaceLoss , Equipment::lauterTunDeadspaceLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_topUpKettle , lineEdit_topUpKettle , Equipment::topUpKettle_l ),
EDITOR_FIELD_NORM(Equipment, label_topUpWater , lineEdit_topUpWater , Equipment::topUpWater_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleTrubChillerLoss , lineEdit_kettleTrubChillerLoss , Equipment::kettleTrubChillerLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_mashTunVolume , lineEdit_mashTunVolume , Equipment::mashTunVolume_l ),
// ⮜⮜⮜ All below added for BeerJSON support ⮞⮞⮞
EDITOR_FIELD_NORM(Equipment, label_hltType , lineEdit_hltType , Equipment::hltType ),
EDITOR_FIELD_NORM(Equipment, label_mashTunType , lineEdit_mashTunType , Equipment::mashTunType ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunType , lineEdit_lauterTunType , Equipment::lauterTunType ),
EDITOR_FIELD_NORM(Equipment, label_kettleType , lineEdit_kettleType , Equipment::kettleType ),
EDITOR_FIELD_NORM(Equipment, label_fermenterType , lineEdit_fermenterType , Equipment::fermenterType ),
EDITOR_FIELD_NORM(Equipment, label_agingVesselType , lineEdit_agingVesselType , Equipment::agingVesselType ),
EDITOR_FIELD_NORM(Equipment, label_packagingVesselType , lineEdit_packagingVesselType , Equipment::packagingVesselType ),
EDITOR_FIELD_NORM(Equipment, label_hltVolume , lineEdit_hltVolume , Equipment::hltVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunVolume , lineEdit_lauterTunVolume , Equipment::lauterTunVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_agingVesselVolume , lineEdit_agingVesselVolume , Equipment::agingVesselVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_packagingVesselVolume , lineEdit_packagingVesselVolume , Equipment::packagingVesselVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_hltLoss , lineEdit_hltLoss , Equipment::hltLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_mashTunLoss , lineEdit_mashTunLoss , Equipment::mashTunLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_fermenterLoss , lineEdit_fermenterLoss , Equipment::fermenterLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_agingVesselLoss , lineEdit_agingVesselLoss , Equipment::agingVesselLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_packagingVesselLoss , lineEdit_packagingVesselLoss , Equipment::packagingVesselLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleOutflowPerMinute , lineEdit_kettleOutflowPerMinute , Equipment::kettleOutflowPerMinute_l ),
EDITOR_FIELD_NORM(Equipment, label_hltWeight , lineEdit_hltWeight , Equipment::hltWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunWeight , lineEdit_lauterTunWeight , Equipment::lauterTunWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_kettleWeight , lineEdit_kettleWeight , Equipment::kettleWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_hltSpecificHeat , lineEdit_hltSpecificHeat , Equipment::hltSpecificHeat_calGC ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunSpecificHeat , lineEdit_lauterTunSpecificHeat , Equipment::lauterTunSpecificHeat_calGC),
EDITOR_FIELD_NORM(Equipment, label_kettleSpecificHeat , lineEdit_kettleSpecificHeat , Equipment::kettleSpecificHeat_calGC ),
EDITOR_FIELD_NORM(Equipment, label_hltType , lineEdit_hltType , Equipment::hltType ),
EDITOR_FIELD_NORM(Equipment, label_mashTunType , lineEdit_mashTunType , Equipment::mashTunType ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunType , lineEdit_lauterTunType , Equipment::lauterTunType ),
EDITOR_FIELD_NORM(Equipment, label_kettleType , lineEdit_kettleType , Equipment::kettleType ),
EDITOR_FIELD_NORM(Equipment, label_fermenterType , lineEdit_fermenterType , Equipment::fermenterType ),
EDITOR_FIELD_NORM(Equipment, label_agingVesselType , lineEdit_agingVesselType , Equipment::agingVesselType ),
EDITOR_FIELD_NORM(Equipment, label_packagingVesselType , lineEdit_packagingVesselType , Equipment::packagingVesselType ),
EDITOR_FIELD_NORM(Equipment, label_hltVolume , lineEdit_hltVolume , Equipment::hltVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunVolume , lineEdit_lauterTunVolume , Equipment::lauterTunVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_agingVesselVolume , lineEdit_agingVesselVolume , Equipment::agingVesselVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_packagingVesselVolume , lineEdit_packagingVesselVolume , Equipment::packagingVesselVolume_l ),
EDITOR_FIELD_NORM(Equipment, label_hltLoss , lineEdit_hltLoss , Equipment::hltLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_mashTunLoss , lineEdit_mashTunLoss , Equipment::mashTunLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_fermenterLoss , lineEdit_fermenterLoss , Equipment::fermenterLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_agingVesselLoss , lineEdit_agingVesselLoss , Equipment::agingVesselLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_packagingVesselLoss , lineEdit_packagingVesselLoss , Equipment::packagingVesselLoss_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleOutflowPerMinute , lineEdit_kettleOutflowPerMinute , Equipment::kettleOutflowPerMinute_l ),
EDITOR_FIELD_NORM(Equipment, label_kettleInternalDiameter , lineEdit_kettleInternalDiameter , Equipment::kettleInternalDiameter_cm, 1),
EDITOR_FIELD_NORM(Equipment, label_kettleOpeningDiameter , lineEdit_kettleOpeningDiameter , Equipment::kettleOpeningDiameter_cm , 1),
EDITOR_FIELD_NORM(Equipment, label_hltWeight , lineEdit_hltWeight , Equipment::hltWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunWeight , lineEdit_lauterTunWeight , Equipment::lauterTunWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_kettleWeight , lineEdit_kettleWeight , Equipment::kettleWeight_kg ),
EDITOR_FIELD_NORM(Equipment, label_hltSpecificHeat , lineEdit_hltSpecificHeat , Equipment::hltSpecificHeat_calGC ),
EDITOR_FIELD_NORM(Equipment, label_lauterTunSpecificHeat , lineEdit_lauterTunSpecificHeat , Equipment::lauterTunSpecificHeat_calGC ),
EDITOR_FIELD_NORM(Equipment, label_kettleSpecificHeat , lineEdit_kettleSpecificHeat , Equipment::kettleSpecificHeat_calGC ),
});

// Connect all the boxen
Expand Down
15 changes: 9 additions & 6 deletions src/widgets/SmartLineEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@
#include "widgets/SmartLabel.h"

namespace {
int const min_text_size = 8;
int const max_text_size = 50;
//
// There is a bit of trial-and-error involved in setting these values
//
int constexpr min_text_size = 3;
int constexpr max_text_size = 40;
}

// This private implementation class holds all private non-virtual members of SmartLineEdit
Expand Down Expand Up @@ -86,9 +89,9 @@ class SmartLineEdit::impl {
// want, but only when we are instructed to force it
this->m_self.setMinimumWidth(0);
if (sizingString.length() < min_text_size) {
sizingString = QString(min_text_size,'a');
sizingString = QString(min_text_size, 'a');
} else if (sizingString.length() > max_text_size) {
sizingString = QString(max_text_size,'a');
sizingString = QString(max_text_size, 'a');
}
this->calculateDisplaySize(sizingString);
}
Expand All @@ -107,8 +110,8 @@ class SmartLineEdit::impl {
return;
}

SmartLineEdit & m_self;
int m_desiredWidthInPixels;
SmartLineEdit & m_self;
int m_desiredWidthInPixels;
};

SmartLineEdit::SmartLineEdit(QWidget * parent) :
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6953,6 +6953,14 @@ El volum final al primari és de %1.</translation>
<source>Cancel</source>
<translation type="unfinished">Cancel·lar</translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6803,6 +6803,14 @@ Celkový objem pro hlavní kvašení je %1.</translation>
<source>Cancel</source>
<translation type="unfinished">Zrušit</translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6842,6 +6842,14 @@ Das endgültige Volumen in der Hauptgärung beträgt %1.</translation>
<source>Cancel</source>
<translation type="unfinished">Abbruch</translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6835,6 +6835,14 @@ The final volume in the primary is %1.</source>
<source>Cancel</source>
<translation type="unfinished">Ακύρωση</translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5291,6 +5291,14 @@ The final volume in the primary is %1.</source>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6905,6 +6905,14 @@ El volumen final en el primario es %1.</translation>
<source>Cancel</source>
<translation type="unfinished">Cancelar</translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_et.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5387,6 +5387,14 @@ The final volume in the primary is %1.</source>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_eu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5399,6 +5399,14 @@ The final volume in the primary is %1.</source>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6959,6 +6959,14 @@ Le volume final dans la cuve de fermentation est de %1.</translation>
<source>Cancel</source>
<translation type="unfinished">Annuler</translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_gl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5741,6 +5741,14 @@ The final volume in the primary is %1.</source>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
8 changes: 8 additions & 0 deletions translations/bt_hu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6881,6 +6881,14 @@ Végleges mennyiség az elsődleges erjesztőben: %1</translation>
<source>Cancel</source>
<translation type="unfinished">Mégsem</translation>
</message>
<message>
<source>Internal Diameter</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Opening Diameter</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>fermentableEditor</name>
Expand Down
Loading

0 comments on commit d7dc360

Please sign in to comment.