File indexing completed on 2024-06-23 05:49:22
0001 /* 0002 This file is part of the Kasten Framework, 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 #include "testdocumentfileloadjob.hpp" 0010 0011 // lib 0012 #include "testdocumentfilesynchronizer.hpp" 0013 #include "testdocumentfileloadthread.hpp" 0014 #include "testdocument.hpp" 0015 // Qt 0016 #include <QCoreApplication> 0017 0018 namespace Kasten { 0019 0020 TestDocumentFileLoadJob::TestDocumentFileLoadJob(TestDocumentFileSynchronizer* synchronizer, const QUrl& url) 0021 : AbstractFileSystemLoadJob(synchronizer, url) 0022 {} 0023 0024 TestDocumentFileLoadJob::~TestDocumentFileLoadJob() = default; 0025 0026 void TestDocumentFileLoadJob::startLoadFromFile() 0027 { 0028 auto* testSynchronizer = qobject_cast<TestDocumentFileSynchronizer*>(synchronizer()); 0029 0030 auto* loadThread = new TestDocumentFileLoadThread(this, testSynchronizer->header(), file()); 0031 loadThread->start(); 0032 while (!loadThread->wait(100)) { 0033 QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers); 0034 } 0035 0036 TestDocument* document = loadThread->document(); 0037 testSynchronizer->setDocument(document); 0038 0039 delete loadThread; 0040 0041 setDocument(document); 0042 } 0043 0044 } 0045 0046 #include "moc_testdocumentfileloadjob.cpp"