新二维码/条形码编辑逻辑
This commit is contained in:
+94
-71
@@ -2,6 +2,8 @@
|
||||
#include "ui_dlgmutilanguage.h"
|
||||
#include "InputMethod.h"
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QTime>
|
||||
#include <unistd.h>
|
||||
|
||||
DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) :
|
||||
@@ -9,7 +11,7 @@ DlgMutiLanguage::DlgMutiLanguage(QWidget *parent) :
|
||||
ui(new Ui::DlgMutiLanguage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// ui->listWidget->hide();
|
||||
// ui->listWidget->hide();
|
||||
connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(SetNewLanguage()));
|
||||
LangIndex=INPUT_METHOD_TYPE_CHINESE;
|
||||
}
|
||||
@@ -32,89 +34,110 @@ void DlgMutiLanguage::setCurrentLanguage(){
|
||||
}
|
||||
|
||||
int DlgMutiLanguage::getCurrentLanguage(){
|
||||
// LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
// if(ui->radioButton_2->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到英文界面"));
|
||||
// buf.append("English\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
// else if(ui->radioButton_3->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到越南语界面"));
|
||||
// buf.append("Vietnamese\r\n");
|
||||
// buf.append("YN_utf8.txt\r\n");
|
||||
// }
|
||||
// /*else if(ui->radioButton->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
// if(ui->radioButton_2->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到英文界面"));
|
||||
// buf.append("English\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
// else if(ui->radioButton_3->isChecked()) {
|
||||
// LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到越南语界面"));
|
||||
// buf.append("Vietnamese\r\n");
|
||||
// buf.append("YN_utf8.txt\r\n");
|
||||
// }
|
||||
// /*else if(ui->radioButton->isChecked()) {
|
||||
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
// }
|
||||
// else if(ui->radioButton->isChecked()) {
|
||||
|
||||
// }*/
|
||||
// else {
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到中文界面"));
|
||||
// buf.append("Chinese\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
// }*/
|
||||
// else {
|
||||
// QMessageBox::information(this,tr("提示"),tr("重启后切换到中文界面"));
|
||||
// buf.append("Chinese\r\n");
|
||||
// buf.append("WINPY_utf8.txt\r\n");
|
||||
// }
|
||||
return LangIndex;
|
||||
}
|
||||
void DlgMutiLanguage::SetNewLanguage(){
|
||||
|
||||
LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
LangIndex = INPUT_METHOD_TYPE_CHINESE;
|
||||
|
||||
QFile file("/home/plg/UseEn");
|
||||
QFile file("/home/plg/UseEn");
|
||||
|
||||
QByteArray buf;
|
||||
buf.clear();
|
||||
QByteArray buf;
|
||||
buf.clear();
|
||||
|
||||
if(file.open(QIODevice::ReadWrite)) {//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看
|
||||
if(file.open(QIODevice::ReadWrite)) {//怀疑是QIODevice::Truncate 引起参数错误,去掉试试看
|
||||
|
||||
|
||||
if(ui->radioButton_2->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
buf.append("English\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
if(ui->radioButton_2->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_ENGLISH;
|
||||
buf.append("English\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_3->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Turkish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_4->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_SPANISH;
|
||||
buf.append("Spanish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_5->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_THAI;
|
||||
buf.append("Thai\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_6->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Vietnamese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_7->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_Farsi;
|
||||
buf.append("Farsi\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_korean->isChecked()){
|
||||
LangIndex = INPUT_METHOD_TYPE_KOREAN;
|
||||
buf.append("Korean\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else {
|
||||
buf.append("Chinese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
file.write(buf);
|
||||
fsync(file.handle());
|
||||
file.close();
|
||||
|
||||
}
|
||||
else if(ui->radioButton_3->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Turkish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
// 提示重启
|
||||
QMessageBox::StandardButton ret = QMessageBox::information(this, tr("提示"),
|
||||
tr("是否重启?"),
|
||||
QMessageBox::Ok);
|
||||
if (ret == QMessageBox::Ok) {
|
||||
sysPara->saveParaToFile(); // 关机前将相关配置保存
|
||||
sysPara->saveRFIDPara();
|
||||
mySleep(200);
|
||||
system("sync");//缓存同步
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
else if(ui->radioButton_4->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_SPANISH;
|
||||
buf.append("Spanish\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_5->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_THAI;
|
||||
buf.append("Thai\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_6->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_VIETNAM;
|
||||
buf.append("Vietnamese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_7->isChecked()) {
|
||||
LangIndex = INPUT_METHOD_TYPE_Farsi;
|
||||
buf.append("Farsi\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else if(ui->radioButton_korean->isChecked()){
|
||||
LangIndex = INPUT_METHOD_TYPE_KOREAN;
|
||||
buf.append("Korean\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
else {
|
||||
buf.append("Chinese\r\n");
|
||||
buf.append("WINPY_utf8.txt\r\n");
|
||||
}
|
||||
file.write(buf);
|
||||
fsync(file.handle());
|
||||
file.close();
|
||||
}
|
||||
|
||||
void DlgMutiLanguage::mySleep(unsigned int msec)
|
||||
{
|
||||
QTime dieTime = QTime::currentTime().addMSecs(msec);
|
||||
|
||||
while( QTime::currentTime() < dieTime )
|
||||
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user