62 lines
1.9 KiB
C++
62 lines
1.9 KiB
C++
#include "controlpowerwidget.h"
|
|
#include "ui_controlpowerwidget.h"
|
|
|
|
ControlPowerWidget::ControlPowerWidget(QWidget *parent,QList<LedCard *> *list) :
|
|
QWidget(parent),
|
|
ui(new Ui::ControlPowerWidget)
|
|
{
|
|
m_pLedlist=list;
|
|
ui->setupUi(this);
|
|
m_pStackedW = new QStackedWidget;
|
|
m_pManual = new ControlPowerManual(this,m_pLedlist);
|
|
m_pSchedule = new ControlPowerSchedule(this,m_pLedlist);
|
|
m_pStackedW->addWidget(m_pManual);
|
|
m_pStackedW->addWidget(m_pSchedule);
|
|
ui->horizontalLayout_2->addWidget(m_pStackedW);
|
|
init();
|
|
// connect(parent->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
|
|
connect(parent->parent(),SIGNAL(sigChangeLanguage()),this,SLOT(refreshLable()));
|
|
connect(m_pSchedule,SIGNAL(sigHaveSchedule(bool)),this,SLOT(OnGetPowerModeType(bool)));
|
|
|
|
}
|
|
|
|
ControlPowerWidget::~ControlPowerWidget()
|
|
{
|
|
m_pStackedW->deleteLater() ;
|
|
m_pManual->deleteLater() ;
|
|
m_pSchedule->deleteLater() ;
|
|
delete ui;
|
|
}
|
|
void ControlPowerWidget::refreshLable()
|
|
{
|
|
ui->labelPowerConfiguration->setText(tr("Power Configuration"));
|
|
ui->radioButtonManual->setText(tr("Manual"));
|
|
ui->radioButtonSchedule->setText(tr("Schedule"));
|
|
}
|
|
|
|
void ControlPowerWidget::init()
|
|
{
|
|
m_buttonGroup = new QButtonGroup;
|
|
//第二个参数id可以自行定义
|
|
m_buttonGroup->addButton(ui->radioButtonManual,0);
|
|
m_buttonGroup->addButton(ui->radioButtonSchedule,1);
|
|
connect(m_buttonGroup,SIGNAL(buttonClicked(int)),m_pStackedW,SLOT(setCurrentIndex(int)));
|
|
ui->radioButtonManual->setChecked(true);
|
|
m_pStackedW->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
void ControlPowerWidget::OnGetPowerModeType(bool b)
|
|
{
|
|
if(b)
|
|
{
|
|
m_pStackedW->setCurrentIndex(1);
|
|
ui->radioButtonSchedule->setChecked(true);
|
|
}
|
|
else {
|
|
m_pStackedW->setCurrentIndex(0);
|
|
ui->radioButtonManual->setChecked(true);
|
|
|
|
}
|
|
}
|