MiniDisplay/minidisplay.h
author sl
Wed, 28 May 2014 19:31:55 +0200
changeset 12 f0c61338a2e8
parent 10 64cfde8062c7
child 15 737f8bb110be
permissions -rw-r--r--
Fixing our font rendering issues by rendering into 32bits bitmap.
     1 #ifndef MINIDISPLAY_H
     2 #define MINIDISPLAY_H
     3 
     4 #include <QQuickItem>
     5 #include "FutabaVfd.h"
     6 
     7 class MiniDisplay : public QQuickItem
     8 {
     9     Q_OBJECT
    10     Q_DISABLE_COPY(MiniDisplay)
    11     //
    12     Q_PROPERTY(bool isOpen READ isOpen NOTIFY statusChanged)
    13     Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
    14     Q_PROPERTY(QString vendor READ vendor)
    15     Q_PROPERTY(QString product READ product)
    16     Q_PROPERTY(QString serialNumber READ serialNumber)
    17     Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
    18     Q_PROPERTY(int maxBrightness READ maxBrightness NOTIFY opened)
    19     Q_PROPERTY(int minBrightness READ minBrightness NOTIFY opened)
    20     Q_PROPERTY(QPoint framePosition READ framePosition WRITE setFramePosition NOTIFY closed)
    21 
    22 public:
    23     //Methods
    24     Q_INVOKABLE void open();
    25     Q_INVOKABLE void close();
    26     //
    27     Q_INVOKABLE void clear();
    28     Q_INVOKABLE void fill();
    29     Q_INVOKABLE void swapBuffers();
    30     //
    31     Q_INVOKABLE void requestPowerStatus();
    32     Q_INVOKABLE void requestDeviceId();
    33     Q_INVOKABLE void requestFirmwareVersion();
    34 
    35 public:
    36     //Properties
    37     bool isOpen();
    38     QFont font() const {return iFont;}
    39     void setFont(const QFont& aFont);
    40     //
    41     QString vendor();
    42     QString product();
    43     QString serialNumber();
    44     //
    45     int maxBrightness() const;
    46     int minBrightness() const;
    47     int brightness() const;
    48     void setBrightness(int aBrightness);
    49     //
    50     QPoint framePosition() const;
    51     void setFramePosition(const QPoint& aPoint);
    52 
    53 signals:
    54     void opened();
    55     void openError();
    56     void closing();
    57     void closed();
    58     void statusChanged();
    59     void fontChanged();
    60     void brightnessChanged();
    61     //
    62     void powerStatus(bool powerOn);
    63     void deviceId(QString deviceId);
    64     void firmwareVersion(QString version);
    65 
    66 public slots:
    67     void readTimer();
    68 
    69 
    70 public:
    71     MiniDisplay(QQuickItem *parent = 0);
    72     ~MiniDisplay();
    73 
    74 private:
    75     GP1212A01A iDisplay;
    76     QFont iFont;
    77     int iReadAttempt;
    78     int iBrightness;
    79     QPoint iFramePosition;
    80 };
    81 
    82 #endif // MINIDISPLAY_H
    83