2020-09-16 00:35:12 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2014-2018 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2010-02-11 18:47:51 +00:00
|
|
|
#include "gui/scanprogressdialog.h"
|
|
|
|
|
2018-04-19 12:29:22 +01:00
|
|
|
#include <QCloseEvent>
|
|
|
|
|
2014-05-13 23:53:37 +01:00
|
|
|
#include <KLocalizedString>
|
2010-02-11 18:47:51 +00:00
|
|
|
|
|
|
|
ScanProgressDialog::ScanProgressDialog(QWidget* parent) :
|
2015-07-13 15:17:41 +01:00
|
|
|
QProgressDialog(parent)
|
2010-02-11 18:47:51 +00:00
|
|
|
{
|
2016-07-18 02:21:14 +01:00
|
|
|
setWindowTitle(xi18nc("@title:window", "Scanning devices..."));
|
2015-07-13 15:17:41 +01:00
|
|
|
setMinimumWidth(280);
|
|
|
|
setMinimumDuration(150);
|
2018-04-14 23:03:41 +01:00
|
|
|
setValue(0);
|
2015-07-13 15:17:41 +01:00
|
|
|
setAttribute(Qt::WA_ShowModal, true);
|
2010-02-11 18:47:51 +00:00
|
|
|
}
|
|
|
|
|
2018-04-19 12:29:22 +01:00
|
|
|
void ScanProgressDialog::closeEvent(QCloseEvent* e)
|
|
|
|
{
|
|
|
|
e->ignore();
|
|
|
|
}
|
|
|
|
|
2021-11-29 12:29:46 +00:00
|
|
|
void ScanProgressDialog::setDeviceName(const QString& device)
|
2010-02-11 18:47:51 +00:00
|
|
|
{
|
2021-11-29 12:29:46 +00:00
|
|
|
if (device.isEmpty()) {
|
2016-07-18 02:21:14 +01:00
|
|
|
setLabelText(xi18nc("@label", "Scanning..."));
|
2021-11-29 12:29:46 +00:00
|
|
|
} else {
|
|
|
|
setLabelText(xi18nc("@label", "Scanning device: <filename>%1</filename>", device));
|
|
|
|
}
|
2010-02-11 18:47:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScanProgressDialog::showEvent(QShowEvent* e)
|
|
|
|
{
|
2018-04-19 12:29:22 +01:00
|
|
|
setCancelButton(nullptr);
|
2010-02-11 18:47:51 +00:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
QProgressDialog::showEvent(e);
|
2010-02-11 18:47:51 +00:00
|
|
|
}
|