mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix: The user was not prompted that the number of channels exceeded the limit
This commit is contained in:
parent
991f497a61
commit
516f17e62b
@ -44,6 +44,8 @@
|
||||
using namespace boost;
|
||||
using namespace std;
|
||||
|
||||
//--------------------------ChannelLabel
|
||||
|
||||
ChannelLabel::ChannelLabel(IChannelCheck *check, QWidget *parent, int chanIndex)
|
||||
: QWidget(parent)
|
||||
{
|
||||
@ -73,10 +75,10 @@ ChannelLabel::ChannelLabel(IChannelCheck *check, QWidget *parent, int chanIndex)
|
||||
void ChannelLabel::on_checked()
|
||||
{
|
||||
assert(_checked);
|
||||
_checked->ChannelChecked(_index);
|
||||
_checked->ChannelChecked(_index, _box);
|
||||
}
|
||||
|
||||
//--------------------------
|
||||
//--------------------------DeviceOptions
|
||||
|
||||
namespace pv {
|
||||
namespace dialogs {
|
||||
@ -156,8 +158,15 @@ DeviceOptions::DeviceOptions(QWidget *parent) :
|
||||
_mode_check_timer.start();
|
||||
}
|
||||
|
||||
DeviceOptions::~DeviceOptions(){
|
||||
}
|
||||
DeviceOptions::~DeviceOptions()
|
||||
{
|
||||
}
|
||||
|
||||
void DeviceOptions::ChannelChecked(int index, QObject *object)
|
||||
{
|
||||
QCheckBox* sc = dynamic_cast<QCheckBox*>(object);
|
||||
channel_checkbox_clicked(sc);
|
||||
}
|
||||
|
||||
void DeviceOptions::accept()
|
||||
{
|
||||
@ -531,10 +540,15 @@ void DeviceOptions::analog_channel_check()
|
||||
try_resize_scroll();
|
||||
}
|
||||
|
||||
void DeviceOptions::channel_enable()
|
||||
void DeviceOptions::on_analog_channel_enable()
|
||||
{
|
||||
QCheckBox* sc = dynamic_cast<QCheckBox*>(sender());
|
||||
channel_checkbox_clicked(sc);
|
||||
}
|
||||
|
||||
void DeviceOptions::channel_checkbox_clicked(QCheckBox *sc)
|
||||
{
|
||||
if (_device_agent->get_work_mode() == LOGIC) {
|
||||
QCheckBox* sc=dynamic_cast<QCheckBox*>(sender());
|
||||
if (sc == NULL || !sc->isChecked())
|
||||
return;
|
||||
|
||||
@ -574,7 +588,6 @@ void DeviceOptions::channel_enable()
|
||||
}
|
||||
}
|
||||
else if (_device_agent->get_work_mode() == ANALOG) {
|
||||
QCheckBox* sc=dynamic_cast<QCheckBox*>(sender());
|
||||
if (sc != NULL) {
|
||||
QGridLayout *const layout = (QGridLayout *)sc->property("Layout").value<void *>();
|
||||
int i = layout->count();
|
||||
@ -655,7 +668,7 @@ void DeviceOptions::analog_probes(QGridLayout &layout)
|
||||
}
|
||||
_probe_options_binding_list.push_back(probe_options_binding);
|
||||
|
||||
connect(probe_checkBox, SIGNAL(released()), this, SLOT(channel_enable()));
|
||||
connect(probe_checkBox, SIGNAL(released()), this, SLOT(on_analog_channel_enable()));
|
||||
|
||||
tabWidget->addTab(probe_widget, QString::fromUtf8(probe->name));
|
||||
}
|
||||
@ -666,11 +679,6 @@ void DeviceOptions::analog_probes(QGridLayout &layout)
|
||||
_dynamic_panel->setFixedHeight(_groupHeight2);
|
||||
}
|
||||
|
||||
void DeviceOptions::ChannelChecked(int index)
|
||||
{
|
||||
channel_enable();
|
||||
}
|
||||
|
||||
QString DeviceOptions::dynamic_widget(QLayout *lay)
|
||||
{
|
||||
int mode = _device_agent->get_work_mode();
|
||||
|
@ -49,7 +49,7 @@ class QScrollArea;
|
||||
class IChannelCheck
|
||||
{
|
||||
public:
|
||||
virtual void ChannelChecked(int index)=0;
|
||||
virtual void ChannelChecked(int index, QObject *object)=0;
|
||||
};
|
||||
|
||||
class ChannelLabel : public QWidget
|
||||
@ -109,9 +109,11 @@ private:
|
||||
void build_dynamic_panel();
|
||||
void try_resize_scroll();
|
||||
|
||||
void channel_checkbox_clicked(QCheckBox *sc);
|
||||
|
||||
private:
|
||||
//IChannelCheck
|
||||
void ChannelChecked(int index);
|
||||
void ChannelChecked(int index, QObject *object);
|
||||
|
||||
private slots:
|
||||
void enable_all_probes();
|
||||
@ -121,7 +123,7 @@ private slots:
|
||||
void channel_check();
|
||||
void analog_channel_check();
|
||||
void on_calibration();
|
||||
void channel_enable();
|
||||
void on_analog_channel_enable();
|
||||
|
||||
private:
|
||||
std::vector<QCheckBox *> _probes_checkBox_list;
|
||||
|
Loading…
x
Reference in New Issue
Block a user