1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
/* Copyright (c) 2020, Dyssol Development Team.
* Copyright (c) 2024, DyssolTEC GmbH.
* All rights reserved. This file is part of Dyssol. See LICENSE file for license information. */
#pragma once
#include "BasicThread.h"
#include "SaveLoadManager.h"
class CFlowsheet;
/** Flowsheet saver/loader thread */
class CSaveLoadThread : public CBasicThread
{
Q_OBJECT
QString m_fileName;
CSaveLoadManager m_fileHandler{}; /// Data saver/loader.
bool m_isSuccess{};
bool m_isSaver{}; /// true for saving, false for loading
bool m_isBlocked{};
public:
CSaveLoadThread(const SSaveLoadData& _data, bool _saver, QObject* _parent = nullptr);
void SetFileName(const QString& _fileName);
[[nodiscard]] QString GetFileName() const;
[[nodiscard]] QString GetFinalFileName() const; // Returns possibly transformed file name that was really used during saving/loading.
[[nodiscard]] bool IsSuccess() const; // Returns true if saving/loading operation succeed.
void Block(); // Blocks saving/loading operation.
public slots:
void StartTask() override;
void RequestStop() override;
};
|