KJobWidgets

kstatusbarjobtracker.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2000 Matej Koss <koss@miesto.sk>
4 SPDX-FileCopyrightText: 2007 Kevin Ottens <ervin@kde.org>
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
14class 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 */
22class KJOBWIDGETS_EXPORT KStatusBarJobTracker : public KAbstractWidgetJobTracker
23{
24 Q_OBJECT
25
26public:
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 */
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
83public 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
93private:
94 Q_DECLARE_PRIVATE(KStatusBarJobTracker)
95};
96
97Q_DECLARE_OPERATORS_FOR_FLAGS(KStatusBarJobTracker::StatusBarModes)
98
99#endif
The base class for widget based job trackers.
virtual void slotClean(KJob *job)
This method is called when the widget should be cleaned (after job is finished).
void unregisterJob(KJob *job) override
Unregister a job from this tracker.
void registerJob(KJob *job) override
Register a new job in this tracker.
virtual QWidget * widget(KJob *job)=0
The widget associated to this tracker.
virtual void speed(KJob *job, unsigned long value)
virtual void totalAmount(KJob *job, KJob::Unit unit, qulonglong amount)
virtual void percent(KJob *job, unsigned long percent)
virtual void description(KJob *job, const QString &title, const QPair< QString, QString > &field1, const QPair< QString, QString > &field2)
This class implements a job tracker with a widget suited for embedding in a status bar.
~KStatusBarJobTracker() override
Destroys a KStatusBarJobTracker.
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 7 2024 11:57:49 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.