source: calamares/trunk/fuentes/src/libcalamaresui/widgets/WaitingWidget.cpp @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 2.0 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2014, Teo Mrnjavac <teo@kde.org>
4 *   Copyright 2017, Adriaan de Groot <groot@kde.org>
5 *
6 *   Calamares is free software: you can redistribute it and/or modify
7 *   it under the terms of the GNU General Public License as published by
8 *   the Free Software Foundation, either version 3 of the License, or
9 *   (at your option) any later version.
10 *
11 *   Calamares is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *   GNU General Public License for more details.
15 *
16 *   You should have received a copy of the GNU General Public License
17 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "WaitingWidget.h"
21
22#include "utils/CalamaresUtilsGui.h"
23#include "waitingspinnerwidget.h"
24
25#include <QBoxLayout>
26#include <QLabel>
27
28WaitingWidget::WaitingWidget( const QString& text, QWidget* parent )
29    : QWidget( parent )
30{
31    QBoxLayout* waitingLayout = new QVBoxLayout;
32    setLayout( waitingLayout );
33    waitingLayout->addStretch();
34    QBoxLayout* pbLayout = new QHBoxLayout;
35    waitingLayout->addLayout( pbLayout );
36    pbLayout->addStretch();
37
38    WaitingSpinnerWidget* spnr = new WaitingSpinnerWidget();
39    pbLayout->addWidget( spnr );
40
41    pbLayout->addStretch();
42
43    m_waitingLabel = new QLabel( text );
44
45    int spnrSize = m_waitingLabel->fontMetrics().height() * 4;
46    spnr->setFixedSize( spnrSize, spnrSize );
47    spnr->setInnerRadius( spnrSize / 2 );
48    spnr->setLineLength( spnrSize / 2 );
49    spnr->setLineWidth( spnrSize / 8 );
50    spnr->start();
51
52    m_waitingLabel->setAlignment( Qt::AlignCenter );
53    waitingLayout->addSpacing( spnrSize / 2 );
54    waitingLayout->addWidget( m_waitingLabel );
55    waitingLayout->addStretch();
56
57    CalamaresUtils::unmarginLayout( waitingLayout );
58}
59
60
61void
62WaitingWidget::setText( const QString& text )
63{
64    m_waitingLabel->setText( text );
65}
Note: See TracBrowser for help on using the repository browser.