ソースを参照

V0.5
1、开始封装最小眼图
2、重新绘制了背景网格

Apple 6 ヶ月 前
コミット
3e54e93281

+ 0 - 1
.gitignore

@@ -1 +0,0 @@
-External

+ 9 - 9
CMakeLists.txt

@@ -50,15 +50,15 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
         if(CMAKE_SIZEOF_VOID_P EQUAL 8)
             message(STATUS "Using 64bit Compiler")
             #设置可执行文件输出位置
-            set(exec_out_path ${CMAKE_SOURCE_DIR}/../../bin_GNU_64)
+            set(exec_out_path ${CMAKE_SOURCE_DIR}/../bin_GNU_64)
             #设置库生成位置
-            set(BUILD_LIB_PATH ${CMAKE_SOURCE_DIR}/../../bin_GNU_64)
+            set(BUILD_LIB_PATH ${CMAKE_SOURCE_DIR}/../bin_GNU_64)
         elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
             message(STATUS "Using 32bit Compiler")
             #设置可执行文件输出位置
-            set(exec_out_path ${CMAKE_SOURCE_DIR}/../../bin_GNU_32)
+            set(exec_out_path ${CMAKE_SOURCE_DIR}/../bin_GNU_32)
             #设置库生成位置
-            set(BUILD_LIB_PATH ${CMAKE_SOURCE_DIR}/../../bin_GNU_32)
+            set(BUILD_LIB_PATH ${CMAKE_SOURCE_DIR}/../bin_GNU_32)
         endif()
         if(CMAKE_BUILD_TYPE MATCHES Debug)
             message(STATUS "编译类型:${CMAKE_BUILD_TYPE}")
@@ -88,11 +88,11 @@ link_directories(${BUILD_LIB_PATH})
 
 #设置MSVC的一些编译属性
 if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
-    #设置MSVC使用UTF-8
-    # add_compile_options(
-    #   "$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>"
-    #   "$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>"
-    # )
+    #设置MSVC使用UTF-8,这一句是必须的,否则中文会乱码,添加这一句,也不是设置为UTF-8 with BOM编码格式了
+    add_compile_options(
+      "$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>"
+      "$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>"
+    )
     #消除MSVC对SPDLOG的兼容性警告
     add_compile_definitions("_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING")
 endif()

+ 1 - 0
External

@@ -0,0 +1 @@
+Subproject commit d5e38431f86219237f089afdea2ac03f568d1a52

+ 11 - 3
EyeMap/CMakeLists.txt

