LMMS
Loading...
Searching...
No Matches
LcdWidget.h
Go to the documentation of this file.
1/*
2 * LcdWidget.h - a widget for displaying numbers in LCD style
3 *
4 * Copyright (c) 2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_GUI_LCD_WIDGET_H
26#define LMMS_GUI_LCD_WIDGET_H
27
28#include <QMap>
29#include <QWidget>
30
31#include "lmms_export.h"
32
33namespace lmms::gui
34{
35
36class LMMS_EXPORT LcdWidget : public QWidget
37{
38 Q_OBJECT
39
40 // theming qproperties
43
44public:
45 explicit LcdWidget(QWidget* parent, const QString& name = QString(), bool leadingZero = false);
46 LcdWidget(int numDigits, QWidget* parent, const QString& name = QString(), bool leadingZero = false);
47 LcdWidget(int numDigits, const QString& style, QWidget* parent, const QString& name = QString(),
48 bool leadingZero = false);
49
50 void setValue(int value);
51 void setValue(float value);
52 void setLabel(const QString& label);
53
54 void addTextForValue( int value, const QString& text )
55 {
57 update();
58 }
59
61
62 inline int numDigits() const { return m_numDigits; }
63 inline void setNumDigits( int n ) { m_numDigits = n; updateSize(); }
64
65 QColor textColor() const;
66 void setTextColor( const QColor & c );
67
68 QColor textShadowColor() const;
69 void setTextShadowColor( const QColor & c );
70
71 int cellHeight() const { return m_cellHeight; }
72
73 void setSeamless(bool left, bool right)
74 {
77 updateSize();
78 }
79
80public slots:
81 virtual void setMarginWidth( int width );
82
83
84protected:
85 void paintEvent( QPaintEvent * pe ) override;
86
87 virtual void updateSize();
88
89
90private:
91
92 static const int charsPerPixmap = 12;
93
94 QMap<int, QString> m_textForValue;
95
96 QString m_display;
97
98 QString m_label;
99 QPixmap m_lcdPixmap;
100
103
111
112 void initUi( const QString& name, const QString &style );
113
114};
115
116} // namespace lmms::gui
117
118#endif // LMMS_GUI_LCD_WIDGET_H
#define READ(addr)
Definition Ay_Cpu.cpp:92
#define WRITE(addr, data)
Definition Ay_Cpu.cpp:93
static const int charsPerPixmap
Definition LcdWidget.h:92
bool m_seamlessRight
Definition LcdWidget.h:109
QColor textShadowColor
Definition LcdWidget.h:42
void setLabel(const QString &label)
Definition LcdWidget.cpp:228
QColor textColor
Definition LcdWidget.h:41
int m_marginWidth
Definition LcdWidget.h:107
int m_numDigits
Definition LcdWidget.h:106
LcdWidget(QWidget *parent, const QString &name=QString(), bool leadingZero=false)
Definition LcdWidget.cpp:40
QColor m_textShadowColor
Definition LcdWidget.h:102
void setTextColor(const QColor &c)
Definition LcdWidget.cpp:116
int m_cellWidth
Definition LcdWidget.h:104
bool m_leadingZero
Definition LcdWidget.h:110
void setTextShadowColor(const QColor &c)
Definition LcdWidget.cpp:129
int numDigits
Definition LcdWidget.h:60
QPixmap m_lcdPixmap
Definition LcdWidget.h:99
void setValue(int value)
Definition LcdWidget.cpp:69
QColor m_textColor
Definition LcdWidget.h:101
void setSeamless(bool left, bool right)
Definition LcdWidget.h:73
virtual void updateSize()
Definition LcdWidget.cpp:247
void initUi(const QString &name, const QString &style)
to be called by ctors
Definition LcdWidget.cpp:276
QMap< int, QString > m_textForValue
Definition LcdWidget.h:94
QString m_display
Definition LcdWidget.h:96
void setNumDigits(int n)
Definition LcdWidget.h:63
int m_cellHeight
Definition LcdWidget.h:105
bool m_seamlessLeft
Definition LcdWidget.h:108
void addTextForValue(int value, const QString &text)
Definition LcdWidget.h:54
int cellHeight() const
Definition LcdWidget.h:71
QString m_label
Definition LcdWidget.h:98
struct @113205115357366127300225113341150224053346037032::@137033172036070230260373056156374243321245367362 left
struct @113205115357366127300225113341150224053346037032::@137033172036070230260373056156374243321245367362 right
static PuglViewHint int value
Definition pugl.h:1708
static const char * name
Definition pugl.h:1582
static int width
Definition pugl.h:1593
static uintptr_t parent
Definition pugl.h:1644
static const SerdStyle style
Definition sratom.c:36
Definition AudioPortAudio.cpp:223
#define false
Definition ordinals.h:83
const char * text
Definition swell-functions.h:167
int n
Definition crypt.c:458
return c
Definition crypt.c:175
#define const
Definition zconf.h:137