Skip to content

Commit 684849f

Browse files
committed
LP-597 again 3 separate buttons + various fixes & cleanups
Suggested by Philippe Renon: - change the combined play-pause button to separate play and pause buttons. Hide button irrelevant button. Code has been simplified as a result. Fixes: - fix situation where replay is stopped/paused and logfile is disconnected through the Disconnect button. - remove unneeded stuff (resizing related) - rename updateBeginAndEndTimes -> setBeginAndEndTimes - less base height needed for the widget - wordwrap for "Playback speed" label. Wraps when space constrains. - set a fixed width for statusLabel to prevent jumping around when the text changes - Update the statusLabel to "Paused" when stopped/paused. - rename enableButtons -> enableWidgets - clear start and end text labels when playback has finished.
1 parent ecd6d20 commit 684849f

5 files changed

Lines changed: 135 additions & 156 deletions

File tree

ground/gcs/src/libs/utils/logfile.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,14 @@ bool LogFile::startReplay()
305305
*/
306306
bool LogFile::stopReplay()
307307
{
308-
if (!m_file.isOpen() || !m_timer.isActive()) {
308+
if (!m_file.isOpen()) {
309309
return false;
310310
}
311+
if (m_timer.isActive()) {
312+
m_timer.stop();
313+
}
314+
311315
qDebug() << "LogFile - stopReplay";
312-
m_timer.stop();
313316
m_replayState = STOPPED;
314317

315318
emit replayFinished();
@@ -386,9 +389,6 @@ bool LogFile::pauseReplay()
386389
qDebug() << "LogFile - pauseReplay";
387390
m_timer.stop();
388391
m_replayState = PAUSED;
389-
390-
// hack to notify UI that replay paused
391-
emit replayStarted();
392392
return true;
393393
}
394394

@@ -527,7 +527,7 @@ bool LogFile::buildIndex()
527527
}
528528
}
529529

530-
emit updateBeginAndEndTimes(m_beginTimeStamp, m_endTimeStamp);
530+
emit setBeginAndEndTimes(m_beginTimeStamp, m_endTimeStamp);
531531

532532
// reset the read pointer to the start of the file
533533
m_file.seek(0);

ground/gcs/src/libs/utils/logfile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected slots:
9999
void replayStarted();
100100
void replayFinished();
101101
void setPlaybackPosition(quint32);
102-
void updateBeginAndEndTimes(quint32, quint32);
102+
void setBeginAndEndTimes(quint32, quint32);
103103

104104
protected:
105105
QByteArray m_dataBuffer;

ground/gcs/src/plugins/logging/logging.ui

