Browse Source

V0.5.1
1、完成了最外层的配置
2、完成了部分设置数目的页面

Apple 2 months ago
parent
commit
1145c53d81

+ 1 - 1
Common/Logs/loginit.cpp

@@ -39,7 +39,7 @@ void init_log()
         /* 创建一个标准输出 */
         auto logger_main = std::make_shared<spdlog::logger>("main",begin(sinks),end(sinks));
         /* 创建一个OSC输出Logger */
-        auto logger_OSC = std::make_shared<spdlog::logger>("OSC",begin(sinks),end(sinks));
+        auto logger_OSC = std::make_shared<spdlog::logger>("EyeMap",begin(sinks),end(sinks));
         /* 创建一个OscData输出Logger */
         auto logger_OscData = std::make_shared<spdlog::logger>("OscData",begin(sinks),end(sinks));
 

+ 39 - 0
Common/combox/customcombobox.cpp

@@ -0,0 +1,39 @@
+#include "customcombobox.h"
+#include <QApplication>
+#include <QGraphicsDropShadowEffect>
+#include <QListView>
+#include <QDebug>
+
+CustomComboBox::CustomComboBox(QWidget *parent)
+    : QComboBox(parent)
+{
+    setView(new QListView());
+    if (nullptr != view() && nullptr != view()->window()) {
+        view()->window()->setWindowFlags(Qt::Popup | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint);
+        view()->window()->setAttribute(Qt::WA_TranslucentBackground);
+
+        QGraphicsDropShadowEffect *pShadowEffect = new QGraphicsDropShadowEffect(this);
+        pShadowEffect->setBlurRadius(LISTVIEW_MARGIN);  // 模糊度
+        pShadowEffect->setColor(QColor(0, 0, 0, 90));   // 阴影的颜色
+        pShadowEffect->setOffset(0, 0);                 // 水平和垂直偏移量
+        view()->setGraphicsEffect(pShadowEffect);
+
+        QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false);
+    }
+}
+CustomComboBox::~CustomComboBox()
+{
+}
+
+void CustomComboBox::showPopup()
+{
+    QComboBox::showPopup();
+
+    if (nullptr != view()) {
+        view()->setMinimumWidth(width() + LISTVIEW_MARGIN * 2);
+    }
+    QWidget *popup = findChild<QFrame*>();
+    if (nullptr != popup) {
+        popup->move(mapToGlobal(QPoint(-LISTVIEW_MARGIN, height() - LISTVIEW_MARGIN + 4)));
+    }
+}

+ 21 - 0
Common/combox/customcombobox.h

@@ -0,0 +1,21 @@
+#ifndef CUSTOMCOMBOBOX_H
+#define CUSTOMCOMBOBOX_H
+
+#include <QComboBox>
+
+/**
+ * @brief 使用此类绘制下拉框阴影需要在样式表中设置QAbstractItemView {margin: LISTVIEW_MARGIN;}
+ */
+class CustomComboBox : public QComboBox
+{
+public:
+    explicit CustomComboBox(QWidget *parent = nullptr);
+    ~CustomComboBox();
+
+    //重写下拉框弹出位置
+    void showPopup() override;
+private:
+    const int LISTVIEW_MARGIN = 12; // QAbstractItemView边距(阴影宽度)
+};
+
+#endif // CUSTOMCOMBOBOX_H

+ 162 - 0
Common/combox/searchcombobox.cpp

@@ -0,0 +1,162 @@
+#include "searchcombobox.h"
+#include "wordtopinyin.h"
+
+#include <QStyleFactory>
+#include <QListView>
+#include <QApplication>
+#include <QGraphicsDropShadowEffect>
+#include <QTimer>
+
+SearchComboBox::SearchComboBox(QWidget *parent)
+    : QComboBox(parent)
+    , m_nMargin(8)
+    , m_autoquery(false)
+    , m_showPopup(false)
+{
+    setStyle(QStyleFactory::create("Windows"));
+
+    setView(new QListView());
+    view()->window()->setWindowFlags(Qt::Popup | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint);
+    view()->window()->setAttribute(Qt::WA_TranslucentBackground);
+
+    //取消拉下动画
+    QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false);
+
+    //设置阴影
+    QGraphicsDropShadowEffect *pShadowEffect = new QGraphicsDropShadowEffect(this);
+    pShadowEffect->setBlurRadius(10); // 模糊度
+    pShadowEffect->setColor(QColor(0, 0, 0, 60)); // 阴影的颜色
+    pShadowEffect->setOffset(0, 0); // 水平和垂直偏移量
+    view()->setGraphicsEffect(pShadowEffect);
+
+    QTimer::singleShot(0, this, [=]
+    {
+        view()->setMinimumWidth(width()+m_nMargin*2);
+    });
+
+    setEditable(true);
+    setCompleter(nullptr);
+
+    //输入后,开始查询
+    connect(this, (void (QComboBox::*)(const QString &))&QComboBox::currentIndexChanged, this, &SearchComboBox::OnCurrentIndexChanged);
+}
+
+SearchComboBox::~SearchComboBox()
+{
+//    qDebug()<<__func__;
+}
+
+void SearchComboBox::showPopup()
+{
+    QComboBox::showPopup();
+    QWidget *popup = findChild<QFrame*>();
+    popup->move(mapToGlobal(QPoint(-m_nMargin, height()-m_nMargin)));
+    m_showPopup = true;
+}
+
+void SearchComboBox::hidePopup()
+{
+    QComboBox::hidePopup();
+    m_showPopup = false;
+}
+
+void SearchComboBox::wheelEvent(QWheelEvent *e)
+{
+    Q_UNUSED(e);
+    //屏蔽鼠标滚动
+}
+bool SearchComboBox::event(QEvent *event)
+{
+    //添加一个鼠标滚轮拦截来禁用combox滚轮改变CurrentIndex
+    if(event->type()==QEvent::Wheel)
+    {
+        return true;
+    }
+    else if(event->type() == QEvent::KeyPress)
+    {
+        QKeyEvent* ev = (QKeyEvent*)event;
+        if(ev->key() == Qt::Key_Enter || ev->key() == Qt::Key_Return){//回车开始查找匹配的数据
+            if(isEditable()){
+                autoquery();
+                m_autoquery = false;
+            }
+        }
+    }
+    else if(event->type() == QEvent::MouseButtonPress)
+    {
+        //点击下拉框,恢复到源数据集
+
+    }
+    else if(event->type() == QEvent::FocusOut)
+    {
+        //离开焦点时,编辑框自动填充当前选择项的文本
+        if(!m_showPopup)
+        {
+            if(!m_currentText.isEmpty())
+            {
+                setCurrentText(m_currentText);
+            }
+            else
+            {
+                int index = currentIndex();
+                if(index >= 0 && index < m_items.count())
+                {
+                    setCurrentText(m_items[index].text);
+
+                }
+            }
+            update();
+        }
+    }
+    return QComboBox::event(event);
+}
+
+void SearchComboBox::OnCurrentIndexChanged(const QString &text)
+{
+    m_currentText = text;
+}
+
+void SearchComboBox::addItem(const QString &text, const QVariant &userData)
+{
+    ItemData item;
+    item.text = text;
+    item.userdata = userData;
+    item.alphbat = WordToPinyin::firstPinyin(item.text);
+    m_items.append(item);
+    QComboBox::addItem(item.text, item.userdata);
+}
+
+void SearchComboBox::clear()
+{
+    m_items.clear();
+    QComboBox::clear();
+}
+
+void SearchComboBox::autoquery()
+{
+    QString text = currentText().toLower();
+    QComboBox::clear();
+    if(text.isEmpty())
+    {
+        //显示源数据集
+        foreach(ItemData item,m_items)
+        {
+            QComboBox::addItem(item.text, item.userdata);
+        }
+    }
+    else
+    {
+        //显示匹配的数据集
+        foreach(ItemData item, m_items)
+        {
+            if(item.alphbat.toLower().contains(text) || item.text.toLower().contains(text))
+            {
+                QComboBox::addItem(item.text, item.userdata);
+            }
+        }
+
+        //没匹配到任何数据
+        //....
+    }
+    showPopup();
+}

