Ver Fonte

update:更新单枪UI背景图;

Bigpang_1 há 1 mês atrás
pai
commit
53a7a82d94

+ 1 - 1
src/utils/GeneralInterface.cpp

@@ -371,7 +371,7 @@ void GeneralInterface::setTouchScroller(QAbstractScrollArea *scrollArea)
 void GeneralInterface::setControlEnabled(QWidget *control, QWidget *label, const int &userType)
 {
     // 管理员和根用户都有控制权
-    const bool hasControl = (userType == General::UserType::ADMIN || userType == General::UserType::ROOT);
+    const bool hasControl = (/*userType == General::UserType::ADMIN || */userType == General::UserType::ROOT);
     if (control) {
         control->setEnabled(hasControl);
     }

+ 3 - 0
src/widgets/workspace/home/FormFinished.cpp

@@ -26,6 +26,7 @@ FormFinished::FormFinished(int gun_id, QWidget *parent)
     connect(GLOBALS, &Globals::tcuConfigValueChanged, this, [this](const TCU_CFG& tcu_cfg) {
         m_tcu_cfg = tcu_cfg;
         auto isOnce = (m_ccu_cfg.GUN_Numb == 1 ? true : false);
+        refreshChargingBackground();
         setOnceLayoutStrect(isOnce);
     });
 
@@ -187,6 +188,8 @@ void FormFinished::refreshData()
 
 void FormFinished::showEvent(QShowEvent *event)
 {
+    m_ccu_cfg = ConfigManager::instance()->ccu_cfg();
+    m_tcu_cfg = ConfigManager::instance()->tcu_cfg();
     refreshData();
     refreshChargingBackground();
     QWidget::showEvent(event);

+ 7 - 7
src/widgets/workspace/home/FormGunDetail.cpp

@@ -205,13 +205,13 @@ void FormGunDetail::setupGlobalsConnections()
     }
 
     connect(GLOBALS,    &Globals::tcuConfigValueChanged,        this,   [this](const TCU_CFG& tcu_cfg) {
-        // m_tcu_cfg = tcu_cfg;
-        // charge_prepare_enum form = static_cast<charge_prepare_enum>(m_tcu_cfg.current_prepare_form);
-        // if (TcpServerThread::instance()->isClientConnected()) {
-        //     showForm(form);
-        // }
-        // showForm(form);
-        // refreshGunLinTempVisible();
+        m_tcu_cfg = tcu_cfg;
+        charge_prepare_enum form = static_cast<charge_prepare_enum>(m_tcu_cfg.current_prepare_form);
+        if (TcpServerThread::instance()->isClientConnected()) {
+            showForm(form);
+        }
+        showForm(form);
+        refreshGunLinTempVisible();
         if (m_tcu_cfg.auth_type_enable.qr != tcu_cfg.auth_type_enable.qr ||
             m_tcu_cfg.auth_type_enable.nfc != tcu_cfg.auth_type_enable.nfc ||
             m_tcu_cfg.auth_type_enable.pos != tcu_cfg.auth_type_enable.pos) {

+ 7 - 0
src/widgets/workspace/home/FormPlugIn.cpp

@@ -33,6 +33,7 @@ FormPlugIn::FormPlugIn(int gun_id, QWidget *parent)
                             << Global::Keys::CHARGING_INFO_2;
 
     m_ccu_cfg = ConfigManager::instance()->ccu_cfg();
+    refreshChargingBackground();
 
     initConnect();
 }
@@ -120,4 +121,10 @@ void FormPlugIn::initWidget()
 void FormPlugIn::initConnect()
 {
     connect(LanguageManager::instance(), &LanguageManager::languageChanged, this, [this]() { ui->retranslateUi(this); });
+    connect(GLOBALS, &Globals::ccuConfigValueChanged, this, [this](const CCU_CFG& ccu_cfg){
+        if (m_ccu_cfg.GUN_Numb != ccu_cfg.GUN_Numb) {
+            m_ccu_cfg = ccu_cfg;
+            refreshChargingBackground();
+        }
+    });
 }

+ 27 - 5
src/widgets/workspace/home/FormStandby.cpp

@@ -6,7 +6,7 @@
 
 #include "Globals.h"
 #include "LanguageManager.h"
-#include "FunctionTimer.h"
+#include "ConfigManager.h"
 
 FormStandby::FormStandby(QWidget *parent)
     : QWidget(parent)
@@ -33,6 +33,16 @@ void FormStandby::initWidget()
     m_price->setParent(this);
     m_price->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
     m_price->setWindowModality(Qt::WindowModal);
+
+    m_ccu_cfg = ConfigManager::instance()->ccu_cfg();
+    refreshDisplay();
+
+    connect(GLOBALS, &Globals::ccuConfigValueChanged, this, [this](const CCU_CFG& ccu_cfg) {
+        if (m_ccu_cfg.GUN_Numb != ccu_cfg.GUN_Numb) {
+            m_ccu_cfg = ccu_cfg;
+            refreshDisplay();
+        }
+    });
 }
 
 void FormStandby::initConnect()
@@ -40,10 +50,6 @@ void FormStandby::initConnect()
     connect(ui->gun_widget_1, &FormGunDetail::signalControlAuth, ui->gun_widget_1, &FormGunDetail::slotParseControlAuth);
     connect(ui->gun_widget_2, &FormGunDetail::signalControlAuth, ui->gun_widget_2, &FormGunDetail::slotParseControlAuth);
 
-    connect(GLOBALS, &Globals::ccuConfigValueChanged, this, [this](const CCU_CFG& value) {
-        ui->gun_widget_2->setVisible(value.GUN_Numb == CHARGE_GUN_DEFAULT_2);
-    });
-
     connect(ui->gun_widget_1, &FormGunDetail::showPrice, this, [this]() {
         if (m_price) m_price->show();
     });
@@ -54,3 +60,19 @@ void FormStandby::initConnect()
     connect(LanguageManager::instance(), &LanguageManager::languageChanged, this, [this]() { ui->retranslateUi(this); });
 }
 
+void FormStandby::refreshDisplay()
+{
+    switch (m_ccu_cfg.GUN_Numb) {
+    case CHARGE_GUN_DEFAULT_1:
+        ui->gun_widget_1->setVisible(true);
+        ui->gun_widget_2->setVisible(false);
+        break;
+    case CHARGE_GUN_DEFAULT_2:
+        ui->gun_widget_1->setVisible(true);
+        ui->gun_widget_2->setVisible(true);
+        break;
+    default:
+        break;
+    }
+}
+

+ 4 - 0
src/widgets/workspace/home/FormStandby.h

@@ -8,6 +8,7 @@
 #include <QStackedWidget>
 
 #include "workspace/home/FormPrice.h"
+#include "DataTypeDef.h"
 
 namespace Ui {
 class FormStandby;
@@ -29,11 +30,14 @@ private:
     void initWidget();
     void initConnect();
 
+    void refreshDisplay();
+
 private:
     Ui::FormStandby *ui;
     QScopedPointer<FormPrice> m_price;
 
     int m_index = 1;
+    CCU_CFG m_ccu_cfg;
 };
 
 #endif // FORMSTANDBY_H

+ 1 - 1
src/widgets/workspace/settings/CcuSettings/FormCcuSetting.cpp

@@ -148,7 +148,7 @@ void FormCcuSetting::refreshVisible()
     GeneralInterface::setControlEnabled(ui->gun_number,             ui->label_gunNumber,            userType());
     GeneralInterface::setControlVisiabled(ui->username,             ui->label_username,             userType());
     GeneralInterface::setControlVisiabled(ui->password,             ui->label_passwprd,             userType());
-    GeneralInterface::setControlVisiabled(ui->BoxTempThreshold,     ui->BoxTempThreshold,           userType());
+    GeneralInterface::setControlEnabled(ui->BoxTempThreshold,       ui->label_BoxOverTemp_Warning,  userType());
 
     ui->groupBox_alarm_enable->setVisible(userType() == General::UserType::ROOT);
 

+ 2 - 2
src/widgets/workspace/settings/CcuSettings/FormCcuSetting.ui

@@ -30,7 +30,7 @@
       </property>
       <layout class="QGridLayout" name="gridLayout_3">
        <item row="0" column="0">
-        <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0">
+        <layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0,1">
          <item row="7" column="1">
           <layout class="QHBoxLayout" name="horizontalLayout_11" stretch="1,0">
            <item>
@@ -297,7 +297,7 @@
              <number>0</number>
             </property>
             <item row="0" column="0">
-             <layout class="QGridLayout" name="gridLayout_2">
+             <layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,1">
               <item row="7" column="1">
                <layout class="QHBoxLayout" name="horizontalLayout_33">
                 <item>