File indexing completed on 2025-01-05 05:23:50

0001 /*
0002     This file is part of the Okteta Kasten module, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #ifndef KASTEN_BYTEARRAYRAWFILEWRITETHREAD_HPP
0010 #define KASTEN_BYTEARRAYRAWFILEWRITETHREAD_HPP
0011 
0012 // Qt
0013 #include <QThread>
0014 
0015 class QFile;
0016 
0017 namespace Kasten {
0018 
0019 class ByteArrayDocument;
0020 
0021 class ByteArrayRawFileWriteThread : public QThread
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     ByteArrayRawFileWriteThread(QObject* parent,
0027                                 ByteArrayDocument* document, QFile* file);
0028 
0029     ~ByteArrayRawFileWriteThread() override;
0030 
0031 public: // QThread API
0032     void run() override;
0033 
0034 public:
0035     bool success() const;
0036 
0037 Q_SIGNALS:
0038     void documentWritten(bool success);
0039 
0040 private:
0041     ByteArrayDocument* mDocument;
0042     QFile* mFile;
0043 
0044     bool mSuccess = false;
0045 };
0046 
0047 inline ByteArrayRawFileWriteThread::ByteArrayRawFileWriteThread(QObject* parent,
0048                                                                 ByteArrayDocument* document, QFile* file)
0049     : QThread(parent)
0050     , mDocument(document)
0051     , mFile(file)
0052 {}
0053 
0054 inline bool ByteArrayRawFileWriteThread::success() const { return mSuccess; }
0055 
0056 }
0057 
0058 #endif