+ 45 - 0
Common/combox/searchcombobox.h

@@ -0,0 +1,45 @@
+#ifndef SEARCHCOMBOBOX_H
+#define SEARCHCOMBOBOX_H
+
+#include <QComboBox>
+#include <QMouseEvent>
+class SearchComboBox : public QComboBox
+{
+    Q_OBJECT
+public:
+    typedef struct ItemData
+    {
+        QString text;
+        QVariant userdata;
+        QString alphbat;
+    }ItemData;
+
+public:
+    explicit SearchComboBox(QWidget *parent = nullptr);
+    ~SearchComboBox();
+    //重写下拉框弹出位置
+    void showPopup() override;
+    void hidePopup() override;
+
+    void clear();
+    void addItem(const QString &text, const QVariant &userData = QVariant());
+
+    void autoquery();
+
+protected:
+    bool event(QEvent *event) override;
+    void wheelEvent(QWheelEvent *e) override;
+
+private slots:
+    void OnCurrentIndexChanged(const QString &text);
+
+private:
+    int m_nMargin;
+
+    QList<ItemData> m_items;
+    bool m_autoquery;
+    bool m_showPopup;
+    QString m_currentText;
+};
+
+#endif // SEARCHCOMBOBOX_H

+ 67 - 0
Common/combox/wordtopinyin.h

@@ -0,0 +1,67 @@
+#ifndef WORDTOPINYIN_H
+#define WORDTOPINYIN_H
+#include <QTextCodec>
+
+class WordToPinyin
+{
+public:
+    static bool In( quint16 start, quint16 end, quint16 code)
+    {
+        return (code>=start && code<=end) ? true : false;
+    }
+
+    static char convert(quint16 n)
+    {
+        if (In(0xB0A1,0xB0C4,n)) return 'a';
+        if (In(0XB0C5,0XB2C0,n)) return 'b';
+        if (In(0xB2C1,0xB4ED,n)) return 'c';
+        if (In(0xB4EE,0xB6E9,n)) return 'd';
+        if (In(0xB6EA,0xB7A0,n)) return 'e';
+        if (In(0xB7A1,0xB8c0,n)) return 'f';
+        if (In(0xB8C1,0xB9FD,n)) return 'g';
+        if (In(0xB9FE,0xBBF6,n)) return 'h';
+        if (In(0xBBF7,0xBFA4,n)) return 'j';
+        if (In(0xBFA5,0xC0AA,n)) return 'k';
+        if (In(0xC0AB,0xC2E7,n)) return 'l';
+        if (In(0xC2E8,0xC4C2,n)) return 'm';
+        if (In(0xC4C3,0xC5B5,n)) return 'n';
+        if (In(0xC5B6,0xC5BD,n)) return 'o';
+        if (In(0xC5BE,0xC6D9,n)) return 'p';
+        if (In(0xC6DA,0xC8BA,n)) return 'q';
+        if (In(0xC8BB,0xC8F5,n)) return 'r';
+        if (In(0xC8F6,0xCBF9,n)) return 's';
+        if (In(0xCBFA,0xCDD9,n)) return 't';
+        if (In(0xCDDA,0xCEF3,n)) return 'w';
+        if (In(0xCEF4,0xD1B8,n)) return 'x';
+        if (In(0xD1B9,0xD4D0,n)) return 'y';
+        if (In(0xD4D1,0xD7F9,n)) return 'z';
+        return '\0';
+    }
+
+    //获取首字母
+    static QString firstPinyin(const QString &string)
+    {
+        QTextCodec *codec4gbk = QTextCodec::codecForName("GBK");    //获取qt提供的gbk的解码器
+        QByteArray buf = codec4gbk->fromUnicode( string );        //qt用的unicode,专程gbk
+        int size = buf.size();
+        quint16 *array = new quint16[size+1]{0};
+        QString alphbats;
+        for( int i = 0, j = 0; i < size; i++, j++ )
+        {
+            if( (quint8)buf[i] < 0x80 )                        //gbk的第一个字节都大于0x81,所以小于0x80的都是符号,字母,数字etc
+            {
+                alphbats.append(QString("%1").arg(buf[i]));
+                continue;
+            }
+            array[j] = (((quint8)buf[i]) << 8) + (quint8)buf[i+1];    //计算gbk编码
+            i++;
+            alphbats.append( convert( array[j] ) );            //相当于查表,用gbk编码得到首拼音字母
+        }
+        delete [] array;
+        return alphbats;
+    }
+
+};
+
+
+#endif 

+ 1 - 1
External

@@ -1 +1 @@
-Subproject commit d5e38431f86219237f089afdea2ac03f568d1a52
+Subproject commit 1460633049acd624c9724d39e3bc1fee8c92d3c6

+ 11 - 1
EyeMap/CMakeLists.txt

