/***************************************************************************
                          myterraindlg.cpp  -  description
                             -------------------
    begin                : Die Feb 11 2003
    copyright            : (C) 2003 by Harald Krippel
    email                : neuro.harald@surfeu.at
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "myterraindlg.h"

#include <qvariant.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
 
MyTerrainEditDlg::MyTerrainEditDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : TerrainEditDlg( parent, name, modal, fl )
{
    point = NULL;
}

/*
 *  Destroys the terrain and frees any allocated resources
 */
MyTerrainEditDlg::~MyTerrainEditDlg()
{
    // no need to delete child widgets, Qt does it all for us
}

void MyTerrainEditDlg::slotGetData()
{
    if(point != NULL)
    {
      slotGetData(point);
    }
}

void MyTerrainEditDlg::slotGetData(FolderListItem *i)
{
    point=i;

    text->setText(i->text(0));
    on->setChecked(i->GetValue("on",i).toInt());
    barrier->setChecked(i->GetValue("barrier",i).toInt());

    locx->setText(i->GetValue("x",i));
    locy->setText(i->GetValue("y",i));
    locz->setText(i->GetValue("z",i));

//    trax->setText(i->GetValue("trax",i));
//    tray->setText(i->GetValue("tray",i));
//    traz->setText(i->GetValue("traz",i));

    scax->setText(i->GetValue("scax",i));
    scay->setText(i->GetValue("scay",i));
    scaz->setText(i->GetValue("scaz",i));

    rotx->setText(i->GetValue("rotx",i));
    roty->setText(i->GetValue("roty",i));
    rotz->setText(i->GetValue("rotz",i));

    qWarning( "MyTerrainEditDlg::slotGetData(): Geht !" );
}

void MyTerrainEditDlg::slotEditData()
{
    point->setText(0,text->text());

    point->SetValue("on", on->isChecked() ? "1" : "0");
    point->SetValue("barrier", barrier->isChecked() ? "1" : "0");

    point->SetValue("x",locx->text());
    point->SetValue("y",locy->text());
    point->SetValue("z",locz->text());

//    point->SetValue("trax",trax->text());
//    point->SetValue("tray",tray->text());
//    point->SetValue("traz",traz->text());

    point->SetValue("scax",scax->text());
    point->SetValue("scay",scay->text());
    point->SetValue("scaz",scaz->text());

    point->SetValue("rotx",rotx->text());
    point->SetValue("roty",roty->text());
    point->SetValue("rotz",rotz->text());

    point->updategl();

    qWarning( "MyTerrainEditDlg::slotEditData(): Geht !" );
}