@@ -7,10 +7,14 @@ set(execName1 EyeMap)
 file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/*.ui
+    ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
+    ${CMAKE_CURRENT_SOURCE_DIR}/OneEyeMap/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/OneEyeMap/*.ui
+
     ${CMAKE_SOURCE_DIR}/*.cpp
     ${CMAKE_SOURCE_DIR}/*.ui
 
-    ${CMAKE_SOURCE_DIR}/External/common/Thread/*.cpp
+    # ${CMAKE_SOURCE_DIR}/External/common/Thread/*.cpp
     ${CMAKE_SOURCE_DIR}/External/common/ThreadPool/*.cpp
     ${CMAKE_SOURCE_DIR}/Common/Logs/*.cpp
 
@@ -27,6 +31,8 @@ add_executable(${execName1} ${LOCAL_SRC})
 #添加头文件
 target_include_directories(${execName1} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_CURRENT_SOURCE_DIR}/OneEyeMap
+
     ${CMAKE_SOURCE_DIR}
     ${CMAKE_SOURCE_DIR}/External/common
     ${CMAKE_SOURCE_DIR}/Common/Logs
@@ -35,6 +41,7 @@ target_include_directories(${execName1} PRIVATE
     ${CMAKE_SOURCE_DIR}/GlobalInfo
 
     # ${LHQLog_INCLUDE_DIRS}
+    ${spdlog_INCLUDE_DIR}
 )
 #链接Qt库
 target_link_libraries(${execName1} PRIVATE
@@ -45,8 +52,9 @@ target_link_libraries(${execName1} PRIVATE
 )
 #链接外部库
 target_link_libraries(${execName1} PRIVATE
-    fmt::fmt
-    spdlog::spdlog
+    # fmt::fmt
+    # spdlog::spdlog
+    ${spdlog_LIBRARY}
 )
 
 #连接stdc++fs库,如果编译器版本低于GCC9.0,则需要连接这个库

+ 244 - 0
EyeMap/OneEyeMap/OneEyeMap.cpp

@@ -0,0 +1,244 @@
+#include "OneEyeMap.h"
+#include "ui_oneeyemap.h"
+
+#include <QApplication>
+#include <QPainter>
+#include <QPaintEvent>
+
+OneEyeMap::OneEyeMap(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::OneEyeMap)
+{
+    ui->setupUi(this);
+    m_logger = spdlog::get("OSC");
+    if(m_logger == nullptr)
+    {
+        SPDLOG_ERROR("获取 OSC logger 失败");
+        return;
+    }
+    /* 初始化变量,加载qss */
+    // QFile fileQss(":/qss/OneEyeMap/OneEyeMap.qss");
+    QFile fileQss(":/qss/OneEyeMap/OneEyeMap.qss");
+    if(fileQss.open(QFile::ReadOnly))
+    {
+        QString qss = fileQss.readAll();
+        this->setStyleSheet(qss);
+        fileQss.close();
+    } else
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "加载qss文件失败");
+    }
+
+    /* 自定义大小 */
+    // setFixedSize(1600, 900);
+
+    /* 设置绘制区域 */
+    m_leftMargin = 70;
+    m_topMargin = 24;
+    m_rightMargin = 24;
+    m_bottomMargin = 24;
+    /* 设置刻度区域 */
+    m_rectScaleValue = QRect(0, ui->widget_title->height(), this->width(), this->height() - ui->widget_title->height());
+    /* 设置眼图区域 */
+    m_rectEyeMap.setX(m_leftMargin);
+    m_rectEyeMap.setY(ui->widget_title->height() + m_topMargin);
+    m_rectEyeMap.setWidth(m_rectScaleValue.width() - m_rightMargin);
+    m_rectEyeMap.setHeight(m_rectScaleValue.height() - m_bottomMargin);
+    // m_rectEyeMap.setLeft(m_leftMargin);
+    // m_rectEyeMap.setTop(ui->widget_title->height() + m_topMargin);
+    // m_rectEyeMap.setRight(m_rectScaleValue.width() - m_rightMargin);
+    // m_rectEyeMap.setBottom(m_rectScaleValue.height() - m_bottomMargin);
+
+    /* 初始化全局数据 */
+    g_eyeMapMatrix.initEyeMapData(this->width(), this->height());
+    /* 设置定时器 */
+    m_timer.setTimerType(Qt::PreciseTimer);
+    m_timer.setSingleShot(false);
+    m_timer.start(16);      /* 16ms刷新一次,大约120帧 */
+
+    connect(this, &OneEyeMap::signal_update, this, &OneEyeMap::do_update);
+    connect(&m_timer, &QTimer::timeout, this, &OneEyeMap::do_update);
+
+    SPDLOG_LOGGER_INFO(m_logger, "OneEyeMap 初始化成功");
+
+}
+
+OneEyeMap::~OneEyeMap()
+{
+    
+    delete ui;
+}
+
+/* 刷新页面 */
+void OneEyeMap::do_update()
+{
+    update();
+}
+
+/**
+ * @brief 绘制图形
+ * 
+ * @param event 
+ */
+void OneEyeMap::paintEvent(QPaintEvent *event)
+{
+    g_eyeMapMatrix.mutexEyeData.lock();
+    QPainter painter(this);
+    
+    painter.setRenderHint(QPainter::Antialiasing, true);
+    
+    /******************** 绘制标题背景 ********************/
+    QBrush brush;
+    brush.setStyle(Qt::SolidPattern);
+    brush.setColor("#000000");
+    painter.setBrush(brush);
+    painter.drawRect(ui->widget_title->geometry());
+
+    /******************** 绘制刻度值 ********************/
+    drawScaleValue(painter);
+    
+
+    /******************** 绘制刻度网格 *********************/
+    drawScale(painter);
+
+    
+    /* 绘制眼图,就是绘制 1000 * 256 个矩形 */
+    // painter.setPen(QPen(Qt::NoPen));
+    // for(int i = 0; i < 1000; i++)
+    // {
+    //     for(int j = 0; j < 256; j++)
+    //     {
+    //         if(g_eyeMapMatrix.dataMatrix[i][j].isDraw == false)
+    //         {
+    //             continue;
+    //         }
+    //         // painter.setBrush(QBrush(g_eyeMapMatrix.dataMatrix[i][j].color));
+    //         painter.setBrush(g_eyeMapMatrix.dataMatrix[i][j].brush);
+    //         painter.drawRect(g_eyeMapMatrix.dataMatrix[i][j].rect);
+    //     }
+    // }
+    g_eyeMapMatrix.mutexEyeData.unlock();
+
+    event->accept();
+}
+
+/* 缩放事件 */
+void OneEyeMap::resizeEvent(QResizeEvent *event)
+{
+    /* 设置刻度区域 */
+    m_rectScaleValue = QRect(0, ui->widget_title->height(), this->width(), this->height() - ui->widget_title->height());
+    /* 设置眼图区域 */
+    m_rectEyeMap.setLeft(m_leftMargin);
+    m_rectEyeMap.setTop(ui->widget_title->height() + m_topMargin);
+    m_rectEyeMap.setRight(m_rectScaleValue.width() - m_rightMargin);
+    m_rectEyeMap.setBottom(m_rectScaleValue.height() - m_bottomMargin);
+    event->accept();
+}
+
+/* 绘制刻度区域 */
+void OneEyeMap::drawScaleValue(QPainter &painter)
+{
+    /* 绘制背景颜色 */
+    QBrush brush;
+    brush.setColor("#1E1E1E");
+    brush.setStyle(Qt::SolidPattern);
+    painter.setBrush(brush);
+    painter.drawRect(m_rectScaleValue);
+}
+
+/* 绘制刻度 */
+void OneEyeMap::drawScale(QPainter &painter)
+{
+    /* 限制操作区域,不过坐标零点依旧是widget的(0,0) */
+    painter.setClipRect(m_rectEyeMap);
+    /* 绘制背景颜色 */
+    QBrush brush;
+    brush.setColor(QColor(0, 0, 0, 0.8 * 255));
+    brush.setStyle(Qt::SolidPattern);
+    painter.setBrush(brush);
+    painter.drawRect(m_rectEyeMap);
+    /* 绘制刻度值 */
+    QPen pen;
+    pen.setWidth(1);
+    pen.setStyle(Qt::SolidLine);
+    /* 绘制中线 */
+    int startX = m_rectEyeMap.x();
+    int startY = m_rectEyeMap.y();
+    int width = m_rectEyeMap.width();
+    int height = m_rectEyeMap.height();
+    pen.setColor(QColor(255, 255, 255, 0.35 * 255));
+    pen.setWidth(2);
+    painter.setPen(pen);
+    painter.drawLine(startX, startY + (height / 2), startX + width, startY + (height / 2));     /* 绘制水平中线 */
+    painter.drawLine(startX + (width / 2), startY, startX + (width / 2), startY + height);      /* 绘制垂直中线 */
+    /* 绘制中线上的刻度 */
+    double scaleW = width / 10.0;
+    double scaleH = height / 5.0;
+    QVector<QLineF> wLines;
+    QVector<QLineF> hLines;
+    for(int i = 0; i < 10; i++)
+    {
+        QLineF line1(startX + i * scaleW, startY + height / 2.0 - 4, startX + i * scaleW, startY + height / 2.0 + 4);
+        wLines.append(line1);
+    }
+    for(int i = 0; i < 5; i++)
+    {
+        QLineF line2(startX + width / 2.0 - 4, startY + height - i * scaleH, startX + width / 2.0 + 4, startY + height - i * scaleH);
+        hLines.append(line2);
+    }
+    painter.drawLines(wLines);
+    painter.drawLines(hLines);
+
+    /* 绘制网格,网格点之间的间距是固定的 */
+    pen.setWidth(1);
+    painter.setPen(pen);
+    scaleW = width / 10.0;
+    scaleH = height / 10.0;
+    int x = 0;
+    int y = 0;
+    QVector<QLineF> wGridLines;
+    QVector<QLineF> hGridLines;
+    for(int i = 1; i < 10; i++)
+    {
+        y = i * scaleH;
+        while(true)
+        {
+            x = x + 8;
+            QLineF line1(x, y, x + 2, y);
+            wGridLines.append(line1);
+            if(x >= width)
+            {
+                x = 0;
+                y = 0;
+                break;
+            }
+        }
+    }
+    x = 0;
+    y = 0;
+    for(int i = 1; i < 10; i++)
+    {
+        x = i * scaleW;
+        while(true)
+        {
+            y = y + 8;
+            QLineF line1(x, y, x, y + 2);
+            hGridLines.append(line1);
+            if(y >= height)
+            {
+                x = 0;
+                y = 0;
+                break;
+            }
+        }
+    }
+    painter.drawLines(wGridLines);
+    painter.drawLines(hGridLines);
+}
+
+/* 绘制眼图区域 */
+void OneEyeMap::drawEyeMap(QPainter &painter)
+{
+
+}
+

