File indexing completed on 2024-05-12 03:54:56

0001 /*
0002     This file is part of the KDE project
0003 
0004     SPDX-FileCopyrightText: 2000 Stephan Kulow <coolo@kde.org>
0005     SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org>
0006     SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
0007 
0008     SPDX-License-Identifier: LGPL-2.0-or-later
0009 */
0010 
0011 #ifndef KJOB_P_H
0012 #define KJOB_P_H
0013 
0014 #include "kjob.h"
0015 #include <QEventLoopLocker>
0016 #include <QMap>
0017 
0018 #include <array>
0019 
0020 class KJobUiDelegate;
0021 class QTimer;
0022 class QEventLoop;
0023 
0024 // This is a private class, but it's exported for
0025 // KIO::Job's usage. Other Job classes in kdelibs may
0026 // use it too.
0027 class KCOREADDONS_EXPORT KJobPrivate
0028 {
0029 public:
0030     KJobPrivate();
0031     virtual ~KJobPrivate();
0032 
0033     void speedTimeout();
0034 
0035     KJob *q_ptr = nullptr;
0036 
0037     KJobUiDelegate *uiDelegate = nullptr;
0038     QString errorText;
0039     int error = KJob::NoError;
0040     KJob::Unit progressUnit = KJob::Bytes;
0041 
0042     struct Amounts {
0043         qulonglong processedAmount = 0;
0044         qulonglong totalAmount = 0;
0045     };
0046 
0047     std::array<Amounts, KJob::UnitsCount> m_jobAmounts;
0048 
0049     unsigned long percentage = 0;
0050     QTimer *speedTimer = nullptr;
0051     QEventLoop *eventLoop = nullptr;
0052     // eventLoopLocker prevents QCoreApplication from exiting when the last
0053     // window is closed until the job has finished running
0054     QEventLoopLocker eventLoopLocker;
0055     KJob::Capabilities capabilities = KJob::NoCapabilities;
0056     bool suspended = false;
0057     bool isAutoDelete = true;
0058     bool m_hideFinishedNotification = false;
0059     bool isFinished = false;
0060     bool m_startedWithExec = false;
0061 
0062     Q_DECLARE_PUBLIC(KJob)
0063 };
0064 
0065 #endif