2014-11-18 18:32:43 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2014-12-09 12:12:57 +01:00
|
|
|
#include "timelinerenderstate_p.h"
|
2014-11-18 18:32:43 +01:00
|
|
|
|
2014-12-09 11:01:23 +01:00
|
|
|
namespace Timeline {
|
2014-11-18 18:32:43 +01:00
|
|
|
|
|
|
|
|
TimelineRenderState::TimelineRenderState(qint64 start, qint64 end, qreal scale, int numPasses) :
|
2014-12-09 12:12:57 +01:00
|
|
|
d_ptr(new TimelineRenderStatePrivate)
|
2014-11-18 18:32:43 +01:00
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
d->expandedRowRoot = new QSGNode;
|
|
|
|
|
d->collapsedRowRoot = new QSGNode;
|
|
|
|
|
d->expandedOverlayRoot = new QSGNode;
|
|
|
|
|
d->collapsedOverlayRoot = new QSGNode;
|
|
|
|
|
d->start = start;
|
|
|
|
|
d->end = end;
|
|
|
|
|
d->scale = scale;
|
|
|
|
|
d->passes.resize(numPasses);
|
|
|
|
|
|
|
|
|
|
d->expandedRowRoot->setFlag(QSGNode::OwnedByParent, false);
|
|
|
|
|
d->collapsedRowRoot->setFlag(QSGNode::OwnedByParent, false);
|
|
|
|
|
d->expandedOverlayRoot->setFlag(QSGNode::OwnedByParent, false);
|
|
|
|
|
d->collapsedOverlayRoot->setFlag(QSGNode::OwnedByParent, false);
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TimelineRenderState::~TimelineRenderState()
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
delete d->expandedRowRoot;
|
|
|
|
|
delete d->collapsedRowRoot;
|
|
|
|
|
delete d->expandedOverlayRoot;
|
|
|
|
|
delete d->collapsedOverlayRoot;
|
|
|
|
|
delete d;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint64 TimelineRenderState::start() const
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->start;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qint64 TimelineRenderState::end() const
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->end;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qreal TimelineRenderState::scale() const
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->scale;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-09 12:12:57 +01:00
|
|
|
const QSGNode *TimelineRenderState::expandedRowRoot() const
|
2014-11-18 18:32:43 +01:00
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->expandedRowRoot;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-09 12:12:57 +01:00
|
|
|
const QSGNode *TimelineRenderState::collapsedRowRoot() const
|
2014-11-18 18:32:43 +01:00
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->collapsedRowRoot;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-09 12:12:57 +01:00
|
|
|
const QSGNode *TimelineRenderState::expandedOverlayRoot() const
|
2014-11-18 18:32:43 +01:00
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->expandedOverlayRoot;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-09 12:12:57 +01:00
|
|
|
const QSGNode *TimelineRenderState::collapsedOverlayRoot() const
|
2014-11-18 18:32:43 +01:00
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->collapsedOverlayRoot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSGNode *TimelineRenderState::expandedRowRoot()
|
|
|
|
|
{
|
|
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
return d->expandedRowRoot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSGNode *TimelineRenderState::collapsedRowRoot()
|
|
|
|
|
{
|
|
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
return d->collapsedRowRoot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSGNode *TimelineRenderState::expandedOverlayRoot()
|
|
|
|
|
{
|
|
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
return d->expandedOverlayRoot;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QSGNode *TimelineRenderState::collapsedOverlayRoot()
|
|
|
|
|
{
|
|
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
return d->collapsedOverlayRoot;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TimelineRenderState::isEmpty() const
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->collapsedRowRoot->childCount() == 0 && d->expandedRowRoot->childCount() == 0 &&
|
|
|
|
|
d->collapsedOverlayRoot->childCount() == 0 && d->expandedOverlayRoot->childCount() == 0;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TimelineRenderPass::State *TimelineRenderState::passState(int i)
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
return d->passes[i];
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TimelineRenderPass::State *TimelineRenderState::passState(int i) const
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(const TimelineRenderState);
|
|
|
|
|
return d->passes[i];
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TimelineRenderState::setPassState(int i, TimelineRenderPass::State *state)
|
|
|
|
|
{
|
2014-12-09 12:12:57 +01:00
|
|
|
Q_D(TimelineRenderState);
|
|
|
|
|
d->passes[i] = state;
|
2014-11-18 18:32:43 +01:00
|
|
|
}
|
|
|
|
|
|
2014-12-09 11:01:23 +01:00
|
|
|
} // namespace Timeline
|