+ 56 - 0
EyeMap/OneEyeMap/OneEyeMap.h

@@ -0,0 +1,56 @@
+#ifndef ONEEYEMAP_H
+#define ONEEYEMAP_H
+
+#include <QWidget>
+#include <memory>
+#include <QTimer>
+
+#include "spdlog/spdlog.h"
+
+#include "OscData.h"
+
+namespace Ui {
+class OneEyeMap;
+}
+
+class OneEyeMap : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit OneEyeMap(QWidget *parent = nullptr);
+    ~OneEyeMap();
+
+signals:
+    void signal_update();
+
+private slots:
+    void do_update();
+
+protected:
+    void paintEvent(QPaintEvent *event) override;
+    /* 缩放事件 */
+    void resizeEvent(QResizeEvent *event) override;
+
+private:
+    /* 绘制刻度值区域 */
+    void drawScaleValue(QPainter &painter);
+    /* 绘制刻度 */
+    void drawScale(QPainter &painter);
+    /* 绘制眼图区域 */
+    void drawEyeMap(QPainter &painter);
+
+private:
+    Ui::OneEyeMap *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+    QTimer m_timer;
+
+    QRect m_rectScaleValue;             /* 刻度值区域 */
+    QRect m_rectEyeMap;                 /* 眼图区域 */
+    int m_leftMargin = 0;               /* 眼图距离刻度区域的左边距 */
+    int m_topMargin = 0;                /* 眼图距离刻度区域的上边距 */
+    int m_rightMargin = 0;              /* 眼图距离刻度区域的右边距 */
+    int m_bottomMargin = 0;             /* 眼图距离刻度区域的下边距 */
+};
+
+#endif // ONEEYEMAP_H

