144 lines
3.6 KiB
C++
144 lines
3.6 KiB
C++
#include "SystemUpdate.h"
|
|
#include "ui_SystemUpdate.h"
|
|
#include "SystemManage.h"
|
|
#include "Public.h"
|
|
#include "InputMethod.h"
|
|
#include <QMessageBox>
|
|
#include <QDebug>
|
|
|
|
SystemUpdate::SystemUpdate(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::SystemUpdate)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
connect(ui->closeBtn, &QPushButton::clicked, this, &SystemUpdate::on_closeBtn_clicked);
|
|
applyStyleSheet();
|
|
|
|
connect(&dlgLanguage, &DlgMutiLanguage::sig_reboot, this, &SystemUpdate::sig_reboot);
|
|
}
|
|
|
|
SystemUpdate::~SystemUpdate()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
/*关闭按键*/
|
|
void SystemUpdate::on_closeBtn_clicked()
|
|
{
|
|
QPushButton* btn = qobject_cast<QPushButton*>(sender());
|
|
if (btn == ui->closeBtn)
|
|
{
|
|
emit sendButtonClickedSignal(1);
|
|
}
|
|
}
|
|
/*关闭按键样式*/
|
|
void SystemUpdate::applyStyleSheet()
|
|
{
|
|
QString styleSheet = R"(
|
|
|
|
QPushButton#closeBtn {
|
|
background-color: #E6F7FF;
|
|
border: 1px solid #87CEEB;
|
|
border-radius: 4px;
|
|
font-size: 24px;
|
|
color: #228B22;
|
|
}
|
|
QPushButton#closeBtn:hover{
|
|
background-color: #D1E9FF;
|
|
}
|
|
|
|
QPushButton#closeBtn:pressed{
|
|
background-color: #BAE7FF;
|
|
}
|
|
|
|
QPushButton {
|
|
background-color: #5396C1;
|
|
color: #ffffff;
|
|
border: 1px solid #000000;
|
|
border-radius: 3px;
|
|
font-size: 18px;
|
|
font-weight:500;
|
|
width: 90px;
|
|
height: 45px;
|
|
}
|
|
|
|
QPushButton:hover {
|
|
background-color: #5396C1;
|
|
}
|
|
|
|
QPushButton:disabled {
|
|
background-color: #7C828E;
|
|
color: #606060;
|
|
border-color: #808080;
|
|
}
|
|
)";
|
|
|
|
this->setStyleSheet(styleSheet);
|
|
}
|
|
|
|
/*烧录FPGA的按键被按下*/
|
|
void SystemUpdate::on_pushButtonProgramFPGA_clicked()
|
|
{
|
|
emit sendProgramFPGASignal();
|
|
}
|
|
/*烧录STM32的按键被按下*/
|
|
void SystemUpdate::on_pushButtonProgramStm32_clicked()
|
|
{
|
|
emit sendProgramSTM32Signal();
|
|
}
|
|
/*更新软件的按钮被按下*/
|
|
void SystemUpdate::on_pushButtonUpdateSoftware_clicked()
|
|
{
|
|
emit sendUpDateSOFTSignal();
|
|
}
|
|
/*更新字库的按键被按下*/
|
|
void SystemUpdate::on_pushButtonUpdateCharLib_clicked()
|
|
{
|
|
emit sendUpDateChARLIBSignal();
|
|
}
|
|
|
|
|
|
void SystemUpdate::on_pushButtonFontToUdisk_clicked()
|
|
{
|
|
QMessageBox::StandardButton ret;
|
|
|
|
QMessageBox box(QMessageBox::Information, tr("警告"), tr("是否确认导出字库到U盘?"), QMessageBox::Ok | QMessageBox::Cancel, this);
|
|
box.setStyleSheet("");
|
|
box.exec();
|
|
ret = box.result();
|
|
if (ret == QMessageBox::Ok)
|
|
{
|
|
QFile file("/udisk");
|
|
if(!file.exists()){
|
|
QMessageBox::warning(this, tr("错误"),
|
|
tr("U盘不可识别!"));
|
|
return;
|
|
}
|
|
|
|
system((char *)((QString("cp /usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib/fonts/* /udisk/.")).toLatin1().data()));
|
|
system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));//am335x
|
|
system((char *)((QString("cp /usr/lib/fonts/* /udisk/.")).toLatin1().data()));
|
|
system((char *)((QString("mkdir /udisk/zk")).toLatin1().data()));
|
|
QMessageBox::information(this, tr("提示"),
|
|
tr("字库导出完成!"));
|
|
}
|
|
}
|
|
|
|
void SystemUpdate::on_pushButtonInterFace_clicked()
|
|
{
|
|
QString s1 = Public::ReadLanguageName();
|
|
if(s1 =="English") {
|
|
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_ENGLISH;
|
|
}
|
|
else if(s1 =="Korean") {
|
|
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_KOREAN;
|
|
}
|
|
else{
|
|
dlgLanguage.LangIndex =INPUT_METHOD_TYPE_CHINESE;
|
|
}
|
|
|
|
dlgLanguage.setCurrentLanguage();
|
|
dlgLanguage.show();
|
|
}
|