File indexing completed on 2024-04-14 04:01:48

0001 /* This file is part of KsirK.
0002    Copyright (C) 2005-2007 Gael de Chalendar <kleag@free.fr>
0003 
0004    KsirK is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, either version 2
0007    of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; if not, write to the Free Software
0016    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017    02110-1301, USA
0018 */
0019 
0020 /*    begin                : Mon Feb 07 2005 */
0021  
0022 #include "ksirkgamexmlloader.h"
0023 #include "ksirkgamexmlhandler.h"
0024 
0025 #include <KMessageBox>
0026 #include <KLocalizedString>
0027 
0028 namespace Ksirk
0029 {
0030 namespace SaveLoad
0031 {
0032 
0033 GameXmlLoader::GameXmlLoader(const QString& fileName, KGameWindow& game, 
0034     QList<GameLogic::PlayerMatrix>& waitedPlayers)
0035 {
0036   GameXmlHandler handler(game, waitedPlayers);
0037   
0038   QFile xmlFile( fileName );
0039   QXmlInputSource source( &xmlFile );
0040   
0041   QXmlSimpleReader reader;
0042   reader.setContentHandler( &handler );
0043   
0044   if (!reader.parse( source ))
0045   {
0046     KMessageBox::error(nullptr, i18n("Skin file parsing error"), 
0047       i18n("KsirK - Error"));
0048     exit(0);
0049   }
0050 }
0051 
0052 } // closing namespace SaveLoad
0053 } // closing namespace Ksirk
0054