File indexing completed on 2024-05-05 05:51:13

0001 /***********************************************************************
0002  * SPDX-FileCopyrightText: 2003-2004 Max Howell <max.howell@methylblue.com>
0003  * SPDX-FileCopyrightText: 2008-2009 Martin Sandsmark <martin.sandsmark@kde.org>
0004  * SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org>
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007  ***********************************************************************/
0008 
0009 #include "radialMap.h"
0010 
0011 #include <QUuid>
0012 
0013 RadialMap::Segment::Segment(const std::shared_ptr<File> &f, uint s, uint l, bool isFake)
0014     : m_angleStart(s)
0015     , m_angleSegment(l)
0016     , m_file(f)
0017     , m_fake(isFake)
0018     , m_uuid(isFake ? QStringLiteral("fake") : QUuid::createUuid().toString())
0019 {
0020     QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
0021     f->setSegment(m_uuid);
0022 }
0023 
0024 RadialMap::Segment::~Segment()
0025 {
0026     if (m_file->segment() == m_uuid) {
0027         m_file->setSegment({});
0028     }
0029 }