
#include <locationdialog.h>
#include <iwear/i18n.h>

namespace iwear
{
    namespace sensor
    {
	namespace location
	{
LocationDialog::LocationDialog( const Location* lo, QWidget* parent )
    : QTabDialog( parent ),
    loc(lo)
{
    setup();
}

LocationDialog::~LocationDialog()
{
}

void LocationDialog::setup( void )
{
    normal_location = new QVBox( this );

    QButtonGroup *symbol_group = new QButtonGroup( 2, QGroupBox::Horizontal, 
	    i18n::trans("Symbolic"), normal_location );

    new QLabel( i18n::trans("City:"), symbol_group );
    city = new QLabel( "<city>" , symbol_group );

    new QLabel( i18n::trans("area:"), symbol_group );
    area = new QLabel( "<area>" , symbol_group );

    new QLabel( i18n::trans("building:"), symbol_group );
    building = new QLabel( "<building>" , symbol_group );
    
    new QLabel( i18n::trans("level:"), symbol_group );
    level = new QLabel( "<level>" , symbol_group );

    new QLabel( i18n::trans("room:"), symbol_group );
    room = new QLabel( "<room>" , symbol_group );

    new QLabel( i18n::trans("comment:"), symbol_group );
    comment = new QLabel( "<comment>" , symbol_group );

    QButtonGroup *value_group = new QButtonGroup( 2, QGroupBox::Horizontal, 
	    i18n::trans("Values"), normal_location );

    new QLabel( i18n::trans("Longitude:"), value_group );
    pos_lon = new QLabel( "" , value_group );

    new QLabel( i18n::trans("Latitude:"), value_group );
    pos_lat = new QLabel( "" , value_group );
    
    new QLabel( i18n::trans("Elevation:"), value_group );
    pos_elev = new QLabel( "" , value_group );

    new QLabel( i18n::trans("Heading:"), value_group );
    heading = new QLabel( "" , value_group );

    new QLabel( i18n::trans("Speed:"), value_group );
    speed = new QLabel( "" , value_group );

    new QLabel( i18n::trans("Pos RMS:"), value_group );
    pos_rms = new QLabel( "" , value_group );

    new QLabel( i18n::trans("Room RMS:"), value_group );
    room_rms = new QLabel( "" , value_group );
    
    new QLabel( i18n::trans("Heading RMS:"), value_group );
    head_rms = new QLabel( "" , value_group );
    
    new QLabel( i18n::trans("Speed RMS:"), value_group );
    speed_rms = new QLabel( "" , value_group );
    
    addTab( normal_location, i18n::trans("Standard"));
    
//    path->setFrameStyle( QFrame::Panel | QFrame::Sunken );
}

void LocationDialog::update( const Location* loc )
{

    level->setText(loc->level);
    comment->setText(loc->comment);
    room->setText(loc->room);
    building->setText(loc->building);
    area->setText(loc->area);
    city->setText(loc->city);
    pos_lon->setText( QString("%1").arg(loc->pos_lon) );
    pos_lat->setText( QString("%1").arg(loc->pos_lat) );
    pos_elev->setText( QString("%1").arg(loc->pos_elev) );
    heading->setText( QString("%1").arg(loc->heading) );
    speed->setText( QString("%1").arg(loc->speed) );
    pos_rms->setText( QString("%1").arg(loc->pos_rms) );
    room_rms->setText( QString("%1").arg(loc->room_rms) );
    head_rms->setText( QString("%1").arg(loc->head_rms) );
    speed_rms->setText( QString("%1").arg(loc->speed_rms) );

}

}
}
}
