/***************************************************************************
 *   Copyright (C) 2005 by the G System Team                               *
 *   http://www.g-system.at                                                *
 *                                                                         *
 *   Permission is hereby granted, free of charge, to any person obtaining *
 *   a copy of this software and associated documentation files (the       *
 *   "Software"), to deal in the Software without restriction, including   *
 *   without limitation the rights to use, copy, modify, merge, publish,   *
 *   distribute, sublicense, and/or sell copies of the Software, and to    *
 *   permit persons to whom the Software is furnished to do so, subject to *
 *   the following conditions:                                             *
 *                                                                         *
 *   The above copyright notice and this permission notice shall be        *
 *   included in all copies or substantial portions of the Software.       *
 *                                                                         *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       *
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    *
 *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*
 *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR     *
 *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
 *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
 *   OTHER DEALINGS IN THE SOFTWARE.                                       *
 ***************************************************************************/

#include <GweXmlConfigurator.h>

#include <kapplication.h>
#include <kmainwindow.h>
#include <kcmdlineargs.h>
#include <kaboutdata.h>

#include <qdom.h>
#include <qfile.h>

#include <stdlib.h>

using namespace GOD;

int main(int argc, char** argv)
{
//   KCmdLineArgs::init(argc,argv,"god","G Options Dialog","G System World Engine Configuration","0.5",true);
  KAboutData about("god","G Options Dialog","0.5","G System World Engine Configuration",KAboutData::License_BSD,"(c) 2003-2005, G System Team",0,"http://www.g-system.at","g-bugs@lists.g-system.at");
  KCmdLineArgs::init(&about);
  KApplication a;
  GweXmlConfigurator* gui = NULL;
  QString url;
  if (argc > 1)
  {
    url = argv[1];
  }
  else
  {
    QString user_home = getenv("HOME");
  
    if (!user_home.isEmpty())
    {
      url = user_home + "/.guniverseclient.xml";
    }
  }
  if (url.length() > 8000)
  {
    qWarning("filename argument too long!");
    url="";
    gui = new GweXmlConfigurator();
  }
  else
  {
    gui = new GweXmlConfigurator(url);
  }
  
  Q_CHECK_PTR(gui);
   
  QObject::connect(&a,SIGNAL(lastWindowClosed()),&a,SLOT(quit()));

  gui->resize(630,400);
  gui->show();
  
  return a.exec();
}


syntax highlighted by Code2HTML, v. 0.9.1