1 /*
2  * movemapobjecttogroup.cpp
3  * Copyright 2010, Jeff Bland <jksb@member.fsf.org>
4  *
5  * This file is part of Tiled.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by the Free
9  * Software Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  * more details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "movemapobjecttogroup.h"
22 
23 #include "addremovemapobject.h"
24 
25 #include <QCoreApplication>
26 
27 using namespace Tiled;
28 
MoveMapObjectToGroup(Document * document,MapObject * mapObject,ObjectGroup * objectGroup)29 MoveMapObjectToGroup::MoveMapObjectToGroup(Document *document,
30                                            MapObject *mapObject,
31                                            ObjectGroup *objectGroup)
32 {
33     setText(QCoreApplication::translate("Undo Commands",
34                                         "Move Object to Layer"));
35 
36     mRemoveMapObject = new RemoveMapObjects(document, mapObject, this);
37     mAddMapObject = new AddMapObjects(document, objectGroup, mapObject, this);
38 }
39 
~MoveMapObjectToGroup()40 MoveMapObjectToGroup::~MoveMapObjectToGroup()
41 {
42     // Make sure the object doesn't get deleted (we don't own it, we just moved it)
43     mRemoveMapObject->releaseObjects();
44     mAddMapObject->releaseObjects();
45 }
46