File indexing completed on 2024-04-28 04:49:53

0001 /*
0002     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_SIGNAL_WAITER_H_
0007 #define _K3B_SIGNAL_WAITER_H_
0008 
0009 #include "k3b_export.h"
0010 
0011 #include <QObject>
0012 
0013 namespace K3b {
0014     class Job;
0015 }
0016 
0017 namespace K3b {
0018     class SignalWaiter : public QObject
0019     {
0020         Q_OBJECT
0021 
0022     public:
0023         /**
0024          * Use this to synchronously wait for a signal.
0025          */
0026         LIBK3B_EXPORT static void waitForSignal( QObject* o, const char* signal );
0027 
0028         /**
0029          * Use this to synchronously wait for a job to finish.
0030          * If the job is not running at all this returns immediately.
0031          */
0032         LIBK3B_EXPORT static void waitForJob( Job* job );
0033 
0034     private Q_SLOTS:
0035         void slotSignal();
0036 
0037     private:
0038         SignalWaiter();
0039         ~SignalWaiter() override;
0040 
0041         class Private;
0042         Private* const d;
0043     };
0044 }
0045 
0046 #endif