#include "etextscrollattr.h"
#include "ui_etextscrollattr.h"
#include <QMessageBox>
eTextScrollAttr::eTextScrollAttr(const eText::Data &data, QWidget *parent) :
    eAttr(parent),
    ui(new Ui::eTextScrollAttr)
{
    ui->setupUi(this);
    init(data);
}

eTextScrollAttr::~eTextScrollAttr()
{
    delete ui;
}

void eTextScrollAttr::init(const eText::Data &data)
{
//    QMessageBox::warning(this, "Title", "eTextScrollAttr widget init");
    // Widget
    connect(ui->wHeadTailConnected, SIGNAL(toggled(bool)),            this, SIGNAL(sHeadTailConnected(bool)));
    connect(ui->wHeadTailSpacing,   SIGNAL(valueChanged(int)),        this, SIGNAL(sHeadTailSpacingChanged(int)));
    connect(ui->wRollingSpeed,      SIGNAL(valueChanged(int)),        this, SIGNAL(sRollingSpeedChanged(int)));
    connect(ui->wRollingStyle,      SIGNAL(currentIndexChanged(int)), this, SIGNAL(sRollingStyleChanged(int)));
    connect(ui->timeEdit,      SIGNAL(timeChanged(QTime)),        this, SIGNAL(sPlayDurationChanged(QTime)));

    QTime aa(0,0,0);
    QTime bb = aa.addSecs(data.stRolloing.playDuration);
    ui->timeEdit->setTime(bb);
    ui->timeEdit->setCurrentSectionIndex(2);


    ui->wHeadTailConnected->setChecked(data.stRolloing.headTailConnected);
    ui->wHeadTailSpacing->setValue    (data.stRolloing.headTailSpacing);
    ui->wRollingSpeed->setValue       (data.stRolloing.rollingSpeed);
    ui->wRollingStyle->setCurrentIndex(data.stRolloing.rollingStyle);
    ui->wHeadTailConnected->setStyleSheet("QCheckBox::indicator {width: 16px; height: 16px;}");
    setFocus();

}

