File indexing completed on 2024-05-19 09:39:02
0001 /*************************************************************************** 0002 * Copyright (C) 2005 by David Saxton * 0003 * david@bluehaze.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #ifndef BIDIRLED_H 0012 #define BIDIRLED_H 0013 0014 #include <component.h> 0015 0016 /** 0017 @author David Saxton 0018 */ 0019 class BiDirLED : public Component 0020 { 0021 public: 0022 BiDirLED(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); 0023 ~BiDirLED() override; 0024 0025 static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); 0026 static LibraryItem *libraryItem(); 0027 0028 void dataChanged() override; 0029 void stepNonLogic() override; 0030 bool doesStepNonLogic() const override 0031 { 0032 return true; 0033 } 0034 0035 private: 0036 void drawShape(QPainter &p) override; 0037 0038 double r[2]; 0039 double g[2]; 0040 double b[2]; 0041 0042 double avg_brightness[2]; 0043 uint last_brightness[2]; 0044 double lastUpdatePeriod; 0045 Diode *m_pDiode[2]; 0046 }; 0047 0048 #endif