1 /* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2012-01-23
7 * Description : file action progress indicator
8 *
9 * Copyright (C) 2012-2021 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 *
11 * This program is free software; you can redistribute it
12 * and/or modify it under the terms of the GNU General
13 * Public License as published by the Free Software Foundation;
14 * either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * ============================================================ */
23
24 #include "fileactionprogress.h"
25
26 // Qt includes
27
28 #include <QIcon>
29
30 // KDE includes
31
32 #include <klocalizedstring.h>
33
34 // Local includes
35
36 #include "digikam_debug.h"
37
38 namespace Digikam
39 {
40
FileActionProgress(const QString & name)41 FileActionProgress::FileActionProgress(const QString& name)
42 : ProgressItem(nullptr, name, QString(), QString(), true, true)
43 {
44 ProgressManager::addProgressItem(this);
45 setLabel(i18n("Process Items"));
46 setThumbnail(QIcon::fromTheme(QLatin1String("digikam")));
47
48 connect(this, SIGNAL(progressItemCanceled(ProgressItem*)),
49 this, SLOT(slotCancel()));
50 }
51
~FileActionProgress()52 FileActionProgress::~FileActionProgress()
53 {
54 }
55
slotProgressValue(float v)56 void FileActionProgress::slotProgressValue(float v)
57 {
58 setProgress((int)(v*100.0));
59 }
60
slotProgressStatus(const QString & st)61 void FileActionProgress::slotProgressStatus(const QString& st)
62 {
63 setStatus(st);
64 }
65
slotCompleted()66 void FileActionProgress::slotCompleted()
67 {
68 emit signalComplete();
69
70 setComplete();
71 }
72
slotCancel()73 void FileActionProgress::slotCancel()
74 {
75 setComplete();
76 }
77
78 } // namespace Digikam
79