/***************************************************************************
                          mysounddlg.cpp  -  description
                             -------------------
    begin                : Tue Jan 20 2004
    copyright            : (C) 2004 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 <mysounddlg.h>

#include <iostream>

#include <qvariant.h>
//#include <kcolorbutton.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>

MySoundEditDlg::MySoundEditDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : SoundEditDlg( parent, name, modal, fl )
{
    point = NULL;
}

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

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

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

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

    locx->setText(i->GetValue("x",i));
    locy->setText(i->GetValue("y",i));
    locz->setText(i->GetValue("z",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));

    play->setChecked(i->GetValue("play",i).toInt());
    loop->setChecked(i->GetValue("loop",i).toInt());
    relativexyz->setChecked(i->GetValue("relativexyz",i).toInt());

    volume->setText(i->GetValue("volume",i));
    rate->setText(i->GetValue("rate",i));
    stereo->setChecked(i->GetValue("stereo",i).toInt());
    bps->setText(i->GetValue("bps",i));

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

void MySoundEditDlg::slotEditData()
{
    point->setText(0,text->text());
    point->SetValue("viewbox", viewbox->isChecked() ? "1" : "0");


    point->SetValue("play", play->isChecked() ? "1" : "0");
    point->SetValue("loop", loop->isChecked() ? "1" : "0");
    point->SetValue("relativexyz", relativexyz->isChecked() ? "1" : "0");

    point->SetValue("x",locx->text());
    point->SetValue("y",locy->text());
    point->SetValue("z",locz->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->SetValue("volume",volume->text());
    point->SetValue("rate",rate->text());
    point->SetValue("stereo", stereo->isChecked() ? "1" : "0");
    point->SetValue("bps",bps->text());

    point->updategl();

qWarning( "MySoundEditDlg::slotEditData(): Geht !" );

}

