CLSSIS3820CompositeScalerChannelView::CLSSIS3820CompositeScalerChannelView(CLSSIS3820ScalerChannel *channel1, CLSSIS3820ScalerChannel *channel2, QWidget *parent)
	: QWidget(parent)
{
	channel1_ = channel1;
	channel2_ = channel2;
	viewMode_ = Counts;
	compositeName_ = "";
	showCompositeView_ = true;

	enableBox_ = new QCheckBox;

	if(channel1_->isConnected() && channel1_->isEnabled())
		enableBox_->setChecked(true);

	connect(channel1_, SIGNAL(enabledChanged(bool)), enableBox_, SLOT(setChecked(bool)));
	connect(enableBox_, SIGNAL(toggled(bool)), channel1_, SLOT(setEnabled(bool)));

	channelName_ = new QLabel(channel1_->customChannelName());

	amplifierView_ = 0;
	connect(channel1_, SIGNAL(currentAmplifierAttached()), this, SLOT(onNewCurrentAmplifierAttached()));

	if (channel1_->currentAmplifier() && channel2_->currentAmplifier()){

		amplifierView_ = new AMCurrentAmplifierCompositeView(channel1_->currentAmplifier(), channel2_->currentAmplifier());
		connect(amplifierView_, SIGNAL(viewModeChanged(AMCurrentAmplifierView::ViewMode)), this, SIGNAL(amplifierViewModeChanged(AMCurrentAmplifierView::ViewMode)));
	}

	scalerOutput_ = new QToolButton;
	scalerOutput_->setAutoRaise(true);

	connect(channel1_, SIGNAL(readingChanged(int)), this, SLOT(onReadingChanged()));
	connect(scalerOutput_, SIGNAL(clicked()), this, SLOT(onScalerOutputClicked()));

	statusLabel_ = new QLabel;
	statusLabel_->setPixmap(QIcon(":/32x32/greenLEDOff.png").pixmap(22));
	statusLabel_->setVisible(channel1_->voltageRange().isValid());
	connect(channel1_, SIGNAL(voltageRangeChanged(AMRange)), this, SLOT(updateStatusLabel()));

	if(channel1_->isConnected())
		onReadingChanged();

	channelLayout_ = new QHBoxLayout;
	channelLayout_->addWidget(enableBox_, 0, Qt::AlignLeft);
	channelLayout_->addWidget(channelName_, 0, Qt::AlignCenter);

	if (amplifierView_)
		channelLayout_->addWidget(amplifierView_, 0, Qt::AlignCenter);

	channelLayout_->addWidget(scalerOutput_, 0, Qt::AlignCenter);
	channelLayout_->addWidget(statusLabel_, 0, Qt::AlignRight);

	setLayout(channelLayout_);
	setVisible(!channel1_->customChannelName().isEmpty());

	setContextMenuPolicy(Qt::CustomContextMenu);
	connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));
}
예제 #2
0
CLSAMDSScalerChannelView::CLSAMDSScalerChannelView(CLSAMDSScalerChannel *channel, QWidget *parent)
	: QWidget(parent)
{
	channel_ = channel;
	viewMode_ = Counts;

	enableBox_ = new QCheckBox;

	if(channel_->isConnected() && channel_->isEnabled())
		enableBox_->setChecked(true);

	connect(channel_, SIGNAL(enabledChanged(bool)), enableBox_, SLOT(setChecked(bool)));
	connect(enableBox_, SIGNAL(toggled(bool)), channel_, SLOT(setEnabled(bool)));

	channelName_ = new QLabel(channel_->customChannelName());
	channelName_->setFixedWidth(80);

	amplifierView_ = 0;

	connect(channel_, SIGNAL(currentAmplifierAttached()), this, SLOT(onNewCurrentAmplifierAttached()));

	if (channel_->currentAmplifier()){

		amplifierView_ = channel_->currentAmplifier()->createView();
		connect( amplifierView_, SIGNAL(viewModeChanged(AMCurrentAmplifierView::ViewMode)), this, SIGNAL(amplifierViewModeChanged(AMCurrentAmplifierView::ViewMode)) );

	}

	scalerOutput_ = new QToolButton;
	scalerOutput_->setMaximumWidth(100);
	scalerOutput_->setAutoRaise(true);


	connect(channel_, SIGNAL(readingChanged(int)), this, SLOT(onReadingChanged()));
	connect(scalerOutput_, SIGNAL(clicked()), this, SLOT(onScalerOutputClicked()));

	statusLabel_ = new QLabel;
	statusLabel_->setPixmap(QIcon(":/22x22/greenLEDOff.png").pixmap(22));
	connect(channel_, SIGNAL(voltageRangeChanged(AMRange)), this, SLOT(updateStatusLabel()));

	if(channel_->isConnected())
		onReadingChanged();

	channelLayout_ = new QHBoxLayout;
	channelLayout_->addWidget(enableBox_, 0, Qt::AlignLeft);
	channelLayout_->addWidget(channelName_, 0, Qt::AlignCenter);

	if (amplifierView_)
		channelLayout_->addWidget(amplifierView_, 0, Qt::AlignCenter);

	channelLayout_->addWidget(scalerOutput_, 0, Qt::AlignCenter);
	channelLayout_->addWidget(statusLabel_, 0, Qt::AlignRight);
	channelLayout_->setContentsMargins(1, 1, 1, 1);

	setLayout(channelLayout_);

	statusLabel_->setVisible(channel_->voltageRange().isValid());
}
예제 #3
0
파일: utility.cpp 프로젝트: Slocan/EZRil
QTM_USE_NAMESPACE
#endif

// Orientation code adapted from http://cdumez.blogspot.com/2010/12/screen-orientation-detection-for-qml.html

Utility::Utility(QObject *parent, QmlApplicationViewer *viewerRef) :
    QObject(parent), m_state("Portrait")
{
    viewer = viewerRef;
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN)
    m_sensor = new QOrientationSensor(this);
    connect(m_sensor, SIGNAL(readingChanged()), SLOT(onReadingChanged()));
    m_sensor->start();
#endif
}