Sfoglia il codice sorgente

修改用户登录,删除旧代码

JonYang 1 giorno fa
parent
commit
000caad391

+ 32 - 6
View/die-bonder-ui/Login.cpp

@@ -4,6 +4,8 @@
 #include <QStackedWidget>
 #include <qDebug>
 #include <QSettings>
+#include "Src/common/JMessageTip.h"
+#include "Src/common/UserManagementShared.h"
 
 Login::Login(QWidget *parent)
     : QMainWindow(parent)
@@ -55,14 +57,38 @@ void Login::onUserNameChanged(const QString &userName)
 
 void Login::on_SinginButton_clicked()
 {
-    emit SendSwitchOriginalWndSignals();
-    /*if (QStackedWidget* parent = qobject_cast<QStackedWidget*>(this->parentWidget()))
+    QString strTip;
+
+    QString strUser = ui->userNameLineEdit->text().trimmed();
+    if (!strUser.isEmpty())
     {
-        OriginalWnd* originalWnd = new OriginalWnd(this);
-        parent->addWidget(originalWnd);
-        parent->setCurrentIndex(parent->indexOf(originalWnd));
+        QString strPass = ui->passLineEdit->text().trimmed();
+        if (!strPass.isEmpty())
+        {
+            //JEncryption::Encryption();
+
+            emit SendSwitchOriginalWndSignals();
+            /*if (QStackedWidget* parent = qobject_cast<QStackedWidget*>(this->parentWidget()))
+            {
+                OriginalWnd* originalWnd = new OriginalWnd(this);
+                parent->addWidget(originalWnd);
+                parent->setCurrentIndex(parent->indexOf(originalWnd));
+
+            }*/
 
-    }*/
+            return;
+        }
+        else
+        {
+            strTip = tr("Please enter your password", "请输入密码");
+        }
+    }
+    else
+    {
+        strTip = tr("Please enter your username", "请输入用户名称");
+    }
+    
+    JMessageTip::Message_warning(strTip);
 }
 
 void Login::on_ExitButton_clicked()

+ 0 - 39
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.cpp

@@ -305,9 +305,6 @@ void MainAndSecondaryCamerasWnd::InitMainCameraBind(CameraBind* pCameraBind)
 {
     m_pMainCameraBind = pCameraBind;
     initFrom();
-
-    m_nTimeShowPos = startTimer(600);
-    ResetIdleTimer(true);
 }
 
 void MainAndSecondaryCamerasWnd::UpdateCameraDisplay0(int iCameraId, JVision::ImageInfo imageData)
@@ -423,22 +420,6 @@ void MainAndSecondaryCamerasWnd::timerEvent(QTimerEvent* event)
     int nID = event->timerId();
 }
 
-void MainAndSecondaryCamerasWnd::ResetIdleTimer(bool bStart /*= false*/)
-{
-    if (bStart)
-    {
-        if (isActiveWindow())
-        {
-            m_idleTimer = startTimer(3000);
-        }
-    }
-    else
-    {
-        killTimer(m_idleTimer);
-        m_idleTimer = -1;
-    }
-}
-
 void MainAndSecondaryCamerasWnd::GetCurrentSelectSlots(int groupId, int nIndex)
 {
     if (m_pMainCameraBind == nullptr)
@@ -618,26 +599,6 @@ void MainAndSecondaryCamerasWnd::wheelEvent(QWheelEvent *event)
 	QMainWindow::wheelEvent(event);
 }
 
-bool MainAndSecondaryCamerasWnd::eventFilter(QObject* obj, QEvent* event)
-{
-    // 检测用户活动事件
-    switch (event->type()) 
-    {
-    case QEvent::KeyPress:
-    case QEvent::MouseMove:
-    case QEvent::MouseButtonPress:
-    case QEvent::MouseButtonDblClick:
-    case QEvent::Wheel:
-        ResetIdleTimer();
-        ResetIdleTimer(true);
-        break;
-    default:
-        break;
-    }
-
-    return QMainWindow::eventFilter(obj, event);
-}
-
 void MainAndSecondaryCamerasWnd::showEvent(QShowEvent *event) {
     isUpdatingSettings = false;
     QMainWindow::showEvent(event);

+ 1 - 9
View/die-bonder-ui/OriginalWnd/MainAndSecondaryCamerasWnd.h

@@ -41,7 +41,7 @@ public slots:
 
 protected:
     void wheelEvent(QWheelEvent* event) override;
-    bool eventFilter(QObject* obj, QEvent* event) override;
+
 
     void loadSettings();
 
@@ -66,8 +66,6 @@ private slots:
         return Right_currentPixmap;
     }
 