Lines changed: 70 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>439</width>
10-
<height>118</height>
10+
<height>120</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -27,34 +27,43 @@
2727
</property>
2828
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
2929
<item>
30-
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
30+
<layout class="QVBoxLayout" name="verticalLayout">
31+
<property name="spacing">
32+
<number>3</number>
33+
</property>
3134
<item>
32-
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,2,0,0,2,0,0">
35+
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,2,0,0,2,0,0">
3336
<property name="sizeConstraint">
3437
<enum>QLayout::SetNoConstraint</enum>
3538
</property>
3639
<item>
37-
<widget class="QPushButton" name="playPauseButton">
40+
<widget class="QPushButton" name="playButton">
41+
<property name="enabled">
42+
<bool>true</bool>
43+
</property>
3844
<property name="sizePolicy">
39-
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
40-
<horstretch>80</horstretch>
45+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
46+
<horstretch>0</horstretch>
4147
<verstretch>0</verstretch>
4248
</sizepolicy>
4349
</property>
4450
<property name="minimumSize">
4551
<size>
46-
<width>30</width>
47-
<height>0</height>
52+
<width>39</width>
53+
<height>38</height>
4854
</size>
4955
</property>
50-
<property name="maximumSize">
56+
<property name="baseSize">
5157
<size>
52-
<width>80</width>
53-
<height>16777215</height>
58+
<width>39</width>
59+
<height>38</height>
5460
</size>
5561
</property>
56-
<property name="text">
57-
<string> Play</string>
62+
<property name="focusPolicy">
63+
<enum>Qt::NoFocus</enum>
64+
</property>
65+
<property name="autoFillBackground">
66+
<bool>false</bool>
5867
</property>
5968
<property name="icon">
6069
<iconset resource="res.qrc">
@@ -69,27 +78,44 @@
6978
</widget>
7079
</item>
7180
<item>
72-
<widget class="QPushButton" name="stopButton">
81+
<widget class="QPushButton" name="pauseButton">
7382
<property name="sizePolicy">
74-
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
75-
<horstretch>80</horstretch>
83+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
84+
<horstretch>0</horstretch>
7685
<verstretch>0</verstretch>
7786
</sizepolicy>
7887
</property>
7988
<property name="minimumSize">
8089
<size>
81-
<width>30</width>
82-
<height>0</height>
90+
<width>39</width>
91+
<height>38</height>
8392
</size>
8493
</property>
85-
<property name="maximumSize">
94+
<property name="icon">
95+
<iconset resource="res.qrc">
96+
<normaloff>:/logging/images/pause.png</normaloff>:/logging/images/pause.png</iconset>
97+
</property>
98+
<property name="iconSize">
8699
<size>
87-
<width>80</width>
88-
<height>16777215</height>
100+
<width>16</width>
101+
<height>16</height>
89102
</size>
90103
</property>
91-
<property name="text">
92-
<string> Stop</string>
104+
</widget>
105+
</item>
106+
<item>
107+
<widget class="QPushButton" name="stopButton">
108+
<property name="sizePolicy">
109+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
110+
<horstretch>0</horstretch>
111+
<verstretch>0</verstretch>
112+
</sizepolicy>
113+
</property>
114+
<property name="minimumSize">
115+
<size>
116+
<width>39</width>
117+
<height>38</height>
118+
</size>
93119
</property>
94120
<property name="icon">
95121
<iconset resource="res.qrc">
@@ -121,12 +147,15 @@
121147
<property name="text">
122148
<string>Playback speed:</string>
123149
</property>
150+
<property name="wordWrap">
151+
<bool>true</bool>
152+
</property>
124153
</widget>
125154
</item>
126155
<item>
127156
<widget class="QDoubleSpinBox" name="playbackSpeed">
128157
<property name="sizePolicy">
129-
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
158+
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
130159
<horstretch>0</horstretch>
131160
<verstretch>0</verstretch>
132161
</sizepolicy>
@@ -170,6 +199,12 @@
170199
</item>
171200
<item>
172201
<widget class="QLabel" name="statusLabel">
202+
<property name="minimumSize">
203+
<size>
204+
<width>65</width>
205+
<height>0</height>
206+
</size>
207+
</property>
173208
<property name="font">
174209
<font>
175210
<weight>75</weight>
@@ -184,29 +219,20 @@
184219
</layout>
185220
</item>
186221
<item>
187-
<widget class="QSlider" name="playBackPosition">
222+
<widget class="QSlider" name="playbackPosition">
188223
<property name="tracking">
189224
<bool>true</bool>
190225
</property>
191226
<property name="orientation">
192227
<enum>Qt::Horizontal</enum>
193228
</property>
194-
<property name="invertedAppearance">
195-
<bool>false</bool>
196-
</property>
197-
<property name="invertedControls">
198-
<bool>false</bool>
199-
</property>
200-
<property name="tickPosition">
201-
<enum>QSlider::TicksBothSides</enum>
202-
</property>
203-
<property name="tickInterval">
204-
<number>5</number>
205-
</property>
206229
</widget>
207230
</item>
208231
<item>
209232
<layout class="QHBoxLayout" name="horizontalLayout_8">
233+
<property name="spacing">
234+
<number>0</number>
235+
</property>
210236
<property name="topMargin">
211237
<number>0</number>
212238
</property>
@@ -230,6 +256,9 @@
230256
<property name="text">
231257
<string/>
232258
</property>
259+
<property name="alignment">
260+
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
261+
</property>
233262
</widget>
234263
</item>
235264
<item>
@@ -262,6 +291,9 @@
262291
<property name="text">
263292
<string/>
264293
</property>
294+
<property name="alignment">
295+
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
296+
</property>
265297
</widget>
266298
</item>
267299
<item>
@@ -295,7 +327,7 @@
295327
<string/>
296328
</property>
297329
<property name="alignment">
298-
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
330+
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
299331
</property>
300332
</widget>
301333
</item>

0 commit comments

Comments
 (0)