AMCurrentAmplifierCompositeView::AMCurrentAmplifierCompositeView(AMCurrentAmplifier *amp1, AMCurrentAmplifier *amp2, QWidget *parent) :
	AMCurrentAmplifierView(parent)
{
	amplifier1_ = amp1;

	if (amplifier1_) {
		connect( amplifier1_, SIGNAL(minimumValue(bool)), minus_, SLOT(setDisabled(bool)) );
		connect( amplifier1_, SIGNAL(maximumValue(bool)), plus_, SLOT(setDisabled(bool)) );
		connect( amplifier1_, SIGNAL(valueChanged()), this, SLOT(onAmplifierValueChanged()) );
		connect( amplifier1_, SIGNAL(isConnected(bool)), this, SLOT(refreshView()));
	}

	setContextMenuPolicy(Qt::CustomContextMenu);
	connect( this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)) );

	amplifier2_ = amp2;

	if (amplifier2_) {
		connect( amplifier2_, SIGNAL(minimumValue(bool)), minus_, SLOT(setDisabled(bool)) );
		connect( amplifier2_, SIGNAL(maximumValue(bool)), plus_, SLOT(setDisabled(bool)) );
		connect( amplifier2_, SIGNAL(valueChanged()), this, SLOT(onAmplifierValueChanged()) );
		connect( amplifier2_, SIGNAL(isConnected(bool)), this, SLOT(refreshView()));
	}

	refreshView();
}
Example #2
0
STWidget::STWidget(QWidget *parent) : QWidget(parent)
{
	// Set variables.

	variables_ = new STVariableCollection(this);
	selectedVariable_ = 0;
	plotWidget_ = new STPlotWidget(this);

	// Set up UI.

	QVBoxLayout *mainLayout = new QVBoxLayout();
	mainLayout->addWidget(plotWidget_);

	setLayout(mainLayout);

	setContextMenuPolicy(Qt::CustomContextMenu);
	connect( this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)) );

	// Get current settings.

	setTime();
	setTimeFilteringEnabled();

	// Make connections.
	connect( variables_, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(onCollectionRowAdded(QModelIndex, int, int)) );
	connect( variables_, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), this, SLOT(onCollectionRowRemoved(QModelIndex, int, int)) );
	connect( variables_, SIGNAL(selectionChanged(STVariable*)), this, SLOT(onCollectionSelectionChanged(STVariable*)) );
	connect( variables_, SIGNAL(selectionDescriptionChanged(QString)), this, SLOT(updatePlotLeftAxisName()) );
	connect( variables_, SIGNAL(selectionUnitsChanged(QString)), this, SLOT(updatePlotLeftAxisName()) );
	connect( plotWidget_, SIGNAL(timeChanged(STTime *)), this, SLOT(setTime()) );
	connect( plotWidget_, SIGNAL(timeFilteringEnabled(bool)), this, SLOT(setTimeFilteringEnabled()) );
	connect( plotWidget_, SIGNAL(plotSelectionChanged(MPlotItem*)), this, SLOT(onPlotSelectionChanged(MPlotItem*)) );

}
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)));
}
AMControlMoveButton::AMControlMoveButton(QWidget *parent, AMControl* control, QList<double> stepSizes,  bool directionReversed) :
    QToolButton(parent)
{
	directionReversed_ = directionReversed;

	control_ = 0;
	setControl(control);

	stepSizes_ = stepSizes;
	if(stepSizes_.isEmpty())
		stepSizes_ << 1.0;	// just to make sure we always have at least one, so that stepSizeIndex_ is valid.
	stepSizeIndex_ = 0;

	contextMenu_ = 0;
	setContextMenuPolicy(Qt::CustomContextMenu);
	connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));

	setText(QString::number(currentStepSize()) % (control_ ? control_->units() : QString()));
	connect(this, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
}
Example #5
0
VESPERSEXAFSScanConfigurationView::VESPERSEXAFSScanConfigurationView(VESPERSEXAFSScanConfiguration *config, QWidget *parent)
	: VESPERSScanConfigurationView(parent)
{
	config_ = config;
	AMTopFrame *frame = new AMTopFrame("VESPERS EXAFS Configuration");

	// Regions setup
	regionsView_ = new AMRegionsView(config_->regions());
	regionsView_->setMinimumWidth(300);
	regionsLineView_ = new AMEXAFSLineView(config_->exafsRegions());

	// The fluorescence detector setup
	QGroupBox *fluorescenceDetectorGroupBox = addFluorescenceDetectorSelectionView();
	connect(fluorescenceButtonGroup_, SIGNAL(buttonClicked(int)), this, SLOT(onFluorescenceChoiceChanged(int)));
	connect(config_->dbObject(), SIGNAL(fluorescenceDetectorChanged(int)), this, SLOT(updateFluorescenceDetector(int)));
	fluorescenceButtonGroup_->button((int)config_->fluorescenceDetector())->setChecked(true);

	// Ion chamber selection
	QGroupBox *ItGroupBox = addItSelectionView();
	connect(ItGroup_, SIGNAL(buttonClicked(int)), this, SLOT(onItClicked(int)));
	connect(config_->dbObject(), SIGNAL(transmissionChoiceChanged(int)), this, SLOT(updateItButtons(int)));

	QGroupBox *I0GroupBox = addI0SelectionView();
	connect(I0Group_, SIGNAL(buttonClicked(int)), this, SLOT(onI0Clicked(int)));
	connect(config_->dbObject(), SIGNAL(incomingChoiceChanged(int)), this, SLOT(updateI0Buttons(int)));

	I0Group_->button((int)config_->incomingChoice())->click();
	ItGroup_->button((int)config_->transmissionChoice())->click();

	QHBoxLayout *ionChambersLayout = new QHBoxLayout;
	ionChambersLayout->addWidget(I0GroupBox);
	ionChambersLayout->addWidget(ItGroupBox);

	// Scan name selection
	scanName_ = addScanNameView(config_->name());
	connect(scanName_, SIGNAL(editingFinished()), this, SLOT(onScanNameEdited()));
	connect(config_, SIGNAL(nameChanged(QString)), scanName_, SLOT(setText(QString)));
	onScanNameEdited();

	QFormLayout *scanNameLayout = new QFormLayout;
	scanNameLayout->addRow("Scan Name:", scanName_);

	// Energy (Eo) selection
	energy_ = new QDoubleSpinBox;
	energy_->setSuffix(" eV");
	energy_->setMinimum(0);
	energy_->setMaximum(30000);
	connect(energy_, SIGNAL(editingFinished()), this, SLOT(setEnergy()));

	elementChoice_ = new QToolButton;
	connect(elementChoice_, SIGNAL(clicked()), this, SLOT(onElementChoiceClicked()));

	lineChoice_ = new QComboBox;
	connect(lineChoice_, SIGNAL(currentIndexChanged(int)), this, SLOT(onLinesComboBoxIndexChanged(int)));

	if (config_->edge().isEmpty()){

		elementChoice_->setText("Cu");
		fillLinesComboBox(AMPeriodicTable::table()->elementBySymbol("Cu"));
		lineChoice_->setCurrentIndex(0);
	}
	// Resets the view for the view to what it should be.  Using the saved for the energy in case it is different from the original line energy.
	else
		onEdgeChanged();

	connect(config_, SIGNAL(edgeChanged(QString)), this, SLOT(onEdgeChanged()));

	QCheckBox *useFixedTime = new QCheckBox("Use fixed time (EXAFS)");
	useFixedTime->setEnabled(config_->useFixedTime());
	connect(config_->exafsRegions(), SIGNAL(regionsHaveKSpaceChanged(bool)), useFixedTime, SLOT(setEnabled(bool)));
	connect(useFixedTime, SIGNAL(toggled(bool)), config_, SLOT(setUseFixedTime(bool)));

	QSpinBox *numberOfScans = new QSpinBox;
	numberOfScans->setMinimum(1);
	numberOfScans->setValue(config_->numberOfScans());
	numberOfScans->setAlignment(Qt::AlignCenter);
	connect(numberOfScans, SIGNAL(valueChanged(int)), config_, SLOT(setNumberOfScans(int)));
	connect(config_, SIGNAL(numberOfScansChanged(int)), this, SLOT(onEstimatedTimeChanged()));

	QFormLayout *numberOfScansLayout = new QFormLayout;
	numberOfScansLayout->addRow("Number of Scans:", numberOfScans);

	QFormLayout *energySetpointLayout = new QFormLayout;
	energySetpointLayout->addRow("Energy:", energy_);

	QHBoxLayout *energyLayout = new QHBoxLayout;
	energyLayout->addLayout(energySetpointLayout);
	energyLayout->addWidget(elementChoice_);
	energyLayout->addWidget(lineChoice_);

	// Setting the scan position.
	QGroupBox *goToPositionGroupBox = addGoToPositionView(config_->goToPosition(), config_->x(), config_->y());

	connect(config_, SIGNAL(gotoPositionChanged(bool)), goToPositionCheckBox_, SLOT(setChecked(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), config_, SLOT(setGoToPosition(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), setCurrentPositionButton_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedXPosition_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedYPosition_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), positionsSaved_, SLOT(setEnabled(bool)));
	connect(setCurrentPositionButton_, SIGNAL(clicked()), this, SLOT(setScanPosition()));

	setSampleStage(VESPERSBeamline::vespers()->experimentConfiguration()->sampleStageChoice());

	// The estimated scan time.
	estimatedTime_ = new QLabel;
	estimatedSetTime_ = new QLabel;
	connect(config_, SIGNAL(totalTimeChanged(double)), this, SLOT(onEstimatedTimeChanged()));
	onEstimatedTimeChanged();

	// The roi text edit.
	roiText_ = new QTextEdit;
	roiText_->setReadOnly(true);

	QPushButton *configureXRFDetectorButton = new QPushButton(QIcon(":/hammer-wrench.png"), "Configure XRF Detector");
	connect(configureXRFDetectorButton, SIGNAL(clicked()), this, SLOT(onConfigureXRFDetectorClicked()));

	QFormLayout *roiTextLayout = new QFormLayout;
	roiTextLayout->addRow(roiText_);
	roiTextLayout->addRow(configureXRFDetectorButton);

	roiTextBox_ = new QGroupBox("Regions Of Interest");
	roiTextBox_->setLayout(roiTextLayout);
	roiTextBox_->setVisible(config_->fluorescenceDetector() == VESPERS::NoXRF ? false : true);

	// Label showing where the data will be saved.
	QLabel *exportPath = addExportPathLabel();

	// Label with a help message for EXAFS.
	QLabel *helpMessage = new QLabel("Note when using EXAFS: when using variable integration time, the time column is the maximum time.");

	// Default XANES and EXAFS buttons.
	QPushButton *defaultXANESButton = new QPushButton("Default XANES");
	connect(defaultXANESButton, SIGNAL(clicked()), this, SLOT(onDefaultXANESScanClicked()));

	QPushButton *defaultEXAFSButton = new QPushButton("Default EXAFS");
	connect(defaultEXAFSButton, SIGNAL(clicked()), this, SLOT(onDefaultEXAFSScanClicked()));

	// Setting up the steps to show the time offset for scan time estimation.
	connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));
	setContextMenuPolicy(Qt::CustomContextMenu);

	QGroupBox *timeOffsetBox = addTimeOffsetLabel(config_->timeOffset());
	connect(timeOffset_, SIGNAL(valueChanged(double)), this, SLOT(setTimeOffset(double)));

	QVBoxLayout *defaultLayout = new QVBoxLayout;
	defaultLayout->addSpacing(35);
	defaultLayout->addWidget(defaultXANESButton);
	defaultLayout->addWidget(defaultEXAFSButton);
	defaultLayout->addStretch();

	// Auto-export option.
	QGroupBox *autoExportGroupBox = addExporterOptionsView(QStringList(), config_->exportSpectraSources());
	connect(autoExportSpectra_, SIGNAL(toggled(bool)), config_, SLOT(setExportSpectraSources(bool)));

	// Setting up the layout.
	QGridLayout *contentsLayout = new QGridLayout;
	contentsLayout->addWidget(regionsView_, 1, 1, 2, 2);
	contentsLayout->addWidget(fluorescenceDetectorGroupBox, 1, 3);
	contentsLayout->addLayout(scanNameLayout, 4, 1);
	contentsLayout->addLayout(energyLayout, 0, 1, 1, 3);
	contentsLayout->addWidget(goToPositionGroupBox, 4, 3, 4, 1);
	contentsLayout->addLayout(ionChambersLayout, 2, 3, 2, 1);
	contentsLayout->addWidget(roiTextBox_, 1, 4, 2, 2);
	contentsLayout->addWidget(useFixedTime, 3, 1);
	contentsLayout->addWidget(estimatedTime_, 6, 1, 1, 2);
	contentsLayout->addWidget(estimatedSetTime_, 7, 1, 1, 2);
	contentsLayout->addLayout(numberOfScansLayout, 5, 1);
	contentsLayout->addWidget(timeOffsetBox, 8, 1, 1, 2);
	contentsLayout->addWidget(autoExportGroupBox, 4, 5, 2, 3);

	QHBoxLayout *squeezeContents = new QHBoxLayout;
	squeezeContents->addStretch();
	squeezeContents->addLayout(defaultLayout);
	squeezeContents->addLayout(contentsLayout);
	squeezeContents->addStretch();

	QVBoxLayout *configViewLayout = new QVBoxLayout;
	configViewLayout->addWidget(frame);
	configViewLayout->addStretch();
	configViewLayout->addWidget(regionsLineView_, 0, Qt::AlignCenter);
	configViewLayout->addSpacing(30);
	configViewLayout->addLayout(squeezeContents);
	configViewLayout->addSpacing(30);
	configViewLayout->addWidget(exportPath, 0, Qt::AlignCenter);
	configViewLayout->addSpacing(30);
	configViewLayout->addWidget(helpMessage, 0, Qt::AlignCenter);
	configViewLayout->addStretch();

	setLayout(configViewLayout);
}
LYGithubProductBacklogCentralWidget::LYGithubProductBacklogCentralWidget(const QString &username, const QString &repository, QWidget *parent) :
	QWidget(parent)
{
	productBacklog_ = new LYGithubProductBacklog();

	networkBusyView_ = 0;

	statusLogView_ = new LYGithubProductBacklogStatusLogView();
	statusLogView_->hide();

	treeView_ = new QTreeView();
	treeView_->setModel(productBacklog_->model());
	treeView_->setSelectionBehavior(QAbstractItemView::SelectItems);
	treeView_->setSelectionMode(QAbstractItemView::SingleSelection);
	treeView_->setAttribute(Qt::WA_MacShowFocusRect, false);
	treeView_->setDragEnabled(true);
	treeView_->viewport()->setAcceptDrops(true);
	treeView_->setDropIndicatorShown(true);
	treeView_->setDragDropMode(QTreeView::InternalMove);
	treeView_->setContextMenuPolicy(Qt::CustomContextMenu);

	connect(treeView_, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));

	uploadChangesButton_ = new QPushButton("Upload Changes");
	uploadChangesButton_->setEnabled(false);

	closeIssueButton_ = new QPushButton("Close Issue");
	closeIssueButton_->setEnabled(false);

	addIssueButton_ = new QPushButton("Add Issue");

	QHBoxLayout *hl = new QHBoxLayout();
	hl->addWidget(addIssueButton_);
	hl->addWidget(closeIssueButton_);
	hl->addStretch(10);
	hl->addWidget(uploadChangesButton_);

	QVBoxLayout *vl = new QVBoxLayout();
	vl->addLayout(hl);
	vl->addWidget(treeView_);

	setLayout(vl);

	connect(productBacklog_, SIGNAL(activeChanges(bool)), this, SLOT(onActiveChangesChanged(bool)));
	connect(uploadChangesButton_, SIGNAL(clicked()), this, SLOT(onUploadChangesButtonClicked()));
	connect(productBacklog_, SIGNAL(authenticated(bool)), this, SLOT(onAuthenticated(bool)));
	connect(productBacklog_, SIGNAL(uploaded(bool)), this, SLOT(onUploaded(bool)));

	connect(productBacklog_->productBacklogModel(), SIGNAL(modelAboutToBeRefreshed()), this, SLOT(onModelAboutToBeRefreshed()));
	connect(productBacklog_->productBacklogModel(), SIGNAL(modelRefreshed()), this, SLOT(onModelRefreshed()));

	connect(productBacklog_, SIGNAL(sanityCheckReturned(LYProductBacklogModel::ProductBacklogSanityChecks)), this, SLOT(onSanityCheckReturned(LYProductBacklogModel::ProductBacklogSanityChecks)));
	connect(productBacklog_, SIGNAL(networkRequestBusy(bool, QString)), this, SLOT(onNetworkRequestBusy(bool, QString)));

	connect(treeView_, SIGNAL(clicked(QModelIndex)), this, SLOT(onTreeViewIndexClicked(QModelIndex)));
	connect(addIssueButton_, SIGNAL(clicked()), this, SLOT(onAddIssueButtonClicked()));
	connect(closeIssueButton_, SIGNAL(clicked()), this, SLOT(onCloseIssueButtonClicked()));

	authenticationView_ = new LYGithubProductBacklogAuthenticationView(username, repository);
	connect(authenticationView_, SIGNAL(submitAuthenticationInformation(QString,QString,QString)), this, SLOT(onSubmitAuthenticationInformationAvailable(QString,QString,QString)));
	authenticationView_->show();
	authenticationView_->raise();
}
WidgetActions::WidgetActions(QWidget *widget) :
    QObject(widget),
    menu(new QMenu(widget))
{
    connect(widget, SIGNAL(customContextMenuRequested(QPoint)),  SLOT(onCustomContextMenuRequested(QPoint)));
}
AMDataSourcesEditor::AMDataSourcesEditor(AMScanSetModel* model, QWidget *parent) :
		QWidget(parent)
{
	detailEditor_ = 0;
	if (objectName().isEmpty())
		setObjectName(QString::fromUtf8("AMDataSourcesEditor"));
	resize(317, 230);
	QSizePolicy localSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
	localSizePolicy.setHorizontalStretch(0);
	localSizePolicy.setVerticalStretch(0);
	localSizePolicy.setHeightForWidth(sizePolicy().hasHeightForWidth());
	setSizePolicy(localSizePolicy);
	verticalLayout_ = new QVBoxLayout();
	verticalLayout_->setObjectName(QString::fromUtf8("verticalLayout"));
	scanSetView_ = new QTreeView();
	scanSetView_->setObjectName(QString::fromUtf8("scanSetView_"));
	scanSetView_->setAlternatingRowColors(true);

	verticalLayout_->addWidget(scanSetView_);

	addAnalysisToolButtonLayout_ = new QHBoxLayout();
	addAnalysisToolButtonLayout_->setObjectName(QString::fromUtf8("addAnalysisToolButtonLayout_"));
	addAnalysisToolButtonLayout_->setContentsMargins(12, 0, 12, -1);
	addDataSourceButton_ = new QToolButton();
	addDataSourceButton_->setObjectName(QString::fromUtf8("addDataSourceButton_"));

	addAnalysisToolButtonLayout_->addWidget(addDataSourceButton_);

	horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);

	addAnalysisToolButtonLayout_->addItem(horizontalSpacer_2);


	verticalLayout_->addLayout(addAnalysisToolButtonLayout_);

	analysisDetailsLayout_ = new QGridLayout();
	analysisDetailsLayout_->setObjectName(QString::fromUtf8("analysisDetailsLayout_"));
	analysisDetailsLayout_->setContentsMargins(-1, 0, -1, -1);
	nameEdit_ = new QLineEdit();
	nameEdit_->setObjectName(QString::fromUtf8("nameEdit_"));
	nameEdit_->setFrame(false);

	analysisDetailsLayout_->addWidget(nameEdit_, 0, 1, 1, 1);

	descriptionLabel_ = new QLabel();
	descriptionLabel_->setObjectName(QString::fromUtf8("descriptionLabel_"));
	descriptionLabel_->setStyleSheet(QString::fromUtf8("font: bold \"Lucida Grande\";\n"
"color: rgb(121,121,121);"));
	descriptionLabel_->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

	analysisDetailsLayout_->addWidget(descriptionLabel_, 1, 0, 1, 1);

	descriptionEdit_ = new QLineEdit();
	descriptionEdit_->setObjectName(QString::fromUtf8("descriptionEdit_"));
	descriptionEdit_->setFrame(false);

	analysisDetailsLayout_->addWidget(descriptionEdit_, 1, 1, 1, 1);

	nameLabel_ = new QLabel();
	nameLabel_->setObjectName(QString::fromUtf8("nameLabel_"));
	nameLabel_->setStyleSheet(QString::fromUtf8("font: bold \"Lucida Grande\";\n"
"color: rgb(121,121,121);"));
	nameLabel_->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

	analysisDetailsLayout_->addWidget(nameLabel_, 0, 0, 1, 1);


	verticalLayout_->addLayout(analysisDetailsLayout_);

	lineBreak_ = new QFrame();
	lineBreak_->setObjectName(QString::fromUtf8("lineBreak_"));
	lineBreak_->setFrameShape(QFrame::HLine);
	lineBreak_->setFrameShadow(QFrame::Sunken);

	verticalLayout_->addWidget(lineBreak_);

	detailEditorLayout_ = new QVBoxLayout();
	detailEditorLayout_->setObjectName(QString::fromUtf8("detailEditorLayout_"));

	verticalLayout_->addLayout(detailEditorLayout_);

	setWindowTitle(QApplication::translate("AMDataSourcesEditor", "Form", 0, QApplication::UnicodeUTF8));
	addDataSourceButton_->setText(QApplication::translate("AMDataSourcesEditor", "Add Analysis Tool", 0, QApplication::UnicodeUTF8));
	descriptionLabel_->setText(QApplication::translate("AMDataSourcesEditor", "description", 0, QApplication::UnicodeUTF8));
	nameLabel_->setText(QApplication::translate("AMDataSourcesEditor", "name", 0, QApplication::UnicodeUTF8));

	// Modify and adjust UI components
	nameEdit_->setReadOnly(true);	// you can't edit existing data source names.
	// When making new names for data sources, they better be mathematically sound variable names (No spaces, alphabetic character at beginning, no funky symbols, etc...)
	nameEdit_->setValidator(new QRegExpValidator(QRegExp("[A-Za-z_]\\w*"), this));



	// apply 'close item' boxes onto the list of data sources
	itemDelegate_ = new AMCloseItemDelegate();
	itemDelegate_->setCloseButtonsEnabled(true);
	connect(itemDelegate_, SIGNAL(closeButtonClicked(QModelIndex)), this, SLOT(onCloseButtonClicked(QModelIndex)));
	scanSetView_->setItemDelegate(itemDelegate_);

	// apply the existing scan set model to the data source list view:
	model_ = model;
	scanSetView_->setModel(model_);
	connect(scanSetView_->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(onSetViewIndexChanged(QModelIndex,QModelIndex)));

	// don't show the drop-down arrows for scans. (Saves a bit of room inside the list of channels.)
	scanSetView_->setRootIsDecorated(false);

	addDataSourceButton_->setDisabled(true);
	connect(addDataSourceButton_, SIGNAL(clicked()), this, SLOT(onAddDataSourceButtonClicked()));

	editingNewDataSourceName_ =  false;
	nameOfAnalysisBlockToBeAdded_ = "";

	connect(descriptionEdit_, SIGNAL(editingFinished()), this, SLOT(descriptionEditingFinished()));

	showAllDataSources_ = false;
	scanSetView_->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(scanSetView_, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));

	setLayout(verticalLayout_);
}
VESPERSEXAFSScanConfigurationView::VESPERSEXAFSScanConfigurationView(VESPERSEXAFSScanConfiguration *config, QWidget *parent)
	: VESPERSScanConfigurationView(parent)
{
	configuration_ = config;
	AMTopFrame *frame = new AMTopFrame("VESPERS EXAFS Configuration");

	// Regions setup
	regionsView_ = new AMEXAFSScanAxisView("", configuration_);

	QVBoxLayout *regionsViewLayout = new QVBoxLayout;
	regionsViewLayout->addWidget(regionsView_);

	QGroupBox *regionsViewGroupBox = new QGroupBox("Regions Setup");
	regionsViewGroupBox->setLayout(regionsViewLayout);

	// The fluorescence detector setup
	fluorescenceDetectorComboBox_  = createFluorescenceComboBox();
	connect(fluorescenceDetectorComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onFluorescenceChoiceChanged(int)));
	connect(configuration_->dbObject(), SIGNAL(fluorescenceDetectorChanged(int)), this, SLOT(updateFluorescenceDetectorComboBox(int)));
	fluorescenceDetectorComboBox_->setCurrentIndex((int)configuration_->fluorescenceDetector());

	// Ion chamber selection
	itComboBox_ = createIonChamberComboBox();
	connect(itComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onItClicked(int)));
	connect(configuration_->dbObject(), SIGNAL(transmissionChoiceChanged(int)), this, SLOT(updateItComboBox(int)));

	i0ComboBox_ = createIonChamberComboBox();
	connect(i0ComboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(onI0Clicked(int)));
	connect(configuration_->dbObject(), SIGNAL(incomingChoiceChanged(int)), this, SLOT(updateI0ComboBox(int)));

	QHBoxLayout *ionChambersLayout = new QHBoxLayout;
	ionChambersLayout->addWidget(i0ComboBox_);
	ionChambersLayout->addWidget(itComboBox_);

	// Scan name selection
	scanName_ = createScanNameView(configuration_->name());
	connect(scanName_, SIGNAL(editingFinished()), this, SLOT(onScanNameEdited()));
	connect(configuration_, SIGNAL(nameChanged(QString)), scanName_, SLOT(setText(QString)));
	onScanNameEdited();

	// The estimated scan time.
	estimatedTime_ = new QLabel;
	connect(configuration_, SIGNAL(totalTimeChanged(double)), this, SLOT(onEstimatedTimeChanged()));
	onEstimatedTimeChanged();

	QFormLayout *scanNameLayout = new QFormLayout;
	scanNameLayout->addRow("Scan Name:", scanName_);
	scanNameLayout->addRow(estimatedTime_);

	QGroupBox *scanNameGroupBox = new QGroupBox("Scan Name");
	scanNameGroupBox->setLayout(scanNameLayout);

	// Energy (Eo) selection
	energy_ = new QDoubleSpinBox;
	energy_->setSuffix(" eV");
	energy_->setMinimum(0);
	energy_->setMaximum(30000);
	connect(energy_, SIGNAL(editingFinished()), this, SLOT(setEnergy()));

	elementChoice_ = new QToolButton;
	connect(elementChoice_, SIGNAL(clicked()), this, SLOT(onElementChoiceClicked()));

	lineChoice_ = new QComboBox;
	connect(lineChoice_, SIGNAL(currentIndexChanged(int)), this, SLOT(onLinesComboBoxIndexChanged(int)));

	if (configuration_->edge().isEmpty()){

		elementChoice_->setText("Cu");
		fillLinesComboBox(AMPeriodicTable::table()->elementBySymbol("Cu"));
		lineChoice_->setCurrentIndex(0);
	}
	// Resets the view for the view to what it should be.  Using the saved for the energy in case it is different from the original line energy.
	else
		onEdgeChanged();

	connect(configuration_, SIGNAL(edgeChanged(QString)), this, SLOT(onEdgeChanged()));

	QFormLayout *energySetpointLayout = new QFormLayout;
	energySetpointLayout->addRow("Energy:", energy_);

	QHBoxLayout *energyLayout = new QHBoxLayout;
	energyLayout->addLayout(energySetpointLayout);
	energyLayout->addWidget(elementChoice_);
	energyLayout->addWidget(lineChoice_);

	// Setting the scan position.
	QGroupBox *goToPositionGroupBox = addGoToPositionView(configuration_->goToPosition(), configuration_->x(), configuration_->y());

	connect(configuration_, SIGNAL(gotoPositionChanged(bool)), goToPositionCheckBox_, SLOT(setChecked(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), configuration_, SLOT(setGoToPosition(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), setCurrentPositionButton_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedXPosition_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedYPosition_, SLOT(setEnabled(bool)));
	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), positionsSaved_, SLOT(setEnabled(bool)));
	connect(setCurrentPositionButton_, SIGNAL(clicked()), this, SLOT(setScanPosition()));
	connect(configuration_->dbObject(), SIGNAL(motorChanged(int)), this, SLOT(onMotorsUpdated(int)));

	onMotorsUpdated(configuration_->motor());

	// Label showing where the data will be saved.
	QLabel *exportPath = addExportPathLabel();

	// Default XANES and EXAFS buttons.
	QPushButton *defaultXANESButton = new QPushButton("Default XANES");
	connect(defaultXANESButton, SIGNAL(clicked()), this, SLOT(setupDefaultXANESScanRegions()));
	QPushButton *defaultEXAFSButton = new QPushButton("Default EXAFS");
	connect(defaultEXAFSButton, SIGNAL(clicked()), this, SLOT(setupDefaultEXAFSScanRegions()));

	// Setting up the steps to show the time offset for scan time estimation.
	connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));
	setContextMenuPolicy(Qt::CustomContextMenu);

	QGroupBox *timeOffsetBox = addTimeOffsetLabel(configuration_->timeOffset());
	connect(timeOffset_, SIGNAL(valueChanged(double)), this, SLOT(setTimeOffset(double)));

	// Auto-export option.
	QGroupBox *autoExportGroupBox = addExporterOptionsView(QStringList(), configuration_->exportSpectraSources(), configuration_->exportSpectraInRows());
	connect(autoExportSpectra_, SIGNAL(toggled(bool)), configuration_, SLOT(setExportSpectraSources(bool)));
	connect(autoExportSpectra_, SIGNAL(toggled(bool)), exportSpectraInRows_, SLOT(setEnabled(bool)));
	connect(exportSpectraInRows_, SIGNAL(toggled(bool)), this, SLOT(updateExportSpectraInRows(bool)));

	fluorescenceDetectorComboBox_->setCurrentIndex((int)configuration_->fluorescenceDetector());
	i0ComboBox_->setCurrentIndex((int)configuration_->incomingChoice());
	itComboBox_->setCurrentIndex((int)configuration_->transmissionChoice());

	disableStandardI0Options();
	disableStandardItOptions();

	QVBoxLayout *defaultLayout = new QVBoxLayout;
	defaultLayout->addSpacing(35);
	defaultLayout->addWidget(defaultXANESButton);
	defaultLayout->addWidget(defaultEXAFSButton);
	defaultLayout->addStretch();

	QFormLayout *detectorLayout = new QFormLayout;
	detectorLayout->addRow("XRF:", fluorescenceDetectorComboBox_);
	detectorLayout->addRow("I0:", i0ComboBox_);
	detectorLayout->addRow("It:", itComboBox_);

	QGroupBox *detectorGroupBox = new QGroupBox("Detectors");
	detectorGroupBox->setLayout(detectorLayout);

	QGroupBox *afterScanBox = createAfterScanOptionsBox(configuration_->closeFastShutter(), configuration_->returnToOriginalPosition(), configuration_->cleanupScaler());
	connect(closeFastShutterCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setCloseFastShutter(bool)));