@@ -10,13 +10,20 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/*.qrc
     ${CMAKE_CURRENT_SOURCE_DIR}/OneEyeMap/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/OneEyeMap/*.ui
+    ${CMAKE_CURRENT_SOURCE_DIR}/EyeMapWidget/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/SettingNum/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/SettingNum/*.ui
+    ${CMAKE_CURRENT_SOURCE_DIR}/SettingNum/OneItem/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/SettingNum/OneItem/*.ui
 
     ${CMAKE_SOURCE_DIR}/*.cpp
     ${CMAKE_SOURCE_DIR}/*.ui
 
     # ${CMAKE_SOURCE_DIR}/External/common/Thread/*.cpp
     ${CMAKE_SOURCE_DIR}/External/common/ThreadPool/*.cpp
+    ${CMAKE_SOURCE_DIR}/External/UI/Resource/*.qrc
     ${CMAKE_SOURCE_DIR}/Common/Logs/*.cpp
+    ${CMAKE_SOURCE_DIR}/Common/combox/*.cpp
 
     ${CMAKE_SOURCE_DIR}/USBInterFace/*.cpp
     ${CMAKE_SOURCE_DIR}/GlobalInfo/*.cpp
@@ -32,10 +39,14 @@ add_executable(${execName1} ${LOCAL_SRC})
 target_include_directories(${execName1} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}/OneEyeMap
+    ${CMAKE_CURRENT_SOURCE_DIR}/EyeMapWidget
+    ${CMAKE_CURRENT_SOURCE_DIR}/SettingNum
+    ${CMAKE_CURRENT_SOURCE_DIR}/SettingNum/OneItem
 
     ${CMAKE_SOURCE_DIR}
     ${CMAKE_SOURCE_DIR}/External/common
     ${CMAKE_SOURCE_DIR}/Common/Logs
+    ${CMAKE_SOURCE_DIR}/Common/combox
 
     ${CMAKE_SOURCE_DIR}/USBInterFace
     ${CMAKE_SOURCE_DIR}/GlobalInfo
@@ -48,7 +59,6 @@ target_link_libraries(${execName1} PRIVATE
     Qt5::Widgets
     Qt5::Core
     Qt5::Network
-    Qt5::Sql
 )
 #链接外部库
 target_link_libraries(${execName1} PRIVATE

+ 58 - 0
EyeMap/EyeMapWidget/EyeMapWidget.qss

@@ -0,0 +1,58 @@
+QWidget
+{
+    font-family: 思源黑体M;
+    background-color: #000000;
+}
+
+
+QLabel
+{
+    font-family: 思源黑体M;
+    color: #FFFFFF;
+    text-align: left;
+    font-style: normal;
+}
+
+QLabel#label_stationName
+{
+    font-family: 思源黑体M;
+    font-weight: 500;
+    font-size: 24px;
+    color: #D4F7FF;
+    line-height: 24px;
+}
+
+QLabel#label_date, QLabel#label_time
+{
+    font-weight: bold;
+    font-size: 20px;
+    color: rgba(255, 255, 255, 0.5);
+    line-height: 30px;
+}
+/* 
+QLabel#label_settingNum, #label_settingScale, #label_exit
+{
+    font-weight: 400;
+    font-size: 18px;
+    color: #F3F7FF;
+    line-height: 27px;
+} */
+
+QPushButton#pBtn_settingNum, #pBtn_settingScale, #pBtn_exit
+{
+    font-weight: 400;
+    font-size: 18px;
+    color: #F3F7FF;
+    line-height: 27px;
+    border: none;
+    border-radius: 4px;
+    background: transparent;
+}
+
+QPushButton#pBtn_settingNum:hover, #pBtn_settingScale:hover, #pBtn_exit:hover
+{
+    /* color: #1890ff; */
+    background-color: rgba(255, 255, 255, 0.4);
+}
+
+

+ 87 - 0
EyeMap/EyeMapWidget/eyemapwidget.cpp

@@ -0,0 +1,87 @@
+#include "eyemapwidget.h"
+#include "ui_eyemapwidget.h"
+
+#include <QDebug>
+#include <QFile>
+#include <QDateTime>
+
+#include "settingnum.h"
+
+EyeMapWidget::EyeMapWidget(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::EyeMapWidget)
+{
+    ui->setupUi(this);
+
+    m_logger = spdlog::get("EyeMap");
+    if(m_logger == nullptr)
+    {
+        qDebug() << "获取 EyeMap logger 失败";
+        return;
+    }
+
+    /* 设置无边框和自动全屏 */
+    this->setWindowFlags(Qt::FramelessWindowHint);
+    this->setWindowState(Qt::WindowFullScreen);
+
+
+    /* 加载QSS文件 */
+    QFile fileQss(":/qss/EyeMapWidget/EyeMapWidget.qss");
+    if(fileQss.open(QFile::ReadOnly))
+    {
+        QString qss = fileQss.readAll();
+        this->setStyleSheet(qss);
+        fileQss.close();
+    } else
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "加载QSS文件失败");
+    }
+
+    /* 获取日期和时间,启动时间定时器 */
+    QDate date = QDate::currentDate();
+    QString strDate = date.toString("yyyy-MM-dd");
+    QString strWeek = date.toString("dddd");
+    ui->label_date->setText(strDate + " " + strWeek);
+
+    QDateTime time = QDateTime::currentDateTime();
+    QString strTime = time.toString("hh:mm:ss");
+    ui->label_time->setText(strTime);
+
+    m_timerTime.setTimerType(Qt::PreciseTimer);
+    m_timerTime.setSingleShot(false);
+
+    /* 连接信号和槽 */
+    connect(ui->pBtn_exit, &QPushButton::clicked, this, &EyeMapWidget::do_exit);
+    connect(&m_timerTime, &QTimer::timeout, this, &EyeMapWidget::do_timeWalk);
+    connect(ui->pBtn_settingNum, &QPushButton::clicked, this, &EyeMapWidget::do_pBtnSettingNum);
+
+    m_timerTime.start(1000);
+}
+
+EyeMapWidget::~EyeMapWidget()
+{
+    delete ui;
+}
+
+void EyeMapWidget::do_exit()
+{
+    this->close();
+}
+
+/* 时间跳动槽函数 */
+void EyeMapWidget::do_timeWalk()
+{
+    /* 获取时间 */
+    QTime time = QTime::currentTime();
+    QString strTime = time.toString("hh:mm:ss");
+    ui->label_time->setText(strTime);
+}
+
+/* 设置眼图个数槽函数 */
+void EyeMapWidget::do_pBtnSettingNum()
+{
+    std::shared_ptr<SettingNum> settingNum = std::make_shared<SettingNum>();
+    settingNum->setParent(this);
+    settingNum->exec();
+}
+

+ 34 - 0
EyeMap/EyeMapWidget/eyemapwidget.h

@@ -0,0 +1,34 @@
+#ifndef EYEMAPWIDGET_H
+#define EYEMAPWIDGET_H
+
+#include <QWidget>
+#include <QTimer>
+
+#include "spdlog/spdlog.h"
+
+namespace Ui {
+class EyeMapWidget;
+}
+
+class EyeMapWidget : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit EyeMapWidget(QWidget *parent = nullptr);
+    ~EyeMapWidget();
+
+private slots:
+    void do_exit();
+    /* 时间跳动槽函数 */
+    void do_timeWalk();
+    /* 设置眼图个数槽函数 */
+    void do_pBtnSettingNum();
+
+private:
+    Ui::EyeMapWidget *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+    QTimer m_timerTime;                         /* 时间定时器 */
+};
+
+#endif // EYEMAPWIDGET_H

+ 205 - 0
EyeMap/EyeMapWidget/eyemapwidget.ui

