157 lines
6.9 KiB
C++
157 lines
6.9 KiB
C++
#include "mdevicesetting.h"
|
|
#include "ui_mdevicesetting.h"
|
|
#include <QLabel>
|
|
#include <globaldefine.h>
|
|
mDeviceSetting::mDeviceSetting(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::mDeviceSetting)
|
|
{
|
|
setAttribute(Qt::WA_DeleteOnClose);
|
|
ui->setupUi(this);
|
|
bnBrightnessAdjustMent = new QPushButton();
|
|
bnBrightnessAdjustMent->setObjectName("bnBrightnessAdjustMent");
|
|
bnBrightnessAdjustMent->setText( "\n\n\n" + tr("Brightness Adjustment"));
|
|
bnBrightnessAdjustMent->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnBrightnessAdjustMent->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnPowerControl = new QPushButton();
|
|
bnPowerControl->setObjectName("bnPowerControl");
|
|
bnPowerControl->setText("\n\n\n" + tr("Power Control"));
|
|
bnPowerControl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnPowerControl->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnNetConfig = new QPushButton();
|
|
bnNetConfig->setObjectName("bnNetConfig");
|
|
bnNetConfig->setText("\n\n\n" + tr("Net Config"));
|
|
bnNetConfig->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnNetConfig->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnVerifyClock = new QPushButton();
|
|
bnVerifyClock->setObjectName("bnVerifyClock");
|
|
bnVerifyClock->setText( "\n\n\n" + tr("Time Synchronization"));
|
|
bnVerifyClock->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnVerifyClock->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnHdmiInput = new QPushButton();
|
|
bnHdmiInput->setObjectName("bnHdmiInput");
|
|
bnHdmiInput->setText( "\n\n\n" + tr("Video source"));
|
|
bnHdmiInput->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnHdmiInput->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnEncrypt = new QPushButton();
|
|
bnEncrypt->setObjectName("bnEncrypt");
|
|
bnEncrypt->setText( "\n\n\n" + tr("Encrypt"));
|
|
bnEncrypt->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnEncrypt->setProperty("ssType", "mainSwitcher");
|
|
|
|
|
|
bnAdvParam = new QPushButton();
|
|
bnAdvParam->setObjectName("bnAdvParam");
|
|
bnAdvParam->setText( "\n\n\n" + tr("Advanced parameters"));
|
|
bnAdvParam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnAdvParam->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnVolume = new QPushButton();
|
|
bnVolume->setObjectName("bnVolume");
|
|
bnVolume->setText( "\n\n\n" + tr("Volume"));
|
|
bnVolume->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnVolume->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnTest = new QPushButton();
|
|
bnTest->setObjectName("bnTest");
|
|
bnTest->setText( "\n\n\n" + tr("Test"));
|
|
bnTest->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnTest->setProperty("ssType", "mainSwitcher");
|
|
|
|
bnLora = new QPushButton();
|
|
bnLora->setObjectName("bnLora");
|
|
bnLora->setText( "\n\n\n" + tr("Lora"));
|
|
bnLora->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);//设置组件大小可扩展
|
|
bnLora->setProperty("ssType", "mainSwitcher");
|
|
|
|
QGridLayout *plBns = new QGridLayout();
|
|
plBns->setSpacing(0);//设置间距
|
|
plBns->addWidget(bnBrightnessAdjustMent, 0, ENUM_CONTRL_WIDGET_BRIGHTNESS);//往网格的不同坐标添加不同的组件
|
|
plBns->addWidget(bnPowerControl, 0, ENUM_CONTRL_WIDGET_POWERCONTROL);
|
|
plBns->addWidget(bnNetConfig, 0, ENUM_CONTRL_WIDGET_NETCONFIG);
|
|
|
|
plBns->addWidget(bnVerifyClock, 0, ENUM_CONTRL_WIDGET_VERIFYCLOCK);
|
|
plBns->addWidget(bnEncrypt, 0, ENUM_CONTRL_WIDGET_ENCRYPT);
|
|
plBns->addWidget(bnHdmiInput, 0, ENUM_CONTRL_WIDGET_HDMIINPUT);
|
|
plBns->addWidget(bnVolume, 0, ENUM_CONTRL_WIDGET_VOLUME);
|
|
plBns->addWidget(bnAdvParam, 0, ENUM_CONTRL_WIDGET_ADVPARAM);
|
|
plBns->addWidget(bnTest, 0, ENUM_CONTRL_WIDGET_TEST);
|
|
// plBns->addWidget(bnLora, 0, ENUM_CONTRL_WIDGET_LORA);
|
|
|
|
plBns->setRowStretch(0, 1);//设置行列比例系数
|
|
// plBns->setRowStretch(2, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_BRIGHTNESS, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_POWERCONTROL, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_NETCONFIG, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_VERIFYCLOCK, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_ENCRYPT, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_HDMIINPUT, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_VOLUME, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_ADVPARAM, 1);
|
|
plBns->setColumnStretch(ENUM_CONTRL_WIDGET_TEST, 1);
|
|
QRect rect;
|
|
rect.setX(50);
|
|
rect.setY(30);
|
|
rect.setWidth(this->width());
|
|
rect.setHeight(this->height());
|
|
plBns->setGeometry(rect);
|
|
plBns->setContentsMargins(10,10, 10, 10);
|
|
setLayout(plBns);//设置顶级布局管理器
|
|
|
|
m_bns = new QButtonGroup();
|
|
m_bns->addButton(bnBrightnessAdjustMent, ENUM_CONTRL_WIDGET_BRIGHTNESS);
|
|
m_bns->addButton(bnPowerControl, ENUM_CONTRL_WIDGET_POWERCONTROL);
|
|
m_bns->addButton(bnNetConfig, ENUM_CONTRL_WIDGET_NETCONFIG);
|
|
m_bns->addButton(bnVerifyClock, ENUM_CONTRL_WIDGET_VERIFYCLOCK);
|
|
m_bns->addButton(bnEncrypt, ENUM_CONTRL_WIDGET_ENCRYPT);
|
|
m_bns->addButton(bnHdmiInput, ENUM_CONTRL_WIDGET_HDMIINPUT);
|
|
m_bns->addButton(bnVolume, ENUM_CONTRL_WIDGET_VOLUME);
|
|
m_bns->addButton(bnAdvParam, ENUM_CONTRL_WIDGET_ADVPARAM);
|
|
m_bns->addButton(bnTest, ENUM_CONTRL_WIDGET_TEST);
|
|
// m_bns->addButton(bnLora, ENUM_CONTRL_WIDGET_LORA);
|
|
|
|
|
|
for(int i=0; i<ENUM_CONTRL_WIDGET_END; i++) {
|
|
m_bns->button(i)->setProperty("ssType", "devicesControl");
|
|
m_bns->button(i)->setCheckable(true);
|
|
if(i == 0) {
|
|
m_bns->button(i)->setChecked(true);//初始按钮终端管理为选中状态
|
|
} else {
|
|
m_bns->button(i)->setChecked(false);
|
|
}
|
|
}
|
|
connect(m_bns, SIGNAL(buttonClicked(int)), parent, SLOT(onSwitchControlWidget(int)));
|
|
}
|
|
|
|
mDeviceSetting::~mDeviceSetting()
|
|
{
|
|
delete ui;
|
|
}
|
|
void mDeviceSetting::paintEvent(QPaintEvent *event)
|
|
{
|
|
Q_UNUSED(event);
|
|
QStyleOption opt;
|
|
opt.init(this);
|
|
QPainter p(this);
|
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
}
|
|
//切换语言,实时刷新翻译标签
|
|
void mDeviceSetting::refreshLable()
|
|
{
|
|
bnBrightnessAdjustMent->setText( "\n\n\n" + tr("Brightness Adjustment"));
|
|
bnPowerControl->setText("\n\n\n" + tr("Power Control"));
|
|
bnNetConfig->setText("\n\n\n" + tr("Net Config"));
|
|
bnVerifyClock->setText( "\n\n\n" + tr("Time Synchronization"));
|
|
bnHdmiInput->setText( "\n\n\n" + tr("Video source"));
|
|
bnEncrypt->setText( "\n\n\n" + tr("Encrypt"));
|
|
bnAdvParam->setText( "\n\n\n" + tr("Advanced parameters"));
|
|
bnVolume->setText( "\n\n\n" + tr("Volume Adjustment"));
|
|
bnTest->setText( "\n\n\n" + tr("Test"));
|
|
bnLora->setText( "\n\n\n" + tr("Lora"));
|
|
}
|