digiKam
progressview.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2012-01-13
7  * Description : progress manager
8  *
9  * Copyright (C) 2007-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  * Copyright (C) 2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
11  * Copyright (C) 2004 by Till Adam <adam at kde dot org>
12  *
13  * This program is free software; you can redistribute it
14  * and/or modify it under the terms of the GNU General
15  * Public License as published by the Free Software Foundation;
16  * either version 2, or (at your option)
17  * any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * ============================================================ */
25 
26 #ifndef DIGIKAM_PROGRESS_VIEW_H
27 #define DIGIKAM_PROGRESS_VIEW_H
28 
29 // Qt includes
30 
31 #include <QScrollArea>
32 
33 // Local includes
34 
35 #include "overlaywidget.h"
36 #include "digikam_export.h"
37 
38 namespace Digikam
39 {
40 class ProgressItem;
41 
42 class TransactionItem : public DVBox
43 {
44  Q_OBJECT
45 
46 public:
47 
48  explicit TransactionItem(QWidget* const parent, ProgressItem* const item, bool first);
49  ~TransactionItem() override;
50 
51  void hideHLine();
52 
53  void setProgress(int progress);
54  void setLabel(const QString&);
55  void setThumbnail(const QPixmap&);
56 
57  // NOTE: the given text is interpreted as RichText, so you might need to
58  // use .toHtmlEscaped() it before passing
59  void setStatus(const QString&);
60 
61  void setTotalSteps( int totalSteps );
62 
63  ProgressItem* item() const;
64 
65  void addSubTransaction(ProgressItem* const item);
66 
67  // The progressitem is deleted immediately, we take 5s to go out,
68  // so better not use mItem during this time.
69  void setItemComplete();
70 
71 public Q_SLOTS:
72 
73  void slotItemCanceled();
74 
75 private:
76 
77  class Private;
78  Private* const d;
79 };
80 
81 // --------------------------------------------------------------------------------
82 
83 class TransactionItemView : public QScrollArea
84 {
85  Q_OBJECT
86 
87 public:
88 
89  explicit TransactionItemView(QWidget* const parent = nullptr, const QString& name=QString());
90  ~TransactionItemView() override {}
91 
93 
94  QSize sizeHint() const override;
95  QSize minimumSizeHint() const override;
96 
97 public Q_SLOTS:
98 
99  void slotLayoutFirstItem();
100 
101 Q_SIGNALS:
102 
104 
105 protected:
106 
107  void resizeEvent(QResizeEvent* event) override;
108 
109 private:
110 
111  DVBox* m_bigBox;
112 };
113 
114 // --------------------------------------------------------------------------------
115 
116 class DIGIKAM_EXPORT ProgressView : public OverlayWidget
117 {
118  Q_OBJECT
119 
120 public:
121 
122  explicit ProgressView(QWidget* const alignWidget, QWidget* const parent, const QString& name = QString());
123  ~ProgressView() override;
124 
125  void setVisible(bool b) override;
126 
127 public Q_SLOTS:
128 
129  void slotToggleVisibility();
130 
131 Q_SIGNALS:
132 
133  void visibilityChanged(bool);
134 
135 protected Q_SLOTS:
136 
137  void slotTransactionAdded(ProgressItem*);
138  void slotTransactionCompleted(ProgressItem*);
139  void slotTransactionCanceled(ProgressItem*);
140  void slotTransactionProgress(ProgressItem*, unsigned int progress);
141  void slotTransactionStatus(ProgressItem*, const QString&);
142  void slotTransactionLabel(ProgressItem*, const QString&);
143  void slotTransactionUsesBusyIndicator(ProgressItem*, bool);
144  void slotTransactionThumbnail(ProgressItem*, const QPixmap&);
145  void slotClose();
146  void slotShow();
147  void slotHide();
148 
149 protected:
150 
151  void closeEvent(QCloseEvent*) override;
152 
153 private:
154 
155  class Private;
156  Private* const d;
157 };
158 
159 } // namespace Digikam
160 
161 #endif // DIGIKAM_PROGRESS_VIEW_H
Definition: dlayoutbox.h:75
Definition: overlaywidget.h:47
Definition: progressmanager.h:45
Definition: progressview.h:117
void visibilityChanged(bool)
Definition: progressview.h:84
~TransactionItemView() override
Definition: progressview.h:90
void slotLayoutFirstItem()
Definition: progressview.cpp:122
TransactionItemView(QWidget *const parent=nullptr, const QString &name=QString())
Definition: progressview.cpp:60
QSize sizeHint() const override
Definition: progressview.cpp:101
TransactionItem * addTransactionItem(ProgressItem *item, bool first)
Definition: progressview.cpp:71
void resizeEvent(QResizeEvent *event) override
Definition: progressview.cpp:80
QSize minimumSizeHint() const override
Definition: progressview.cpp:106
Definition: progressview.h:43
void setProgress(int progress)
Definition: progressview.cpp:260
void setStatus(const QString &)
Definition: progressview.cpp:280
void hideHLine()
Definition: progressview.cpp:255
void setLabel(const QString &)
Definition: progressview.cpp:270
TransactionItem(QWidget *const parent, ProgressItem *const item, bool first)
Definition: progressview.cpp:181
~TransactionItem() override
Definition: progressview.cpp:245
void setThumbnail(const QPixmap &)
Definition: progressview.cpp:275
ProgressItem * item() const
Definition: progressview.cpp:250
void addSubTransaction(ProgressItem *const item)
Definition: progressview.cpp:298
void slotItemCanceled()
Definition: progressview.cpp:290
void setItemComplete()
Definition: progressview.cpp:265
void setTotalSteps(int totalSteps)
Definition: progressview.cpp:285
Definition: datefolderview.cpp:43