File indexing completed on 2025-01-19 03:53:49

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2009-11-03
0007  * Description : a busy dialog for digiKam
0008  *
0009  * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_DBUSY_DLG_H
0016 #define DIGIKAM_DBUSY_DLG_H
0017 
0018 // Qt includes
0019 
0020 #include <QThread>
0021 #include <QString>
0022 #include <QProgressDialog>
0023 
0024 // Local includes
0025 
0026 #include "digikam_export.h"
0027 
0028 namespace Digikam
0029 {
0030 
0031 class DIGIKAM_EXPORT DBusyThread : public QThread
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036 
0037     explicit DBusyThread(QObject* const parent);
0038     ~DBusyThread() override;
0039 
0040 Q_SIGNALS:
0041 
0042     void signalComplete();
0043 
0044 protected:
0045 
0046     /// Reimplement this method with your code to run in a separate thread.
0047     void run() override {};
0048 };
0049 
0050 // ----------------------------------------------------------------------------------
0051 
0052 class DIGIKAM_EXPORT DBusyDlg : public QProgressDialog
0053 {
0054     Q_OBJECT
0055 
0056 public:
0057 
0058     explicit DBusyDlg(const QString& txt, QWidget* const parent = nullptr);
0059     ~DBusyDlg() override;
0060 
0061     void setBusyThread(DBusyThread* const thread);
0062 
0063 public Q_SLOTS:
0064 
0065     void slotComplete();
0066 
0067 private:
0068 
0069     class Private;
0070     Private* const d;
0071 };
0072 
0073 } // namespace Digikam
0074 
0075 #endif // DIGIKAM_DBUSY_DLG_H