File indexing completed on 2024-09-15 04:57:32
0001 /*************************************************************************** 0002 * Copyright (C) 2022 by Renaud Guezennec * 0003 * http://www.rolisteam.org/contact * 0004 * * 0005 * This software is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #include "common_widgets/busyindicatordialog.h" 0021 0022 #include <QLabel> 0023 #include <QMovie> 0024 #include <QProgressBar> 0025 #include <QVBoxLayout> 0026 0027 BusyIndicatorDialog::BusyIndicatorDialog(const QString& title, const QString& text, const QString& pathMovie, 0028 QWidget* parent) 0029 : QDialog(parent), m_title(title), m_text(text), m_path(pathMovie) 0030 { 0031 setModal(true); 0032 setUpUi(); 0033 } 0034 void BusyIndicatorDialog::setUpUi() 0035 { 0036 setTitle(m_title); 0037 setLayout(nullptr); 0038 auto l= new QVBoxLayout(this); 0039 auto lbl= new QLabel(this); 0040 lbl->setText(m_text); 0041 l->addWidget(lbl); 0042 0043 QMovie* movie= new QMovie(m_path, {}, this); 0044 0045 auto lbl2= new QLabel(this); 0046 lbl2->setMaximumHeight(200); 0047 lbl2->setMaximumWidth(200); 0048 lbl2->setScaledContents(true); 0049 lbl2->setMovie(movie); 0050 l->addWidget(lbl2); 0051 setLayout(l); 0052 0053 movie->start(); 0054 } 0055 0056 const QString& BusyIndicatorDialog::text() const 0057 { 0058 return m_text; 0059 } 0060 0061 void BusyIndicatorDialog::setText(const QString& newText) 0062 { 0063 if(m_text == newText) 0064 return; 0065 m_text= newText; 0066 emit textChanged(); 0067 } 0068 0069 const QString& BusyIndicatorDialog::title() const 0070 { 0071 return m_title; 0072 } 0073 0074 void BusyIndicatorDialog::setTitle(const QString& newTitle) 0075 { 0076 if(m_title == newTitle) 0077 return; 0078 m_title= newTitle; 0079 emit titleChanged(); 0080 }