YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
loadingwidget.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#include "loadingwidget.h"
7#include "ui_loadingwidget.h"
8
9LoadingWidget::LoadingWidget(QWidget *parent) :
10 QDialog(parent),
11 ui(new Ui::LoadingWidget)
12{
13 ui->setupUi(this);
14 counter=0;
15
16 setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
17 setAttribute(Qt::WA_TranslucentBackground);
18
19 setModal(true);
20
21
22 splashTimer.setInterval(50);
23 splashTimer.setSingleShot(false);
24 connect(&splashTimer,SIGNAL(timeout()),this,SLOT(onSplashTimer()),Qt::DirectConnection);
25}
26
28{
29 delete ui;
30}
31
32
33void LoadingWidget::onSplashTimer()
34{
35 QString name = QString(":/images/splash/bg%1.png").arg(counter+1);
36 counter++;
37 counter = counter % 8;
38 ui->loadingIco->setPixmap(QPixmap(name));
39 ui->loadingIco->repaint();
40}
41
42
44{
45 mutex.lock();
46 splashTimer.start();
47 QWidget *w =((QWidget*)parent());
48 int x = w->x() + ((w->width() - width()) / 2);
49 int y = w->y() + ((w->height() - height()) / 2);
50 this->setGeometry(x,y,width(),height());
51 mutex.unlock();
52 return exec();
53}
54
56{
57 mutex.lock();
58 splashTimer.stop();
59 mutex.unlock();
60}
int SIGNAL(int pid, int signum)
LoadingWidget(QWidget *parent=0)
Definition aboutdlg.h:11