00001 /****************************************************************************** 00002 * This file is part of the Gluon Development Platform 00003 * Copyright (c) 2010 Arjen Hiemstra <ahiemstra@heimr.nl> 00004 * Copyright (C) 2010 Dan Leinir Turthra Jensen <admin@leinir.dk> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 #include "gameprojectprivate.h" 00022 00023 #include "savable.h" 00024 00025 #include <core/gluonobject.h> 00026 #include <core/debughelper.h> 00027 00028 #include <QtCore/QStringList> 00029 00030 using namespace GluonEngine; 00031 00032 GameProjectPrivate::GameProjectPrivate() 00033 { 00034 entryPoint = NULL; 00035 } 00036 00037 GameProjectPrivate::GameProjectPrivate( const GameProjectPrivate& other ) 00038 : QSharedData( other ) 00039 , description( other.description ) 00040 , homepage( other.homepage ) 00041 , mediaInfo( other.mediaInfo ) 00042 , filename( other.filename ) 00043 , entryPoint( other.entryPoint ) 00044 { 00045 } 00046 00047 GameProjectPrivate::~GameProjectPrivate() 00048 { 00049 } 00050 00051 bool 00052 GameProjectPrivate::saveChildren( const GluonCore::GluonObject* parent ) 00053 { 00054 DEBUG_FUNC_NAME 00055 if( !parent ) 00056 { 00057 DEBUG_TEXT( QString( "Object child was null!" ) ); 00058 return false; 00059 } 00060 00061 for( int i = 0; i < parent->children().size(); ++i ) 00062 { 00063 GluonCore::GluonObject* child = parent->child( i ); 00064 // Inherits is slow, but at least it's going to be calling something that does 00065 // disk IO, so it's not the slowest thing there 00066 if( child && child->inherits( "GluonEngine::Savable" ) ) 00067 { 00068 DEBUG_TEXT( QString( "Saving object named %1" ).arg( qobject_cast<const GluonCore::GluonObject*>( child )->name() ) ); 00069 Savable::saveToFile( qobject_cast<GluonCore::GluonObject*>( child ) ); 00070 } 00071 00072 // Recurse! 00073 saveChildren( qobject_cast<const GluonCore::GluonObject*>( child ) ); 00074 } 00075 return true; 00076 }