Skip to content

Commit 7ec7991

Browse files
committed
实现保存按钮对应功能
1 parent 77825ff commit 7ec7991

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

MindViewer/mainwidget.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ MainWidget::MainWidget(QWidget *parent)
88
, ui(new Ui::MainWidget)
99
, m_parser(new DataParser)
1010
, m_bStatus(false)
11+
, m_eType(None)
1112
{
1213
ui->setupUi(this);
1314
ui->widgetAttention->setLabel("注意力");
@@ -50,13 +51,15 @@ void MainWidget::sltBtnCOM()
5051
m_bStatus = true;
5152
ui->labelStatusValue->setText("运行");
5253
m_parser->setSource(COM);
54+
m_eType = COM;
5355
}
5456

5557
void MainWidget::sltBtnSIM()
5658
{
5759
m_bStatus = true;
5860
ui->labelStatusValue->setText("运行");
5961
m_parser->setSource(Sim);
62+
m_eType = Sim;
6063
}
6164

6265
void MainWidget::sltBtnLocal()
@@ -73,6 +76,7 @@ void MainWidget::sltBtnLocal()
7376
ui->labelStatusValue->setText("运行");
7477
m_parser->setFilePath(filePath);
7578
m_parser->setSource(Local);
79+
m_eType = Local;
7680
}
7781

7882
void MainWidget::sltBtnPlay()
@@ -104,7 +108,19 @@ void MainWidget::sltBtnClear()
104108

105109
void MainWidget::sltBtnSave()
106110
{
107-
QMessageBox::information(this,tr("警告"),tr("功能未实现,不要乱点"),QMessageBox::Ok);
111+
switch(m_eType){
112+
case COM:
113+
break;
114+
case Sim:
115+
QMessageBox::warning(this,tr("警告"),tr("模拟数据没必要保存"));
116+
break;
117+
case Local:
118+
QMessageBox::warning(this,tr("警告"),tr("你告诉我已经保存的数据怎么再保存"));
119+
break;
120+
default:
121+
QMessageBox::warning(this,tr("警告"),tr("没有选择源怎么保存"));
122+
break;
123+
}
108124
}
109125

110126
// 从解析类中获取数据然后显示

MindViewer/mainwidget.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,7 @@ private slots:
7272
DataParser *m_parser;
7373

7474
bool m_bStatus;//状态控制
75+
76+
DataSourceType m_eType;//当前模式
7577
};
7678
#endif // MAINWIDGET_H

0 commit comments

Comments
 (0)