2
2
// Distributed under the MIT software license, see the accompanying
3
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
4
5
- #include < qml/components/blockclockdial .h>
5
+ #include < qml/components/blockstatusdial .h>
6
6
7
7
#include < QBrush>
8
8
#include < QColor>
12
12
#include < QtMath>
13
13
#include < QtGlobal>
14
14
15
- BlockClockDial::BlockClockDial (QQuickItem *parent)
15
+ BlockStatusDial::BlockStatusDial (QQuickItem *parent)
16
16
: QQuickPaintedItem(parent)
17
17
{
18
18
m_animation_timer.setTimerType (Qt::PreciseTimer);
@@ -32,7 +32,7 @@ BlockClockDial::BlockClockDial(QQuickItem *parent)
32
32
m_delay_timer.start ();
33
33
}
34
34
35
- void BlockClockDial ::setupConnectingGradient (const QPen & pen)
35
+ void BlockStatusDial ::setupConnectingGradient (const QPen & pen)
36
36
{
37
37
m_connecting_gradient.setCenter (getBoundsForPen (pen).center ());
38
38
m_connecting_gradient.setAngle (m_connecting_start_angle);
@@ -43,7 +43,7 @@ void BlockClockDial::setupConnectingGradient(const QPen & pen)
43
43
m_connecting_gradient.setColorAt (1 , " transparent" );
44
44
}
45
45
46
- qreal BlockClockDial ::decrementGradientAngle (qreal angle)
46
+ qreal BlockStatusDial ::decrementGradientAngle (qreal angle)
47
47
{
48
48
if (angle == -360 ) {
49
49
return 0 ;
@@ -52,7 +52,7 @@ qreal BlockClockDial::decrementGradientAngle(qreal angle)
52
52
}
53
53
}
54
54
55
- qreal BlockClockDial ::getTargetAnimationAngle ()
55
+ qreal BlockStatusDial ::getTargetAnimationAngle ()
56
56
{
57
57
if (connected () && synced ()) {
58
58
return m_time_ratio_list[0 ].toDouble () * 360 ;
@@ -63,7 +63,7 @@ qreal BlockClockDial::getTargetAnimationAngle()
63
63
}
64
64
}
65
65
66
- qreal BlockClockDial ::incrementAnimatingMaxAngle (qreal angle)
66
+ qreal BlockStatusDial ::incrementAnimatingMaxAngle (qreal angle)
67
67
{
68
68
if (connected ()) {
69
69
return angle += (getTargetAnimationAngle () - angle) * 0.05 ;
@@ -77,19 +77,19 @@ qreal BlockClockDial::incrementAnimatingMaxAngle(qreal angle)
77
77
}
78
78
}
79
79
80
- void BlockClockDial ::setTimeRatioList (QVariantList new_list)
80
+ void BlockStatusDial ::setTimeRatioList (QVariantList new_list)
81
81
{
82
82
m_time_ratio_list = new_list;
83
83
update ();
84
84
}
85
85
86
- void BlockClockDial ::setVerificationProgress (double progress)
86
+ void BlockStatusDial ::setVerificationProgress (double progress)
87
87
{
88
88
m_verification_progress = progress;
89
89
update ();
90
90
}
91
91
92
- void BlockClockDial ::setConnected (bool connected)
92
+ void BlockStatusDial ::setConnected (bool connected)
93
93
{
94
94
if (m_is_connected != connected) {
95
95
m_is_connected = connected;
@@ -104,7 +104,7 @@ void BlockClockDial::setConnected(bool connected)
104
104
}
105
105
}
106
106
107
- void BlockClockDial ::setSynced (bool is_synced)
107
+ void BlockStatusDial ::setSynced (bool is_synced)
108
108
{
109
109
if (m_is_synced != is_synced) {
110
110
m_is_synced = is_synced;
@@ -116,7 +116,7 @@ void BlockClockDial::setSynced(bool is_synced)
116
116
}
117
117
}
118
118
119
- void BlockClockDial ::setPaused (bool paused)
119
+ void BlockStatusDial ::setPaused (bool paused)
120
120
{
121
121
if (m_is_paused != paused) {
122
122
m_is_paused = paused;
@@ -128,39 +128,39 @@ void BlockClockDial::setPaused(bool paused)
128
128
}
129
129
}
130
130
131
- void BlockClockDial ::setPenWidth (qreal width)
131
+ void BlockStatusDial ::setPenWidth (qreal width)
132
132
{
133
133
m_pen_width = width;
134
134
update ();
135
135
}
136
136
137
- void BlockClockDial ::setScale (qreal scale)
137
+ void BlockStatusDial ::setScale (qreal scale)
138
138
{
139
139
m_scale = scale;
140
140
update ();
141
141
142
142
Q_EMIT scaleChanged ();
143
143
}
144
144
145
- void BlockClockDial ::setBackgroundColor (QColor color)
145
+ void BlockStatusDial ::setBackgroundColor (QColor color)
146
146
{
147
147
m_background_color = color;
148
148
update ();
149
149
}
150
150
151
- void BlockClockDial ::setConfirmationColors (QList<QColor> colorList)
151
+ void BlockStatusDial ::setConfirmationColors (QList<QColor> colorList)
152
152
{
153
153
m_confirmation_colors = colorList;
154
154
update ();
155
155
}
156
156
157
- void BlockClockDial ::setTimeTickColor (QColor color)
157
+ void BlockStatusDial ::setTimeTickColor (QColor color)
158
158
{
159
159
m_time_tick_color = color;
160
160
update ();
161
161
}
162
162
163
- QRectF BlockClockDial ::getBoundsForPen (const QPen & pen)
163
+ QRectF BlockStatusDial ::getBoundsForPen (const QPen & pen)
164
164
{
165
165
const QRectF bounds = boundingRect ();
166
166
const qreal smallest = qMin (bounds.width (), bounds.height ());
@@ -185,7 +185,7 @@ QRectF BlockClockDial::getBoundsForPen(const QPen & pen)
185
185
return rect;
186
186
}
187
187
188
- void BlockClockDial ::paintBlocks (QPainter * painter)
188
+ void BlockStatusDial ::paintBlocks (QPainter * painter)
189
189
{
190
190
int numberOfBlocks = m_time_ratio_list.length ();
191
191
if (numberOfBlocks < 2 ) {
@@ -234,7 +234,7 @@ void BlockClockDial::paintBlocks(QPainter * painter)
234
234
}
235
235
}
236
236
237
- void BlockClockDial ::paintProgress (QPainter * painter)
237
+ void BlockStatusDial ::paintProgress (QPainter * painter)
238
238
{
239
239
QPen pen (m_confirmation_colors[5 ]);
240
240
pen.setWidthF (m_pen_width);
@@ -257,7 +257,7 @@ void BlockClockDial::paintProgress(QPainter * painter)
257
257
painter->drawArc (bounds, startAngle * 16 , spanAngle * 16 );
258
258
}
259
259
260
- void BlockClockDial ::paintConnectingAnimation (QPainter * painter)
260
+ void BlockStatusDial ::paintConnectingAnimation (QPainter * painter)
261
261
{
262
262
QPen pen;
263
263
pen.setWidthF (m_pen_width);
@@ -274,7 +274,7 @@ void BlockClockDial::paintConnectingAnimation(QPainter * painter)
274
274
}
275
275
}
276
276
277
- void BlockClockDial ::paintBackground (QPainter * painter)
277
+ void BlockStatusDial ::paintBackground (QPainter * painter)
278
278
{
279
279
QPen pen (m_background_color);
280
280
pen.setWidthF (m_pen_width);
@@ -284,13 +284,13 @@ void BlockClockDial::paintBackground(QPainter * painter)
284
284
painter->drawEllipse (bounds);
285
285
}
286
286
287
- double BlockClockDial ::degreesPerPixel ()
287
+ double BlockStatusDial ::degreesPerPixel ()
288
288
{
289
289
double circumference = width () * 3.1415926 ;
290
290
return 360 / circumference;
291
291
}
292
292
293
- void BlockClockDial ::paintTimeTicks (QPainter * painter)
293
+ void BlockStatusDial ::paintTimeTicks (QPainter * painter)
294
294
{
295
295
QPen pen (m_time_tick_color);
296
296
pen.setWidthF (m_pen_width);
@@ -309,7 +309,7 @@ void BlockClockDial::paintTimeTicks(QPainter * painter)
309
309
}
310
310
}
311
311
312
- void BlockClockDial ::paint (QPainter * painter)
312
+ void BlockStatusDial ::paint (QPainter * painter)
313
313
{
314
314
if (width () <= 0 || height () <= 0 ) {
315
315
return ;
0 commit comments