qTbot 0.89.ee6949a
qTbot is base back end library for your c++ Qt projects.
filewaiter.cpp
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2024 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7#include "filewaiter.h"
8namespace qTbot {
9
14
15void FileWaiter::wait(const QSharedPointer<iFile> &file) {
16 if (!file->isFinished()) {
17 auto address = reinterpret_cast<size_t>(file.get());
18
19 _files[address] = file;
20
21
22 connect(file.get(), &qTbot::iFile::finishedChanged, this, &FileWaiter::handleFileFinished,
23 Qt::QueuedConnection);
24 }
25}
26
27void FileWaiter::handleFileFinished() {
28 auto address = reinterpret_cast<size_t>(sender());
29
30 _files.remove(address);
31
32}
33
34}
void wait(const QSharedPointer< iFile > &file)
wait This method add shared pointer of file in to local storage, and remove it from this when file ch...
void finishedChanged()
Signal emitted when the associated finished changes.