# HG changeset patch # User Michiel Broek # Date 1656536798 -7200 # Node ID ff02aca2b63c42f9f9353c22fd2367ffaf487a79 # Parent f78827503fb01feaabde51860c126455cc1e30f6 Removed LED plugin, now using the one from the AnalogWidgets. diff -r f78827503fb0 -r ff02aca2b63c CMakeLists.txt --- a/CMakeLists.txt Wed Jun 29 22:19:39 2022 +0200 +++ b/CMakeLists.txt Wed Jun 29 23:06:38 2022 +0200 @@ -131,13 +131,6 @@ ${GEN_MOC_FILES2} ) - QT_WRAP_CPP( GEN_MOC_FILES3 ${SRCDIR}/LED.h designer/LEDPlugin.h) - add_library(bmsapp_LED SHARED - ${SRCDIR}/LED.cpp - designer/LEDPlugin.cpp - ${GEN_MOC_FILES3} - ) - QT_WRAP_CPP(GEN_MOC_FILES4 ${SRCDIR}/analog/thermometer.h ${SRCDIR}/analog/abstractmeter.h @@ -240,7 +233,6 @@ ${SRCDIR}/database/db_recipe.cpp ${SRCDIR}/RangedSlider.cpp ${SRCDIR}/NullDateEdit.cpp - ${SRCDIR}/LED.cpp ${SRCDIR}/analog/abstractmeter.cpp ${SRCDIR}/analog/functions.cpp ${SRCDIR}/analog/widgetwithbackground.cpp @@ -298,7 +290,6 @@ ${SRCDIR}/database/db_recipe.h ${SRCDIR}/RangedSlider.h ${SRCDIR}/NullDateEdit.h - ${SRCDIR}/LED.h ${SRCDIR}/analog/abstractmeter.h ${SRCDIR}/analog/functions.h ${SRCDIR}/analog/widgetwithbackground.h @@ -379,7 +370,6 @@ INSTALL(TARGETS bmsapp_rangeslider bmsapp_nulldate - bmsapp_LED bmsapp_thermometer bmsapp_manometer bmsapp_led diff -r f78827503fb0 -r ff02aca2b63c designer/LEDPlugin.cpp --- a/designer/LEDPlugin.cpp Wed Jun 29 22:19:39 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ - -#include -#include -#include -#include -#include -#include - -#include "LEDPlugin.h" -#include "LED.h" - -LEDPlugin::LEDPlugin(QObject* parent) : - QObject(parent) -{ -} - -void LEDPlugin::initialize(QDesignerFormEditorInterface * /* core */) -{ - if(initialized) - return; - - initialized = true; - return; -} - -bool LEDPlugin::isInitialized() const -{ - return initialized; -} - -QString LEDPlugin::name() const -{ - return "LED"; -} - -QString LEDPlugin::group() const -{ - return "BMSapp Widgets"; -} - -QString LEDPlugin::toolTip() const -{ - return QString("An LED"); -} - -QString LEDPlugin::whatsThis() const -{ - return QString("An LED"); -} - -QString LEDPlugin::includeFile() const -{ - return "LED.h"; -} - -QString LEDPlugin::domXml() const -{ - return "\n" - " \n" - " \n" - "\n"; -} - -QIcon LEDPlugin::icon() const -{ - return QIcon(); -} - -bool LEDPlugin::isContainer() const -{ - return false; -} - -QWidget * LEDPlugin::createWidget(QWidget *parent) -{ - return new LED(parent); -} - diff -r f78827503fb0 -r ff02aca2b63c designer/LEDPlugin.h --- a/designer/LEDPlugin.h Wed Jun 29 22:19:39 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#ifndef _LED_PLUGIN_H_ -#define _LED_PLUGIN_H_ - -#include -#include -#include -#include -#include - -class LEDPlugin; - -class LEDPlugin : public QObject, public QDesignerCustomWidgetInterface -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QDesignerCustomWidgetCollectionInterface") - Q_INTERFACES(QDesignerCustomWidgetInterface) - -public: - LEDPlugin(QObject* parent=0); - - QString name() const; - QString group() const; - QString toolTip() const; - QString whatsThis() const; - QString includeFile() const; - QIcon icon() const; - QString domXml() const; - - bool isContainer() const; - bool isInitialized() const; - - QWidget *createWidget(QWidget *parent); - void initialize(QDesignerFormEditorInterface *core); - -private: - bool initialized = false; -}; - -#endif diff -r f78827503fb0 -r ff02aca2b63c src/DetailFermenter.cpp --- a/src/DetailFermenter.cpp Wed Jun 29 22:19:39 2022 +0200 +++ b/src/DetailFermenter.cpp Wed Jun 29 23:06:38 2022 +0200 @@ -27,6 +27,9 @@ WindowTitle(); + // srcMode = ['OFF', 'NONE', 'FRIDGE', 'BEER', 'PROFILE']; + // srcStage = ['PRIMARY', 'SECONDARY', 'TERTIARY', 'CARBONATION']; + // // connect(ui->nameEdit, &QLineEdit::textChanged, this, &DetailFermenter::is_changed); // connect(ui->unlimitedEdit, &QCheckBox::stateChanged, this, &DetailFermenter::is_changed); // connect(ui->caEdit, &QDoubleSpinBox::textChanged, this, &DetailFermenter::water_changed); @@ -46,7 +49,13 @@ query.exec(); if (query.next()) { + ui->uuidEdit->setText(query.value("uuid").toString()); + ui->systemEdit->setText(query.value("node").toString()+"/"+query.value("alias").toString()); + if (query.value("online").toInt()) { + ui->statusEdit->setText(tr("Online")); + ui->codeEdit->setText(query.value("beercode").toString()+" - "+query.value("beername").toString()); + if (query.value("mode").toString() == "OFF") { ui->powerLED->setChecked(false); // disable dropdowns select beer. diff -r f78827503fb0 -r ff02aca2b63c src/LED.cpp --- a/src/LED.cpp Wed Jun 29 22:19:39 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -#include - -#include -#include -#include -#include - -#include "LED.h" - -LED:: -LED(QWidget* parent) : - QWidget(parent), - diameter_(5), - color_(QColor("red")), - alignment_(Qt::AlignCenter), - initialState_(true), - state_(true), - flashRate_(200), - flashing_(false) -{ - timer_ = new QTimer(this); - connect(timer_, SIGNAL(timeout()), this, SLOT(toggleState())); - - setDiameter(diameter_); -} - -LED:: -~LED() -{ -} - - -double LED:: -diameter() const -{ - return diameter_; -} - -void LED:: -setDiameter(double diameter) -{ - diameter_ = diameter; - - pixX_ = round(double(height())/heightMM()); - pixY_ = round(double(width())/widthMM()); - - diamX_ = diameter_*pixX_; - diamY_ = diameter_*pixY_; - - update(); -} - - -QColor LED:: -color() const -{ - return color_; -} - -void LED:: -setColor(const QColor& color) -{ - color_ = color; - update(); -} - -Qt::Alignment LED:: -alignment() const -{ - return alignment_; -} - -void LED:: -setAlignment(Qt::Alignment alignment) -{ - alignment_ = alignment; - - update(); -} - -void LED:: -setFlashRate(int rate) -{ - flashRate_ = rate; - - update(); -} - -void LED:: -setFlashing(bool flashing) -{ - flashing_ = flashing; - - update(); -} - -void LED:: -startFlashing() -{ - setFlashing(true); -} - -void LED:: -stopFlashing() -{ - setFlashing(false); -} - - -void LED:: -setState(bool state) -{ - state_ = state; - update(); -} - -void LED:: -toggleState() -{ - state_ = !state_; - update(); -} - -int LED:: -heightForWidth(int width) const -{ - return width; -} - -QSize LED:: -sizeHint() const -{ - return QSize(diamX_, diamY_); -} - -QSize LED:: -minimumSizeHint() const -{ - return QSize(diamX_, diamY_); -} - -void LED:: -paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event); - - QPainter p(this); - - QRect geo = geometry(); - int width = geo.width(); - int height = geo.height(); - - int x=0, y=0; - if ( alignment_ & Qt::AlignLeft ) - x = 0; - else if ( alignment_ & Qt::AlignRight ) - x = width-diamX_; - else if ( alignment_ & Qt::AlignHCenter ) - x = (width-diamX_)/2; - else if ( alignment_ & Qt::AlignJustify ) - x = 0; - - if ( alignment_ & Qt::AlignTop ) - y = 0; - else if ( alignment_ & Qt::AlignBottom ) - y = height-diamY_; - else if ( alignment_ & Qt::AlignVCenter ) - y = (height-diamY_)/2; - - QRadialGradient g(x+diamX_/2, y+diamY_/2, diamX_*0.4, - diamX_*0.4, diamY_*0.4); - - g.setColorAt(0, Qt::white); - if ( state_ ) - g.setColorAt(1, color_); - else - g.setColorAt(1, Qt::black); - QBrush brush(g); - - p.setPen(color_); - p.setRenderHint(QPainter::Antialiasing, true); - p.setBrush(brush); - p.drawEllipse(x, y, diamX_-1, diamY_-1); - - if ( flashRate_ > 0 && flashing_ ) - timer_->start(flashRate_); - else - timer_->stop(); -} - -bool LED:: -state() const -{ - return state_; -} - -bool LED:: -isFlashing() const -{ - return flashing_; -} - -int LED:: -flashRate() const -{ - return flashRate_; -} diff -r f78827503fb0 -r ff02aca2b63c src/LED.h --- a/src/LED.h Wed Jun 29 22:19:39 2022 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -#ifndef _LED_H_ -#define _LED_H_ - -#include -#include - -class QTimer; - -class QDESIGNER_WIDGET_EXPORT LED : public QWidget -{ - Q_OBJECT - - Q_PROPERTY(double diameter READ diameter WRITE setDiameter) // mm - Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) - Q_PROPERTY(bool state READ state WRITE setState) - Q_PROPERTY(bool flashing READ isFlashing WRITE setFlashing) - Q_PROPERTY(int flashRate READ flashRate WRITE setFlashRate) - -public: - explicit LED(QWidget* parent=0); - ~LED(); - - double diameter() const; - void setDiameter(double diameter); - - QColor color() const; - void setColor(const QColor& color); - - Qt::Alignment alignment() const; - void setAlignment(Qt::Alignment alignment); - - bool state() const; - - bool isFlashing() const; - - int flashRate() const; - -public slots: - void setState(bool state); - void toggleState(); - void setFlashing(bool flashing); - void setFlashRate(int rate); - void startFlashing(); - void stopFlashing(); - -public: - int heightForWidth(int width) const; - QSize sizeHint() const; - QSize minimumSizeHint() const; - -protected: - void paintEvent(QPaintEvent* event); - -private: - double diameter_; - QColor color_; - Qt::Alignment alignment_; - bool initialState_; - bool state_; - int flashRate_; - bool flashing_; - - // - // Pixels per mm for x and y... - // - int pixX_, pixY_; - - // - // Scaled values for x and y diameter. - // - int diamX_, diamY_; - - QRadialGradient gradient_; - QTimer* timer_; -}; - -#endif diff -r f78827503fb0 -r ff02aca2b63c ui/DetailFermenter.ui --- a/ui/DetailFermenter.ui Wed Jun 29 22:19:39 2022 +0200 +++ b/ui/DetailFermenter.ui Wed Jun 29 23:06:38 2022 +0200 @@ -320,10 +320,13 @@ 140 40 - 221 + 271 23 + + true + true @@ -333,10 +336,13 @@ 140 70 - 151 + 181 23 + + true + true @@ -350,6 +356,9 @@ 23 + + true + @@ -360,6 +369,9 @@ 23 + + true + @@ -396,10 +408,13 @@ 140 190 - 221 + 271 23 + + true + @@ -410,6 +425,9 @@ 23 + + true + @@ -451,7 +469,7 @@ 290 - 10 + 150 101 20 @@ -729,24 +747,120 @@ + + + + 15 + 50 + 71 + 20 + + + + Heat + + + Qt::AlignCenter + + + + + + 95 + 50 + 71 + 20 + + + + Cool + + + Qt::AlignCenter + + + + + + 175 + 50 + 71 + 20 + + + + Fan + + + Qt::AlignCenter + + + + + + 36 + 80 + 28 + 22 + + + + ... + + + true + + + false + + + + + + 116 + 80 + 28 + 22 + + + + ... + + + true + + + + + + 196 + 80 + 28 + 22 + + + + ... + + + true + + 720 - 390 + 380 261 - 131 + 141 - - GroupBox - 90 - 90 + 100 80 23 @@ -765,6 +879,32 @@ :icons/silk/door_out.png:icons/silk/door_out.png + + + + 90 + 20 + 80 + 23 + + + + Log + + + + + + 90 + 60 + 80 + 23 + + + + Camera + +