@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>EyeMapWidget</class>
+ <widget class="QWidget" name="EyeMapWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1545</width>
+    <height>960</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_top" 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>60</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>60</height>
+      </size>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <property name="spacing">
+       <number>0</number>
+      </property>
+      <property name="leftMargin">
+       <number>16</number>
+      </property>
+      <property name="topMargin">
+       <number>18</number>
+      </property>
+      <property name="rightMargin">
+       <number>32</number>
+      </property>
+      <property name="bottomMargin">
+       <number>18</number>
+      </property>
+      <item>
+       <widget class="QLabel" name="label_stationName">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>300</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>多通道眼图监测站</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>642</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_date">
+        <property name="minimumSize">
+         <size>
+          <width>200</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>2024/10/14  星期一</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_time">
+        <property name="minimumSize">
+         <size>
+          <width>132</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>14:00:00</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pBtn_settingNum">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>92</width>
+          <height>0</height>
+         </size>
+        </property>
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string>组屏配置</string>
+        </property>
+        <property name="autoDefault">
+         <bool>false</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pBtn_settingScale">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>92</width>
+          <height>24</height>
+         </size>
+        </property>
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string>视图配置</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QPushButton" name="pBtn_exit">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>56</width>
+          <height>24</height>
+         </size>
+        </property>
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="text">
+         <string>退出</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QWidget" name="widget_container" native="true"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 200 - 64
EyeMap/OneEyeMap/OneEyeMap.cpp

@@ -1,4 +1,4 @@
-#include "OneEyeMap.h"
+#include "OneEyeMap.h"
 #include "ui_oneeyemap.h"
 
 #include <QApplication>
@@ -10,10 +10,10 @@ OneEyeMap::OneEyeMap(QWidget *parent) :
     ui(new Ui::OneEyeMap)
 {
     ui->setupUi(this);
-    m_logger = spdlog::get("OSC");
+    m_logger = spdlog::get("EyeMap");
     if(m_logger == nullptr)
     {
-        SPDLOG_ERROR("获取 OSC logger 失败");
+        SPDLOG_ERROR("获取 EyeMap logger 失败");
         return;
     }
     /* 初始化变量,加载qss */
@@ -32,29 +32,32 @@ OneEyeMap::OneEyeMap(QWidget *parent) :
     /* 自定义大小 */
     // setFixedSize(1600, 900);
 
+    /* 设置水平刻度和垂直刻度数目 */
+    m_hScaleNum = 6;
+    m_vScaleNum = 4;
+
     /* 设置绘制区域 */
     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_rectScaleValue.setX(0);
+    m_rectScaleValue.setY(ui->widget_title->height());
+    m_rectScaleValue.setWidth(this->width());
+    m_rectScaleValue.setHeight(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);
+    m_rectEyeMap.setY(m_rectScaleValue.y() + m_topMargin);
+    m_rectEyeMap.setWidth(m_rectScaleValue.width() - m_leftMargin - m_rightMargin);
+    m_rectEyeMap.setHeight(m_rectScaleValue.height() - m_topMargin - m_bottomMargin);
 
     /* 初始化全局数据 */
     g_eyeMapMatrix.initEyeMapData(this->width(), this->height());
     /* 设置定时器 */
     m_timer.setTimerType(Qt::PreciseTimer);
     m_timer.setSingleShot(false);
-    m_timer.start(16);      /* 16ms刷新一次,大约120帧 */
+    // m_timer.start(16);      /* 16ms刷新一次,大约60帧 */
 
     connect(this, &OneEyeMap::signal_update, this, &OneEyeMap::do_update);
     connect(&m_timer, &QTimer::timeout, this, &OneEyeMap::do_update);
@@ -100,7 +103,9 @@ void OneEyeMap::paintEvent(QPaintEvent *event)
 
     /******************** 绘制刻度网格 *********************/
     drawScale(painter);
-
+    // SPDLOG_LOGGER_DEBUG(m_logger, "width = {}, height = {}", this->width(), this->height());
+    // SPDLOG_LOGGER_DEBUG(m_logger, "m_rectScaleValue: x = {}, y = {}, width = {}, height = {}", m_rectScaleValue.x(), m_rectScaleValue.y(), m_rectScaleValue.width(), m_rectScaleValue.height());
+    // SPDLOG_LOGGER_DEBUG(m_logger, "m_rectEyeMap: x = {}, y = {}, width = {}, height = {}", m_rectEyeMap.x(), m_rectEyeMap.y(), m_rectEyeMap.width(), m_rectEyeMap.height());
     
     /* 绘制眼图,就是绘制 1000 * 256 个矩形 */
     // painter.setPen(QPen(Qt::NoPen));
@@ -126,12 +131,18 @@ void OneEyeMap::paintEvent(QPaintEvent *event)
 void OneEyeMap::resizeEvent(QResizeEvent *event)
 {
     /* 设置刻度区域 */
-    m_rectScaleValue = QRect(0, ui->widget_title->height(), this->width(), this->height() - ui->widget_title->height());
+    m_rectScaleValue.setX(0);
+    m_rectScaleValue.setY(ui->widget_title->height());
+    m_rectScaleValue.setWidth(this->width());
+    m_rectScaleValue.setHeight(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);
+    m_rectEyeMap.setX(m_leftMargin);
+    m_rectEyeMap.setY(m_rectScaleValue.y() + m_topMargin);
+    m_rectEyeMap.setWidth(m_rectScaleValue.width() - m_leftMargin - m_rightMargin);
+    m_rectEyeMap.setHeight(m_rectScaleValue.height() - m_topMargin - m_bottomMargin);
+
+    /* 刷新一下页面 */
+    update();
     event->accept();
 }
 
@@ -144,6 +155,31 @@ void OneEyeMap::drawScaleValue(QPainter &painter)
     brush.setStyle(Qt::SolidPattern);
     painter.setBrush(brush);
     painter.drawRect(m_rectScaleValue);
+
+    /* 绘制刻度值 */
+    
+    QRect rectText(0, 0, 50, 14);
+    QFont font;
+    font.setFamily("思源黑体R");
+    font.setPixelSize(14);
+    painter.setFont(font);
+    int oneScale = m_rectEyeMap.height() / m_vScaleNum;
+    // SPDLOG_LOGGER_DEBUG(m_logger, "oneScale = {}", oneScale);
+    /* 绘制电压值 */
+    for(int i = 0; i <= m_vScaleNum; i++)
+    {
+        /* 计算字体区域坐标 */
+        rectText.moveTo(10, m_rectEyeMap.y() + oneScale * i - 7);
+        painter.drawText(rectText, Qt::AlignRight | Qt::AlignVCenter, getVScaleValue(i));
+    }
+    /* 绘制时间刻度值 */
+    int oneTime = m_rectEyeMap.width() / m_hScaleNum;
+    for(int i = 0; i <= m_hScaleNum; i++)
+    {
+        rectText.moveTo(m_rectEyeMap.x() + oneTime * i - 25, m_rectEyeMap.y() + m_rectEyeMap.height() + 4);
+        painter.drawText(rectText, Qt::AlignCenter, getTimeValue(i));
+    }
+
 }
 
 /* 绘制刻度 */
