File: checkerstatus.h

package info (click to toggle)
kdevelop 4%3A22.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 70,096 kB
  • sloc: cpp: 284,635; javascript: 3,558; python: 3,422; sh: 1,319; ansic: 685; xml: 331; php: 95; lisp: 66; makefile: 39; sed: 12
file content (85 lines) | stat: -rw-r--r-- 2,145 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
    SPDX-FileCopyrightText: 2015 Laszlo Kis-Adam <laszlo.kis-adam@kdemail.net>

    SPDX-License-Identifier: LGPL-2.0-or-later
*/

#ifndef CHECKER_STATUS_H
#define CHECKER_STATUS_H

#include <shell/shellexport.h>

#include <interfaces/istatus.h>

namespace KDevelop
{

class CheckerStatusPrivate;

/**
* Status / Progress reporter for checker tools. It shows a progress bar as more and more items are checked.
* As part of initialization the max. number of items have to be set, and then when an item is checked that has to be indicated to the class. When stopped the progressbar first filled up to max, then it disappears.
*
* Initialization:
* @code
* m_status = new CheckerStatus();
* m_status->setCheckerName(QStringLiteral("SomeChecker"));
* ICore::self()->uiController()->registerStatus(m_status);
* @endcode
*
* Starting:
* @code
* m_status->setMaxItems(9001);
* m_status->start();
* @endcode
*
* Stopping:
* @code
* m_status->stop();
* @endcode
*
* Showing progress:
* @code
* m_status->itemChecked();
* @endcode
*/
class KDEVPLATFORMSHELL_EXPORT CheckerStatus : public QObject, public KDevelop::IStatus
{
    Q_OBJECT
    Q_INTERFACES(KDevelop::IStatus)
public:
    CheckerStatus();
    ~CheckerStatus() override;

    QString statusName() const override;

    /// Sets the name of the checker tool
    void setCheckerName(const QString &name);

    /// Sets the maximum number of items that will be checked
    void setMaxItems(int maxItems);

    /// Increases the number of checked items
    void itemChecked();

    /// Starts status / progress reporting
    void start();

    /// Stops status / progress reporting
    void stop();

Q_SIGNALS:
    void clearMessage(KDevelop::IStatus*) override;
    void showMessage(KDevelop::IStatus*, const QString &message, int timeout = 0) override;
    void showErrorMessage(const QString & message, int timeout = 0) override;
    void hideProgress(KDevelop::IStatus*) override;
    void showProgress(KDevelop::IStatus*, int minimum, int maximum, int value) override;

private:
    const QScopedPointer<class CheckerStatusPrivate> d_ptr;
    Q_DECLARE_PRIVATE(CheckerStatus)
};

}

#endif