# HG changeset patch # User Michiel Broek # Date 1648824745 -7200 # Node ID 053c0578cf58c88b0ccaaff37fda105489c2dc77 # Parent 1425bf3e18ed7431c7ced94520f9e5c7cfacec1a 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. diff -r 1425bf3e18ed -r 053c0578cf58 CMakeLists.txt --- 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" ) diff -r 1425bf3e18ed -r 053c0578cf58 resources/icons.qrc --- 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 @@ icons/bms/erlenmeyer.png icons/bms/fermenter.png icons/bms/fridge.png - icons/bms/glass.png icons/bms/graan.png icons/bms/hop.png icons/bms/mash.png diff -r 1425bf3e18ed -r 053c0578cf58 resources/icons/bms/glass.png Binary file resources/icons/bms/glass.png has changed diff -r 1425bf3e18ed -r 053c0578cf58 src/EditRecipe.cpp --- 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()); diff -r 1425bf3e18ed -r 053c0578cf58 src/RangedSlider.cpp --- 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 -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 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) { diff -r 1425bf3e18ed -r 053c0578cf58 src/RangedSlider.h --- 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: /** diff -r 1425bf3e18ed -r 053c0578cf58 ui/EditRecipe.ui --- 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 @@ - 380 + 370 140 131 20 @@ -243,7 +243,7 @@ - 380 + 370 170 131 20 @@ -259,7 +259,7 @@ - 760 + 740 140 131 20 @@ -275,7 +275,7 @@ - 760 + 740 170 131 20 @@ -291,7 +291,7 @@ - 520 + 510 140 101 24 @@ -316,7 +316,7 @@ - 520 + 510 170 101 24 @@ -338,7 +338,7 @@ - 900 + 880 140 101 24 @@ -366,15 +366,21 @@ - 900 + 880 170 - 101 + 87 24 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + true + + + QAbstractSpinBox::NoButtons + true @@ -395,7 +401,7 @@ 220 - 200 + 320 148 24 @@ -405,7 +411,7 @@ 0 - 200 + 320 131 20 @@ -421,7 +427,7 @@ 140 - 200 + 320 71 24 @@ -429,6 +435,9 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + QAbstractSpinBox::UpDownArrows + true @@ -448,8 +457,8 @@ - 0 - 230 + 370 + 320 131 20 @@ -464,14 +473,14 @@ - 0 - 260 + 740 + 320 131 20 - Estimated ABV: + Alcohol Volume: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -481,13 +490,13 @@ 0 - 290 + 350 131 20 - Estimated Color EBC: + Color EBC: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -496,8 +505,8 @@ - 140 - 230 + 510 + 320 71 24 @@ -505,6 +514,9 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + QAbstractSpinBox::NoButtons + true @@ -524,8 +536,8 @@ - 220 - 230 + 590 + 320 148 24 @@ -534,9 +546,9 @@ - 140 - 260 - 57 + 880 + 320 + 71 24 @@ -572,8 +584,8 @@ 140 - 290 - 57 + 350 + 71 24 @@ -605,28 +617,18 @@ - 220 - 260 + 960 + 320 148 24 - - - - 590 - 270 - 90 - 130 - - - - 140 - 320 + 510 + 350 201 23 @@ -636,12 +638,381 @@ 220 - 290 - 151 + 350 + 148 24 + + + + 510 + 200 + 201 + 23 + + + + + + + 0 + 260 + 131 + 20 + + + + Style type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 0 + 230 + 131 + 20 + + + + Style guide: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 370 + 230 + 131 + 20 + + + + Style name: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 370 + 260 + 131 + 20 + + + + Category: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 740 + 230 + 131 + 20 + + + + Style group: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 740 + 260 + 131 + 20 + + + + Category number: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 140 + 200 + 131 + 20 + + + + + 11 + 75 + true + + + + Beerstyle data + + + + + + 370 + 350 + 131 + 20 + + + + Color method: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 370 + 380 + 131 + 20 + + + + IBU method: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 510 + 380 + 201 + 23 + + + + + + + 140 + 230 + 226 + 23 + + + + true + + + + + + 140 + 260 + 226 + 23 + + + + true + + + + + + 510 + 230 + 226 + 23 + + + + true + + + + + + 510 + 260 + 226 + 23 + + + + true + + + + + + 880 + 230 + 101 + 23 + + + + true + + + + + + 880 + 260 + 71 + 23 + + + + true + + + + + + 0 + 380 + 131 + 20 + + + + Bitterness IBU: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 140 + 380 + 71 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + QAbstractSpinBox::NoButtons + + + false + + + 0 + + + 0.000000000000000 + + + 400.000000000000000 + + + 1.000000000000000 + + + + + + 220 + 380 + 148 + 24 + + + + + + + 960 + 350 + 148 + 24 + + + + + + + 880 + 350 + 71 + 24 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + true + + + QAbstractSpinBox::NoButtons + + + false + + + % + + + 1 + + + 0.000000000000000 + + + 80.000000000000000 + + + 0.100000000000000 + + + + + + 740 + 350 + 131 + 20 + + + + Carbonation: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + @@ -738,11 +1109,6 @@ - BeerColor - QWidget -
BeerColor.h
-
- RangedSlider QWidget
RangedSlider.h