File indexing completed on 2025-02-09 07:11:25

0001 /*
0002     This file is part of the Kasten Framework, made within the KDE community.
0003 
0004     SPDX-FileCopyrightText: 2008-2009 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 #include "modelencoderfilesystemexportjob_p.hpp"
0010 
0011 // lib
0012 #include "modelstreamencodethread.hpp"
0013 // Qt
0014 #include <QCoreApplication>
0015 #include <QFile>
0016 
0017 namespace Kasten {
0018 
0019 void ModelEncoderFileSystemExportJobPrivate::startExportToFile()
0020 {
0021     Q_Q(ModelEncoderFileSystemExportJob);
0022 
0023     auto* exportThread = new ModelStreamEncodeThread(q, file(), model(), selection(), mEncoder);
0024     exportThread->start();
0025     while (!exportThread->wait(100)) {
0026         QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers);
0027     }
0028 
0029     const bool success = exportThread->success();
0030     delete exportThread;
0031 
0032     q->completeExport(success);
0033 }
0034 
0035 }