//	connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setReturnToOriginalPosition(bool)));
	connect(cleanupScalerCheckBox_, SIGNAL(toggled(bool)), this, SLOT(setCleanupScaler(bool)));

	goToPositionCheckBox_->setDisabled(true);

	// Setting up the layout.
	QGridLayout *contentsLayout = new QGridLayout;
	contentsLayout->addLayout(energyLayout, 0, 0, 1, 3);
	contentsLayout->addWidget(regionsViewGroupBox, 1, 0, 2, 3);
	contentsLayout->addWidget(scanNameGroupBox, 3, 0, 1, 2);
	contentsLayout->addWidget(goToPositionGroupBox, 4, 0, 1, 1);
	contentsLayout->addWidget(timeOffsetBox, 5, 0, 1, 1);
	contentsLayout->addWidget(detectorGroupBox, 3, 2, 1, 1);
	contentsLayout->addWidget(autoExportGroupBox, 4, 1, 1, 2);
	contentsLayout->addWidget(afterScanBox, 5, 2, 1, 1);

	QHBoxLayout *squeezeContents = new QHBoxLayout;
	squeezeContents->addStretch();
	squeezeContents->addLayout(defaultLayout);
	squeezeContents->addLayout(contentsLayout);
	squeezeContents->addStretch();

	QVBoxLayout *configViewLayout = new QVBoxLayout;
	configViewLayout->addWidget(frame);
	configViewLayout->addStretch();
	configViewLayout->addSpacing(30);
	configViewLayout->addLayout(squeezeContents);
	configViewLayout->addSpacing(30);
	configViewLayout->addWidget(exportPath, 0, Qt::AlignCenter);
	configViewLayout->addStretch();

	setLayout(configViewLayout);
}
Example #10
0
SkpFileWidget::SkpFileWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SkpFileWidget),
    m_mouseMoveColor(QColor(193, 210, 240, 50)),
    m_defaultBackgroundColor(QColor(255, 255, 255)),
    m_currMouseRow(-1)
{
    ui->setupUi(this);

    SkpTransferFile::createThread(5);

    m_signal = new SkpSignal(NULL, 0);
    m_signalCallback = new SkpSignal(NULL, 0);

    auto func = std::bind(&SkpFileWidget::registerCallbackChat, this, std::placeholders::_1);
    m_signal->emit_register_ack(MessageClass_MemoryFile, func);
    m_signal->emit_register_ack(MessageClass_Chat, func);

    connect(this, SIGNAL(sigFriendChat(QByteArray)), this, SLOT(onFriendChat(QByteArray)));

    connect(ui->pushFile_pushButton,SIGNAL(clicked()), this, SLOT(onPushFile()));
    connect(ui->refresh_pushButton, SIGNAL(clicked()), this, SLOT(onRefresh()));

    QStringList header;
    header << tr("name") << tr("md5") << tr("offset") << tr("lenth") << tr("服务器文件状态") << tr("请求状态") << tr("%");

    ui->tableWidget->setColumnCount(header.size());
    ui->tableWidget->setHorizontalHeaderLabels(header);
    ui->tableWidget->horizontalHeader()->setStretchLastSection(true);
    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->tableWidget->setShowGrid(false); //设置不显示格子线
    ui->tableWidget->verticalHeader()->setVisible(false); //设置垂直头不可见
    ui->tableWidget->setFrameShape(QFrame::NoFrame); //设置无边框
    ui->tableWidget->horizontalHeader()->setHighlightSections(false);
    ui->tableWidget->setItemDelegate(new NoFocusDelegate());
    ui->tableWidget->setMouseTracking(true);
    ui->tableWidget->horizontalHeader()->setHighlightSections(false);
    connect(ui->tableWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint)));
    connect(ui->tableWidget, SIGNAL(cellEntered(int,int)), this, SLOT(onCellEntered(int,int)));
    connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(onCellClicked(int,int)));



    header.clear();
    header << tr("code") << tr("name") << tr("password");

    ui->friend_tableWidget->setColumnCount(header.size());
    ui->friend_tableWidget->setHorizontalHeaderLabels(header);
    ui->friend_tableWidget->horizontalHeader()->setStretchLastSection(true);
    ui->friend_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->friend_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
    ui->friend_tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
    ui->friend_tableWidget->setShowGrid(false); //设置不显示格子线
    ui->friend_tableWidget->verticalHeader()->setVisible(false); //设置垂直头不可见
    ui->friend_tableWidget->setFrameShape(QFrame::NoFrame); //设置无边框
    ui->friend_tableWidget->horizontalHeader()->setHighlightSections(false);
    ui->friend_tableWidget->setItemDelegate(new NoFocusDelegate());
    ui->friend_tableWidget->setMouseTracking(true);
    ui->friend_tableWidget->horizontalHeader()->setHighlightSections(false);
    connect(ui->refreshFriend_pushButton, SIGNAL(clicked()), this, SLOT(onRefreshFriend()));
    connect(this, SIGNAL(sigRefreshFriend(QByteArray)), this, SLOT(onRefreshFriend(QByteArray)));

    connect(ui->friend_tableWidget, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(onTtemDoubleClicked(QTableWidgetItem*)));


    m_menu = new QMenu(ui->tableWidget);
    m_pullAction = new QAction("down", this);
    connect(m_pullAction, SIGNAL(triggered()), this, SLOT(onPullAction()));
    m_menu->addAction(m_pullAction);

    m_startAction = new QAction("start", this);
    connect(m_startAction, SIGNAL(triggered()), this, SLOT(onStartAction()));
    m_menu->addAction(m_startAction);

    m_stopAction = new QAction("stop", this);
    connect(m_stopAction, SIGNAL(triggered()), this, SLOT(onStopAction()));
    m_menu->addAction(m_stopAction);

    m_deleteAction = new QAction("delete", this);
    connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(onDeleteAction()));
    m_menu->addAction(m_deleteAction);

    onRefresh();
    onRefreshFriend();
}