+ 38 - 0
EyeMap/OneEyeMap/OneEyeMap.qss

@@ -0,0 +1,38 @@
+QWidget
+{
+    font-family: SourceHanSansCN, SourceHanSansCN;
+    font-weight: 500;
+    font-size: 14px;
+    color: #C8CCD2;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+    background: transparent;
+}
+
+/************ 设置背景 ************/
+QWidget#widget_title
+{
+    background: rgba(108,105,124,0.2);
+    border-radius: 4px 4px 0px 0px;
+}
+
+/* QWidget#widget_content
+{
+    background: #1E1E1E;
+    border-radius: 4px;
+} */
+
+/* QWidget#widget_display
+{
+    background: #151515;
+    border: 1px solid rgba(0,0,0,0.8);
+} */
+
+QLabel#label_title
+{
+    font-size: 20px;
+    color: #CECECE;
+    line-height: 30px;
+    text-align: left;
+}

+ 95 - 0
EyeMap/OneEyeMap/oneeyemap.ui

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OneEyeMap</class>
+ <widget class="QWidget" name="OneEyeMap">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>937</width>
+    <height>519</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widget_title" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>40</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>40</height>
+      </size>
+     </property>
+     <widget class="QLabel" name="label">
+      <property name="geometry">
+       <rect>
+        <x>16</x>
+        <y>10</y>
+        <width>152</width>
+        <height>20</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>通道名称</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+   <item>
+    <widget class="QWidget" name="widget_container" native="true">
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <property name="spacing">
+       <number>0</number>
+      </property>
+      <property name="leftMargin">
+       <number>70</number>
+      </property>
+      <property name="topMargin">
+       <number>24</number>
+      </property>
+      <property name="rightMargin">
+       <number>24</number>
+      </property>
+      <property name="bottomMargin">
+       <number>24</number>
+      </property>
+      <item>
+       <widget class="QWidget" name="widget_display" native="true"/>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 1 - 1
EyeMap/OscData.cpp

@@ -1,4 +1,4 @@
-#include "OscData.h"
+#include "OscData.h"
 #include <QApplication>
 #include <QRandomGenerator>
 

+ 1 - 1
EyeMap/OscData.h

@@ -1,4 +1,4 @@
-#ifndef _OscilloscopeData_H_
+#ifndef _OscilloscopeData_H_
 #define _OscilloscopeData_H_
 
 #include <QObject>

+ 0 - 160
EyeMap/eyemap.cpp

@@ -1,160 +0,0 @@
-#include "eyemap.h"
-#include "ui_eyemap.h"
-
-#include <QApplication>
-#include <QPainter>
-#include <QPaintEvent>
-
-EyeMap::EyeMap(QWidget *parent) :
-    QWidget(parent),
-    ui(new Ui::EyeMap)
-{
-    ui->setupUi(this);
-    m_logger = spdlog::get("OSC");
-    if(m_logger == nullptr)
-    {
-        SPDLOG_ERROR("获取 OSC logger 失败");
-        return;
-    }
-    /* 自定义大小 */
-    setFixedSize(1600, 900);
-    /* 初始化全局数据 */
-    g_eyeMapMatrix.initEyeMapData(this->width(), this->height());
-    /* 设置定时器 */
-    m_timer.setTimerType(Qt::PreciseTimer);
-    m_timer.setSingleShot(false);
-    m_timer.start(16);      /* 16ms刷新一次,大约120帧 */
-
-    connect(this, &EyeMap::signal_update, this, &EyeMap::do_update);
-    connect(&m_timer, &QTimer::timeout, this, &EyeMap::do_update);
-
-    SPDLOG_LOGGER_INFO(m_logger, "EyeMap 初始化成功");
-
-}
-
-EyeMap::~EyeMap()
-{
-    
-    delete ui;
-}
-
-/* 刷新页面 */
-void EyeMap::do_update()
-{
-    update();
-}
-
-/**
- * @brief 绘制图形
- * 
- * @param event 
- */
-void EyeMap::paintEvent(QPaintEvent *event)
-{
-    g_eyeMapMatrix.mutexEyeData.lock();
-
-    QPainter painter(this);
-    
-    QPen pen;
-    pen.setColor(Qt::black);
-    pen.setWidth(1);
-    pen.setStyle(Qt::SolidLine);
-    QBrush brush;
-    brush.setColor(Qt::white);
-    brush.setStyle(Qt::SolidPattern);
-    
-    painter.setRenderHint(QPainter::Antialiasing, true);
-    /* 绘制背景 */
-    painter.setPen(pen);
-    painter.setBrush(brush);
-    painter.drawRect(0, 0, this->width(), this->height());
-    /* 绘制中线 */
-    int width = this->width();
-    int height = this->height();
-    pen.setColor(QColor(220, 220, 220));
-    pen.setWidth(2);
-    painter.setPen(pen);
-    painter.drawLine(0, height / 2, width, height / 2);     /* 绘制水平中线 */
-    painter.drawLine(width / 2, 0, width / 2, height);      /* 绘制垂直中线 */
-    /* 绘制中线上的刻度 */
-    double scaleW = width / 50.0;
-    double scaleH = height / 50.0;
-    QVector<QLineF> wLines;
-    QVector<QLineF> hLines;
-    for(int i = 0; i < 50; i++)
-    {
-        QLineF line1(i * scaleW, height / 2.0 - 4, i * scaleW, height / 2.0 + 4);
-        wLines.append(line1);
-        QLineF line2(width / 2.0 - 4, i * scaleH, width / 2.0 + 4, i * scaleH);
-        hLines.append(line2);
-    }
-    painter.drawLines(wLines);
-    painter.drawLines(hLines);
-
-    /* 绘制网格,网格点之间的间距是固定的 */
-    pen.setWidth(1);
-    painter.setPen(pen);
-    scaleW = width / 10.0;
-    scaleH = height / 10.0;
-    int x = 0;
-    int y = 0;
-    QVector<QLineF> wGridLines;
-    QVector<QLineF> hGridLines;
-    for(int i = 1; i < 10; i++)
-    {
-        y = i * scaleH;
-        while(true)
-        {
-            x = x + 8;
-            QLineF line1(x, y, x + 2, y);
-            wGridLines.append(line1);
-            if(x >= width)
-            {
-                x = 0;
-                y = 0;
-                break;
-            }
-        }
-    }
-    x = 0;
-    y = 0;
-    for(int i = 1; i < 10; i++)
-    {
-        x = i * scaleW;
-        while(true)
-        {
-            y = y + 8;
-            QLineF line1(x, y, x, y + 2);
-            hGridLines.append(line1);
-            if(y >= height)
-            {
-                x = 0;
-                y = 0;
-                break;
-            }
-        }
-    }
-    painter.drawLines(wGridLines);
-    painter.drawLines(hGridLines);
-
-    
-    /* 绘制眼图,就是绘制 1000 * 256 个矩形 */
-    painter.setPen(QPen(Qt::NoPen));
-    for(int i = 0; i < 1000; i++)
-    {
-        for(int j = 0; j < 256; j++)
-        {
-            if(g_eyeMapMatrix.dataMatrix[i][j].isDraw == false)
-            {
-                continue;
-            }
-            // painter.setBrush(QBrush(g_eyeMapMatrix.dataMatrix[i][j].color));
-            painter.setBrush(g_eyeMapMatrix.dataMatrix[i][j].brush);
-            painter.drawRect(g_eyeMapMatrix.dataMatrix[i][j].rect);
-        }
-    }
-    g_eyeMapMatrix.mutexEyeData.unlock();
-
-    event->accept();
-}
-

+ 0 - 39
EyeMap/eyemap.h

@@ -1,39 +0,0 @@
-#ifndef EYEMAP_H
-#define EYEMAP_H
-
-#include <QWidget>
-#include <memory>
-#include <QTimer>
-
-#include "spdlog/spdlog.h"
-
-#include "OscData.h"
-
-namespace Ui {
-class EyeMap;
-}
-
-class EyeMap : public QWidget
-{
-    Q_OBJECT
-
-public:
-    explicit EyeMap(QWidget *parent = nullptr);
-    ~EyeMap();
-
-signals:
-    void signal_update();
-
-private slots:
-    void do_update();
-
-protected:
-    void paintEvent(QPaintEvent *event) override;
-
-private:
-    Ui::EyeMap *ui;
-    std::shared_ptr<spdlog::logger> m_logger = nullptr;
-    QTimer m_timer;
-};
-
-#endif // EYEMAP_H

+ 5 - 0
EyeMap/eyemap.qrc

@@ -0,0 +1,5 @@
+<RCC>
+    <qresource prefix="/qss">
+        <file>OneEyeMap/OneEyeMap.qss</file>
+    </qresource>
+</RCC>

+ 0 - 19
EyeMap/eyemap.ui

@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>EyeMap</class>
- <widget class="QWidget" name="EyeMap">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>1024</width>
-    <height>776</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
- </widget>
- <resources/>
- <connections/>
-</ui>

+ 1 - 1
EyeMap/main.cpp

@@ -16,7 +16,7 @@ int main(int argc, char* argv[])
         SPDLOG_ERROR("main logger is nullptr");
         return -1;
     }
-    SPDLOG_LOGGER_INFO(logger, "★  ★  ★   Oscilloscope   ★  ★  ★");
+    SPDLOG_LOGGER_INFO(logger, "★  ★  ★  ★  ★   Oscilloscope   ★  ★  ★  ★  ★");
 
     OscWidget w;
     w.show();

+ 84 - 0
EyeMap/oneeyemap.ui

@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OneEyeMap</class>
+ <widget class="QWidget" name="OneEyeMap">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1129</width>
+    <height>620</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widget_title" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>40</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>40</height>
+      </size>
+     </property>
+     <widget class="QLabel" name="label_title">
+      <property name="geometry">
+       <rect>
+        <x>16</x>
+        <y>10</y>
+        <width>152</width>
+        <height>20</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>通道名称</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 1 - 1
GlobalInfo/GlobalInfo.cpp

@@ -35,7 +35,7 @@ void EyeDataMatrix::addData(int x, int y)
 }
 
 /**
- * @brief 比重统计,点数大于79999的个数比点数大于0的个数的比重超过0.25,就开始减慢颜色变化的速度
+ * @brief 比重统计,点数大于79999的个数  点数大于0的个数的比重超过0.25,就开始减慢颜色变化的速度
  * 
  */
 void EyeDataMatrix::eyeStatisticalWeight()

+ 1 - 1
GlobalInfo/GlobalInfo.h

@@ -1,4 +1,4 @@
-#ifndef GLOBALINFO_H
+#ifndef GLOBALINFO_H
 #define GLOBALINFO_H
 
 #include <mutex>

+ 1 - 1
USBInterFace/USBInterFace.h

@@ -1,4 +1,4 @@
-#ifndef _USBINTERFACE_H_
+#ifndef _USBINTERFACE_H_
 #define _USBINTERFACE_H_
 
 #include <QString>

+ 3 - 2
oscwidget.cpp

@@ -1,4 +1,4 @@
-#include "oscwidget.h"
+#include "oscwidget.h"
 #include "ui_oscwidget.h"
 
 #include "OscData.h"
@@ -20,7 +20,7 @@ OscWidget::OscWidget(QWidget *parent) :
     // setFixedSize(1920, 1080);
 
     /* 设置眼图窗口 */
-    m_eyeMap = new EyeMap(ui->widget_display);
+    m_eyeMap = new OneEyeMap(ui->widget_display);
     /* 添加下拉框的选项 */
     ui->comboBox_time->addItem("0.05us");
     ui->comboBox_time->addItem("0.1us");
@@ -118,5 +118,6 @@ void OscWidget::on_pBtn_stopCap_clicked()
 void OscWidget::paintEvent(QPaintEvent *event)
 {
     QPainter painter(this);
+    
 }
 

+ 3 - 3
oscwidget.h

@@ -1,9 +1,9 @@
-#ifndef OSCWIDGET_H
+#ifndef OSCWIDGET_H
 #define OSCWIDGET_H
 
 #include <QWidget>
 #include "spdlog/spdlog.h"
-#include "eyemap.h"
+#include "OneEyeMap.h"
 
 namespace Ui {
 class OscWidget;
@@ -29,7 +29,7 @@ protected:
 private:
     Ui::OscWidget *ui;
     std::shared_ptr<spdlog::logger> m_logger = nullptr;
-    EyeMap* m_eyeMap = nullptr;
+    OneEyeMap* m_eyeMap = nullptr;
     QMap<QString, int> m_mapTime;
 
     int m_widthScaleplate = 20;             /* 刻度板宽度 */