@@ -157,7 +193,7 @@ void OneEyeMap::drawScale(QPainter &painter)
     brush.setStyle(Qt::SolidPattern);
     painter.setBrush(brush);
     painter.drawRect(m_rectEyeMap);
-    /* 绘制刻度 */
+    /* 绘制刻度线 */
     QPen pen;
     pen.setWidth(1);
     pen.setStyle(Qt::SolidLine);
@@ -172,16 +208,18 @@ void OneEyeMap::drawScale(QPainter &painter)
     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;
+    int hScale = m_hScaleNum * 5;
+    int vScale = m_vScaleNum * 5;
+    double scaleW = width * 1.0 / hScale;
+    double scaleH = height * 1.0 / vScale;
     QVector<QLineF> wLines;
     QVector<QLineF> hLines;
-    for(int i = 0; i < 10; i++)
+    for(int i = 0; i < hScale; 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++)
+    for(int i = 0; i < vScale; i++)
     {
         QLineF line2(startX + width / 2.0 - 4, startY + height - i * scaleH, startX + width / 2.0 + 4, startY + height - i * scaleH);
         hLines.append(line2);
@@ -189,51 +227,72 @@ void OneEyeMap::drawScale(QPainter &painter)
     painter.drawLines(wLines);
     painter.drawLines(hLines);
 
-    /* 绘制网格,网格点之间的间距是固定的 */
+    /* 绘制网格,这里是网格线 */
     pen.setWidth(1);
+    pen.setColor(QColor(255, 255, 255, 0.15 * 255));
     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;
-            }
-        }
+    scaleH = height * 1.0 / m_vScaleNum;
+    scaleW = width * 1.0 / m_hScaleNum;
+
+    /* 水平线 */
+    for(int i = 1; i < m_vScaleNum; i++)
+    {
+        int y = startY + i * scaleH;
+        QLineF line1(startX, y, startX + width, y);
+        painter.drawLine(line1);
     }
-    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;
-            }
-        }
+    /* 垂直线 */
+    for(int i = 1; i < m_hScaleNum; i++)
+    {
+        int x = startX + i * scaleW;
+        QLineF line1(x, startY, x, startY + height);
+        painter.drawLine(line1);
     }
-    painter.drawLines(wGridLines);
-    painter.drawLines(hGridLines);
+
+    /* 绘制虚线 */
+    // 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);
 }
 
 /* 绘制眼图区域 */
@@ -242,3 +301,80 @@ void OneEyeMap::drawEyeMap(QPainter &painter)
 
 }
 
+/* 获取一个格子的电压值 */
+QString OneEyeMap::getVScaleValue(int index)
+{
+    index = 2 - index;
+    if(m_cRange == OscChannelRange::CR_100MV)
+    {
+        return QString::number(0.1 * index) + "V";
+    } else if(m_cRange == OscChannelRange::CR_250MV)
+    {
+        return QString::number(0.25 * index) + "V";
+    } else if(m_cRange == OscChannelRange::CR_500MV)
+    {
+        return QString::number(0.5 * index) + "V";
+    } else if(m_cRange == OscChannelRange::CR_1V)
+    {
+        return QString::number(1.0 * index) + "V";
+    } else if(m_cRange == OscChannelRange::CR_2V5)
+    {
+        return QString::number(2.5 * index) + "V";
+    } else if(m_cRange == OscChannelRange::CR_5V)
+    {
+        return QString::number(5.0 * index) + "V";
+    } else if(m_cRange == OscChannelRange::CR_8V)
+    {
+        return QString::number(8.0 * index) + "V";
+    } else
+    {
+        return QString::number(0.1 * index) + "V";
+    }
+}
+
+/* 获取一个时间值 */
+QString OneEyeMap::getTimeValue(int index)
+{
+    QString str;
+    switch (m_tGridValue)
+    {
+        case OscTimeGridValue::TGV_20NS:
+            str = QString::number(index * 20 / 1000.0) + "us";
+            break;
+        case OscTimeGridValue::TGV_50NS:
+            str = QString::number(index * 50 / 1000.0) + "us";
+            break;
+        case OscTimeGridValue::TGV_100NS:
+            str = QString::number(index * 100 / 1000.0) + "us";
+            break;
+        case OscTimeGridValue::TGV_200NS:
+            str = QString::number(index * 200 / 1000.0) + "us";
+            break;
+        case OscTimeGridValue::TGV_500NS:
+            str = QString::number(index * 500 / 1000.0) + "us";
+            break;
+        case OscTimeGridValue::TGV_1US:
+            str = QString::number(index * 1) + "us";
+            break;
+        case OscTimeGridValue::TGV_2US:
+            str = QString::number(index * 2) + "us";
+            break;
+        case OscTimeGridValue::TGV_5US:
+            str = QString::number(index * 5) + "us";
+            break;
+        case OscTimeGridValue::TGV_10US:
+            str = QString::number(index * 10) + "us";
+            break;
+        case OscTimeGridValue::TGV_20US:
+            str = QString::number(index * 20) + "us";
+            break;
+        case OscTimeGridValue::TGV_100US:
+            str = QString::number(index * 100) + "us";
+            break;
+        default:
+            str = "us";
+            break;
+    }
+    return str;
+}
+

+ 14 - 1
EyeMap/OneEyeMap/OneEyeMap.h

@@ -8,6 +8,7 @@
 #include "spdlog/spdlog.h"
 
 #include "OscData.h"
+#include "GlobalInfo.h"
 
 namespace Ui {
 class OneEyeMap;
@@ -40,6 +41,12 @@ private:
     /* 绘制眼图区域 */
     void drawEyeMap(QPainter &painter);
 
+    /* 获取一个格子的电压值 */
+    inline QString getVScaleValue(int index);
+    /* 获取一个时间值 */
+    inline QString getTimeValue(int index);
+    
+
 private:
     Ui::OneEyeMap *ui;
     std::shared_ptr<spdlog::logger> m_logger = nullptr;
@@ -51,6 +58,12 @@ private:
     int m_topMargin = 0;                /* 眼图距离刻度区域的上边距 */
     int m_rightMargin = 0;              /* 眼图距离刻度区域的右边距 */
     int m_bottomMargin = 0;             /* 眼图距离刻度区域的下边距 */
+
+    int m_hScaleNum = 0;                /* 水平刻度 */
+    int m_vScaleNum = 0;                /* 垂直刻度 */
+
+    OscChannelRange m_cRange = OscChannelRange::CR_2V5;    /* 通道输入档位 */
+    OscTimeGridValue m_tGridValue = OscTimeGridValue::TGV_200NS;    /* 时间刻度值 */
 };
 
-#endif // ONEEYEMAP_H
+#endif // ONEEYEMAP_H

+ 1 - 1
EyeMap/OneEyeMap/OneEyeMap.qss

@@ -1,6 +1,6 @@
 QWidget
 {
-    font-family: SourceHanSansCN, SourceHanSansCN;
+    font-family: 思源黑体M;
     font-weight: 500;
     font-size: 14px;
     color: #C8CCD2;

+ 14 - 25
EyeMap/OneEyeMap/oneeyemap.ui

@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>937</width>
-    <height>519</height>
+    <width>1129</width>
+    <height>620</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -49,7 +49,7 @@
        <height>40</height>
       </size>
      </property>
-     <widget class="QLabel" name="label">
+     <widget class="QLabel" name="label_title">
       <property name="geometry">
        <rect>
         <x>16</x>
@@ -65,28 +65,17 @@
     </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>
+    <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>

BIN
EyeMap/Resource/image/dev_none.png


BIN
EyeMap/Resource/image/dev_outline.png


+ 80 - 0
EyeMap/SettingNum/OneItem/OneSettingItem.qss

@@ -0,0 +1,80 @@
+
+QWidget
+{
+    font-family: 思源黑体M;
+    text-align: left;
+    font-style: normal;
+    background: transparent;
+}
+
+QLabel
+{
+    font-weight: 400;
+    font-size: 14px;
+    color: #D2D2D2;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+/*****************  QComboBox下拉框 ****************/
+QComboBox
+{
+	background: transparent;
+	border-radius: 4px;
+	border: 1px solid rgba(255,255,255,0.15);
+	font-weight: 400;
+	font-size: 14px;
+	color: #D2D2D2;
+	padding-left: 12px;
+}
+QComboBox:hover, QComboBox:on 
+{
+	border: 1px solid #438EFF;
+}
+/*下拉箭头样式*/
+QComboBox::down-arrow
+{
+	height: 16px;
+	width: 16px;
+	image: url(:/Standard_ICON/DownArrow.png);
+}
+QComboBox::drop-down
+{
+    background-color:transparent;
+	padding-right:12px;
+}
+/* 下拉后,整个下拉窗体样式 */
+QComboBox QAbstractItemView
+{
+	margin: 8px;
+	font-size: 14px;
+	background-color: #5C5E61;
+	outline:0px;
+	border-radius: 4px;
+}
+/* 下拉后,整个下拉窗体每项的样式 */
+QComboBox QAbstractItemView::item 
+{
+    border-radius: 4px;
+	color: #D2D2D2;
+    height: 32px;
+	background-color: #5C5E61;
+	font-weight: 400;
+	font-size: 14px;
+	padding-left: 11px;
+}
+QComboBox QAbstractItemView::item:hover 
+{
+	font-weight: 400;
+    color: #FFFFFF;
+	background-color: #438EFF;
+}
+QComboBox QAbstractItemView::item:selected 
+{
+	font-weight: 400;
+    color: #FFFFFF;
+	background-color: #438EFF;
+}
+
+

+ 41 - 0
EyeMap/SettingNum/OneItem/onesettingitem.cpp

@@ -0,0 +1,41 @@
+#include "onesettingitem.h"
+#include "ui_onesettingitem.h"
+
+#include <QDebug>
+#include <QFile>
+
+OneSettingItem::OneSettingItem(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::OneSettingItem)
+{
+    ui->setupUi(this);
+
+    m_logger = spdlog::get("EyeMap");
+    if(m_logger == nullptr)
+    {
+        qDebug() << "获取 EyeMap logger 失败";
+        return;
+    }
+    /* 加载QSS */
+    QFile fileQss(":/qss/SettingNum/OneItem/OneSettingItem.qss");
+    if(fileQss.open(QFile::ReadOnly))
+    {
+        QString qss = fileQss.readAll();
+        this->setStyleSheet(qss);
+        fileQss.close();
+    } else
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "加载QSS文件失败");
+    }
+}
+
+OneSettingItem::~OneSettingItem()
+{
+    delete ui;
+}
+
+/* 设置行数和列数 */
+void OneSettingItem::setRowColumn(int row, int column)
+{
+    
+}

+ 27 - 0
EyeMap/SettingNum/OneItem/onesettingitem.h

@@ -0,0 +1,27 @@
+#ifndef ONESETTINGITEM_H
+#define ONESETTINGITEM_H
+
+#include <QWidget>
+#include "spdlog/spdlog.h"
+
+namespace Ui {
+class OneSettingItem;
+}
+
+class OneSettingItem : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit OneSettingItem(QWidget *parent = nullptr);
+    ~OneSettingItem();
+
+    /* 设置行数和列数 */
+    void setRowColumn(int row, int column);
+
+private:
+    Ui::OneSettingItem *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+};
+
+#endif // ONESETTINGITEM_H

+ 88 - 0
EyeMap/SettingNum/OneItem/onesettingitem.ui

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>OneSettingItem</class>
+ <widget class="QWidget" name="OneSettingItem">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>724</width>
+    <height>48</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <property name="spacing">
+    <number>16</number>
+   </property>
+   <property name="leftMargin">
+    <number>12</number>
+   </property>
+   <property name="topMargin">
+    <number>8</number>
+   </property>
+   <property name="rightMargin">
+    <number>16</number>
+   </property>
+   <property name="bottomMargin">
+    <number>8</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="label_num">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>40</width>
+       <height>14</height>
+      </size>
+     </property>
+     <property name="text">
+      <string>1</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QComboBox" name="comboBox">
+     <property name="minimumSize">
+      <size>
+       <width>280</width>
+       <height>32</height>
+      </size>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLineEdit" name="lineEdit">
+     <property name="minimumSize">
+      <size>
+       <width>280</width>
+       <height>32</height>
+      </size>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QPushButton" name="pBtn_background">
+     <property name="minimumSize">
+      <size>
+       <width>48</width>
+       <height>32</height>
+      </size>
+     </property>
+     <property name="text">
+      <string/>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 191 - 0
EyeMap/SettingNum/SettingNum.qss

@@ -0,0 +1,191 @@
+
+QWidget
+{
+    font-family: 思源黑体M;
+    text-align: left;
+    font-style: normal;
+    background: transparent;
+}
+
+QWidget#widget
+{
+    background: #2E2D31;
+    /* box-shadow: 0px 10px 14px 6px rgba(0,0,0,0.2); */
+    border-radius: 10px;
+    border: 1px solid #595959;
+}
+
+/* 设置顶栏背景 */
+QWidget#widget_top
+{
+    background: #6C697C;
+    border-top-left-radius: 10px;
+    border-top-right-radius: 10px;
+    opacity: 0.2;
+}
+
+/********************** 设置按钮 ***********************/
+
+/* 设置关闭按钮 */ 
+QPushButton#pBtn_close
+{
+    background: transparent;
+    border: none;
+    border-image: url(:/Standard_ICON/close_dark/close_default.png);
+    /* background-image: url(:/Standard_ICON/close_dark/close_default.png); */
+}
+
+QPushButton#pBtn_close:hover
+{
+    /* background-image: url(:/Standard_ICON/close_dark/close_pass.png); */
+    border-image: url(:/Standard_ICON/close_dark/close_pass.png);
+}
+
+/* 设置确定按钮 */
+
+QPushButton#pBtn_ok
+{
+	font-size:14px;
+	font-weight: 500;
+    text-align: center;
+	color: #f3f7ff;
+	line-height: 24px;
+	border: 1px solid #000000;
+	border-radius: 4px;
+	background: #0058b1;
+}
+QPushButton#pBtn_ok::hover
+{
+	font-size:14px;
+	font-weight: 500;
+    text-align: center;
+	color: #f3f7ff;
+	line-height: 24px;
+	border: 1px solid #000000;
+	border-radius: 4px;
+	background: #1a69b8;
+}
+
+QPushButton#pBtn_cancel
+{
+    font-size:14px;
+    font-weight: 500;
+    text-align: center;
+    color: #f3f7ff;
+    line-height: 24px;
+    border: 1px solid #000000;
+    border-radius: 4px;
+    background: #3e3d42;
+}
+QPushButton#pBtn_cancel::hover
+{
+    font-size:14px;
+    font-weight: 500;
+    text-align: center;
+    color: #f3f7ff;
+    line-height: 24px;
+    border: 1px solid #000000;
+    border-radius: 4px;
+    background: #605e65;
+}
+
+
+/************************** 设置Label ************************/
+QLabel#label_settingName
+{
+    font-weight: bold;
+    font-size: 18px;
+    color: #D2D2D2;
+    line-height: 27px;
+    text-align: left;
+    font-style: normal;
+    text-transform: uppercase;
+}
+/* 其他label字体 */
+QLabel
+{
+    font-weight: 400;
+    font-size: 14px;
+    color: #D2D2D2;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+/* 设置分割线 */
+QLabel#label_line1, #label_line2, #label_line3
+{
+    background: rgba(255,255,255,0.15);
+}
+
+/* 设置红色星号 */ 
+QLabel#label_x1, #label_x2
+{
+    font-weight: 400;
+    font-size: 14px;
+    color: #D21F21;
+    line-height: 21px;
+    text-align: left;
+    font-style: normal;
+}
+
+/*****************  QComboBox下拉框 ****************/
+QComboBox
+{
+	background: transparent;
+	border-radius: 4px;
+	border: 1px solid rgba(255,255,255,0.15);
+	font-weight: 400;
+	font-size: 14px;
+	color: #D2D2D2;
+	padding-left: 12px;
+}
+QComboBox:hover, QComboBox:on 
+{
+	border: 1px solid #438EFF;
+}
+/*下拉箭头样式*/
+QComboBox::down-arrow
+{
+	height: 16px;
+	width: 16px;
+	image: url(:/Standard_ICON/DownArrow.png);
+}
+QComboBox::drop-down
+{
+    background-color:transparent;
+	padding-right:12px;
+}
+/* 下拉后,整个下拉窗体样式 */
+QComboBox QAbstractItemView
+{
+	margin: 8px;
+	font-size: 14px;
+	background-color: #5C5E61;
+	outline:0px;
+	border-radius: 4px;
+}
+/* 下拉后,整个下拉窗体每项的样式 */
+QComboBox QAbstractItemView::item 
+{
+    border-radius: 4px;
+	color: #D2D2D2;
+    height: 32px;
+	background-color: #5C5E61;
+	font-weight: 400;
+	font-size: 14px;
+	padding-left: 11px;
+}
+QComboBox QAbstractItemView::item:hover 
+{
+	font-weight: 400;
+    color: #FFFFFF;
+	background-color: #438EFF;
+}
+QComboBox QAbstractItemView::item:selected 
+{
+	font-weight: 400;
+    color: #FFFFFF;
+	background-color: #438EFF;
+}
+

+ 57 - 0
EyeMap/SettingNum/settingnum.cpp

@@ -0,0 +1,57 @@
+#include "settingnum.h"
+#include "ui_settingnum.h"
+
+#include <QDebug>
+#include <QFile>
+
+#include "customcombobox.h"
+
+SettingNum::SettingNum(QDialog *parent) :
+    QDialog(parent),
+    ui(new Ui::SettingNum)
+{
+    ui->setupUi(this);
+
+    m_logger = spdlog::get("EyeMap");
+    if(m_logger == nullptr)
+    {
+        qDebug() << "获取 EyeMap logger 失败";
+        return;
+    }
+    /* 设置无边框 */
+    this->setWindowFlags(Qt::FramelessWindowHint);
+    /* 加载QSS */
+    QFile fileQss(":/qss/SettingNum/SettingNum.qss");
+    if(fileQss.open(QFile::ReadOnly))
+    {
+        QString qss = fileQss.readAll();
+        this->setStyleSheet(qss);
+        fileQss.close();
+    } else
+    {
+        SPDLOG_LOGGER_ERROR(m_logger, "加载QSS文件失败");
+    }
+
+    /* 设置下拉框可选个数 */
+    QStringList listRow;
+    listRow << "1" << "2" << "3" << "4";
+    ui->comboBox_rowNum->addItems(listRow);
+    ui->comboBox_columnNum->addItem("1");
+    ui->comboBox_columnNum->addItem("2");
+    ui->comboBox_rowNum->setCurrentIndex(1);
+    ui->comboBox_columnNum->setCurrentIndex(1);
+
+
+    connect(ui->pBtn_close, &QPushButton::clicked, this, &SettingNum::do_pBtn_close);
+
+}
+
+SettingNum::~SettingNum()
+{
+    delete ui;
+}
+
+void SettingNum::do_pBtn_close()
+{
+    this->close();
+}

+ 30 - 0
EyeMap/SettingNum/settingnum.h

@@ -0,0 +1,30 @@
+#ifndef SETTINGNUM_H
+#define SETTINGNUM_H
+
+#include <QDialog>
+
+#include "spdlog/spdlog.h"
+
+namespace Ui {
+class SettingNum;
+}
+
+class SettingNum : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit SettingNum(QDialog *parent = nullptr);
+    ~SettingNum();
+
+private slots:
+    void do_pBtn_close();
+
+private:
+    Ui::SettingNum *ui;
+    std::shared_ptr<spdlog::logger> m_logger = nullptr;
+
+
+};
+
+#endif // SETTINGNUM_H

+ 267 - 0
EyeMap/SettingNum/settingnum.ui