-    void ResetIdleTimer(bool bStart = false);
-
 
     void GetCurrentSelectSlots(int groupId, int nIndex);
     void GetUpDataImageShowSignals0(const QPixmap& imageData);
@@ -147,12 +145,6 @@ private:
 
     int m_nIdex = 0;
 
-    int                     m_nTimeShowPos = -1;
-    /**用作定时使用,后面移动到整个类里面,目前先实现功能
-    */
-    int                     m_idleTimer = -1;
-
-
     QMap<int, Waffle*> waffleMap;
     QMap<int, MaterialBox*> materialBoxMap;
 

+ 28 - 2
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.cpp

@@ -261,17 +261,17 @@ void ControlOperationPage::UpDateCameraBind(CameraBind* pCameraBind)
 
 void ControlOperationPage::on_switchJoystickBut_clicked()
 {
+    m_isUserOnclick = true;
     ResetIdleTimer(true);
 }
 
 void ControlOperationPage::MouseMovedSlots(const QPoint& delta)
 {
-    qDebug() << "MouseMovedSlots" << delta;
+    qDebug() << "MouseMovedSlots:" << delta;
     if (m_pCameraBindCopy)
     {
         m_pCameraBindCopy->JCameraMove(0, delta.x(), delta.y());
     }
-    
 }
 
 void ControlOperationPage::RequestCursorMoveSlots(const QPoint& pos)
@@ -285,6 +285,7 @@ void ControlOperationPage::timerEvent(QTimerEvent* event)
     if (nID == m_idleTimer)
     {
         ResetIdleTimer(false);
+        m_isUserOnclick = false;
     }
 }
 
@@ -305,6 +306,30 @@ void ControlOperationPage::mouseMoveEvent(QMouseEvent* event)
     int a = 10;
 }
 
+bool ControlOperationPage::eventFilter(QObject* obj, QEvent* event)
+{
+    switch (event->type())
+    {
+    case QEvent::KeyPress:
+    case QEvent::MouseMove:
+    case QEvent::MouseButtonPress:
+    case QEvent::MouseButtonDblClick:
+    case QEvent::Wheel:
+    {
+        if (m_isUserOnclick)
+        {
+            ResetIdleTimer(false);
+            ResetIdleTimer(true);
+        }
+    }
+    break;
+    default:
+        break;
+    }
+
+    return QWidget::eventFilter(obj, event);
+}
+
 void ControlOperationPage::HideLayout(bool bShow)
 {
     for (int i = 0; i < ui->horizontalLayout->count(); ++i)
@@ -346,6 +371,7 @@ void ControlOperationPage::InitWnd()
     HideLayout(false);
     
     this->setMouseTracking(true);
+    this->installEventFilter(this);
 }
 
 void ControlOperationPage::CreateMouseMonitor(bool isStart)

+ 3 - 1
View/die-bonder-ui/Src/RewriteControl/ControlOperationPage.h

@@ -73,6 +73,8 @@ protected:
 
     void mouseMoveEvent(QMouseEvent* event) override;
 
+    bool eventFilter(QObject* obj, QEvent* event) override;
+
 private:
     void HideLayout(bool bShow);
     void ResetIdleTimer(bool bStart = false);
@@ -113,7 +115,7 @@ private:
     JMouseMonitorThread*        m_pMousethread = nullptr;
 
     bool                        m_bMouseRun = false; // 重复点击
-
+    bool                        m_isUserOnclick = false;
 
     /**硬件指针
      */