diff --git a/CMakeLists.txt b/CMakeLists.txt index d370db1..20fad02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR}) project(Radio) set(Radio_VERSION 1.0.0) set(CMAKE_CXX_STANDARD 20) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(third_party/build_infra/start.cmake) include(third_party/CPP_Core/main.cmake) include(third_party/Graphic_Core/main.cmake) diff --git a/main.cmake b/main.cmake index 8432a8f..7fc0e3f 100644 --- a/main.cmake +++ b/main.cmake @@ -1,8 +1,13 @@ include(${CMAKE_SOURCE_DIR}/third_party/build_infra/Doxygen/export.cmake) include(${CMAKE_SOURCE_DIR}/third_party/build_infra/Graphviz/export.cmake) +include(${CMAKE_SOURCE_DIR}/third_party/build_infra/LLVM/export.cmake) +include(${CMAKE_SOURCE_DIR}/third_party/build_infra/Cppcheck/export.cmake) +include(${CMAKE_SOURCE_DIR}/third_party/build_infra/lizard/export.cmake) +include(${CMAKE_SOURCE_DIR}/third_party/build_infra/cloc_tokei/export.cmake) +include(${CMAKE_SOURCE_DIR}/third_party/build_infra/CodeMetrics/export.cmake) set(module_dir "${CMAKE_CURRENT_LIST_DIR}/module") set(dir "${module_dir}/radio") -file(GLOB_RECURSE srcs "${dir}/*.c" "${dir}/*.cpp" "${dir}/*.h" "${dir}/*.hpp") +file(GLOB_RECURSE srcs "${dir}/*.c" "${dir}/*.cpp" "${dir}/*.h" "${dir}/*.hpp" "${dir}/*.qrc") add_executable(radio ${srcs}) target_link_libraries(radio PUBLIC YSGraphic_Core) if (MSVC) @@ -45,3 +50,57 @@ psc_add_cmake_graphviz_target(psc_radio_cmake_graphviz add_custom_target(psc_radio_docs DEPENDS psc_radio_doxygen psc_radio_graphviz psc_radio_cmake_graphviz ) +set(radio_metrics_dir "${CMAKE_BINARY_DIR}/metrics/radio") +psc_add_llvm_cognitive_target(psc_radio_llvm_cognitive + INPUT_DIRS ${radio_document_dirs} + EXCLUDE_DIRS ${radio_document_exclude_dirs} + COMPILE_COMMANDS "${CMAKE_BINARY_DIR}/compile_commands.json" + OUTPUT_DIR "${radio_metrics_dir}/llvm" + TOP_N 50 + THRESHOLD 0 +) +psc_add_cppcheck_target(psc_radio_cppcheck + INPUT_DIRS ${radio_document_dirs} + EXCLUDE_DIRS ${radio_document_exclude_dirs} + COMPILE_COMMANDS "${CMAKE_BINARY_DIR}/compile_commands.json" + OUTPUT_DIR "${radio_metrics_dir}/cppcheck" + CHECK_LEVEL normal +) +psc_add_lizard_target(psc_radio_lizard + INPUT_DIRS ${radio_document_dirs} + EXCLUDE_DIRS ${radio_document_exclude_dirs} + OUTPUT_DIR "${radio_metrics_dir}/lizard" + TOP_N 50 + CCN_WARNING 15 + FUNCTION_LENGTH_WARNING 200 + ARGUMENT_WARNING 8 +) +psc_add_code_count_target(psc_radio_code_count + INPUT_DIRS ${radio_document_dirs} + EXCLUDE_DIRS ${radio_document_exclude_dirs} + OUTPUT_DIR "${radio_metrics_dir}/code_count" +) +psc_add_coupling_target(psc_radio_coupling + INPUT_DIRS ${radio_document_dirs} + EXCLUDE_DIRS ${radio_document_exclude_dirs} + OUTPUT_DIR "${radio_metrics_dir}/coupling" + TOP_N 50 +) +psc_add_metrics_report_target(psc_radio_metrics + PROJECT_NAME "Radio" + OUTPUT_DIR "${radio_metrics_dir}" + LLVM_DIR "${radio_metrics_dir}/llvm" + CPPCHECK_DIR "${radio_metrics_dir}/cppcheck" + LIZARD_DIR "${radio_metrics_dir}/lizard" + CODE_COUNT_DIR "${radio_metrics_dir}/code_count" + COUPLING_DIR "${radio_metrics_dir}/coupling" + DEPENDS + psc_radio_llvm_cognitive + psc_radio_cppcheck + psc_radio_lizard + psc_radio_code_count + psc_radio_coupling +) +add_custom_target(psc_radio_quality + DEPENDS psc_radio_metrics psc_radio_docs +) diff --git a/module/F/Center.h b/module/F/Center.h deleted file mode 100644 index d93ba9f..0000000 --- a/module/F/Center.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef CENTER_H -#define CENTER_H -#include "component/Button.h" -#include "global.h" -class Center : public QWidget { -public: - QWidget* cur{}; - Center() = default; - void setWidget(QWidget* widget) { - if (cur) - { - cur->hide(); - } - cur = widget; - widget->setParent(this); - widget->resize(width(), height()); - widget->show(); - } -protected: - void paintEvent(QPaintEvent* event) override { - // QPainter painter(this); - // painter.fillRect(event->rect(), Qt::black); - // painter.end(); - QWidget::paintEvent(event); - } - void resizeEvent(QResizeEvent* event) override { - if (cur) - { - cur->resize(width(), height()); - } - } -}; -#endif diff --git a/module/F/MainWindow.h b/module/F/MainWindow.h deleted file mode 100644 index e3452fa..0000000 --- a/module/F/MainWindow.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H -#include "Center.h" -#include "Navigate_Bar.h" -#include "component/frameless/FrameLessWidget.h" -#include "header.h" -class MainWindow : public FrameLessWidget { -public: - QVBoxLayout* main_layout; - Header* header; - QHBoxLayout* center_layout; - Navigate_Bar* navigate_bar; - Center* center; - void create_center_Layout(); - MainWindow(); -protected: - // void paintEvent(QPaintEvent* event) override { - // QPainter painter(this); - // painter.fillRect(rect(), Qt::gray); - // painter.end(); - // } -}; -#endif diff --git a/module/F/Navigate_Bar.h b/module/F/Navigate_Bar.h deleted file mode 100644 index 91607c7..0000000 --- a/module/F/Navigate_Bar.h +++ /dev/null @@ -1,154 +0,0 @@ -#ifndef Navigate_Bar_H -#define Navigate_Bar_H -#include "function/function.export.h" -#include "global.h" -class Delegate_导航 : public QStyledItemDelegate { -public: - using QStyledItemDelegate::QStyledItemDelegate; - void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override { - painter->save(); - auto dd = index.data(Qt::DisplayRole).value<导航_Dat>(); - if (std::holds_alternative<导航_Dat1>(dd.data)) - { - bool selected = option.state & QStyle::State_Selected; - if (selected) - { - painter->setPen(Qt::NoPen); - // painter->setBrush(QColor("#ADD8E6")); - painter->setBrush(base); - painter->drawRoundedRect(option.rect, 4, 4); - } - auto& d = std::get<导航_Dat1>(dd.data); - QColor cc = selected ? Qt::white : d.icon.get_color(); - int height = 20; - int y = (option.rect.height() - height) / 2; - QRect iconRect = QRect(option.rect.left() + 8, option.rect.y() + y, height, height); - d.icon.render(painter, iconRect, cc); - QRect textRect = option.rect; - textRect.setLeft(iconRect.right() + 8); - painter->setPen(QPen(cc)); - painter->drawText(textRect, Qt::AlignVCenter, d.text); - } - if (std::holds_alternative<导航_Dat2>(dd.data)) - { - auto& d = std::get<导航_Dat2>(dd.data); - QRect textRect = option.rect; - // painter->drawRect(textRect); - painter->setPen(QPen(Qt::darkGray)); - painter->setFont(get_font()); - painter->drawText(textRect, Qt::AlignVCenter, d.text); - painter->drawLine(textRect.bottomLeft(), textRect.bottomRight()); - } - painter->restore(); - } - QFont get_font() const { - QFont f; - f.setPixelSize(18); - return f; - } - QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override { - auto dd = index.data(Qt::DisplayRole).value<导航_Dat>(); - if (std::holds_alternative<导航_Dat1>(dd.data)) - { - auto& d = std::get<导航_Dat1>(dd.data); - QString text = d.text; - int width = option.rect.width(); // 视图宽度 - QFontMetrics fm(option.font); // 获取字体度量 - int textHeight = - fm.boundingRect(QRect(0, 0, width, 0), Qt::TextWordWrap, text).height(); // 计算多行文本的高度 - int extraPadding = 10; // 额外的间距 - return QSize(width, textHeight + extraPadding); // 返回计算后的尺寸 - } - if (std::holds_alternative<导航_Dat2>(dd.data)) - { - auto& d = std::get<导航_Dat2>(dd.data); - QString text = d.text; - QFontMetrics fm(get_font()); - int extraPadding = 20; // 额外的间距 - return QSize(fm.horizontalAdvance(text), fm.height() + extraPadding); // 返回计算后的 - } - return {0, 20}; - } -}; -class View_导航 : public QListView { -public: - explicit View_导航(QWidget* parent = nullptr) : QListView(parent) { - setFrameShape(QFrame::NoFrame); - model = new Model_导航<导航_Dat>(this); - QAbstractItemView::setModel(model); - setItemDelegate(new Delegate_导航(this)); - QObject::connect(this, &QListView::clicked, [&](const QModelIndex& index) { - 导航_Dat it = model->data(index, Qt::DisplayRole).value<导航_Dat>(); - if (click) click(&it); - }); - setStyleSheet("background: rgba(0, 0, 0, 0);"); - setSpacing(2); - } -protected: - void paintEvent(QPaintEvent* e) override { - QPainter painter(viewport()); // 在视图区域绘制 - QListView::paintEvent(e); - } -public: - std::function click = nullptr; - QVector<导航_Dat> items; - void update_model() { model->setDataList(items); } -private: - Model_导航<导航_Dat>* model; -}; -class Navigate_Bar : public QWidget { -public: - View_导航* w; - QVBoxLayout* layout; - void set_click(const std::function& click) { w->click = click; } - 采集预处理* m采集预处理; - 信号侦察* m信号侦察; - 信号处理* m信号处理; - 信号生成* m信号生成; - 信号对消* m信号对消; - 存储列表* m存储列表; -protected: - void paintEvent(QPaintEvent* event) override { - QPainter painter(this); - painter.setRenderHints(QPainter::Antialiasing); - painter.setPen(Qt::NoPen); - painter.setBrush(Qt::white); - painter.drawRoundedRect(rect(), 8, 8); - painter.end(); - } -public: - Navigate_Bar() { - layout = new QVBoxLayout(this); - w = new View_导航; - m采集预处理 = new 采集预处理; - m信号侦察 = new 信号侦察; - m信号处理 = new 信号处理; - m信号生成 = new 信号生成; - m信号对消 = new 信号对消; - m存储列表 = new 存储列表; - QColor c = Qt::darkGray; - w->items.push_back(导航_Dat(导航_Dat2{"功能模块"})); - w->items.push_back( - 导航_Dat(导航_Dat1{"采集预处理\n\t\t999.999MHZ", "采集预处理", "F信号 载频、能量、用户聚类", - SVGImage_Render().set_path(":/filter_1.svg").set_color(c).create(), m采集预处理})); - w->items.push_back( - 导航_Dat(导航_Dat1{"信号侦察\n\tF信号侦察\n\t\t\t\t6/44", "信号侦察", "F信号 载频、能量、用户聚类", - SVGImage_Render().set_path(":/filter_2.svg").set_color(c).create(), m信号侦察})); - w->items.push_back( - 导航_Dat(导航_Dat1{"信号处理", "信号处理", "F信号 载频、能量、用户聚类", - SVGImage_Render().set_path(":/filter_3.svg").set_color(c).create(), m信号处理})); - w->items.push_back( - 导航_Dat(导航_Dat1{"信号生成", "信号生成", "F信号 载频、能量、用户聚类", - SVGImage_Render().set_path(":/filter_4.svg").set_color(c).create(), m信号生成})); - w->items.push_back( - 导航_Dat(导航_Dat1{"信号对消", "信号对消", "F信号 载频、能量、用户聚类", - SVGImage_Render().set_path(":/filter_5.svg").set_color(c).create(), m信号对消})); - w->items.push_back(导航_Dat(导航_Dat2{"数据存储"})); - w->items.push_back( - 导航_Dat(导航_Dat1{"存储列表\n\t\t1/60", "存储列表", "F信号 载频、能量、用户聚类", - SVGImage_Render().set_path(":/filter_1.svg").set_color(c).create(), m存储列表})); - w->update_model(); - layout->addWidget(w); - } -}; -#endif // FUNCTION_BAR_H diff --git a/module/F/ScrollBar.cpp b/module/F/ScrollBar.cpp deleted file mode 100644 index 82fe1e5..0000000 --- a/module/F/ScrollBar.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "ScrollBar.h" -#include -#include -#include "function/function_global.h" -void ScrollBar::Style::drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, -QPainter* painter, const QWidget* widget) const { - - painter->fillRect(widget->rect(), Qt::white); - SubControls sub = option->subControls; - if(CC_ScrollBar != control){ - return; - } - const QStyleOptionSlider* sopt = qstyleoption_cast(option); - - // 前面的矩形 - QRect front = subControlRect(control, sopt, QStyle::SC_ScrollBarSubLine, widget); - QRect back = subControlRect(control, sopt, QStyle::SC_ScrollBarAddLine, widget); - - - - // painter->drawRect(leftIndicatorRect); - // painter->drawRect(rightIndicatorRect); - // qDebug() << r2; - // painter->drawRect(r2); - - // if(sub & QStyle::SC_ScrollBarSubLine) { - // QStyleOptionComplex* opt = const_cast(option); - // opt->subControls = QStyle::SC_ScrollBarSubLine; - // QProxyStyle::drawComplexControl(control, option, painter, widget); - // return; - // } - // if(sub & QStyle::SC_ScrollBarSubLine) { - // QStyleOptionComplex* opt = const_cast(option); - // opt->subControls = QStyle::SC_ScrollBarSubLine; - // QProxyStyle::drawComplexControl(control, option, painter, widget); - // return; - // } - - - QRect scrollBarRect = sopt->rect; - painter->setPen(Qt::NoPen); - painter->setBrush(Qt::blue); - //painter->drawRoundedRect(scrollBarRect, 6, 6); - - QRectF sliderRect = subControlRect(control, sopt, QStyle::SC_ScrollBarSlider, widget); - painter->setBrush(base); - painter->drawRoundedRect(sliderRect, 6, 6); - -} \ No newline at end of file diff --git a/module/F/ScrollBar.h b/module/F/ScrollBar.h deleted file mode 100644 index 7fee9f7..0000000 --- a/module/F/ScrollBar.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef SCROLLBAR_H -#define SCROLLBAR_H -#include -#include -#include - - -class ScrollBar : public QScrollBar { -public: - ScrollBar() { setStyle(new Style()); } - class Style : public QProxyStyle { - public: - void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption* option, QPainter* painter, - const QWidget* widget) const override { - qDebug() << "drawPrimitive == " << element; - QProxyStyle::drawPrimitive(element, option, painter, widget); - } - void drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, - const QWidget* widget) const override; - void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, - const QWidget* widget) const override { - qDebug() << "drawControl == " << element; - QProxyStyle::drawControl(element, option, painter, widget); - } - QRect subElementRect(SubElement element, const QStyleOption* option, const QWidget* widget) const override { - qDebug() << "subElementRect == " << element; - return QProxyStyle::subElementRect(element, option, widget); - } - }; -}; - - - -#endif diff --git a/module/F/Table.cpp b/module/F/Table.cpp deleted file mode 100644 index efb2b2b..0000000 --- a/module/F/Table.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "Table.h" -#include - - -CustomModel::CustomModel(QObject *parent) - : QAbstractTableModel(parent) { - tableData = { - {"Item 1-1", "Item 1-2", "Item 1-3"}, - {"Item 2-1", "Item 2-2", "Item 2-3"}, - {"Item 3-1", "Item 3-2", "Item 3-3"} - }; -} - -int CustomModel::rowCount(const QModelIndex &) const { - return tableData.size(); -} - -int CustomModel::columnCount(const QModelIndex &) const { - return tableData.isEmpty() ? 0 : tableData[0].size(); -} - -QVariant CustomModel::data(const QModelIndex &index, int role) const { - if (!index.isValid()) - return QVariant(); - - if (role == Qt::DisplayRole || role == Qt::EditRole) { - return tableData[index.row()][index.column()]; - } - - return QVariant(); -} - -bool CustomModel::setData(const QModelIndex &index, const QVariant &value, int role) { - if (index.isValid() && role == Qt::EditRole) { - tableData[index.row()][index.column()] = value.toString(); - emit dataChanged(index, index); - return true; - } - return false; -} - -Qt::ItemFlags CustomModel::flags(const QModelIndex &index) const { - if (!index.isValid()) - return Qt::NoItemFlags; - - return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled; -} -CustomTableDelegate::CustomTableDelegate(QObject *parent) : QStyledItemDelegate(parent) {} - -void CustomTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - painter->save(); - - if (index.row() % 2 == 0) { - painter->fillRect(option.rect, QColor(220, 220, 220)); - } else { - painter->fillRect(option.rect, Qt::white); - } - - painter->drawText(option.rect, Qt::AlignCenter, index.data().toString()); - - painter->restore(); -} - -CustomTableView::CustomTableView(QWidget *parent) : QTableView(parent) { - setAlternatingRowColors(true); - setSelectionBehavior(QAbstractItemView::SelectRows); - setSelectionMode(QAbstractItemView::SingleSelection); - horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); -} - - diff --git a/module/F/Table.h b/module/F/Table.h deleted file mode 100644 index 6d2e3e1..0000000 --- a/module/F/Table.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef CUSTOMMODEL_H -#define CUSTOMMODEL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -class CustomModel : public QAbstractTableModel { -public: - explicit CustomModel(QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - int columnCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; - Qt::ItemFlags flags(const QModelIndex &index) const override; -private: - QVector> tableData; -}; - -class CustomTableDelegate : public QStyledItemDelegate { -public: - explicit CustomTableDelegate(QObject *parent = nullptr); - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; -}; - - -class CustomTableView : public QTableView { -public: - explicit CustomTableView(QWidget *parent = nullptr); -}; - - - - - -#endif // CUSTOMMODEL_H diff --git a/module/F/Tree_Table.h b/module/F/Tree_Table.h deleted file mode 100644 index 5cc6759..0000000 --- a/module/F/Tree_Table.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef CMAKEUSERPRESETS_JSON_TREE_TABLE_H -#define CMAKEUSERPRESETS_JSON_TREE_TABLE_H -#include -#include -#include -#include -#include -#include -#include -#include "ScrollBar.h" -struct TreeNode { - QStringList data; // 节点数据,每个字段一个字符串 - QList children; // 子节点列表 - TreeNode* parent; // 父节点指针 - - TreeNode(const QStringList& data, TreeNode* parent = nullptr) - : data(data), parent(parent) {} - ~TreeNode() { - qDeleteAll(children); - } -}; - - -class TreeModel : public QAbstractItemModel { -public: - TreeModel(const QStringList& headers, QObject* parent = nullptr) - : QAbstractItemModel(parent), headers(headers) { - rootItem = new TreeNode(headers); - } - - ~TreeModel() { - delete rootItem; - } - - // 必要的虚函数实现 - int rowCount(const QModelIndex& parent = QModelIndex()) const override { - TreeNode* parentNode = nodeFromIndex(parent); - return parentNode->children.count(); - } - - int columnCount(const QModelIndex& parent = QModelIndex()) const override { - return headers.count(); - } - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override { - if (!index.isValid() || role != Qt::DisplayRole) - return QVariant(); - - TreeNode* item = nodeFromIndex(index); - return item->data.value(index.column()); - } - - QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override { - if (!hasIndex(row, column, parent)) - return QModelIndex(); - - TreeNode* parentNode = nodeFromIndex(parent); - TreeNode* childItem = parentNode->children.value(row); - if (childItem) - return createIndex(row, column, childItem); - else - return QModelIndex(); - } - - QModelIndex parent(const QModelIndex& index) const override { - if (!index.isValid()) - return QModelIndex(); - - TreeNode* childItem = nodeFromIndex(index); - TreeNode* parentItem = childItem->parent; - - if (parentItem == rootItem || !parentItem) - return QModelIndex(); - - int row = parentItem->parent->children.indexOf(parentItem); - return createIndex(row, 0, parentItem); - } - - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override { - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) - return headers.value(section); - - return QVariant(); - } - - // 添加节点的函数 - void addNode(const QStringList& data, const QModelIndex& parent = QModelIndex()) { - TreeNode* parentNode = nodeFromIndex(parent); - beginInsertRows(parent, parentNode->children.count(), parentNode->children.count()); - TreeNode* newNode = new TreeNode(data, parentNode); - parentNode->children.append(newNode); - endInsertRows(); - } - -private: - TreeNode* rootItem; - QStringList headers; - - TreeNode* nodeFromIndex(const QModelIndex& index) const { - if (index.isValid()) - return static_cast(index.internalPointer()); - else - return rootItem; - } -}; - - -class TreeDelegate : public QStyledItemDelegate { -public: - TreeDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) {} - - QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, - const QModelIndex& index) const override { - // 根据需要创建编辑器,例如 QLineEdit - QLineEdit* editor = new QLineEdit(parent); - return editor; - } - - void setEditorData(QWidget* editor, const QModelIndex& index) const override { - QString value = index.model()->data(index, Qt::EditRole).toString(); - QLineEdit* lineEdit = static_cast(editor); - lineEdit->setText(value); - } - - void setModelData(QWidget* editor, QAbstractItemModel* model, - const QModelIndex& index) const override { - QLineEdit* lineEdit = static_cast(editor); - model->setData(index, lineEdit->text(), Qt::EditRole); - } - - void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, - const QModelIndex& index) const override { - editor->setGeometry(option.rect); - } -}; - - - - -class TreeView : public QTreeView { -public: - TreeView(){ - setVerticalScrollBar(new ScrollBar()); - setHorizontalScrollBar(new ScrollBar()); - } -}; - -#endif - diff --git a/module/F/function/a1_采集预处理.h b/module/F/function/a1_采集预处理.h deleted file mode 100644 index 84da390..0000000 --- a/module/F/function/a1_采集预处理.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef a_采集预处理_H -#define a_采集预处理_H -#include "function_global.h" -class T_采集预处理_瀑布图 : public YSG::Plot { -public: - YSG::FrequentAxis* xAxis{}; - YSG::TimeAxis* yAxis{}; - YSG::MutiSelectRect* msr{}; - YSG::WaterFall* wf{}; - QMenu* mMenu{}; - void init() override { - Plot::init(); - mObjectName = "WaterFallPlot"; - bindRenderThread(mObjectName + "Thread"); - xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal).set_tick_length(-10).set_sub_tick_length(-5).build(); - yAxis = YSG::TimeAxis::Builder(this, Qt::Vertical).build(); - wf = YSG::WaterFall::Builder(xAxis, yAxis).set_layerName("plottable").set_frequent_range({0, 20}).build(); - msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build(); - } -protected: - void resizeEvent(QResizeEvent* event) override { - xAxis->set_x(0); - xAxis->set_y(height() - 1); - xAxis->set_pixel_size(width()); - yAxis->set_x(0); - yAxis->set_y(0); - yAxis->set_pixel_size(height()); - // wf->set_frequent_point_size(wf->frequent_axis()->get_pixel_point_size()); - wf->set_frequent_point_size(width()); - } - void contextMenuEvent(QContextMenuEvent* event) override { - if (!mMenu) - { - auto ws = - bw(cw(wf, -1), "瀑布图") + bw(cw(xAxis), "频率轴") + bw(cw(yAxis), "时间轴") + bw(cw(msr), "多选框"); - mMenu = createMenu(this, ws); - } - mMenu->exec(event->globalPos()); - } -}; -class T_采集预处理_频谱图 : public YSG::Plot { -public: - YSG::FrequentAxis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::MutiSelectRect* msr{}; - YSG::Spectrum* sp{}; - QMenu* mMenu{}; - void init() override { - Plot::init(); - mObjectName = "SpectrumPlot"; - bindRenderThread(mObjectName + "Thread"); - xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal) - .set_coord_range({0, 100}) - .set_tick_length(-10) - .set_sub_tick_length(-5) - .set_use_wheel(true) - .set_use_drag(true) - .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) - .set_coord_range({100, 0}) - .set_unit_text("功率") - .set_use_drag(true) - .build(); - sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build(); - msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build(); - } -protected: - void resizeEvent(QResizeEvent* event) override { - int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20; - int w = width() - leftMargin - rightMargin; - int h = height() - topMargin - bottomMargin; - xAxis->set_x(leftMargin); - xAxis->set_y(height() - bottomMargin); - xAxis->set_pixel_size(w); - yAxis->set_x(leftMargin); - yAxis->set_y(topMargin); - yAxis->set_pixel_size(h); - sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size()); - } - void contextMenuEvent(QContextMenuEvent* event) override { - if (!mMenu) - { - auto ws = - bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框"); - mMenu = createMenu(this, ws); - } - mMenu->exec(event->globalPos()); - } -}; -class 采集预处理 : public BaseWidget { -public: - QHBoxLayout* mainLayout{}; - T_采集预处理_瀑布图* m_瀑布图{}; - T_采集预处理_频谱图* m_频谱图{}; - QVBoxLayout* createV(); - 采集预处理(); - void paintEvent(QPaintEvent* event) override; -}; -#endif diff --git a/module/F/function/a2_信号侦察.h b/module/F/function/a2_信号侦察.h deleted file mode 100644 index f440f0e..0000000 --- a/module/F/function/a2_信号侦察.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef a_信号侦察_H -#define a_信号侦察_H -#include "function_global.h" -class T_信号侦察_频谱图 : public YSG::Plot { -public: - YSG::FrequentAxis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::MutiSelectRect* msr{}; - YSG::Spectrum* sp{}; - QMenu* mMenu{}; - void init() override { - Plot::init(); - mObjectName = "SpectrumPlot"; - bindRenderThread(mObjectName + "Thread"); - xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal) - .set_coord_range({0, 100}) - .set_tick_length(-10) - .set_sub_tick_length(-5) - .set_use_wheel(true) - .set_use_drag(true) - .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) - .set_coord_range({100, 0}) - .set_unit_text("功率") - .set_use_drag(true) - .build(); - sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build(); - msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build(); - } -protected: - void resizeEvent(QResizeEvent* event) override { - int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20; - int w = width() - leftMargin - rightMargin; - int h = height() - topMargin - bottomMargin; - xAxis->set_x(leftMargin); - xAxis->set_y(height() - bottomMargin); - xAxis->set_pixel_size(w); - yAxis->set_x(leftMargin); - yAxis->set_y(topMargin); - yAxis->set_pixel_size(h); - sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size()); - } - void contextMenuEvent(QContextMenuEvent* event) override { - if (!mMenu) - { - auto ws = - bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框"); - mMenu = createMenu(this, ws); - } - mMenu->exec(event->globalPos()); - } -}; -class 信号侦察 : public BaseWidget { -public: - QHBoxLayout* mainLayout{}; - T_信号侦察_频谱图* m_频谱图{}; - TreeView *treeView{}; - QVBoxLayout* createV(); - void paintEvent(QPaintEvent* event) override; - 信号侦察(); -}; -#endif // 信号侦察_H diff --git a/module/F/function/a3_信号处理.h b/module/F/function/a3_信号处理.h deleted file mode 100644 index d637f16..0000000 --- a/module/F/function/a3_信号处理.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef a_信号处理_H -#define a_信号处理_H -#include "function_global.h" -class 信号处理 : public BaseWidget { -public: - void paintEvent(QPaintEvent* event) override; - QVBoxLayout* createV(); - QHBoxLayout* mainLayout{}; - TreeView* treeView{}; - 信号处理(); -}; -#endif // 信号处理_H diff --git a/module/F/function/a4_信号生成.h b/module/F/function/a4_信号生成.h deleted file mode 100644 index 7f4617a..0000000 --- a/module/F/function/a4_信号生成.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef a_信号生成_H -#define a_信号生成_H -#include "function_global.h" -class T_信号生成_频谱图 : public YSG::Plot { -public: - YSG::FrequentAxis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::MutiSelectRect* msr{}; - YSG::Spectrum* sp{}; - QMenu* mMenu{}; - void init() override { - Plot::init(); - mObjectName = "SpectrumPlot"; - bindRenderThread(mObjectName + "Thread"); - xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal) - .set_coord_range({0, 100}) - .set_tick_length(-10) - .set_sub_tick_length(-5) - .set_use_wheel(true) - .set_use_drag(true) - .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) - .set_coord_range({100, 0}) - .set_unit_text("功率") - .set_use_drag(true) - .build(); - sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build(); - msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build(); - } -protected: - void resizeEvent(QResizeEvent* event) override { - int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20; - int w = width() - leftMargin - rightMargin; - int h = height() - topMargin - bottomMargin; - xAxis->set_x(leftMargin); - xAxis->set_y(height() - bottomMargin); - xAxis->set_pixel_size(w); - yAxis->set_x(leftMargin); - yAxis->set_y(topMargin); - yAxis->set_pixel_size(h); - sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size()); - } - void contextMenuEvent(QContextMenuEvent* event) override { - if (!mMenu) - { - auto ws = - bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框"); - mMenu = createMenu(this, ws); - } - mMenu->exec(event->globalPos()); - } -}; -class 信号生成 : public BaseWidget { -public: - void paintEvent(QPaintEvent* event) override; - QHBoxLayout* mainLayout{}; - QVBoxLayout* createV(); - TreeView* treeView{}; - T_信号生成_频谱图* m_频谱图{}; - 信号生成(); -}; -#endif // 信号生成_H diff --git a/module/F/function/a5_信号对消.h b/module/F/function/a5_信号对消.h deleted file mode 100644 index 2d53568..0000000 --- a/module/F/function/a5_信号对消.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef a_信号对消_H -#define a_信号对消_H -#include "function_global.h" -class T_信号对消_频谱图 : public YSG::Plot { -public: - YSG::FrequentAxis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::MutiSelectRect* msr{}; - YSG::Spectrum* sp{}; - QMenu* mMenu{}; - void init() override { - Plot::init(); - mObjectName = "SpectrumPlot"; - bindRenderThread(mObjectName + "Thread"); - xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal) - .set_coord_range({0, 100}) - .set_tick_length(-10) - .set_sub_tick_length(-5) - .set_use_wheel(true) - .set_use_drag(true) - .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) - .set_coord_range({100, 0}) - .set_unit_text("功率") - .set_use_drag(true) - .build(); - sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build(); - msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build(); - } -protected: - void resizeEvent(QResizeEvent* event) override { - int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20; - int w = width() - leftMargin - rightMargin; - int h = height() - topMargin - bottomMargin; - xAxis->set_x(leftMargin); - xAxis->set_y(height() - bottomMargin); - xAxis->set_pixel_size(w); - yAxis->set_x(leftMargin); - yAxis->set_y(topMargin); - yAxis->set_pixel_size(h); - sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size()); - } - void contextMenuEvent(QContextMenuEvent* event) override { - if (!mMenu) - { - auto ws = - bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框"); - mMenu = createMenu(this, ws); - } - mMenu->exec(event->globalPos()); - } -}; -class 信号对消 : public BaseWidget { -public: - void paintEvent(QPaintEvent* event) override; - QHBoxLayout* mainLayout{}; - QVBoxLayout* createV(); - T_信号对消_频谱图* m_频谱图{}; - TreeView *treeView{}; - 信号对消(); -}; -#endif // 信号对消_H diff --git a/module/F/function/a6_存储列表.h b/module/F/function/a6_存储列表.h deleted file mode 100644 index c417e6d..0000000 --- a/module/F/function/a6_存储列表.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef a_存储列表_H -#define a_存储列表_H -#include "function_global.h" -class 存储列表 : public BaseWidget { -public: - void paintEvent(QPaintEvent* event) override; - QHBoxLayout* mainLayout{}; - CustomTableView* m_table{}; - QVBoxLayout* createV(); - 存储列表(); -}; -#endif // 存储列表_H diff --git a/module/F/function/b0_升级记录.h b/module/F/function/b0_升级记录.h deleted file mode 100644 index ef7ae13..0000000 --- a/module/F/function/b0_升级记录.h +++ /dev/null @@ -1,14 +0,0 @@ -#include "function_global.h" -#ifndef b0_升级记录_H -#define b0_升级记录_H - - - - -class 升级记录 : QWidget{ -public: - QString content; - Button *confirm{}; -}; - -#endif diff --git a/module/F/function/data_source.cpp b/module/F/function/data_source.cpp deleted file mode 100644 index 61488c8..0000000 --- a/module/F/function/data_source.cpp +++ /dev/null @@ -1,253 +0,0 @@ -#include "../MainWindow.h" -#include "a2_信号侦察.h" -#include "a3_信号处理.h" -#include "a4_信号生成.h" -#include "a5_信号对消.h" -#include "function.export.h" -#include "a6_存储列表.h" -Data_source data_source; -void Data_source::set_root(MainWindow* root) { m_root = root; } -Data_source::Data_source() {} -// 1 -采集预处理::采集预处理() { - mainLayout = new QHBoxLayout(this); - mainLayout->setMargin(0); - mainLayout->addLayout(createV(), 3); - auto fw = new FunctionWidget(); - auto 中心频率 = create_input("中心频率", "MHZ"); - auto 带宽 = create_input("带宽", "MHZ"); - auto 采样率 = create_input("采样率", "MHZ"); - auto layout = new QVBoxLayout; - layout->setSpacing(0); - layout->addLayout(中心频率); - layout->addSpacing(10); - layout->addLayout(带宽); - layout->addSpacing(10); - layout->addLayout(采样率); - fw->init("预处理参数", "展示设备宽采效果", layout); - mainLayout->addWidget(fw, 1); -} -QVBoxLayout* 采集预处理::createV() { - QVBoxLayout* ret; - ret = new QVBoxLayout(); - m_频谱图 = new T_采集预处理_频谱图; - m_频谱图->init(); - ret->addWidget(m_频谱图); - m_瀑布图 = new T_采集预处理_瀑布图; - m_瀑布图->init(); - ret->addWidget(m_瀑布图); - return ret; -} -void 采集预处理::paintEvent(QPaintEvent* event) { - // QPainter painter(this); - // painter.fillRect(event->rect(), Qt::white); - QWidget::paintEvent(event); -} - -// 2 -QVBoxLayout* 信号侦察::createV() { - auto ret = new QVBoxLayout; - m_频谱图 = new T_信号侦察_频谱图(); - m_频谱图->init(); - ret->addWidget(m_频谱图, 1); - QStringList headers = {"子带通道", "频点", "出联状态", "锁定状态", "出联时间", "出联时长", "符号率", "频值", "EbNo", "误码率", "电平", "帧定时"}; - TreeModel* model = new TreeModel(headers); - QStringList parentData = {"父节点1", "数据2", "数据3"}; - model->addNode(parentData); - QModelIndex parentIndex = model->index(0, 0); - QStringList childData = {"子节点1", "数据2", "数据3"}; - model->addNode(childData, parentIndex); - treeView = new TreeView; - treeView->setModel(model); - TreeDelegate* delegate = new TreeDelegate; - treeView->setItemDelegate(delegate); - treeView->expandAll(); - ret->addWidget(treeView, 1); - return ret; -} - -信号侦察::信号侦察() { - mainLayout = new QHBoxLayout(this); - mainLayout->setMargin(0);mainLayout->setMargin(0); - mainLayout->addLayout(createV(), 3); - auto fw = new FunctionWidget(); - auto layout = new QVBoxLayout; - layout->setSpacing(0); - fw->init("侦察参数", "展示参数信息", layout); - layout->addLayout(create_check_box("载波通道", {"221", "222"})); - layout->addLayout(create_input("中心频率", "MHz")); - layout->addLayout(create_input("带宽", "KHz")); - layout->addLayout(create_input("采样率", "KHz")); - layout->addLayout(create_check_box("调制方式", {"221", "222"})); - layout->addLayout(create_input("符号率", "KBd")); - layout->addLayout(create_check_box("译码方式", {"TPC"})); - mainLayout->addWidget(fw, 1); -} -void 信号侦察::paintEvent(QPaintEvent* event) { - QPainter painter(this); - //painter.fillRect(event->rect(), Qt::yellow); - painter.end(); - QWidget::paintEvent(event); -} - - -// 3 -信号处理::信号处理() { - mainLayout = new QHBoxLayout(this); - mainLayout->setMargin(0); - mainLayout->addLayout(createV(), 3); - auto fw = new FunctionWidget(); - auto layout = new QVBoxLayout; - layout->setSpacing(0); - layout->addLayout(create_check_box("工作模式", {"信号侦察"})); - layout->addLayout(create_check_box("工作模式", {"信号侦察"})); - fw->init("处理参数", "对用户或载波解调译码分析", layout); - mainLayout->addWidget(fw, 1); -} -void 信号处理::paintEvent(QPaintEvent* event) { - QPainter painter(this); - //painter.fillRect(event->rect(), Qt::green); - painter.end(); - QWidget::paintEvent(event); -} -QVBoxLayout* 信号处理::createV() { - QVBoxLayout* ret; - ret = new QVBoxLayout(); - ret->addWidget(new QWidget, 1); - QStringList headers = {"子带通道", "频点", "出联状态", "锁定状态", "出联时间", "出联时长", "符号率", "频值", "EbNo", "误码率", "电平", "帧定时"}; - TreeModel* model = new TreeModel(headers); - QStringList parentData = {"父节点1", "数据2", "数据3"}; - model->addNode(parentData); - QModelIndex parentIndex = model->index(0, 0); - QStringList childData = {"子节点1", "数据2", "数据3"}; - model->addNode(childData, parentIndex); - treeView = new TreeView; - treeView->setModel(model); - TreeDelegate* delegate = new TreeDelegate; - treeView->setItemDelegate(delegate); - treeView->expandAll(); - ret->addWidget(treeView, 1); - return ret; -} - -// 4 -信号生成::信号生成() { - mainLayout = new QHBoxLayout(this); - mainLayout->setMargin(0); - mainLayout->addLayout(createV(), 3); - auto fw = new FunctionWidget(); - auto layout = new QVBoxLayout; - layout->setSpacing(0); - layout->addLayout(create_check_box("发射模式", {"多载波合路"})); - layout->addLayout(create_check_box("数据源", {"本地样本"})); - layout->addLayout(create_check_box("切入点", {"HDLC封装"})); - layout->addLayout(create_check_box("信道编码", {"VIT"})); - // TODO 80比特帧封装 - // TODO 符号映射 - layout->addLayout(create_check_box("调制类型", {"BPSK"})); - layout->addLayout(create_input("发射时刻", {""})); - // TODO 发射样本 - fw->init("生成参数", "支持", layout); - mainLayout->addWidget(fw, 1); -} - -// 4 -void 信号生成::paintEvent(QPaintEvent* event) { - QPainter painter(this); - //painter.fillRect(event->rect(), Qt::red); - painter.end(); - QWidget::paintEvent(event); -} - -QVBoxLayout* 信号生成::createV() { - auto ret = new QVBoxLayout; - m_频谱图 = new T_信号生成_频谱图(); - m_频谱图->init(); - ret->addWidget(m_频谱图, 1); - QStringList headers = {"载波通道", "数据源"}; - TreeModel* model = new TreeModel(headers); - QStringList parentData = {"父节点1", "数据2", "数据3"}; - model->addNode(parentData); - QModelIndex parentIndex = model->index(0, 0); - QStringList childData = {"子节点1", "数据2", "数据3"}; - model->addNode(childData, parentIndex); - treeView = new TreeView; - treeView->setModel(model); - TreeDelegate* delegate = new TreeDelegate; - treeView->setItemDelegate(delegate); - treeView->expandAll(); - ret->addWidget(treeView, 1); - return ret; -} - - -// 5 -信号对消::信号对消() { - mainLayout = new QHBoxLayout(this); -mainLayout->setMargin(0); - mainLayout->addLayout(createV(), 3); - auto fw = new FunctionWidget(); - auto layout = new QVBoxLayout; - layout->setSpacing(0); - layout->addLayout(create_check_box("时差", {"10ms", "20ms"})); - layout->addLayout(create_check_box("频差", {"100Hz"})); - layout->addLayout(create_check_box("搜索范围", {"30ms"})); - fw->init("对消参数", "对40M内发射信号对消", layout); - mainLayout->addWidget(fw, 1); -} -void 信号对消::paintEvent(QPaintEvent* event) { - QPainter painter(this); - //painter.fillRect(event->rect(), Qt::blue); - painter.end(); - QWidget::paintEvent(event); -} - -QVBoxLayout* 信号对消::createV() { - auto ret = new QVBoxLayout; - m_频谱图 = new T_信号对消_频谱图(); - m_频谱图->init(); - ret->addWidget(m_频谱图, 1); - QStringList headers = {"子带通道", "频点", "出联状态", "锁定状态", "出联时间", "出联时长", "符号率", "频值", "EbNo", "误码率", "电平", "帧定时"}; - TreeModel* model = new TreeModel(headers); - QStringList parentData = {"父节点1", "数据2", "数据3"}; - model->addNode(parentData); - QModelIndex parentIndex = model->index(0, 0); - QStringList childData = {"子节点1", "数据2", "数据3"}; - model->addNode(childData, parentIndex); - treeView = new TreeView; - treeView->setModel(model); - TreeDelegate* delegate = new TreeDelegate; - treeView->setItemDelegate(delegate); - treeView->expandAll(); - ret->addWidget(treeView, 1); - return ret; -} -// 6 -存储列表::存储列表() { - mainLayout = new QHBoxLayout(this); -mainLayout->setMargin(0); - mainLayout->addLayout(createV(), 3); - auto fw = new FunctionWidget(); - auto layout = new QVBoxLayout; - layout->setSpacing(0); - layout->addLayout(create_check_box("工作模式", {"信号侦察"})); - layout->addLayout(create_check_box("工作模式", {"信号侦察"})); - fw->init("处理参数", "对用户或载波解调译码分析", layout); - mainLayout->addWidget(fw, 1); -} -void 存储列表::paintEvent(QPaintEvent* event) { - QPainter painter(this); - //painter.fillRect(event->rect(), Qt::gray); - painter.end(); - QWidget::paintEvent(event); -} -QVBoxLayout* 存储列表::createV() { - auto ret = new QVBoxLayout; - m_table = new CustomTableView(this); - auto* model = new CustomModel(this); - auto* delegate = new CustomTableDelegate(this); - m_table->setModel(model); - m_table->setItemDelegate(delegate); - ret->addWidget(m_table); - return ret; -} diff --git a/module/F/function/function.export.h b/module/F/function/function.export.h deleted file mode 100644 index cbd4b95..0000000 --- a/module/F/function/function.export.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CMAKEUSERPRESETS_JSON_FUNCTION_EXPORT_H -#define CMAKEUSERPRESETS_JSON_FUNCTION_EXPORT_H -#include "a1_采集预处理.h" -#include "a2_信号侦察.h" -#include "a3_信号处理.h" -#include "a4_信号生成.h" -#include "a5_信号对消.h" -#include "a6_存储列表.h" -#include "b0_升级记录.h" -class MainWindow; -class Data_source { -public: - void set_root(MainWindow* root); - Data_source(); -protected: - MainWindow* m_root{}; -}; -extern Data_source data_source; -#endif diff --git a/module/F/function/function_global.h b/module/F/function/function_global.h deleted file mode 100644 index b9fc525..0000000 --- a/module/F/function/function_global.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef FUNCTION_GLOBAL_H -#define FUNCTION_GLOBAL_H -#include -#include -#include -#include "DemoGallery/Tool.h" -#include "component/Button.h" -#include "component/ComboBox.h" -#include "component/Input.h" -#include "../Tree_Table.h" -#include "../Table.h" - - -extern QColor base; -class FunctionWidget : public QWidget { -public: - QLabel* title{}; - QLabel* explain{}; - QVBoxLayout* layout{}; - Button* btn{}; - FunctionWidget() {} - void init(const QString& title_text, const QString& explain_text, QLayout* l) { - this->title = new QLabel(title_text); - this->explain = new QLabel(explain_text); - layout = new QVBoxLayout(this); - layout->addLayout(create_line_1()); - btn = new Button(); - btn->content.text = new Text(QString("确定"), QPen(Qt::white)); - layout->addLayout(l); - // qDebug() << " btn->sizeHint() " << btn->sizeHint(); - layout->addStretch(1); - layout->addWidget(btn); - btn->background.set_color(base); - } - QHBoxLayout* create_line_1() { - auto ret = new QHBoxLayout; - ret->addWidget(this->title, 1); - ret->addWidget(this->explain, 1); - return ret; - } - void paintEvent(QPaintEvent* event) override { - QPainter painter(this); - painter.setRenderHints(QPainter::Antialiasing); - painter.setPen(Qt::NoPen); - painter.setBrush(Qt::white); - painter.drawRoundedRect(rect(), 8, 8); - painter.end(); - } -}; -class BaseWidget : public QWidget { -public: -}; -static Button* create_label(const QString& content) { - auto ret = new Button; - ret->content.text = new Text(content); - ret->content.layout.second_prefix = 4; - ret->content.layout.second_suffix = 0; - ret->content.layout.main_type = Layout::Prefix_Space; - // ret->background.set_border(Qt::yellow); - return ret; -} -static QLayout* create_input(const QString& content, const QString& unit) { - auto ret = new QVBoxLayout; - ret->setSpacing(0); - ret->setMargin(0); - auto label = create_label(content); - ret->addWidget(label); - auto core = new Input; - core->unit = unit; - core->focus_color = base; - ret->addWidget(core); - return ret; -} -static QLayout* create_check_box(const QString& content, const QVector& opt_list) { - auto ret = new QVBoxLayout; - ret->setSpacing(0); - ret->setMargin(0); - auto label = create_label(content); - ret->addWidget(label); - auto core = new ComboBox; - for (auto& opt : opt_list) - { - core->addItem(opt); - } - ret->addWidget(core); - return ret; -} -#endif diff --git a/module/F/global.h b/module/F/global.h deleted file mode 100644 index 0a971de..0000000 --- a/module/F/global.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef F_GLOBAL_H -#define F_GLOBAL_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "component/SVG.h" -template -class Model_导航 : public QAbstractListModel { -public: - explicit Model_导航(QObject* parent = nullptr) : QAbstractListModel(parent) {} - int rowCount(const QModelIndex& parent = QModelIndex()) const override { return items.size(); } - QVariant data(const QModelIndex& index, int role) const override { - if (!index.isValid() || index.row() >= items.size()) - { - return QVariant(); - } - if (role == Qt::DisplayRole) - { - int i = index.row(); - return QVariant::fromValue(items[i]); - } - return QVariant(); - } - void setDataList(const QVector& dataList) { - beginResetModel(); - items = dataList; - endResetModel(); - } - QVector items; -}; - - - -struct 导航_Dat1 { - QString text; - QString title; - QString detail; - SVGImage_Render icon; - QWidget* widget{}; -}; - -struct 导航_Dat2 { - QString text; -}; - -class 导航_Dat { -public: - 导航_Dat() {} - std::variant<导航_Dat1, 导航_Dat2> data; - 导航_Dat(const std::variant<导航_Dat1, 导航_Dat2>& data) : data(data) {} -}; - - - -Q_DECLARE_METATYPE(导航_Dat) - -#endif diff --git a/module/F/header.h b/module/F/header.h deleted file mode 100644 index c268640..0000000 --- a/module/F/header.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef HEADER_H -#define HEADER_H -#include "component/Button.h" -#include "global.h" -struct Button; -class Header : public QWidget { -public: - QLabel *icon; - QLabel *app_title; - QLabel *text{}; - QHBoxLayout *layout; - Button *show_update{}; - Switch_Button *max; - Button *hide; - Button *close; - QLabel *cur_title{}; - QLabel *detail{}; - - void set_title(const QString& big_content, const QString& little_content){ - cur_title->setText(big_content); - detail->setText(little_content); - } - explicit Header(QWidget* parent) : QWidget(parent) { - layout = new QHBoxLayout(this); - icon = new QLabel(this); - icon->setPixmap(QPixmap(":/filter_3.svg")); - app_title = new QLabel(this); - QFont app_title_font; - app_title_font.setPointSize(20); - app_title->setFont(app_title_font); - app_title->setText("F信号处理设备"); - app_title->setStyleSheet("color: rgb(255, 255, 255);"); - layout->addWidget(app_title); - - - cur_title = new QLabel("???"); - QFont big_font; - big_font.setPointSize(16); - cur_title->setFont(big_font); - cur_title->setStyleSheet("color: rgb(255, 255, 255);"); - detail = new QLabel("??"); - detail->setStyleSheet("color: rgb(255, 255, 255);"); - - layout->addWidget(icon); - layout->addWidget(app_title); - layout->setSpacing(24); - layout->addWidget(cur_title); - layout->setSpacing(16); - layout->addWidget(detail); - layout->addStretch(); - layout->setMargin(0); - show_update = create_icon(":/help.svg", base, [parent](QEvent::Type t, QMouseEvent* e) { - if (t == QEvent::MouseButtonPress) - { - //parent->showMinimized(); - } - e->accept(); - }); - hide = create_icon(":/zui_xiao_hua.svg", base, [parent](QEvent::Type t, QMouseEvent* e) { - if (t == QEvent::MouseButtonPress) - { - parent->showMinimized(); - } - e->accept(); - }); - max = create_switch_icon( - base, ":/zui_da_hua2.svg", - [parent](QEvent::Type t, QMouseEvent* e) { - parent->showMaximized(); - e->accept(); - }, - ":/zui_da_hua_back.svg", - [parent](QEvent::Type t, QMouseEvent* e) { - parent->showNormal(); - e->accept(); - }); - close = create_icon(":/guan_bi.svg", base, [parent](QEvent::Type t, QMouseEvent* e) { - if (t == QEvent::MouseButtonPress) - { - parent->close(); - } - e->accept(); - }); - layout->addWidget(show_update); - layout->addWidget(hide); - layout->addWidget(max); - layout->addWidget(close); - } -protected: - void resizeEvent(QResizeEvent* event) override { - int a = event->size().height(); - show_update->setFixedSize({a, a}); - hide->setFixedSize({a, a}); - max->setFixedSize({a, a}); - close->setFixedSize({a, a}); - } - void paintEvent(QPaintEvent* event) override { - QPainter painter(this); - // painter.fillRect(event->rect(), Qt::blue); - painter.end(); - } -}; -#endif // HEADER_H diff --git a/module/F/img/1_采集预处理.jpg b/module/F/img/1_采集预处理.jpg deleted file mode 100644 index 2ef0dec..0000000 Binary files a/module/F/img/1_采集预处理.jpg and /dev/null differ diff --git a/module/F/img/2_信号侦察.jpg b/module/F/img/2_信号侦察.jpg deleted file mode 100644 index 74c3f38..0000000 Binary files a/module/F/img/2_信号侦察.jpg and /dev/null differ diff --git a/module/F/img/3_信号处理.jpg b/module/F/img/3_信号处理.jpg deleted file mode 100644 index ea052f5..0000000 Binary files a/module/F/img/3_信号处理.jpg and /dev/null differ diff --git a/module/F/img/4_信号生成.jpg b/module/F/img/4_信号生成.jpg deleted file mode 100644 index 6c586fc..0000000 Binary files a/module/F/img/4_信号生成.jpg and /dev/null differ diff --git a/module/F/img/5_信号对消.jpg b/module/F/img/5_信号对消.jpg deleted file mode 100644 index 4f01b59..0000000 Binary files a/module/F/img/5_信号对消.jpg and /dev/null differ diff --git a/module/F/img/升级记录.jpg b/module/F/img/升级记录.jpg deleted file mode 100644 index 03351f6..0000000 Binary files a/module/F/img/升级记录.jpg and /dev/null differ diff --git a/module/F/img/存储列表.jpg b/module/F/img/存储列表.jpg deleted file mode 100644 index 841860b..0000000 Binary files a/module/F/img/存储列表.jpg and /dev/null differ diff --git a/module/F/main.cpp b/module/F/main.cpp deleted file mode 100644 index 9de9cd1..0000000 --- a/module/F/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#ifdef _WINDOWS -#include -#endif -#include -#include -#include -#include "MainWindow.h" -#include "component/SVG.h" -#include "global.h" -// 自定义 qHash 函数 -#include -#include -#include -#include -QColor base = QColor("#007ee1"); -MainWindow::MainWindow() { - background_color = base; - main_layout = new QVBoxLayout(this); - int a = 2; - main_layout->setContentsMargins(leftMargin + 20, topMargin + a, rightMargin + a, bottomMargin + a); - header = new Header(this); - main_layout->addWidget(header); - create_center_Layout(); - data_source.set_root(this); -} - - -void MainWindow::create_center_Layout() { - center_layout = new QHBoxLayout(); - navigate_bar = new Navigate_Bar(); - center_layout->addWidget(navigate_bar, 1); - center = new Center(); - center_layout->addWidget(center, 4); - - main_layout->addSpacing(16); - main_layout->addLayout(center_layout); - - static auto click = [this](导航_Dat* d) { - if(std::holds_alternative<导航_Dat1>(d->data)){ - auto& dd = std::get<导航_Dat1>(d->data); - auto w = dd.widget; - center->setWidget(dd.widget); - header->set_title(dd.title, dd.detail); - } - }; - - navigate_bar->set_click(click); - - click(&navigate_bar->w->items[0]); -} - - -int main(int argc, char* argv[]) { - QApplication app(argc, argv); - QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); -#ifdef _WINDOWS - SetConsoleOutputCP(CP_UTF8); - system("chcp 65001"); - // setbuf(stdout, 0); -#endif - qRegisterMetaType<导航_Dat>("Dat"); - MainWindow w; - w.resize(1000, 700); - w.show(); - // svg/filter_1_24dp_5985E1_FILL0_wght400_GRAD0_opsz24.svg - YSG::startAllRenderThread(); - return QApplication::exec(); -} diff --git a/module/F/mock_data.cpp b/module/F/mock_data.cpp deleted file mode 100644 index 9186487..0000000 --- a/module/F/mock_data.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "mock_data.h" diff --git a/module/F/mock_data.h b/module/F/mock_data.h deleted file mode 100644 index 7aab3f8..0000000 --- a/module/F/mock_data.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef MOCK_DATA_H -#define MOCK_DATA_H -class mock_data {}; -#endif diff --git a/module/F/resource/order/filter_1.svg b/module/F/resource/order/filter_1.svg deleted file mode 100644 index ad376f2..0000000 --- a/module/F/resource/order/filter_1.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_2.svg b/module/F/resource/order/filter_2.svg deleted file mode 100644 index b7db83e..0000000 --- a/module/F/resource/order/filter_2.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_3.svg b/module/F/resource/order/filter_3.svg deleted file mode 100644 index e1dbf7c..0000000 --- a/module/F/resource/order/filter_3.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_4.svg b/module/F/resource/order/filter_4.svg deleted file mode 100644 index 4f361da..0000000 --- a/module/F/resource/order/filter_4.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_5.svg b/module/F/resource/order/filter_5.svg deleted file mode 100644 index af14a76..0000000 --- a/module/F/resource/order/filter_5.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_6.svg b/module/F/resource/order/filter_6.svg deleted file mode 100644 index 0fc371c..0000000 --- a/module/F/resource/order/filter_6.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_7.svg b/module/F/resource/order/filter_7.svg deleted file mode 100644 index a2adc47..0000000 --- a/module/F/resource/order/filter_7.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_8.svg b/module/F/resource/order/filter_8.svg deleted file mode 100644 index 8ccdb63..0000000 --- a/module/F/resource/order/filter_8.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/filter_9.svg b/module/F/resource/order/filter_9.svg deleted file mode 100644 index bc99a17..0000000 --- a/module/F/resource/order/filter_9.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/order/resource.qrc b/module/F/resource/order/resource.qrc deleted file mode 100644 index 888abef..0000000 --- a/module/F/resource/order/resource.qrc +++ /dev/null @@ -1,14 +0,0 @@ - - - filter_1.svg - filter_2.svg - filter_3.svg - filter_4.svg - filter_5.svg - filter_6.svg - filter_7.svg - filter_8.svg - filter_9.svg - - - diff --git a/module/F/resource/other/app.svg b/module/F/resource/other/app.svg deleted file mode 100644 index 71ee15c..0000000 --- a/module/F/resource/other/app.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/guan_bi.svg b/module/F/resource/other/guan_bi.svg deleted file mode 100644 index 2c9f443..0000000 --- a/module/F/resource/other/guan_bi.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/help.svg b/module/F/resource/other/help.svg deleted file mode 100644 index a20737f..0000000 --- a/module/F/resource/other/help.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/resource.qrc b/module/F/resource/other/resource.qrc deleted file mode 100644 index b39dd30..0000000 --- a/module/F/resource/other/resource.qrc +++ /dev/null @@ -1,19 +0,0 @@ - - - app.svg - zui_da_hua2.svg - help.svg - save.svg - settings.svg - toggle_off.svg - toggle_on.svg - - - - guan_bi.svg - zui_da_hua.svg - zui_da_hua_back.svg - zui_xiao_hua.svg - - - diff --git a/module/F/resource/other/save.svg b/module/F/resource/other/save.svg deleted file mode 100644 index 7775492..0000000 --- a/module/F/resource/other/save.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/settings.svg b/module/F/resource/other/settings.svg deleted file mode 100644 index 328e2f0..0000000 --- a/module/F/resource/other/settings.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/toggle_off.svg b/module/F/resource/other/toggle_off.svg deleted file mode 100644 index 3268e82..0000000 --- a/module/F/resource/other/toggle_off.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/toggle_on.svg b/module/F/resource/other/toggle_on.svg deleted file mode 100644 index a706ffd..0000000 --- a/module/F/resource/other/toggle_on.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/zui_da_hua.svg b/module/F/resource/other/zui_da_hua.svg deleted file mode 100644 index d678860..0000000 --- a/module/F/resource/other/zui_da_hua.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/zui_da_hua2.svg b/module/F/resource/other/zui_da_hua2.svg deleted file mode 100644 index 3ac70ef..0000000 --- a/module/F/resource/other/zui_da_hua2.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/module/F/resource/other/zui_da_hua_back.svg b/module/F/resource/other/zui_da_hua_back.svg deleted file mode 100644 index 0451db7..0000000 --- a/module/F/resource/other/zui_da_hua_back.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/F/resource/other/zui_xiao_hua.svg b/module/F/resource/other/zui_xiao_hua.svg deleted file mode 100644 index eeb8b23..0000000 --- a/module/F/resource/other/zui_xiao_hua.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/module/Tree_Table/main.cpp b/module/Tree_Table/main.cpp deleted file mode 100644 index 64ac8a6..0000000 --- a/module/Tree_Table/main.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#ifndef CUSTOMMODEL_H -#define CUSTOMMODEL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -class CustomModel : public QAbstractTableModel { -public: - explicit CustomModel(QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - int columnCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; - Qt::ItemFlags flags(const QModelIndex &index) const override; -private: - QVector> tableData; -}; - -class CustomTableDelegate : public QStyledItemDelegate { -public: - explicit CustomTableDelegate(QObject *parent = nullptr); - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; -}; - - -class CustomTableView : public QTableView { -public: - explicit CustomTableView(QWidget *parent = nullptr); -}; - - - - - -#endif // CUSTOMMODEL_H - - -CustomModel::CustomModel(QObject *parent) - : QAbstractTableModel(parent) { - tableData = { - {"Item 1-1", "Item 1-2", "Item 1-3"}, - {"Item 2-1", "Item 2-2", "Item 2-3"}, - {"Item 3-1", "Item 3-2", "Item 3-3"} - }; -} - -int CustomModel::rowCount(const QModelIndex &) const { - return tableData.size(); -} - -int CustomModel::columnCount(const QModelIndex &) const { - return tableData.isEmpty() ? 0 : tableData[0].size(); -} - -QVariant CustomModel::data(const QModelIndex &index, int role) const { - if (!index.isValid()) - return QVariant(); - - if (role == Qt::DisplayRole || role == Qt::EditRole) { - return tableData[index.row()][index.column()]; - } - - return QVariant(); -} - -bool CustomModel::setData(const QModelIndex &index, const QVariant &value, int role) { - if (index.isValid() && role == Qt::EditRole) { - tableData[index.row()][index.column()] = value.toString(); - emit dataChanged(index, index); - return true; - } - return false; -} - -Qt::ItemFlags CustomModel::flags(const QModelIndex &index) const { - if (!index.isValid()) - return Qt::NoItemFlags; - - return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled; -} -CustomTableDelegate::CustomTableDelegate(QObject *parent) : QStyledItemDelegate(parent) {} - -void CustomTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - painter->save(); - - if (index.row() % 2 == 0) { - painter->fillRect(option.rect, QColor(220, 220, 220)); - } else { - painter->fillRect(option.rect, Qt::white); - } - - painter->drawText(option.rect, Qt::AlignCenter, index.data().toString()); - - painter->restore(); -} - -CustomTableView::CustomTableView(QWidget *parent) : QTableView(parent) { - setAlternatingRowColors(true); - setSelectionBehavior(QAbstractItemView::SelectRows); - setSelectionMode(QAbstractItemView::SingleSelection); - horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); -} - - - -int main(int argc, char *argv[]) { - QApplication app(argc, argv); - - auto *tableView = new CustomTableView; - auto *model = new CustomModel(tableView); - auto *delegate = new CustomTableDelegate(tableView); - - tableView->setModel(model); - tableView->setItemDelegate(delegate); - - tableView->show(); - - - return app.exec(); -} diff --git a/module/main.cpp b/module/main.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/module/old/main.cpp b/module/old/main.cpp deleted file mode 100644 index 2ffe88a..0000000 --- a/module/old/main.cpp +++ /dev/null @@ -1,240 +0,0 @@ -#include -#include - -#ifdef _WINDOWS -#include -#include -#endif -#include -#include -#include -#include "GenerateMockData.h" -#include "base/Graphic.h" -#include "base/Plot.h" -#include "component/Table/Table_View.h" -#include "component/Tree/Tree_View.h" -#include "component/simple_widget.h" -#include "plottable/Afterglow.h" -#include "plottable/Planisphere.h" -#include "plottable/Planisphere_p.h" -#include "plottable/Spectrum.h" -#include "plottable/Spectrum_p.h" -#include "plottable/WaterFall.h" -#include "plottable/WaterFall_p.h" -#include "DemoGallery/AfterglowPlot.h" -#include "DemoGallery/DemoGallery.h" -#include "DemoGallery/PlanispherePlot.h" -#include "DemoGallery/SpectrumPlot.h" -#include "DemoGallery/WaterFallPlot.h" - -#include -#include -#include -#include -#include - - -struct TreeNode { - QStringList data; // 节点数据,每个字段一个字符串 - QList children; // 子节点列表 - TreeNode* parent; // 父节点指针 - - TreeNode(const QStringList& data, TreeNode* parent = nullptr) - : data(data), parent(parent) {} - ~TreeNode() { - qDeleteAll(children); - } -}; - - -class TreeModel : public QAbstractItemModel { -public: - TreeModel(const QStringList& headers, QObject* parent = nullptr) - : QAbstractItemModel(parent), headers(headers) { - rootItem = new TreeNode(headers); - } - - ~TreeModel() { - delete rootItem; - } - - // 必要的虚函数实现 - int rowCount(const QModelIndex& parent = QModelIndex()) const override { - TreeNode* parentNode = nodeFromIndex(parent); - return parentNode->children.count(); - } - - int columnCount(const QModelIndex& parent = QModelIndex()) const override { - return headers.count(); - } - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override { - if (!index.isValid() || role != Qt::DisplayRole) - return QVariant(); - - TreeNode* item = nodeFromIndex(index); - return item->data.value(index.column()); - } - - QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override { - if (!hasIndex(row, column, parent)) - return QModelIndex(); - - TreeNode* parentNode = nodeFromIndex(parent); - TreeNode* childItem = parentNode->children.value(row); - if (childItem) - return createIndex(row, column, childItem); - else - return QModelIndex(); - } - - QModelIndex parent(const QModelIndex& index) const override { - if (!index.isValid()) - return QModelIndex(); - - TreeNode* childItem = nodeFromIndex(index); - TreeNode* parentItem = childItem->parent; - - if (parentItem == rootItem || !parentItem) - return QModelIndex(); - - int row = parentItem->parent->children.indexOf(parentItem); - return createIndex(row, 0, parentItem); - } - - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override { - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) - return headers.value(section); - - return QVariant(); - } - - // 添加节点的函数 - void addNode(const QStringList& data, const QModelIndex& parent = QModelIndex()) { - TreeNode* parentNode = nodeFromIndex(parent); - beginInsertRows(parent, parentNode->children.count(), parentNode->children.count()); - TreeNode* newNode = new TreeNode(data, parentNode); - parentNode->children.append(newNode); - endInsertRows(); - } - -private: - TreeNode* rootItem; - QStringList headers; - - TreeNode* nodeFromIndex(const QModelIndex& index) const { - if (index.isValid()) - return static_cast(index.internalPointer()); - else - return rootItem; - } -}; - - -class TreeDelegate : public QStyledItemDelegate { -public: - TreeDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) {} - - QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, - const QModelIndex& index) const override { - // 根据需要创建编辑器,例如 QLineEdit - QLineEdit* editor = new QLineEdit(parent); - return editor; - } - - void setEditorData(QWidget* editor, const QModelIndex& index) const override { - QString value = index.model()->data(index, Qt::EditRole).toString(); - QLineEdit* lineEdit = static_cast(editor); - lineEdit->setText(value); - } - - void setModelData(QWidget* editor, QAbstractItemModel* model, - const QModelIndex& index) const override { - QLineEdit* lineEdit = static_cast(editor); - model->setData(index, lineEdit->text(), Qt::EditRole); - } - - void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, - const QModelIndex& index) const override { - editor->setGeometry(option.rect); - } -}; - -class TreeView : public QTreeView{ -public: -}; - -int main(int argc, char* argv[]) { - QApplication app(argc, argv); - // 定义表头 - QStringList headers = {"字段1", "字段2", "字段3"}; - // 创建模型并设置表头 - TreeModel* model = new TreeModel(headers); - // 添加层次化数据 - QStringList parentData = {"父节点1", "数据2", "数据3"}; - model->addNode(parentData); - QModelIndex parentIndex = model->index(0, 0); - QStringList childData = {"子节点1", "数据2", "数据3"}; - model->addNode(childData, parentIndex); - - // 创建视图并设置模型 - TreeView* treeView = new TreeView; - treeView->setModel(model); - - // 设置自定义委托 - TreeDelegate* delegate = new TreeDelegate; - treeView->setItemDelegate(delegate); - - // 展开所有节点 - treeView->expandAll(); - - // 显示窗口 - QMainWindow mainWindow; - mainWindow.setCentralWidget(treeView); - mainWindow.resize(600, 400); - - - mainWindow.show(); - - return app.exec(); -} - - -int main2(int argc, char *argv[]) { - QApplication app(argc, argv); - QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8")); -#ifdef _WINDOWS - SetConsoleOutputCP(CP_UTF8); - system("chcp 65001"); - //setbuf(stdout, 0); -#endif - QElapsedTimer timer; - timer.start(); - // DemoGallery w; - // w.resize(1000, 600); - // w.show(); - - // YSG::Graphic g; - // g.resize(1000, 600); - // g.show(); - -// auto it = new YSG::SelectColorDialog(); -// it->resize(1000, 600); -// it->show(); - - Tree_View w; - w.resize(400, 400); - w.show(); - - - - YSG::startAllRenderThread(); - qDebug() << "启动耗时 " << timer.elapsed(); - - - - //f(); - - - return QApplication::exec(); -} diff --git a/module/radio/BackEnd/IntermediateFrequencyWidget.cpp b/module/radio/BackEnd/IntermediateFrequencyWidget.cpp index 3cc845c..8402d7c 100644 --- a/module/radio/BackEnd/IntermediateFrequencyWidget.cpp +++ b/module/radio/BackEnd/IntermediateFrequencyWidget.cpp @@ -18,30 +18,33 @@ static double max = 160; QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() { class SpectrumPlot : public YSG::Plot { public: - YSG::Frequent_Axis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::Muti_Select_Rect* msr{}; - YSG::Spectrum* sp{}; + std::shared_ptr xAxis{}; + std::shared_ptr yAxis{}; + std::shared_ptr msr{}; + std::shared_ptr sp{}; QMenu* mMenu{}; void init() override { Plot::init(); object_name = "SpectrumPlot"; - xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal) + auto data = create_renderable_node(root_renderable(), "DataRenderable"); + auto axis = create_renderable_node(root_renderable(), "AxisRenderable"); + auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable"); + xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal) .set_tick_length(-10) .set_coord_range(frequent_range) .set_tick_length(-10) .set_sub_tick_length(-5) .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) + yAxis = YSG::Axis::Builder(axis, Qt::Vertical) .set_coord_range({160, 0}) .set_unit_text("功率") .build(); - sp = YSG::Spectrum::Builder(xAxis, yAxis) + sp = YSG::Spectrum::Builder(data, xAxis, yAxis) .set_frequent_range(frequent_range) .set_use_sweep_frequent_rect(true) .set_frequent_point_size(1024) .build(); - msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build(); + msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build(); } protected: void resizeEvent(QResizeEvent* event) override { @@ -55,10 +58,10 @@ QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() { void contextMenuEvent(QContextMenuEvent* event) override { if (!mMenu) { auto ws = - bw(cw(sp, -1), "频谱图") + - bw(cw(xAxis), "频率x轴") + - bw(cw(yAxis), "功率y轴") + - bw(cw(msr), "多选框"); + bw(cw(sp.get(), -1), "频谱图") + + bw(cw(xAxis.get()), "频率x轴") + + bw(cw(yAxis.get()), "功率y轴") + + bw(cw(msr.get()), "多选框"); mMenu = createMenu(this, ws); } mMenu->exec(event->globalPos()); @@ -77,30 +80,33 @@ QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() { QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot() { class AfterglowPlot : public YSG::Plot { public: - YSG::Frequent_Axis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::Afterglow* ag{}; - YSG::Muti_Select_Rect* msr{}; + std::shared_ptr xAxis{}; + std::shared_ptr yAxis{}; + std::shared_ptr ag{}; + std::shared_ptr msr{}; QMenu* mMenu{}; void init() override { Plot::init(); object_name = "AfterglowPlot"; - xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal) + auto data = create_renderable_node(root_renderable(), "DataRenderable"); + auto axis = create_renderable_node(root_renderable(), "AxisRenderable"); + auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable"); + xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal) .set_coord_range(frequent_range) .set_tick_length(-10) .set_sub_tick_length(-5) .set_use_drag(true) .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) + yAxis = YSG::Axis::Builder(axis, Qt::Vertical) .set_coord_range({160, 0}) .set_use_drag(true) .build(); - ag = YSG::Afterglow::Builder(xAxis, yAxis) + ag = YSG::Afterglow::Builder(data, xAxis, yAxis) .set_frequent_range(frequent_range) .set_power_range({0, 160}) .set_frequent_point_size(1024) .build(); - msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build(); + msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build(); } protected: void resizeEvent(QResizeEvent* event) override { @@ -115,10 +121,10 @@ QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot() { void contextMenuEvent(QContextMenuEvent* event) override { if (!mMenu) { auto ws = - bw(cw(ag, -1), "余辉图") + - bw(cw(xAxis), "频率轴") + - bw(cw(yAxis), "功率概率轴") + - bw(cw(msr), "多选框"); + bw(cw(ag.get(), -1), "余辉图") + + bw(cw(xAxis.get()), "频率轴") + + bw(cw(yAxis.get()), "功率概率轴") + + bw(cw(msr.get()), "多选框"); mMenu = createMenu(this, ws); } mMenu->exec(event->globalPos()); @@ -256,7 +262,7 @@ void IntermediateFrequencyWidget::initMenu() { auto addInitFrequent = new ValueMenuButton("添加初始频率:%1", fontSize, [frequentStep,this](ValueMenuButton* that, bool add) { int newFrequent = (int)that->mValue + (add ? frequentStep->mValue : -frequentStep->mValue); that->setValue(newFrequent); - }, mSpectrogramLine->frequent_range().lower); + }, mSpectrogramLine->frequent_range().origin); auto btn1_1 = new ValueMenuButton("当前标记:%1", fontSize, [&, markFrequent](ValueMenuButton* that, bool add) { int index = ((int)that->mValue + (add ? 1 : -1)) % mSpectrogramLine->select_line_marker_size(); that->setValue(index); diff --git a/module/radio/BackEnd/IntermediateFrequencyWidget.h b/module/radio/BackEnd/IntermediateFrequencyWidget.h index 468876d..dbca6e8 100644 --- a/module/radio/BackEnd/IntermediateFrequencyWidget.h +++ b/module/radio/BackEnd/IntermediateFrequencyWidget.h @@ -1,6 +1,7 @@ #ifndef IntermediateFrequencyWidget_H #define IntermediateFrequencyWidget_H #include "../BaseWidget.h" +#include class TextButton; class DoubleTextButton; @@ -17,8 +18,8 @@ public: QPushButton *m1, *m2, *m3, *m4, *m5, *m6; FrequentShower *mFrequentShower; ProgressBar *mProgressBar1, *mProgressBar2; - YSG::Spectrum *mSpectrogramLine{}; - YSG::Afterglow *mAfterglow{}; + std::shared_ptr mSpectrogramLine{}; + std::shared_ptr mAfterglow{}; QWidget* createSpectrogramPowerPlot(); QWidget* create_Afterglow_Plot(); void initMenu(); diff --git a/module/radio/BackEnd/RadioWidget.cpp b/module/radio/BackEnd/RadioWidget.cpp index edb26b5..bb4aa3b 100644 --- a/module/radio/BackEnd/RadioWidget.cpp +++ b/module/radio/BackEnd/RadioWidget.cpp @@ -15,27 +15,30 @@ static YSG::Range frequent_range = {-12000, 12000}; QWidget* RadioWidget::createSpectrogramPowerPlot() { class SpectrumPlot : public YSG::Plot { public: - YSG::Frequent_Axis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::Muti_Select_Rect* msr{}; - YSG::Spectrum* sp{}; + std::shared_ptr xAxis{}; + std::shared_ptr yAxis{}; + std::shared_ptr msr{}; + std::shared_ptr sp{}; QMenu* mMenu{}; void init() override { Plot::init(); object_name = "SpectrumPlot"; - xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal) + auto data = create_renderable_node(root_renderable(), "DataRenderable"); + auto axis = create_renderable_node(root_renderable(), "AxisRenderable"); + auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable"); + xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal) .set_coord_range(frequent_range) .set_tick_length(-10) .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) + yAxis = YSG::Axis::Builder(axis, Qt::Vertical) .set_coord_range({max, 0}) .set_unit_text("功率") .build(); - sp = YSG::Spectrum::Builder(xAxis, yAxis) + sp = YSG::Spectrum::Builder(data, xAxis, yAxis) .set_frequent_range(frequent_range) .set_frequent_point_size(1024) .build(); - msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build(); + msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build(); if (use_Performance_shower) set_use_performance_shower(true); } protected: @@ -50,10 +53,10 @@ QWidget* RadioWidget::createSpectrogramPowerPlot() { void contextMenuEvent(QContextMenuEvent* event) override { if (!mMenu) { auto ws = - bw(cw(sp, -1), "频谱图") + - bw(cw(xAxis), "频率x轴") + - bw(cw(yAxis), "功率y轴") + - bw(cw(msr), "多选框"); + bw(cw(sp.get(), -1), "频谱图") + + bw(cw(xAxis.get()), "频率x轴") + + bw(cw(yAxis.get()), "功率y轴") + + bw(cw(msr.get()), "多选框"); mMenu = createMenu(this, ws); } mMenu->exec(event->globalPos()); @@ -72,29 +75,32 @@ QWidget* RadioWidget::createSpectrogramPowerPlot() { QWidget* RadioWidget::createWaterFallPlot() { class WaterFallPlot : public YSG::Plot { public: - YSG::Frequent_Axis* xAxis{}; - YSG::Time_Axis* yAxis{}; - YSG::Muti_Select_Rect* msr{}; - YSG::Waterfall* wf{}; + std::shared_ptr xAxis{}; + std::shared_ptr yAxis{}; + std::shared_ptr msr{}; + std::shared_ptr wf{}; QMenu* mMenu{}; void init() override { Plot::init(); object_name = "WaterFallPlot"; - xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal) + auto data = create_renderable_node(root_renderable(), "DataRenderable"); + auto axis = create_renderable_node(root_renderable(), "AxisRenderable"); + auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable"); + xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal) .set_tick_length(-10) .set_sub_tick_length(-5) .set_coord_range(frequent_range) .build(); - yAxis = YSG::Time_Axis::Builder(this, Qt::Vertical) + yAxis = YSG::Time_Axis::Builder(axis, Qt::Vertical) .set_time_point_size(100) .build(); - wf = YSG::Waterfall::Builder(xAxis, yAxis) + wf = YSG::Waterfall::Builder(data, xAxis, yAxis) .set_frequent_range(frequent_range) .set_frequent_point_size(1024) .set_power_range({0, max}) // .set_time_point_size(100) .build(); - msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build(); + msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build(); if (use_Performance_shower) set_use_performance_shower(true); } protected: @@ -109,10 +115,10 @@ QWidget* RadioWidget::createWaterFallPlot() { void contextMenuEvent(QContextMenuEvent* event) override { if (!mMenu) { auto ws = - bw(cw(wf, -1), "瀑布图") + - bw(cw(xAxis), "频率轴") + - bw(cw(yAxis), "时间轴") + - bw(cw(msr), "多选框"); + bw(cw(wf.get(), -1), "瀑布图") + + bw(cw(xAxis.get()), "频率轴") + + bw(cw(yAxis.get()), "时间轴") + + bw(cw(msr.get()), "多选框"); mMenu = createMenu(this, ws); } mMenu->exec(event->globalPos()); @@ -126,27 +132,30 @@ QWidget* RadioWidget::createWaterFallPlot() { QWidget* RadioWidget::createAudioSpectrogramPlot() { class SpectrumPlot : public YSG::Plot { public: - YSG::Frequent_Axis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::Muti_Select_Rect* msr{}; - YSG::Spectrum* sp{}; + std::shared_ptr xAxis{}; + std::shared_ptr yAxis{}; + std::shared_ptr msr{}; + std::shared_ptr sp{}; QMenu* mMenu{}; void init() override { Plot::init(); object_name = "SpectrumPlot"; - xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal) + auto data = create_renderable_node(root_renderable(), "DataRenderable"); + auto axis = create_renderable_node(root_renderable(), "AxisRenderable"); + auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable"); + xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal) .set_coord_range({-12000, 12000}) .set_tick_length(-10) .set_sub_tick_length(-5) .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) + yAxis = YSG::Axis::Builder(axis, Qt::Vertical) .set_coord_range({12000, -12000}) .set_unit_text("功率").build(); - sp = YSG::Spectrum::Builder(xAxis, yAxis) + sp = YSG::Spectrum::Builder(data, xAxis, yAxis) .set_frequent_range({-12000, 12000}) .set_frequent_point_size(512) .build(); - msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build(); + msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build(); if (use_Performance_shower) set_use_performance_shower(true); } protected: @@ -161,10 +170,10 @@ QWidget* RadioWidget::createAudioSpectrogramPlot() { void contextMenuEvent(QContextMenuEvent* event) override { if (!mMenu) { auto ws = - bw(cw(sp, -1), "频谱图") + - bw(cw(xAxis), "频率x轴") + - bw(cw(yAxis), "功率y轴") + - bw(cw(msr), "多选框"); + bw(cw(sp.get(), -1), "频谱图") + + bw(cw(xAxis.get()), "频率x轴") + + bw(cw(yAxis.get()), "功率y轴") + + bw(cw(msr.get()), "多选框"); mMenu = createMenu(this, ws); } mMenu->exec(event->globalPos()); @@ -178,24 +187,27 @@ QWidget* RadioWidget::createAudioSpectrogramPlot() { QWidget* RadioWidget::createTimePowerPlot() { class AudioPlot : public YSG::Plot { public: - YSG::Time_Axis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::Audio_Frequent* audio{}; - YSG::Muti_Select_Rect* msr{}; + std::shared_ptr xAxis{}; + std::shared_ptr yAxis{}; + std::shared_ptr audio{}; + std::shared_ptr msr{}; QMenu* mMenu{}; void init() override { Plot::init(); object_name = "AudioPlot"; - xAxis = YSG::Time_Axis::Builder(this, Qt::Horizontal) + auto data = create_renderable_node(root_renderable(), "DataRenderable"); + auto axis = create_renderable_node(root_renderable(), "AxisRenderable"); + auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable"); + xAxis = YSG::Time_Axis::Builder(axis, Qt::Horizontal) .set_tick_length(-10) .set_sub_tick_length(-5) .build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) + yAxis = YSG::Axis::Builder(axis, Qt::Vertical) .set_coord_range({12000, -12000}) .build(); - audio = YSG::Audio_Frequent::Builder(xAxis, yAxis) + audio = YSG::Audio_Frequent::Builder(data, xAxis, yAxis) .build(); - msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build(); + msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build(); if (use_Performance_shower) set_use_performance_shower(true); } protected: @@ -211,10 +223,10 @@ QWidget* RadioWidget::createTimePowerPlot() { void contextMenuEvent(QContextMenuEvent* event) override { if (!mMenu) { auto ws = - bw(cw(audio, -1), "音频图") + - bw(cw(yAxis), "功率y轴") + - bw(cw(xAxis), "时间轴") + - bw(cw(msr), "多选框"); + bw(cw(audio.get(), -1), "音频图") + + bw(cw(yAxis.get()), "功率y轴") + + bw(cw(xAxis.get()), "时间轴") + + bw(cw(msr.get()), "多选框"); mMenu = createMenu(this, ws); } mMenu->exec(event->globalPos()); diff --git a/module/radio/BackEnd/RadioWidget.h b/module/radio/BackEnd/RadioWidget.h index 549d35f..63cf342 100644 --- a/module/radio/BackEnd/RadioWidget.h +++ b/module/radio/BackEnd/RadioWidget.h @@ -1,6 +1,7 @@ #ifndef RadioWidget_H #define RadioWidget_H #include "../BaseWidget.h" +#include class TextButton; @@ -25,10 +26,10 @@ public: QWidget* createAudioSpectrogramPlot(); QWidget* createTimePowerPlot(); QWidget* createWaterFallPlot(); - YSG::Spectrum *mSpectrogramLine{}; - YSG::Spectrum* mAudioSpectrogramPlot{}; - YSG::Audio_Frequent *mTimePower{}; - YSG::Waterfall *mWaterFall{}; + std::shared_ptr mSpectrogramLine{}; + std::shared_ptr mAudioSpectrogramPlot{}; + std::shared_ptr mTimePower{}; + std::shared_ptr mWaterFall{}; protected: void focusInEvent(QFocusEvent *event) override; void keyPressEvent(QKeyEvent *event) override; diff --git a/module/radio/BackEnd/SweepFrequencyWidget.cpp b/module/radio/BackEnd/SweepFrequencyWidget.cpp index 55d33d3..1fbdb2b 100644 --- a/module/radio/BackEnd/SweepFrequencyWidget.cpp +++ b/module/radio/BackEnd/SweepFrequencyWidget.cpp @@ -14,26 +14,29 @@ QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() { class SweepFrequentPlot : public YSG::Plot { public: - YSG::Axis* xAxis{}; - YSG::Axis* yAxis{}; - YSG::Muti_Select_Rect* msr{}; - YSG::Sweep_Frequent* sf{}; + std::shared_ptr xAxis{}; + std::shared_ptr yAxis{}; + std::shared_ptr msr{}; + std::shared_ptr sf{}; QMenu* mMenu{}; void init() override { Plot::init(); object_name = "AxisTestPlot"; - xAxis = YSG::Axis::Builder(this, Qt::Horizontal) + auto data = create_renderable_node(root_renderable(), "DataRenderable"); + auto axis = create_renderable_node(root_renderable(), "AxisRenderable"); + auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable"); + xAxis = YSG::Axis::Builder(axis, Qt::Horizontal) .set_coord_range({0, 100}) .set_tick_length(-10).build(); - yAxis = YSG::Axis::Builder(this, Qt::Vertical) + yAxis = YSG::Axis::Builder(axis, Qt::Vertical) .set_coord_range({100, 0}) .set_tick_length(-10).build(); - sf = YSG::Sweep_Frequent::Builder(xAxis, yAxis) + sf = YSG::Sweep_Frequent::Builder(data, xAxis, yAxis) .set_block_num(200) .set_block_frequent_point_size(20) .set_frequent_range({0, 100}) .build(); - msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build(); + msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build(); } protected: void resizeEvent(QResizeEvent* event) override { @@ -47,10 +50,10 @@ QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() { void contextMenuEvent(QContextMenuEvent* event) override { if (!mMenu) { auto ws = - bw(cw(sf, -1), "扫频图") + - bw(cw(xAxis), "x轴") + - bw(cw(yAxis), "y轴") + - bw(cw(msr), "多选框"); + bw(cw(sf.get(), -1), "扫频图") + + bw(cw(xAxis.get()), "x轴") + + bw(cw(yAxis.get()), "y轴") + + bw(cw(msr.get()), "多选框"); mMenu = createMenu(this, ws); } mMenu->exec(event->globalPos()); @@ -131,11 +134,11 @@ void SweepFrequencyWidget::initMenu() { auto startFreq = new ValueMenuButton("起始频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) { that->setValue(that->mValue + (double)(add ? 1 : -1)); }, -1); - startFreq->setValue(mSweepFrequencyLine->frequent_range().lower); + startFreq->setValue(mSweepFrequencyLine->frequent_range().origin); auto endFreq = new ValueMenuButton("终止频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) { that->setValue(that->mValue + (double)(add ? 1 : -1)); }, -1); - endFreq->setValue(mSweepFrequencyLine->frequent_range().upper); + endFreq->setValue(mSweepFrequencyLine->frequent_range().target); auto btn3 = new MenuButton("设置频率", fontSize, [&, startFreq, endFreq]() { mSweepFrequencyLine->set_frequent_range({startFreq->mValue, endFreq->mValue}); }); diff --git a/module/radio/BackEnd/SweepFrequencyWidget.h b/module/radio/BackEnd/SweepFrequencyWidget.h index 1d94333..d6307d2 100644 --- a/module/radio/BackEnd/SweepFrequencyWidget.h +++ b/module/radio/BackEnd/SweepFrequencyWidget.h @@ -1,6 +1,7 @@ #ifndef SweepFrequencyWidget_H #define SweepFrequencyWidget_H #include "../BaseWidget.h" +#include class TextButton; class DoubleTextButton; class FrequentShower; @@ -22,7 +23,7 @@ public: FrequentShower *mSelectValueWidget; ProgressBar *mProgressBar1, *mProgressBar2; void initMenu(); - YSG::Sweep_Frequent *mSweepFrequencyLine{}; + std::shared_ptr mSweepFrequencyLine{}; QWidget* createSpectrogramPowerPlot(); protected: void focusInEvent(QFocusEvent *event) override;