@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SettingNum</class>
+ <widget class="QDialog" name="SettingNum">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>810</width>
+    <height>705</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QWidget" name="widget" native="true">
+     <widget class="QWidget" name="widget_top" native="true">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>788</width>
+        <height>50</height>
+       </rect>
+      </property>
+      <widget class="QLabel" name="label_settingName">
+       <property name="geometry">
+        <rect>
+         <x>32</x>
+         <y>16</y>
+         <width>80</width>
+         <height>18</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string>组屏配置</string>
+       </property>
+      </widget>
+      <widget class="QPushButton" name="pBtn_close">
+       <property name="geometry">
+        <rect>
+         <x>748</x>
+         <y>13</y>
+         <width>24</width>
+         <height>24</height>
+        </rect>
+       </property>
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </widget>
+     <widget class="QLabel" name="label_x1">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>89</y>
+        <width>7</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>*</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_nc1">
+      <property name="geometry">
+       <rect>
+        <x>40</x>
+        <y>89</y>
+        <width>70</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>通道行数:</string>
+      </property>
+     </widget>
+     <widget class="CustomComboBox" name="comboBox_rowNum">
+      <property name="geometry">
+       <rect>
+        <x>110</x>
+        <y>80</y>
+        <width>82</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_nc2">
+      <property name="geometry">
+       <rect>
+        <x>240</x>
+        <y>89</y>
+        <width>70</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>通道列数:</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_x2">
+      <property name="geometry">
+       <rect>
+        <x>232</x>
+        <y>89</y>
+        <width>7</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>*</string>
+      </property>
+     </widget>
+     <widget class="CustomComboBox" name="comboBox_columnNum">
+      <property name="geometry">
+       <rect>
+        <x>310</x>
+        <y>80</y>
+        <width>82</width>
+        <height>32</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_line1">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>142</y>
+        <width>724</width>
+        <height>1</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_line2">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>190</y>
+        <width>724</width>
+        <height>1</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_nc3">
+      <property name="geometry">
+       <rect>
+        <x>44</x>
+        <y>160</y>
+        <width>40</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>序号</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_nc4">
+      <property name="geometry">
+       <rect>
+        <x>100</x>
+        <y>160</y>
+        <width>40</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>通道</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_nc5">
+      <property name="geometry">
+       <rect>
+        <x>396</x>
+        <y>160</y>
+        <width>280</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>通道展示名称</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_nc6">
+      <property name="geometry">
+       <rect>
+        <x>692</x>
+        <y>160</y>
+        <width>40</width>
+        <height>14</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>底色</string>
+      </property>
+     </widget>
+     <widget class="QLabel" name="label_line3">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>575</y>
+        <width>724</width>
+        <height>1</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string/>
+      </property>
+     </widget>
+     <widget class="QWidget" name="widget_list" native="true">
+      <property name="geometry">
+       <rect>
+        <x>32</x>
+        <y>191</y>
+        <width>724</width>
+        <height>384</height>
+       </rect>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_ok">
+      <property name="geometry">
+       <rect>
+        <x>560</x>
+        <y>606</y>
+        <width>90</width>
+        <height>40</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>保存</string>
+      </property>
+     </widget>
+     <widget class="QPushButton" name="pBtn_cancel">
+      <property name="geometry">
+       <rect>
+        <x>666</x>
+        <y>606</y>
+        <width>90</width>
+        <height>40</height>
+       </rect>
+      </property>
+      <property name="text">
+       <string>取消</string>
+      </property>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>CustomComboBox</class>
+   <extends>QComboBox</extends>
+   <header location="global">customcombobox.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>

+ 7 - 0
EyeMap/eyemap.qrc

@@ -1,5 +1,12 @@
 <RCC>
     <qresource prefix="/qss">
         <file>OneEyeMap/OneEyeMap.qss</file>
+        <file>EyeMapWidget/EyeMapWidget.qss</file>
+        <file>SettingNum/SettingNum.qss</file>
+        <file>SettingNum/OneItem/OneSettingItem.qss</file>
+    </qresource>
+    <qresource prefix="/image">
+        <file>Resource/image/dev_none.png</file>
+        <file>Resource/image/dev_outline.png</file>
     </qresource>
 </RCC>

+ 32 - 3
EyeMap/main.cpp

@@ -1,9 +1,13 @@
 
+
+#include <QApplication>
+#include <QFontDatabase>
+
 #include "spdlog/spdlog.h"
 #include "logs/loginit.h"
-#include <QApplication>
-#include "oscwidget.h"
+#include "EyeMapWidget.h"
 
+void addFont();
 
 int main(int argc, char* argv[])
 {
@@ -18,11 +22,36 @@ int main(int argc, char* argv[])
     }
     SPDLOG_LOGGER_INFO(logger, "★  ★  ★  ★  ★   Oscilloscope   ★  ★  ★  ★  ★");
 
-    OscWidget w;
+    /* 加载字体 */
+    addFont();
+
+    EyeMapWidget w;
     w.show();
 
     return app.exec();
 }
 
+/* 加载字体 */
+void addFont()
+{
+    /* 加载字体 */
+    QFontDatabase::addApplicationFont(R"(:/font/font/SiYuanBlack_ttf/SiYuanBlack_Bold.ttf)");
+    QFontDatabase::addApplicationFont(R"(:/font/font/SiYuanBlack_ttf/SiYuanBlack_M.ttf)");
+    QFontDatabase::addApplicationFont(R"(:/font/font/SiYuanBlack_ttf/SiYuanBlack_R.ttf)");
+    /***************************************************
+     * 字体使用方式
+     * id1 ("思源黑体-粗")
+     * id2 ("思源黑体M")
+     * id3 ("思源黑体R")
+    ****************************************************/
+    //    SPDLOG_LOGGER_DEBUG(m_logger,"id1 = {}",QFontDatabase::applicationFontFamilies(id1));
+    //    qDebug() << "id1" << QFontDatabase::applicationFontFamilies(id1);
+    //    qDebug() << "id2" << QFontDatabase::applicationFontFamilies(id2);
+    //    qDebug() << "id3" << QFontDatabase::applicationFontFamilies(id3);
+    QFont font_main;
+//    font_main.setFamily("思源黑体R");
+    font_main.setPixelSize(14);
+    QApplication::setFont(font_main);
+}
 
 

+ 0 - 84
EyeMap/oneeyemap.ui

@@ -1,84 +0,0 @@
-<?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>

+ 16 - 0
GlobalInfo/GlobalInfo.h

@@ -58,6 +58,22 @@ enum class OscTriggerSensitivity
     TS_HIGH,        /* 高灵敏度 */
 };
 
+/* 一个格子的时间刻度值单位 */
+enum class OscTimeGridValue
+{
+    TGV_20NS = 20,          /* 0.02us */
+    TGV_50NS = 50,          /* 0.05us */
+    TGV_100NS = 100,        /* 0.1us */
+    TGV_200NS = 200,        /* 0.2us */
+    TGV_500NS = 500,        /* 0.5us */
+    TGV_1US = 1000,         /* 1us */
+    TGV_2US = 2000,         /* 2us */
+    TGV_5US = 5000,         /* 5us */
+    TGV_10US = 10000,       /* 10us */
+    TGV_20US = 20000,       /* 20us */
+    TGV_100US = 100000,     /* 100us */
+};
+
 
 struct EyeDataT
 {

+ 1 - 0
oscwidget.cpp

@@ -21,6 +21,7 @@ OscWidget::OscWidget(QWidget *parent) :
 
     /* 设置眼图窗口 */
     m_eyeMap = new OneEyeMap(ui->widget_display);
+    m_eyeMap->setGeometry(0, 0, ui->widget_display->width(), ui->widget_display->height());
     /* 添加下拉框的选项 */
     ui->comboBox_time->addItem("0.05us");
     ui->comboBox_time->addItem("0.1us");