File indexing completed on 2024-05-12 12:36:40

0001 /*
0002     SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDEVPLATFORM_ISTATUS_H
0008 #define KDEVPLATFORM_ISTATUS_H
0009 
0010 #include "interfacesexport.h"
0011 #include <QObject>
0012 
0013 namespace KDevelop {
0014 
0015 /**
0016  * An interface for plugins, languages etc. to provide status updates.
0017  * Plugins only have to implement this extension interface, registration
0018  * happens automagically.
0019  * Regular QObjects can register themselves through IUiController like so:
0020  * @code
0021  *    Foo* f; // some QObject that implements IStatus
0022  *    ICore::self()->uiController()->registerStatus(f);
0023  * @endcode
0024  */
0025 class KDEVPLATFORMINTERFACES_EXPORT IStatus
0026 {
0027 public:
0028     virtual ~IStatus();
0029 
0030     /**
0031      * Return a name for the status object
0032      */
0033     virtual QString statusName() const = 0;
0034 
0035 Q_SIGNALS:
0036     /**
0037      * Request the current message for this plugin to be cleared.
0038      */
0039     virtual void clearMessage( IStatus* ) = 0;
0040 
0041     /**
0042      * Request a status \a message to be shown for this plugin, with a given \a timeout.
0043      *
0044      * \param message Message to display
0045      * \param timeout Timeout in milliseconds, or pass 0 for no timeout.
0046      */
0047     virtual void showMessage( IStatus*, const QString & message, int timeout = 0) = 0;
0048 
0049     /**
0050      * Request an error \a message to be shown for this plugin, with a given \a timeout.
0051      *
0052      * \param message Message to display
0053      * \param timeout Timeout in seconds how long to show the message.
0054      */
0055     virtual void showErrorMessage(const QString& message, int timeout = 5) = 0;
0056 
0057     /**
0058      * Hide the progress bar.
0059      */
0060     virtual void hideProgress( IStatus* ) = 0;
0061 
0062     /**
0063      * Show a progress bar, with the given \a percentage.
0064      */
0065     virtual void showProgress( IStatus*, int minimum, int maximum, int value) = 0;
0066 };
0067 
0068 }
0069 
0070 Q_DECLARE_METATYPE(KDevelop::IStatus*)
0071 Q_DECLARE_INTERFACE( KDevelop::IStatus, "org.kdevelop.IStatus" )
0072 
0073 #endif
0074