#include "edclockattr.h" #include "ui_edclockattr.h" eDClockAttr::eDClockAttr(const eDClock::Data &data, QWidget *parent) : eAttr(parent), ui(new Ui::eDClockAttr) { ui->setupUi(this); QList ids = QTimeZone::availableTimeZoneIds(); foreach(QByteArray id, ids) { ui->wTimeZone->addItem(QString(id)); } ui->wTimeZone ->setCurrentText(QString(data.timeZoneId)); ui->wYear ->setChecked(data.year); ui->wMonth ->setChecked(data.month); ui->wDay ->setChecked(data.day); ui->wHour ->setChecked(data.hour); ui->wMin ->setChecked(data.min); ui->wSec ->setChecked(data.sec); ui->wWeekly ->setChecked(data.weekly); ui->wFullYear ->setChecked(data.fullYear); ui->w12Hour ->setChecked(data.hour12); ui->wMorA ->setChecked(data.AmPm); ui->wDateStyle ->setCurrentIndex(data.dateStyle); ui->wTimeStyle ->setCurrentIndex(data.timeStyle); ui->wMultiline ->setChecked(data.multiline); ui->wFontFamily ->setCurrentText(data.fontFamily); ui->wFontSize ->setValue(data.fontSize); ui->wFontBold ->setChecked(data.fontBold); ui->wFontItalics ->setChecked(data.fontItalics); ui->wFontUnderline->setChecked(data.fontUnderline); ui->wTextColor ->setColor(data.textColor); ui->wPlayDuration ->setValue(data.playDuration); connect(ui->wTimeZone, SIGNAL(currentIndexChanged(int)), this, SLOT(onAttrChanged())); connect(ui->wYear, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wMonth, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wDay, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wHour, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wMin, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wSec, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wWeekly, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wFullYear, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->w12Hour, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wMorA, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wDateStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(onAttrChanged())); connect(ui->wTimeStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(onAttrChanged())); connect(ui->wMultiline, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wFontFamily, SIGNAL(currentIndexChanged(int)), this, SLOT(onAttrChanged())); connect(ui->wFontSize, SIGNAL(valueChanged(int)), this, SLOT(onAttrChanged())); connect(ui->wFontBold, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wFontItalics, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wFontUnderline, SIGNAL(toggled(bool)), this, SLOT(onAttrChanged())); connect(ui->wTextColor, SIGNAL(sColorChanged(const QColor &)), this, SLOT(onAttrChanged())); connect(ui->wPlayDuration, SIGNAL(valueChanged(int)), this, SLOT(onAttrChanged())); } eDClockAttr::~eDClockAttr() { delete ui; } void eDClockAttr::onAttrChanged() { eDClock::Data data; data.timeZoneId = QByteArray().append(ui->wTimeZone->currentText()); data.year = ui->wYear->isChecked(); data.month = ui->wMonth->isChecked(); if(!data.month) ui->wDay->setChecked(false); data.day = ui->wDay->isChecked(); data.hour = ui->wHour->isChecked(); data.min = ui->wMin->isChecked(); if(!data.min) ui->wSec->setChecked(false); data.sec = ui->wSec->isChecked(); data.weekly = ui->wWeekly->isChecked(); data.fullYear = ui->wFullYear->isChecked(); data.hour12 = ui->w12Hour->isChecked(); data.AmPm = ui->wMorA->isChecked(); data.dateStyle = ui->wDateStyle->currentIndex(); data.timeStyle = ui->wTimeStyle->currentIndex(); data.multiline = ui->wMultiline->isChecked(); data.fontFamily = ui->wFontFamily->currentText(); data.fontSize = ui->wFontSize->value(); data.fontBold = ui->wFontBold->isChecked(); data.fontItalics = ui->wFontItalics->isChecked(); data.fontUnderline = ui->wFontUnderline->isChecked(); data.textColor = ui->wTextColor->color(); data.playDuration = ui->wPlayDuration->value(); emit sAttrChanged(data); }