#include "welcome_page.h"
|
#include "ui_welcome_page.h"
|
#include "Common/mymessagebox.h"
|
#include "IMEKeyBoard/syszuxpinyin.h"
|
#include "Common/classxml.h"
|
|
Welcome_Page::Welcome_Page(QWidget *parent, Work_Thread *thread) :
|
customDialog(parent),
|
ui(new Ui::Welcome_Page)
|
{
|
ui->setupUi(this);
|
work_thread = thread;
|
set_btn_beep(ui->ledit_Type,SIGNAL(custom_click()));
|
set_btn_beep(ui->ledit_Name,SIGNAL(custom_click()));
|
set_btn_beep(ui->ledit_CName,SIGNAL(custom_click()));
|
set_btn_beep(ui->ledit_EName,SIGNAL(custom_click()));
|
|
set_btn_beep(ui->Btn_set,SIGNAL(pressed()));
|
set_btn_beep(ui->Btn_Exit,SIGNAL(pressed()));
|
set_btn_beep(ui->Btn_Logo,SIGNAL(pressed()));
|
|
connect(ui->ledit_Type,SIGNAL(custom_click()),this,SLOT(ledit_action()));
|
connect(ui->ledit_Name,SIGNAL(custom_click()),this,SLOT(ledit_action()));
|
connect(ui->ledit_CName,SIGNAL(custom_click()),this,SLOT(ledit_action()));
|
connect(ui->ledit_EName,SIGNAL(custom_click()),this,SLOT(ledit_action()));
|
|
connect(ui->Btn_set,SIGNAL(released()),this,SLOT(BtnReleased()));
|
connect(ui->Btn_Exit,SIGNAL(released()),this,SLOT(BtnReleased()));
|
connect(ui->Btn_Logo,SIGNAL(released()),this,SLOT(BtnReleased()));
|
|
initPage();
|
|
}
|
|
Welcome_Page::~Welcome_Page()
|
{
|
delete ui;
|
}
|
|
void Welcome_Page::initPage()
|
{
|
ui->Btn_set->setEnabled(false);
|
ui->label_tip->setText("");
|
|
ClassXML::ReadLOGOXml(LOGO);
|
|
if(LOGO.LOGOEN)
|
ui->Btn_Logo->setStyleSheet("border-image: url(:/new/prefix1/FG.png);");
|
else
|
ui->Btn_Logo->setStyleSheet("border:1px solid white;");
|
|
ui->ledit_Type->setText(LOGO.ModelLogo);
|
ui->ledit_Type->setStyleSheet("color:black");
|
|
ui->ledit_Name->setText(LOGO.MachineName);
|
ui->ledit_Name->setStyleSheet("color:black");
|
|
ui->ledit_CName->setText(LOGO.CompanyCName);
|
ui->ledit_CName->setStyleSheet("color:black");
|
|
ui->ledit_EName->setText(LOGO.CompanyEName);
|
ui->ledit_EName->setStyleSheet("color:black");
|
}
|
|
void Welcome_Page::ledit_action(void)
|
{
|
if(!ui->Btn_set->isEnabled())
|
ui->Btn_set->setEnabled(true);
|
Custom_LineEdit *le = dynamic_cast<Custom_LineEdit*>(sender());
|
le->setCursorPosition(le->text().size()); //设置焦点(光标) 位置,设置在末尾
|
if(le == ui->ledit_Type)
|
{
|
le->setStyleSheet("color:blue");
|
SyszuxPinyin pinyin(this,le,work_thread);
|
pinyin.exec();
|
le->setStyleSheet("color:red");
|
LOGO.ModelLogo = le->text();
|
}
|
else if(le == ui->ledit_Name)
|
{
|
le->setStyleSheet("color:blue");
|
SyszuxPinyin pinyin(this,le,work_thread);
|
pinyin.exec();
|
le->setStyleSheet("color:red");
|
LOGO.MachineName = le->text();
|
}
|
else if(le == ui->ledit_CName)
|
{
|
le->setStyleSheet("color:blue");
|
SyszuxPinyin pinyin(this,le,work_thread);
|
pinyin.exec();
|
le->setStyleSheet("color:red");
|
LOGO.CompanyCName = le->text();
|
}
|
else if(le == ui->ledit_EName)
|
{
|
le->setStyleSheet("color:blue");
|
SyszuxPinyin pinyin(this,le,work_thread);
|
pinyin.exec();
|
le->setStyleSheet("color:red");
|
LOGO.CompanyEName = le->text();
|
}
|
}
|
|
void Welcome_Page::BtnReleased()
|
{
|
QPushButton *pb = dynamic_cast<QPushButton*>(sender());
|
|
if(pb == ui->Btn_Exit)
|
{
|
closeCustom(false);
|
}
|
else if(pb == ui->Btn_set)
|
{
|
ClassXML::ModifyLOGOXml(LOGO);
|
MessageBox box( this, QMessageBox::Question, MB_Caption, tr("界面设置成功,需重启后生效,确定重启?"),
|
QMessageBox::Yes|QMessageBox::No,QMessageBox::Yes,work_thread);
|
if(box.exec()!=QMessageBox::Yes)
|
{
|
return;
|
}
|
system("/app/restart_app.sh &");
|
return;
|
}
|
else if(pb == ui->Btn_Logo)
|
{
|
if(!ui->Btn_set->isEnabled())
|
ui->Btn_set->setEnabled(true);
|
if(LOGO.LOGOEN)
|
{
|
LOGO.LOGOEN = false;
|
ui->Btn_Logo->setStyleSheet("border:1px solid white;");
|
}
|
else
|
{
|
LOGO.LOGOEN = true;
|
ui->Btn_Logo->setStyleSheet("border-image: url(:/new/prefix1/FG.png);");
|
}
|
}
|
}
|