Fri, 01 Apr 2022 16:52:25 +0200
CMakeLists.txt cleanup. Removed partial BeerColor plugin, it was ugly and takes too much space. A bit of RanedSlider code cleanup. Most widgets for the first tab in the recipe editor placed.
CMakeLists.txt | file | annotate | diff | comparison | revisions | |
resources/icons.qrc | file | annotate | diff | comparison | revisions | |
resources/icons/bms/glass.png | file | annotate | diff | comparison | revisions | |
src/EditRecipe.cpp | file | annotate | diff | comparison | revisions | |
src/RangedSlider.cpp | file | annotate | diff | comparison | revisions | |
src/RangedSlider.h | file | annotate | diff | comparison | revisions | |
ui/EditRecipe.ui | file | annotate | diff | comparison | revisions |
--- a/CMakeLists.txt Fri Apr 01 14:58:57 2022 +0200 +++ b/CMakeLists.txt Fri Apr 01 16:52:25 2022 +0200 @@ -113,28 +113,28 @@ ${QT_LIBRARY_DIR} ) - set( SRC_FILES - ${SRCDIR}/RangedSlider.cpp - ${SRCDIR}/NullDateEdit.cpp - ) + #set( SRC_FILES + # ${SRCDIR}/RangedSlider.cpp + # ${SRCDIR}/NullDateEdit.cpp + #) # By default only QtCore and QtGui are enabled SET( QT_USE_QTDESIGNER TRUE ) - set( MOC_FILES - ${SRCDIR}/RangedSlider.h - ${SRCDIR}/NullDateEdit.h - ) + # set( MOC_FILES + # ${SRCDIR}/RangedSlider.h + # ${SRCDIR}/NullDateEdit.h + #) - set( PLUGIN_MOCS - designer/RangedSliderPlugin.h - designer/NullDateEditPlugin.h - ) + #set( PLUGIN_MOCS + # designer/RangedSliderPlugin.h + # designer/NullDateEditPlugin.h + #) - set( PLUGIN_SRCS - designer/RangedSliderPlugin.cpp - designer/NullDateEditPlugin.cpp - ) + #set( PLUGIN_SRCS + # designer/RangedSliderPlugin.cpp + # designer/NullDateEditPlugin.cpp + #) QT_WRAP_CPP( GEN_MOC_FILES1 ${SRCDIR}/RangedSlider.h designer/RangedSliderPlugin.h) add_library(bmsapp_rangeslider SHARED @@ -150,13 +150,6 @@ ${GEN_MOC_FILES2} ) - QT_WRAP_CPP( GEN_MOC_FILES3 ${SRCDIR}/BeerColor.h designer/BeerColorPlugin.h) - add_library(bmsapp_beercolor SHARED - ${SRCDIR}/BeerColor.cpp - designer/BeerColorPlugin.cpp - ${GEN_MOC_FILES3} - ) - ELSE() set( SRCS @@ -193,7 +186,6 @@ ${SRCDIR}/database/database.cpp ${SRCDIR}/RangedSlider.cpp ${SRCDIR}/NullDateEdit.cpp - ${SRCDIR}/BeerColor.cpp ) set( HDRS @@ -229,7 +221,6 @@ ${SRCDIR}/database/database.h ${SRCDIR}/RangedSlider.h ${SRCDIR}/NullDateEdit.h - ${SRCDIR}/BeerColor.h ) set( UIS @@ -296,7 +287,7 @@ IF( ${BUILD_DESIGNER_PLUGINS} ) - INSTALL(TARGETS bmsapp_rangeslider bmsapp_nulldate bmsapp_beercolor + INSTALL(TARGETS bmsapp_rangeslider bmsapp_nulldate DESTINATION "${LIBPATH}/plugins/designer" )
--- a/resources/icons.qrc Fri Apr 01 14:58:57 2022 +0200 +++ b/resources/icons.qrc Fri Apr 01 16:52:25 2022 +0200 @@ -1009,7 +1009,6 @@ <file>icons/bms/erlenmeyer.png</file> <file>icons/bms/fermenter.png</file> <file>icons/bms/fridge.png</file> - <file>icons/bms/glass.png</file> <file>icons/bms/graan.png</file> <file>icons/bms/hop.png</file> <file>icons/bms/mash.png</file>
--- a/src/EditRecipe.cpp Fri Apr 01 14:58:57 2022 +0200 +++ b/src/EditRecipe.cpp Fri Apr 01 16:52:25 2022 +0200 @@ -91,12 +91,11 @@ ui->est_abvShow->setMarkerTextIsValue(true); ui->est_abvShow->setValue(query.value(30).toDouble()); + QColor color = Utils::ebc_to_color(query.value(31).toInt()); ui->est_colorEdit->setValue(query.value(31).toDouble()); - QColor color = Utils::ebc_to_color(query.value(31).toInt()); ui->est_colorEdit->setStyleSheet(Utils::ebc_to_style(query.value(31).toInt())); - ui->est_colorGlass->setColor(color); ui->est_colorShow->setPrecision(0); - ui->est_colorShow->setMarkerTextIsValue(false); + ui->est_colorShow->setMarkerTextIsValue(true); ui->est_colorShow->setRange(query.value(15).toDouble(), query.value(16).toDouble()); ui->est_colorShow->setValue(query.value(31).toDouble());
--- a/src/RangedSlider.cpp Fri Apr 01 14:58:57 2022 +0200 +++ b/src/RangedSlider.cpp Fri Apr 01 16:52:25 2022 +0200 @@ -38,8 +38,7 @@ #include <QDebug> -RangedSlider::RangedSlider(QWidget* parent) - : QWidget(parent), +RangedSlider::RangedSlider(QWidget* parent) : QWidget(parent), _min(0.0), _max(1.0), _prefMin(0.25), @@ -52,12 +51,10 @@ _prefRangePen(Qt::NoPen), _markerBrush(QColor(255,255,255)), _markerTextIsValue(false), - indicatorTextFont("Arial", - 10, - QFont::Normal) // Previously we just did the indicator text in 'default' font + indicatorTextFont("Arial", 10, QFont::Normal) // Previously we just did the indicator text in 'default' font { - // Ensure this->heightInPixels is properly initialised - this->recalculateHeightInPixels(); + // Ensure this->heightInPixels is properly initialised +// this->recalculateHeightInPixels(); // In principle we want to set our min/max sizes etc here. However, if, say, a maximumSize property has been set // for this object in a Designer UI File (eg ui/mainWindow.ui) then that setting will override this one, because it @@ -94,7 +91,7 @@ void RangedSlider::setRange(QPair<double,double> minmax) { - setRange( minmax.first, minmax.second ); + setRange( minmax.first, minmax.second ); } @@ -198,16 +195,13 @@ // could end up painting us into a corner. // //QFontMetrics indicatorTextFontMetrics(this->indicatorTextFont); - this->heightInPixels = this->height(); //indicatorTextFontMetrics.lineSpacing(); +// this->heightInPixels = this->height(); return; } void RangedSlider::setSizes() { - // Caller's responsibility to have recently called this->recalculateHeightInPixels(). (See comment in that function - // for how we choose minimum width.) -// this->setMinimumSize(2 * this->heightInPixels, this->heightInPixels); + // Fixed minimum size. this->setMinimumSize(60, 20); - this->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); // There no particular reason to limit our horizontal size, so, in principle, this call asks that there be no such @@ -217,11 +211,11 @@ return; } -QSize RangedSlider::sizeHint() const -{ - this->recalculateHeightInPixels(); - return QSize(4 * this->heightInPixels, this->heightInPixels); -} +//QSize RangedSlider::sizeHint() const +//{ +// this->recalculateHeightInPixels(); +// return QSize(4 * this->heightInPixels, this->heightInPixels); +//} void RangedSlider::mouseMoveEvent(QMouseEvent* event) {
--- a/src/RangedSlider.h Fri Apr 01 14:58:57 2022 +0200 +++ b/src/RangedSlider.h Fri Apr 01 16:52:25 2022 +0200 @@ -59,7 +59,7 @@ void setPrecision(int precision); //! \brief Reimplemented from QWidget. - virtual QSize sizeHint() const; +// virtual QSize sizeHint() const; public slots: /**
--- a/ui/EditRecipe.ui Fri Apr 01 14:58:57 2022 +0200 +++ b/ui/EditRecipe.ui Fri Apr 01 16:52:25 2022 +0200 @@ -227,7 +227,7 @@ <widget class="QLabel" name="efficiencyLabel"> <property name="geometry"> <rect> - <x>380</x> + <x>370</x> <y>140</y> <width>131</width> <height>20</height> @@ -243,7 +243,7 @@ <widget class="QLabel" name="boil_timeLabel"> <property name="geometry"> <rect> - <x>380</x> + <x>370</x> <y>170</y> <width>131</width> <height>20</height> @@ -259,7 +259,7 @@ <widget class="QLabel" name="batch_sizeLabel"> <property name="geometry"> <rect> - <x>760</x> + <x>740</x> <y>140</y> <width>131</width> <height>20</height> @@ -275,7 +275,7 @@ <widget class="QLabel" name="boil_sizeLabel"> <property name="geometry"> <rect> - <x>760</x> + <x>740</x> <y>170</y> <width>131</width> <height>20</height> @@ -291,7 +291,7 @@ <widget class="QDoubleSpinBox" name="efficiencyEdit"> <property name="geometry"> <rect> - <x>520</x> + <x>510</x> <y>140</y> <width>101</width> <height>24</height> @@ -316,7 +316,7 @@ <widget class="QSpinBox" name="boil_timeEdit"> <property name="geometry"> <rect> - <x>520</x> + <x>510</x> <y>170</y> <width>101</width> <height>24</height> @@ -338,7 +338,7 @@ <widget class="QDoubleSpinBox" name="batch_sizeEdit"> <property name="geometry"> <rect> - <x>900</x> + <x>880</x> <y>140</y> <width>101</width> <height>24</height> @@ -366,15 +366,21 @@ <widget class="QDoubleSpinBox" name="boil_sizeEdit"> <property name="geometry"> <rect> - <x>900</x> + <x>880</x> <y>170</y> - <width>101</width> + <width>87</width> <height>24</height> </rect> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::NoButtons</enum> + </property> <property name="accelerated"> <bool>true</bool> </property> @@ -395,7 +401,7 @@ <property name="geometry"> <rect> <x>220</x> - <y>200</y> + <y>320</y> <width>148</width> <height>24</height> </rect> @@ -405,7 +411,7 @@ <property name="geometry"> <rect> <x>0</x> - <y>200</y> + <y>320</y> <width>131</width> <height>20</height> </rect> @@ -421,7 +427,7 @@ <property name="geometry"> <rect> <x>140</x> - <y>200</y> + <y>320</y> <width>71</width> <height>24</height> </rect> @@ -429,6 +435,9 @@ <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::UpDownArrows</enum> + </property> <property name="accelerated"> <bool>true</bool> </property> @@ -448,8 +457,8 @@ <widget class="QLabel" name="est_fgLabel"> <property name="geometry"> <rect> - <x>0</x> - <y>230</y> + <x>370</x> + <y>320</y> <width>131</width> <height>20</height> </rect> @@ -464,14 +473,14 @@ <widget class="QLabel" name="est_abvLabel"> <property name="geometry"> <rect> - <x>0</x> - <y>260</y> + <x>740</x> + <y>320</y> <width>131</width> <height>20</height> </rect> </property> <property name="text"> - <string>Estimated ABV:</string> + <string>Alcohol Volume:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> @@ -481,13 +490,13 @@ <property name="geometry"> <rect> <x>0</x> - <y>290</y> + <y>350</y> <width>131</width> <height>20</height> </rect> </property> <property name="text"> - <string>Estimated Color EBC:</string> + <string>Color EBC:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> @@ -496,8 +505,8 @@ <widget class="QDoubleSpinBox" name="est_fgEdit"> <property name="geometry"> <rect> - <x>140</x> - <y>230</y> + <x>510</x> + <y>320</y> <width>71</width> <height>24</height> </rect> @@ -505,6 +514,9 @@ <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::NoButtons</enum> + </property> <property name="accelerated"> <bool>true</bool> </property> @@ -524,8 +536,8 @@ <widget class="RangedSlider" name="est_fgShow"> <property name="geometry"> <rect> - <x>220</x> - <y>230</y> + <x>590</x> + <y>320</y> <width>148</width> <height>24</height> </rect> @@ -534,9 +546,9 @@ <widget class="QDoubleSpinBox" name="est_abvEdit"> <property name="geometry"> <rect> - <x>140</x> - <y>260</y> - <width>57</width> + <x>880</x> + <y>320</y> + <width>71</width> <height>24</height> </rect> </property> @@ -572,8 +584,8 @@ <property name="geometry"> <rect> <x>140</x> - <y>290</y> - <width>57</width> + <y>350</y> + <width>71</width> <height>24</height> </rect> </property> @@ -605,28 +617,18 @@ <widget class="RangedSlider" name="est_abvShow"> <property name="geometry"> <rect> - <x>220</x> - <y>260</y> + <x>960</x> + <y>320</y> <width>148</width> <height>24</height> </rect> </property> </widget> - <widget class="BeerColor" name="est_colorGlass"> - <property name="geometry"> - <rect> - <x>590</x> - <y>270</y> - <width>90</width> - <height>130</height> - </rect> - </property> - </widget> <widget class="QComboBox" name="color_methodEdit"> <property name="geometry"> <rect> - <x>140</x> - <y>320</y> + <x>510</x> + <y>350</y> <width>201</width> <height>23</height> </rect> @@ -636,12 +638,381 @@ <property name="geometry"> <rect> <x>220</x> - <y>290</y> - <width>151</width> + <y>350</y> + <width>148</width> <height>24</height> </rect> </property> </widget> + <widget class="QComboBox" name="beerstyleEdit"> + <property name="geometry"> + <rect> + <x>510</x> + <y>200</y> + <width>201</width> + <height>23</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="st_typeLabel"> + <property name="geometry"> + <rect> + <x>0</x> + <y>260</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Style type:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="st_guideLabel"> + <property name="geometry"> + <rect> + <x>0</x> + <y>230</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Style guide:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="st_nameLabel"> + <property name="geometry"> + <rect> + <x>370</x> + <y>230</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Style name:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="st_catLabel"> + <property name="geometry"> + <rect> + <x>370</x> + <y>260</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Category:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="st_groupLabel"> + <property name="geometry"> + <rect> + <x>740</x> + <y>230</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Style group:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="st_catnrLabel"> + <property name="geometry"> + <rect> + <x>740</x> + <y>260</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Category number:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="stylelableLabel"> + <property name="geometry"> + <rect> + <x>140</x> + <y>200</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="font"> + <font> + <pointsize>11</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Beerstyle data</string> + </property> + </widget> + <widget class="QLabel" name="color_methodLabel"> + <property name="geometry"> + <rect> + <x>370</x> + <y>350</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Color method:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QLabel" name="ibu_methodLabel"> + <property name="geometry"> + <rect> + <x>370</x> + <y>380</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>IBU method:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QComboBox" name="ibu_methodEdit"> + <property name="geometry"> + <rect> + <x>510</x> + <y>380</y> + <width>201</width> + <height>23</height> + </rect> + </property> + </widget> + <widget class="QLineEdit" name="st_guideEdit"> + <property name="geometry"> + <rect> + <x>140</x> + <y>230</y> + <width>226</width> + <height>23</height> + </rect> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="QLineEdit" name="st_typeEdit"> + <property name="geometry"> + <rect> + <x>140</x> + <y>260</y> + <width>226</width> + <height>23</height> + </rect> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="QLineEdit" name="st_nameEdit"> + <property name="geometry"> + <rect> + <x>510</x> + <y>230</y> + <width>226</width> + <height>23</height> + </rect> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="QLineEdit" name="st_catEdit"> + <property name="geometry"> + <rect> + <x>510</x> + <y>260</y> + <width>226</width> + <height>23</height> + </rect> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="QLineEdit" name="st_groupEdit"> + <property name="geometry"> + <rect> + <x>880</x> + <y>230</y> + <width>101</width> + <height>23</height> + </rect> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="QLineEdit" name="st_catnrEdit"> + <property name="geometry"> + <rect> + <x>880</x> + <y>260</y> + <width>71</width> + <height>23</height> + </rect> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" name="est_ibuLabel"> + <property name="geometry"> + <rect> + <x>0</x> + <y>380</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Bitterness IBU:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + <widget class="QDoubleSpinBox" name="est_ibuEdit"> + <property name="geometry"> + <rect> + <x>140</x> + <y>380</y> + <width>71</width> + <height>24</height> + </rect> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::NoButtons</enum> + </property> + <property name="accelerated"> + <bool>false</bool> + </property> + <property name="decimals"> + <number>0</number> + </property> + <property name="minimum"> + <double>0.000000000000000</double> + </property> + <property name="maximum"> + <double>400.000000000000000</double> + </property> + <property name="singleStep"> + <double>1.000000000000000</double> + </property> + </widget> + <widget class="RangedSlider" name="est_ibuShow"> + <property name="geometry"> + <rect> + <x>220</x> + <y>380</y> + <width>148</width> + <height>24</height> + </rect> + </property> + </widget> + <widget class="RangedSlider" name="est_carbShow"> + <property name="geometry"> + <rect> + <x>960</x> + <y>350</y> + <width>148</width> + <height>24</height> + </rect> + </property> + </widget> + <widget class="QDoubleSpinBox" name="est_carbEdit"> + <property name="geometry"> + <rect> + <x>880</x> + <y>350</y> + <width>71</width> + <height>24</height> + </rect> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="buttonSymbols"> + <enum>QAbstractSpinBox::NoButtons</enum> + </property> + <property name="accelerated"> + <bool>false</bool> + </property> + <property name="suffix"> + <string> %</string> + </property> + <property name="decimals"> + <number>1</number> + </property> + <property name="minimum"> + <double>0.000000000000000</double> + </property> + <property name="maximum"> + <double>80.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + <widget class="QLabel" name="est_carbLabel"> + <property name="geometry"> + <rect> + <x>740</x> + <y>350</y> + <width>131</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Carbonation:</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> </widget> <widget class="QWidget" name="fermentables"> <attribute name="icon"> @@ -738,11 +1109,6 @@ </widget> <customwidgets> <customwidget> - <class>BeerColor</class> - <extends>QWidget</extends> - <header>BeerColor.h</header> - </customwidget> - <customwidget> <class>RangedSlider</class> <extends>QWidget</extends> <header>RangedSlider.h</header>