File indexing completed on 2024-12-01 04:37:03
0001 /* 0002 SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "uploadfileprogressstatuswidget.h" 0008 0009 #include <KLocalizedString> 0010 0011 #include <QHBoxLayout> 0012 #include <QLabel> 0013 #include <QProgressBar> 0014 #include <QToolButton> 0015 0016 UploadFileProgressStatusWidget::UploadFileProgressStatusWidget(QWidget *parent) 0017 : QWidget(parent) 0018 , mFileName(new QLabel(this)) 0019 , mProgressBar(new QProgressBar(this)) 0020 , mCancelToolButton(new QToolButton(this)) 0021 { 0022 auto hboxLayout = new QHBoxLayout(this); 0023 hboxLayout->setObjectName(QStringLiteral("hboxLayout")); 0024 hboxLayout->setContentsMargins({}); 0025 0026 mFileName->setObjectName(QStringLiteral("mFileName")); 0027 hboxLayout->addWidget(mFileName); 0028 0029 mProgressBar->setObjectName(QStringLiteral("mProgressBar")); 0030 mProgressBar->setRange(0, 100); 0031 0032 mCancelToolButton->setObjectName(QStringLiteral("mCancelToolButton")); 0033 mCancelToolButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-cancel"))); 0034 mCancelToolButton->setToolTip(i18n("Cancel Upload")); 0035 connect(mCancelToolButton, &QToolButton::clicked, this, [this] { 0036 Q_EMIT cancelUpload(mIdentifier); 0037 }); 0038 0039 hboxLayout->addWidget(mProgressBar); 0040 hboxLayout->addWidget(mCancelToolButton); 0041 } 0042 0043 UploadFileProgressStatusWidget::~UploadFileProgressStatusWidget() = default; 0044 0045 void UploadFileProgressStatusWidget::setUploadFileName(const QString &str) 0046 { 0047 mFileName->setText(str); 0048 } 0049 0050 int UploadFileProgressStatusWidget::identifier() const 0051 { 0052 return mIdentifier; 0053 } 0054 0055 void UploadFileProgressStatusWidget::setIdentifier(int newIdentifier) 0056 { 0057 mIdentifier = newIdentifier; 0058 } 0059 0060 void UploadFileProgressStatusWidget::setValue(int value) 0061 { 0062 mProgressBar->setValue(value); 0063 } 0064 0065 #include "moc_uploadfileprogressstatuswidget.cpp"