KJobWidgets

kstatusbarjobtracker.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2000 Matej Koss <[email protected]>
4  SPDX-FileCopyrightText: 2007 Kevin Ottens <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-only
7 */
8 
9 #ifndef KSTATUSBARJOBTRACKER_H
10 #define KSTATUSBARJOBTRACKER_H
11 
12 #include <kabstractwidgetjobtracker.h>
13 
14 class KStatusBarJobTrackerPrivate;
15 
16 /**
17  * @class KStatusBarJobTracker kstatusbarjobtracker.h KStatusBarJobTracker
18  *
19  * This class implements a job tracker with a widget suited for embedding in a
20  * status bar.
21  */
22 class KJOBWIDGETS_EXPORT KStatusBarJobTracker : public KAbstractWidgetJobTracker
23 {
24  Q_OBJECT
25 
26 public:
27  /**
28  * @see StatusBarModes
29  */
31  NoInformation = 0x0000, ///< Does not show any information
32  LabelOnly = 0x0001, ///< Shows an informative label for job progress
33  ProgressOnly = 0x0002, ///< Shows a progress bar with the job completion
34  };
35 
36  /**
37  * Stores a combination of #StatusBarMode values.
38  */
39  Q_DECLARE_FLAGS(StatusBarModes, StatusBarMode)
40 
41  /**
42  * Creates a new KStatusBarJobTracker
43  *
44  * @param parent the parent of this object and of the widget displaying the job progresses
45  * @param button true to display a stop button allowing to kill the job, false otherwise
46  */
47  explicit KStatusBarJobTracker(QWidget *parent = nullptr, bool button = true);
48 
49  /**
50  * Destroys a KStatusBarJobTracker
51  */
52  ~KStatusBarJobTracker() override;
53 
54  /**
55  * Register a new job in this tracker.
56  *
57  * @param job the job to register
58  */
59  void registerJob(KJob *job) override;
60 
61  /**
62  * Unregister a job from this tracker.
63  *
64  * @param job the job to unregister
65  */
66  void unregisterJob(KJob *job) override;
67 
68  /**
69  * The widget associated to this tracker.
70  *
71  * @return the widget displaying the job progresses
72  */
73  QWidget *widget(KJob *job) override;
74 
75  /**
76  * Sets the mode of the status bar.
77  *
78  * @param statusBarMode what information the status bar will show (see StatusBarMode).
79  * LabelOnly by default
80  */
81  void setStatusBarMode(StatusBarModes statusBarMode);
82 
83 public Q_SLOTS:
84  /**
85  * The following slots are inherited from KJobTrackerInterface.
86  */
87  virtual void description(KJob *job, const QString &title, const QPair<QString, QString> &field1, const QPair<QString, QString> &field2) override;
88  void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount) override;
89  void percent(KJob *job, unsigned long percent) override;
90  void speed(KJob *job, unsigned long value) override;
91  void slotClean(KJob *job) override;
92 
93 private:
94  Q_DECLARE_PRIVATE_D(KAbstractWidgetJobTracker::d, KStatusBarJobTracker)
95 #if KJOBWIDGETS_BUILD_DEPRECATED_SINCE(5, 79)
96  // Unused, kept for ABI compatibility
97  const void *__kjobwidgets_d_do_not_use;
98 #endif
99 };
100 
101 Q_DECLARE_OPERATORS_FOR_FLAGS(KStatusBarJobTracker::StatusBarModes)
102 
103 #endif
virtual void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount)
virtual void speed(KJob *job, unsigned long value)
Q_SLOTSQ_SLOTS
void unregisterJob(KJob *job) override
Unregister a job from this tracker.
virtual void description(KJob *job, const QString &title, const QPair< QString, QString > &field1, const QPair< QString, QString > &field2)
virtual void slotClean(KJob *job)
This method is called when the widget should be cleaned (after job is finished).
virtual QWidget * widget(KJob *job)=0
The widget associated to this tracker.
void registerJob(KJob *job) override
Register a new job in this tracker.
virtual void percent(KJob *job, unsigned long percent)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Oct 6 2022 04:15:43 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.