123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- #include "etTestResult.h"
- #include "ui_etTestResult.h"
- #include "CAppInfo.h"
- #include <QScrollBar>
- #include <QHBoxLayout>
- #include <QLabel>
- etTestResult::etTestResult(QWidget *parent) :
- QWidget(parent),
- ui(new Ui::etTestResult)
- {
- ui->setupUi(this);
- setStyleSheet(g_appInfoPtr->m_sQssStr);
- ui->tablewt_envTest->setEditTriggers(QAbstractItemView::NoEditTriggers);
- //整行选中的方式
- ui->tablewt_envTest->setSelectionBehavior(QAbstractItemView::SelectRows);
- //设置为只能选中一行
- ui->tablewt_envTest->setSelectionMode(QAbstractItemView::SingleSelection);
- //隐藏列表头
- ui->tablewt_envTest->verticalHeader()->setVisible(false);
- //隐藏边框
- ui->tablewt_envTest->setShowGrid(false);
- //表头不高亮显示
- ui->tablewt_envTest->horizontalHeader()->setVisible(false);// ->setHighlightSections(false);
- //设置行数
- ui->tablewt_envTest->setRowCount(6);
- //设置列数
- ui->tablewt_envTest->setColumnCount(2);
- ui->tablewt_envTest->setHorizontalScrollMode(QTableWidget::ScrollPerPixel);
- ui->tablewt_envTest->horizontalScrollBar()->setSingleStep(g_appInfoPtr->m_fRate * 5);
- QStringList sHeadStr;
- sHeadStr << QString::fromLocal8Bit("检测项") <<
- QString::fromLocal8Bit("结果");
- ui->tablewt_envTest->setHorizontalHeaderLabels(sHeadStr);
- ui->tablewt_envTest->horizontalHeader()->setDefaultAlignment(Qt::AlignJustify | Qt::AlignVCenter);
- ui->tablewt_envTest->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
- ui->tablewt_envTest->verticalHeader()->setDefaultSectionSize(g_appInfoPtr->m_fRate * 48);
- ui->tablewt_envTest->setColumnWidth(0, g_appInfoPtr->m_fRate * 425);
- // ui->tablewt_envTest->setColumnWidth(1, g_appInfoPtr->m_fRate * 170);
- ui->tablewt_envTest->horizontalHeader()->setStretchLastSection(true);
- }
- etTestResult::~etTestResult()
- {
- delete ui;
- }
- int etTestResult::setUI(const int nLeft, const int nTop, const int nWidth)
- {
- setGeometry(nLeft, nTop, nWidth, g_appInfoPtr->m_fRate*146);
- ui->tablewt_envTest->setGeometry(g_appInfoPtr->m_fRate*30, 0, width() - g_appInfoPtr->m_fRate*30*2, g_appInfoPtr->m_fRate*293);
-
- QString sTextStyle = QString(R"(QLabel
- {
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:400;
- color:rgba(153,153,153,1);
- })").arg((int)(g_appInfoPtr->m_fRate * 12));
-
-
- {
- int i = 0;
- QWidget *widget1 = new QWidget;
- QHBoxLayout *layout1 = new QHBoxLayout;
- widget1->setLayout(layout1);
-
- QLabel *icon1 = new QLabel;
- icon1->setStyleSheet(sTextStyle);
- icon1->setText(QString::fromLocal8Bit("检查项"));
- layout1->addWidget(icon1);
- layout1->addStretch();
- ui->tablewt_envTest->setCellWidget(i, 0, widget1);
-
- QWidget *widget = new QWidget;
- QHBoxLayout *layout = new QHBoxLayout;
- widget->setLayout(layout);
- QLabel *icon = new QLabel;
- icon->setStyleSheet(sTextStyle);
- icon->setText(QString::fromLocal8Bit("结果"));
- layout->addStretch();
- layout->addWidget(icon);
-
- ui->tablewt_envTest->setCellWidget(i, 1, widget);
- }
- ui->lw_ettr_unpass->setGeometry(ui->tablewt_envTest->x(), ui->tablewt_envTest->y() + ui->tablewt_envTest->height() + g_appInfoPtr->m_fRate*20,
- ui->tablewt_envTest->width(), ui->lw_ettr_unpass->count()*g_appInfoPtr->m_fRate*26);
- setGeometry(nLeft, nTop, nWidth, ui->lw_ettr_unpass->y() + ui->lw_ettr_unpass->height());
- return height();
- }
- int etTestResult::widgetHeight()
- {
- return ui->lw_ettr_unpass->y() + ui->lw_ettr_unpass->height();
- }
- void etTestResult::setResult(int nNetWorkStatus, int nTimekStatus, int nCameraStatus, int nVoiceStatus, int nWXStatus)
- {
- QString sTextStyle = QString(R"(QLabel
- {
- font-size:%1px;
- font-family:"Microsoft YaHei";
- font-weight:400;
- color:rgba(254,119,100,1);
- })").arg((int)(g_appInfoPtr->m_fRate*12));
- ui->lw_ettr_unpass->clear();
- ui->lw_ettr_unpass->setIconSize(QSize(g_appInfoPtr->m_fRate*16, g_appInfoPtr->m_fRate*16));
- int i = 1;
- {
- ui->tablewt_envTest->setItem(i, 0, new QTableWidgetItem(QString::fromLocal8Bit("网速")));
- QWidget *widget = new QWidget;
- QHBoxLayout *layout = new QHBoxLayout;
- widget->setLayout(layout);
- layout->addStretch();
- QLabel *icon = new QLabel;
- if(nNetWorkStatus == 1)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- icon->setPixmap(QPixmap(":/images/icon-et-item-pass.png").scaled(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- }
- else
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- icon->setPixmap(QPixmap(":/images/icon-et-iten-unpass.png").scaled(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- QListWidgetItem *item = new QListWidgetItem(QIcon(QPixmap(":/images/icon-et-tips.png")), QString::fromLocal8Bit("检查网络是否连接,路由器是否正常工作。"));
- ui->lw_ettr_unpass->addItem(item);
- item->setSizeHint(QSize(item->sizeHint().width(), g_appInfoPtr->m_fRate*26));
- }
- layout->addWidget(icon);
- ui->tablewt_envTest->setCellWidget(i, 1, widget);
- }
- {
- i = 2;
- ui->tablewt_envTest->setItem(i, 0, new QTableWidgetItem(QString::fromLocal8Bit("时钟")));
- QWidget *widget = new QWidget;
- QHBoxLayout *layout = new QHBoxLayout;
- widget->setLayout(layout);
- layout->addStretch();
- QLabel *icon = new QLabel;
- if(nTimekStatus == 1)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- icon->setPixmap(QPixmap(":/images/icon-et-item-pass.png").scaled(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- }
- else
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- icon->setPixmap(QPixmap(":/images/icon-et-iten-unpass.png").scaled(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- QListWidgetItem *item = new QListWidgetItem(QIcon(QPixmap(":/images/icon-et-tips.png")), QString::fromLocal8Bit("检查电脑时区及时钟是否正常。"));
- ui->lw_ettr_unpass->addItem(item);
- item->setSizeHint(QSize(item->sizeHint().width(), g_appInfoPtr->m_fRate * 26));
- }
- layout->addWidget(icon);
- ui->tablewt_envTest->setCellWidget(i, 1, widget);
- }
- {
- i = 3;
- ui->tablewt_envTest->setItem(i, 0, new QTableWidgetItem(QString::fromLocal8Bit("摄像头")));
- QWidget *widget = new QWidget;
- QHBoxLayout *layout = new QHBoxLayout;
- widget->setLayout(layout);
- layout->addStretch();
- QLabel *icon = new QLabel;
- if(nCameraStatus == 1)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- icon->setPixmap(QPixmap(":/images/icon-et-item-pass.png").scaled(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- }
- else if(nCameraStatus == 0)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- icon->setPixmap(QPixmap(":/images/icon-et-iten-unpass.png").scaled(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- QListWidgetItem *item = new QListWidgetItem(QIcon(QPixmap(":/images/icon-et-tips.png")), QString::fromLocal8Bit("请确认摄像头连接线正常,能正常工作,关闭杀毒软件;请确认您的电脑是否为双摄像头,启用摄像头是否正确。"));
- ui->lw_ettr_unpass->addItem(item);
- item->setSizeHint(QSize(item->sizeHint().width(), g_appInfoPtr->m_fRate * 26));
- }
- else if(nCameraStatus == 2)
- {
- icon->setStyleSheet(sTextStyle);
- icon->setText(QString::fromLocal8Bit("请在“摄像头”步骤进行人工确认!"));
- icon->adjustSize();
- }
- layout->addWidget(icon);
- ui->tablewt_envTest->setCellWidget(i, 1, widget);
- }
- {
- i = 4;
- ui->tablewt_envTest->setItem(i, 0, new QTableWidgetItem(QString::fromLocal8Bit("声音")));
- QWidget *widget = new QWidget;
- QHBoxLayout *layout = new QHBoxLayout;
- widget->setLayout(layout);
- layout->addStretch();
- QLabel *icon = new QLabel;
- if(nVoiceStatus == 1)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- icon->setPixmap(QPixmap(":/images/icon-et-item-pass.png").scaled(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- }
- else if(nVoiceStatus == 0)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- icon->setPixmap(QPixmap(":/images/icon-et-iten-unpass.png").scaled(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- QListWidgetItem *item = new QListWidgetItem(QIcon(QPixmap(":/images/icon-et-tips.png")), QString::fromLocal8Bit("请确认音箱连接正常,调节音量开关及大小。"));
- ui->lw_ettr_unpass->addItem(item);
- item->setSizeHint(QSize(item->sizeHint().width(), g_appInfoPtr->m_fRate * 26));
- }
- else if(nVoiceStatus == 2)
- {
- icon->setStyleSheet(sTextStyle);
- icon->setText(QString::fromLocal8Bit("请在“声音”步骤进行人工确认!"));
- icon->adjustSize();
- }
- layout->addWidget(icon);
- ui->tablewt_envTest->setCellWidget(i, 1, widget);
- }
- {
- i = 5;
- ui->tablewt_envTest->setItem(i, 0, new QTableWidgetItem(QString::fromLocal8Bit("微信小程序")));
- QWidget *widget = new QWidget;
- QHBoxLayout *layout = new QHBoxLayout;
- widget->setLayout(layout);
- layout->addStretch();
- QLabel *icon = new QLabel;
- if(nWXStatus == 1)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- icon->setPixmap(QPixmap(":/images/icon-et-item-pass.png").scaled(g_appInfoPtr->m_fRate*12, g_appInfoPtr->m_fRate*9));
- }
- else if(nWXStatus == 0)
- {
- icon->setFixedSize(QSize(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- icon->setPixmap(QPixmap(":/images/icon-et-iten-unpass.png").scaled(g_appInfoPtr->m_fRate*8, g_appInfoPtr->m_fRate*8));
- QListWidgetItem *item = new QListWidgetItem(QIcon(QPixmap(":/images/icon-et-tips.png")), QString::fromLocal8Bit("请确认微信已登录并连接网络。"));
- ui->lw_ettr_unpass->addItem(item);
- item->setSizeHint(QSize(item->sizeHint().width(), g_appInfoPtr->m_fRate * 26));
- }
- else if(nWXStatus == 2)
- {
- icon->setStyleSheet(sTextStyle);
- icon->setText(QString::fromLocal8Bit("请在“微信小程序”步骤进行人工确认!"));
- icon->adjustSize();
- }
- layout->addWidget(icon);
- ui->tablewt_envTest->setCellWidget(i, 1, widget);
- }
- if(ui->lw_ettr_unpass->count() > 0)
- {
- QListWidgetItem *item = new QListWidgetItem(QIcon(QPixmap(":/images/icon-et-tips.png")), QString::fromLocal8Bit("请按提示检查并调试,调试后可再次进行环境检测。"));
- ui->lw_ettr_unpass->addItem(item);
- }
- }
|