aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qml/qmlpuppet/commands/statepreviewimagechangedcommand.cpp
blob: 1f7e628613e6cf0d7bb2bb4f515c323c5a2790ae (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "statepreviewimagechangedcommand.h"

#include <QDebug>

#include <algorithm>

namespace QmlDesigner {

StatePreviewImageChangedCommand::StatePreviewImageChangedCommand() = default;

StatePreviewImageChangedCommand::StatePreviewImageChangedCommand(const QVector<ImageContainer> &imageVector)
    : m_previewVector(imageVector)
{
}

QVector<ImageContainer> StatePreviewImageChangedCommand::previews()const
{
    return m_previewVector;
}

void StatePreviewImageChangedCommand::sort()
{
    std::sort(m_previewVector.begin(), m_previewVector.end());
}

QDataStream &operator<<(QDataStream &out, const StatePreviewImageChangedCommand &command)
{
    out << command.previews();

    return out;
}

QDataStream &operator>>(QDataStream &in, StatePreviewImageChangedCommand &command)
{
    in >> command.m_previewVector;

    return in;
}

bool operator ==(const StatePreviewImageChangedCommand &first, const StatePreviewImageChangedCommand &second)
{
    return first.m_previewVector == second.m_previewVector;
}

QDebug operator <<(QDebug debug, const StatePreviewImageChangedCommand &command)
{
    return debug.nospace() << "StatePreviewImageChangedCommand(" << command.previews() << ")";

}

} // namespace QmlDesigner