-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharmsinter.cpp
More file actions
84 lines (68 loc) · 1.9 KB
/
armsinter.cpp
File metadata and controls
84 lines (68 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "armsinter.h"
#include "ui_armsinter.h"
#include "state.h"
#include "workoutpage.h"
#include <QTimer>
#include <QLCDNumber>
armsinter::armsinter(QWidget *parent) :
QDialog(parent),
ui(new Ui::armsinter)
{
ui->setupUi(this);
movie=new QMovie("D:/FITBIT3.0/FITBIT/sbcurl.gif");
if (!movie->isValid()) {
// Handle error gracefully (e.g., display an error message)
qDebug() << "Error loading GIF: images/sbcurl.gif";
return;
}
label = new QLabel(this);
label->setMovie(movie);
// GIF positioning and scaling:
label->setGeometry(180, 60,600,338);
// Connect movie finished signal to restart playback
connect(movie, &QMovie::finished, this, &armsinter::onMovieFinished);
// Start the animation
movie->start();
m_remainingTime = 0;
}
armsinter::~armsinter()
{
movie->stop();
delete ui;
}
void armsinter::onMovieFinished()
{
movie->start(); // Restart the GIF when it finishes
}
void armsinter::on_madb_clicked()
{
::__arms = true;
}
void armsinter::on_backbutton_clicked()
{
hide();
workoutpage wp;
wp.setModal(true);
wp.exec();
}
void armsinter::on_startimerb_clicked()
{
qDebug() << "Button clicked";
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, &armsinter::updateTimer);
timer->start(1000); // Emit timeout signal every second
qDebug() << "Timer started";
m_remainingTime = 30; // Set initial remaining time to 30 seconds
ui->lcdNumber->display(m_remainingTime);
}
void armsinter::updateTimer()
{
m_remainingTime--;
ui->lcdNumber->display(m_remainingTime);
if (m_remainingTime == 0) {
// Timer has finished, perform any necessary actions here
// ...
// Stop the timer
sender()->deleteLater(); // Delete the timer object
}
}