#include "colorinformation.h"
#include "ui_colorinformation.h"
#include <iostream>

ColorInformation::ColorInformation(QWidget *parent) :
    QWidget(parent),
    m_ui(new Ui::ColorInformation)
{
    m_ui->setupUi(this);
}

ColorInformation::~ColorInformation()
{
    delete m_ui;
}

void ColorInformation::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;
    default:
        break;
    }
}
void ColorInformation::getColorInformation(M3D::M3DML_Color_Block *color)
{
    color->a = m_ui->TAlpha->value();
    color->r = m_ui->TRed->value();
    color->g = m_ui->TGreen->value();
    color->b = m_ui->TBlue->value();
}
void ColorInformation::loadData(const M3D::M3DML_Layer *layer)
{
    std::cerr<<layer->color_block->a<<std::endl;
    m_ui->TAlpha->setValue(layer->color_block->a);
    m_ui->TBlue->setValue(layer->color_block->b);
    m_ui->TRed->setValue(layer->color_block->r);
    m_ui->TGreen->setValue(layer->color_block->g);
}
