116 lines
4.0 KiB
C++
116 lines
4.0 KiB
C++
#include "x_uimsgboxok.h"
|
||
#include "ui_x_uimsgboxok.h"
|
||
#include <QSettings>
|
||
#include <loappconfig.h>
|
||
#include "LoUIClass/x_uimsgboxokcancel.h"
|
||
#include "LoUIClass/updaterfirmwaredialog.h"
|
||
X_UIMsgBoxOk::X_UIMsgBoxOk(QWidget *parent) :
|
||
LoQDialog(parent),
|
||
ui(new Ui::X_UIMsgBoxOk)
|
||
{
|
||
ui->setupUi(this);
|
||
m_bExitTypeFlag=0;
|
||
}
|
||
|
||
X_UIMsgBoxOk::~X_UIMsgBoxOk()
|
||
{
|
||
delete ui;
|
||
}
|
||
X_UIMsgBoxOk::X_UIMsgBoxOk(QString strTitle,QString text, QWidget *parent) :
|
||
LoQDialog(parent),
|
||
ui(new Ui::X_UIMsgBoxOk)
|
||
{
|
||
ui->setupUi(this);
|
||
ui->lInfoTip->adjustSize();
|
||
ui->label_3->setText(strTitle);
|
||
//让QLabel能够自动判断并换行显示:
|
||
// ui->lInfoTip->setGeometry(QRect(328, 240, 329, 27*4)); //四倍行距
|
||
ui->lInfoTip->setWordWrap(true);
|
||
ui->lInfoTip->setAlignment(Qt::AlignTop);
|
||
ui->lInfoTip->setText(text);
|
||
ui->pushButton_3->setVisible(false);
|
||
m_bExitTypeFlag=0;
|
||
ui->pushButton->setProperty("ssType", "progManageTool");
|
||
ui->pushButton->setStyleSheet("QPushButton{background:rgba(28,154,210,255);}");
|
||
ui->pushButton_2->setProperty("ssType", "progManageTool");
|
||
ui->pushButton_2->setStyleSheet("QPushButton{background:rgba(28,154,210,255);}");
|
||
ui->pushButton_3->setProperty("ssType", "progManageTool");
|
||
ui->pushButton_3->setStyleSheet("QPushButton{background:rgba(28,154,210,255);}");
|
||
|
||
}
|
||
X_UIMsgBoxOk::X_UIMsgBoxOk(QString strTitle,QString text, QWidget *parent,int iType) :
|
||
LoQDialog(parent),
|
||
ui(new Ui::X_UIMsgBoxOk)
|
||
{
|
||
ui->setupUi(this);
|
||
m_bExitTypeFlag=0;
|
||
ui->lInfoTip->adjustSize();
|
||
ui->label_3->setText(strTitle);
|
||
//让QLabel能够自动判断并换行显示:
|
||
// ui->lInfoTip->setGeometry(QRect(328, 240, 329, 27*4)); //四倍行距
|
||
ui->lInfoTip->setWordWrap(true);
|
||
ui->lInfoTip->setAlignment(Qt::AlignTop);
|
||
ui->lInfoTip->setText(text);
|
||
ui->pushButton_3->setVisible(false);
|
||
if(iType==1)
|
||
{
|
||
ui->lInfoTip->setStyleSheet("background:rgba(206,206,206,1)");
|
||
ui->frame->setStyleSheet("QFrame{background:rgba(206,206,206,1)}");
|
||
setStyleSheet("background:rgba(206,206,206,1)");
|
||
ui->pushButton->setProperty("ssType", "progManageTool");
|
||
ui->pushButton->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
||
ui->pushButton_2->setProperty("ssType", "progManageTool");
|
||
ui->pushButton_2->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
||
|
||
}
|
||
else if(iType==2)//升级同步提示,升级固件
|
||
{
|
||
ui->pushButton_3->setText(tr("Sync"));
|
||
ui->pushButton_3->setVisible(true);
|
||
|
||
}
|
||
else if(iType==3)//升级同步提示,升级固件
|
||
{
|
||
ui->pushButton_3->setText(tr("install"));
|
||
ui->pushButton_3->setVisible(true);
|
||
|
||
}
|
||
//connect(ui->pushButton_3, SIGNAL(clicked()), this, SIGNAL(signSyncFirmware()));
|
||
connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(OnSyncFirmware()));
|
||
connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(close()));
|
||
// ui->frame->setStyleSheet("border:1px solid rgb(116,116,116)");
|
||
}
|
||
|
||
void X_UIMsgBoxOk::OnSyncFirmware()
|
||
{
|
||
LoAppConfig *cfg = LoAppConfig::getInstance();
|
||
QSettings *settings = new QSettings(cfg->OrganizationName(), cfg->ApplicationName());
|
||
|
||
QString strfilepath = settings->value("xixunplayer").toString();
|
||
if(strfilepath.isEmpty())
|
||
{
|
||
strfilepath=QCoreApplication::applicationDirPath() + "/Downloads/"+"xixunplayer10.9.9-8.apk";
|
||
}
|
||
QFileInfo file1(strfilepath);
|
||
|
||
QFile file(strfilepath);
|
||
if(file.exists())
|
||
{
|
||
emit signSyncFirmware();
|
||
|
||
}
|
||
else {
|
||
settings->setValue("https://www.ledok.cn/download/definitions/player.json","10.9.9-8");
|
||
X_UIMsgBoxOkCancel *dlg = new X_UIMsgBoxOkCancel(tr("Tip Info"),tr("No found xixunplayer.apk,Do you want download it from internet?"), this);
|
||
if(dlg->exec() == QDialog::Accepted)
|
||
{
|
||
UpdaterFirmwareDialog *pDlg=new UpdaterFirmwareDialog(this);
|
||
pDlg->exec();
|
||
emit signSyncFirmware();
|
||
}
|
||
else {
|
||
|
||
}
|
||
}
|
||
}
|