3 changed files with 114 additions and 11 deletions
-
107src/app/syncbox16ch/syncbox16ch.cpp
-
6src/app/syncbox16ch/syncbox16ch.h
-
12src/app/syncbox16ch/syncbox16ch.ui
@ -1,14 +1,105 @@ |
|||||
#include "syncbox16ch.h"
|
#include "syncbox16ch.h"
|
||||
|
|
||||
#include "ui_syncbox16ch.h"
|
#include "ui_syncbox16ch.h"
|
||||
|
|
||||
SyncBox16CH::SyncBox16CH(QWidget *parent) : |
|
||||
QWidget(parent), |
|
||||
ui(new Ui::SyncBox16CH) |
|
||||
{ |
|
||||
ui->setupUi(this); |
|
||||
|
typedef enum { |
||||
|
koutput_mode_continue_mode, |
||||
|
koutput_mode_pluse_mode, |
||||
|
} OutputMode_t; |
||||
|
|
||||
|
typedef enum { |
||||
|
// 自定义
|
||||
|
koutput_pluse_type_custom, |
||||
|
// 方波
|
||||
|
koutput_pluse_type_square_wave, |
||||
|
} OutputPluseType_t; |
||||
|
|
||||
|
static QString outputMode2Str(OutputMode_t mode) { |
||||
|
if (mode == koutput_mode_continue_mode) { |
||||
|
return "连续模式"; |
||||
|
} else if (mode == koutput_mode_pluse_mode) { |
||||
|
return "脉冲模式"; |
||||
|
} else { |
||||
|
return "未知模式"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
static OutputMode_t outputModeStr2Enum(QString str) { |
||||
|
if (str == "连续模式") { |
||||
|
return koutput_mode_continue_mode; |
||||
|
} else if (str == "脉冲模式") { |
||||
|
return koutput_mode_pluse_mode; |
||||
|
} else { |
||||
|
return koutput_mode_continue_mode; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
static QString outputPluseType2Str(OutputPluseType_t type) { |
||||
|
if (type == koutput_pluse_type_custom) { |
||||
|
return "自定义"; |
||||
|
} else if (type == koutput_pluse_type_square_wave) { |
||||
|
return "方波"; |
||||
|
} else { |
||||
|
return "未知"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
static OutputPluseType_t outputPluseTypeStr2Enum(QString str) { |
||||
|
if (str == "自定义") { |
||||
|
return koutput_pluse_type_custom; |
||||
|
} else if (str == "方波") { |
||||
|
return koutput_pluse_type_square_wave; |
||||
|
} else { |
||||
|
return koutput_pluse_type_custom; |
||||
|
} |
||||
} |
} |
||||
|
|
||||
SyncBox16CH::~SyncBox16CH() |
|
||||
{ |
|
||||
delete ui; |
|
||||
|
SyncBox16CH::SyncBox16CH(QWidget *parent) : QWidget(parent), ui(new Ui::SyncBox16CH) { |
||||
|
ui->setupUi(this); |
||||
|
|
||||
|
{ |
||||
|
//
|
||||
|
// ui->StateGB->hide();
|
||||
|
ui->OutputModeVal->addItem(outputMode2Str(koutput_mode_continue_mode)); |
||||
|
ui->OutputModeVal->addItem(outputMode2Str(koutput_mode_pluse_mode)); |
||||
|
|
||||
|
ui->OutputPluseTypeVal->addItem(outputPluseType2Str(koutput_pluse_type_custom)); |
||||
|
ui->OutputPluseTypeVal->addItem(outputPluseType2Str(koutput_pluse_type_square_wave)); |
||||
|
|
||||
|
ui->OutputPluseWidthVal->setText("1"); |
||||
|
ui->OutputPluseNumVal->setText("1"); |
||||
|
ui->OutputPluseFreqVal->setText("1000"); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
SyncBox16CH::~SyncBox16CH() { delete ui; } |
||||
|
|
||||
|
void SyncBox16CH::on_OutputModeVal_currentIndexChanged(const QString &arg1) { onModeChange(); } |
||||
|
void SyncBox16CH::on_OutputPluseTypeVal_currentIndexChanged(const QString &arg1) { onModeChange(); } |
||||
|
void SyncBox16CH::onModeChange() { |
||||
|
OutputMode_t outputMode = outputModeStr2Enum(ui->OutputModeVal->currentText()); |
||||
|
OutputPluseType_t outputPluseType = outputPluseTypeStr2Enum(ui->OutputPluseTypeVal->currentText()); |
||||
|
|
||||
|
if (outputMode == koutput_mode_continue_mode) { |
||||
|
ui->OutputPluseNumVal->hide(); |
||||
|
ui->OutputPluseNumTag->hide(); |
||||
|
} else if (outputMode == koutput_mode_pluse_mode) { |
||||
|
ui->OutputPluseNumVal->show(); |
||||
|
ui->OutputPluseNumTag->show(); |
||||
|
} |
||||
|
|
||||
|
if (outputPluseType == koutput_pluse_type_custom) { |
||||
|
ui->OutputPluseWidthVal->show(); |
||||
|
ui->OutputPluseWidthTag->show(); |
||||
|
} else if (outputPluseType == koutput_pluse_type_square_wave) { |
||||
|
ui->OutputPluseWidthVal->hide(); |
||||
|
ui->OutputPluseWidthTag->hide(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
void SyncBox16CH::on_SendButton_clicked() { |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
} |
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue