included images

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@52 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d
2012-09-07 16:29:32 +00:00
parent a4a0237711
commit c9db2c4272
25 changed files with 331 additions and 147 deletions

View File

@ -45,6 +45,7 @@ void qActionsWidget::SetupWidgetWindow(){
NUM_ACTION_WIDGETS++;
setFixedHeight(25);
}

View File

@ -99,10 +99,10 @@ void qDetectorMain::SetUpWidgetWindow(){
// creating all the tab widgets
tab_messages = new qTabMessages (this, myDet); cout<<"Messages ready"<<endl;
tab_measurement = new qTabMeasurement (this, myDet,myPlot); cout<<"Measurement ready"<<endl;
tab_dataoutput = new qTabDataOutput (this, myDet, detID); cout<<"DataOutput ready"<<endl;
tab_dataoutput = new qTabDataOutput (this, myDet); cout<<"DataOutput ready"<<endl;
tab_plot = new qTabPlot (this, myDet,myPlot); cout<<"Plot ready"<<endl;
tab_actions = new qTabActions (this, myDet); cout<<"Actions ready"<<endl;
tab_settings = new qTabSettings (this, myDet, detID); cout<<"Settings ready"<<endl;
tab_settings = new qTabSettings (this, myDet); cout<<"Settings ready"<<endl;
tab_advanced = new qTabAdvanced (this, myDet); cout<<"Advanced ready"<<endl;
tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<<endl;
tab_developer = new qTabDeveloper (this, myDet); cout<<"Developer ready"<<endl;

View File

@ -129,7 +129,8 @@ void qScanWidget::SetupWidgetWindow(){
QHBoxLayout *layoutCustom = new QHBoxLayout(widgetCustom);
layoutCustom->setContentsMargins(0, 0, 0, 0);
comboCustom = new QComboBox(widgetCustom);
btnCustom = new QPushButton("Delete",widgetCustom);
btnCustom = new QPushButton("Delete ",widgetCustom);
btnCustom->setIcon(QIcon( ":/icons/images/close.png" ));
comboCustom->setEditable(true);
comboCustom->setCompleter(false);
comboCustom->setValidator(new QDoubleValidator(comboCustom));

View File

@ -56,8 +56,13 @@ void qTabActions::SetupWidgetWindow(){
// Buttongroup to know which +/- button was clicked
group = new QButtonGroup(this);
group->setExclusive(false);
palette = new QPalette();
QPalette p;
p.setColor(QPalette::Shadow,QColor(0,0,0,0));
p.setColor(QPalette::Button,QColor(0,0,0,0));
char names[NumTotalActions][200] = {
"Action at Start",
"Scan Level 0",
@ -70,15 +75,30 @@ void qTabActions::SetupWidgetWindow(){
"Action at Stop"
};
//creating the icons for the buttons
iconPlus = new QIcon(":/icons/images/add.png");
iconMinus = new QIcon(":/icons/images/remove.png");
QString tip = "<nobr>Click on the \"+\" to Expand or \"-\" to Collapse.</nobr>";
// For each level of Actions
for(int i=0;i<NumTotalActions;i++){
//common widgets
lblName[i] = new QLabel(QString(names[i]));
btnExpand[i] = new QPushButton("+");
btnExpand[i]->setFixedSize(20,20);
QString tip = "<nobr>Click on the \"+\" to Expand or \"-\" to Collapse.</nobr>";
btnExpand[i] = new QPushButton();
lblName[i]->setToolTip(tip);
btnExpand[i]->setCheckable(true);
btnExpand[i]->setChecked(false);
btnExpand[i]->setFixedSize(16,16);
btnExpand[i]->setToolTip(tip);
btnExpand[i]->setIcon(*iconPlus);
btnExpand[i]->setFocusPolicy(Qt::NoFocus);
btnExpand[i]->setFlat(true);
btnExpand[i]->setIconSize(QSize(16,16));
btnExpand[i]->setPalette(p);
group->addButton(btnExpand[i],i);
//add the widgets to the layout , depending on the type create the widgets
@ -157,7 +177,9 @@ void qTabActions::CreatePositionsWidget(){
comboPos->setValidator(validate);
layout->addWidget(comboPos,0,5);
layout->addItem(new QSpacerItem(5,20,QSizePolicy::Fixed,QSizePolicy::Fixed),0,6);
btnDelete = new QPushButton("Delete");
btnDelete = new QPushButton("Delete ");
btnDelete->setEnabled(false);
btnDelete->setIcon(QIcon( ":/icons/images/close.png" ));
btnDelete->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
layout->addWidget(btnDelete,0,7);
@ -202,11 +224,12 @@ void qTabActions::Initialization(){
void qTabActions::Expand(QAbstractButton *button ){
int index = group->id(button);
// Collapse
if(!QString::compare(button->text(), "-")){
if(!button->isChecked()){
palette->setColor(QPalette::WindowText,Qt::black);
lblName[index]->setPalette(*palette);
button->setText("+");
button->setIcon(*iconPlus);
if(index==NumPositions) {
positionWidget->hide();
@ -234,9 +257,11 @@ void qTabActions::Expand(QAbstractButton *button ){
}
}else{
// Expand
//always set title color to blue for expan\d
palette->setColor(QPalette::WindowText,QColor(0,0,200,255));
lblName[index]->setPalette(*palette);
button->setText("-");
button->setIcon(*iconMinus);
if(index==NumPositions){
positionWidget->show();
setFixedHeight(height()+30);//+80 if the checkboxes are included
@ -265,6 +290,7 @@ void qTabActions::SetPosition(){
comboPos->setMaxCount(numPos);
comboPos->setEnabled(numPos);
lblPosList->setEnabled(numPos);
btnDelete->setEnabled(numPos);
//deleting too many or not entering enough
if(numPos>comboPos->count()){
@ -378,6 +404,7 @@ void qTabActions::Refresh(){
disconnect(comboPos,SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
comboPos->setEnabled(numPos);
lblPosList->setEnabled(numPos);
btnDelete->setEnabled(numPos);
lblPosList->setText("List of Positions: ");
lblPosList->setPalette(normal);
for(int i=0;i<comboPos->count();i++)

View File

@ -87,6 +87,9 @@ void qTabAdvanced::Initialization(){
//start Trimming
connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming()));
//refresh
connect(btnRefresh, SIGNAL(clicked()), this, SLOT(UpdatePlot()));
}
@ -319,9 +322,6 @@ void qTabAdvanced::StartTrimming(){
break;
}
#ifdef VERBOSE
#endif
//execute
int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1);
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){
@ -330,6 +330,8 @@ void qTabAdvanced::StartTrimming(){
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1))
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced");
else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced");
//updates plots
UpdatePlot();
}
else
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced");
@ -339,6 +341,16 @@ void qTabAdvanced::StartTrimming(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::UpdatePlot(){
#ifdef VERBOSE
cout << "Updating Plot" << endl;
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Refresh(){
//disconnect
disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));

View File

@ -25,8 +25,9 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector,int detID):
QWidget(parent),myDet(detector),detID(detID){
qTabDataOutput::qTabDataOutput(QWidget *parent,multiSlsDetector*& detector):
QWidget(parent),myDet(detector){
setupUi(this);
SetupWidgetWindow();
Initialization();
@ -241,7 +242,7 @@ void qTabDataOutput::SetRateCorrection(){
#ifdef VERBOSE
cout << "Entering Set Rate Correction function" << endl;
#endif
slsDetector *s = myDet->getSlsDetector(detID);
if(chkRate->isChecked()){
radioAuto->setEnabled(true);
radioDeadTime->setEnabled(true);
@ -251,14 +252,14 @@ void qTabDataOutput::SetRateCorrection(){
//auto
if(radioAuto->isChecked()){
spinDeadTime->setEnabled(false);
s->setRateCorrection(-1);
myDet->setRateCorrection(-1);
#ifdef VERBOSE
cout << "Setting rate corrections with default dead time" << endl;
#endif
}//custom dead time
else{
spinDeadTime->setEnabled(true);
s->setRateCorrection((double)spinDeadTime->value());
myDet->setRateCorrection((double)spinDeadTime->value());
#ifdef VERBOSE
cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl;
#endif
@ -270,7 +271,7 @@ void qTabDataOutput::SetRateCorrection(){
spinDeadTime->setEnabled(false);
//Unsetting rate correction
s->setRateCorrection(0);
myDet->setRateCorrection(0);
#ifdef VERBOSE
cout << "Unsetting rate correction" << endl;
#endif
@ -291,8 +292,7 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){
disconnect(spinDeadTime, SIGNAL(valueChanged(double)), this, SLOT(SetRateCorrection()));
double rate;
slsDetector *s = myDet->getSlsDetector(detID);
rate = (double)s->getRateCorrectionTau();
rate = (double)myDet->getRateCorrectionTau();
#ifdef VERBOSE
cout << "Getting rate correction from server:" << rate << " : ";
#endif

View File

@ -81,6 +81,11 @@ void qTabMeasurement::SetupWidgetWindow(){
//file write enabled/disabled
chkFile->setChecked(myDet->enableWriteToFile());
//creating the icons for the buttons
iconStart = new QIcon(":/icons/images/start.png");
iconStop = new QIcon(":/icons/images/stop.png");
}
@ -278,12 +283,13 @@ void qTabMeasurement::setRunIndex(int index){
void qTabMeasurement::startStopAcquisition(){
if(!btnStartStop->text().compare("Start")){
if(btnStartStop->isChecked()){
#ifdef VERBOSE
cout << endl << endl << "Starting Acquisition" << endl;
#endif
//btnStartStop->setStyleSheet("color:red");
btnStartStop->setText("Stop");
btnStartStop->setIcon(*iconStop);
Enable(0);
progressBar->setValue(0);
//the progress which keeps adding up for all the measurements
@ -301,6 +307,8 @@ void qTabMeasurement::startStopAcquisition(){
//btnStartStop->setStyleSheet("background:rgb(239,239,239)");
progressTimer->stop();
btnStartStop->setText("Start");
btnStartStop->setIcon(*iconStart);
btnStartStop->setChecked(false);
Enable(1);
emit StopSignal();
}
@ -313,6 +321,8 @@ void qTabMeasurement::startStopAcquisition(){
void qTabMeasurement::UpdateFinished(){
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
btnStartStop->setText("Start");
btnStartStop->setIcon(*iconStart);
btnStartStop->setChecked(false);
//btnStartStop->setStyleSheet("color:green");
//btnStartStop->setStyleSheet("background:rgb(239,239,239)");
Enable(1);

View File

@ -16,7 +16,6 @@
#include <QFile>
#include <QTextStream>
#include <QFileDialog>
#include <QSizePolicy>
/** C++ Include Headers */
#include <iostream>
#include <string>
@ -47,15 +46,16 @@ void qTabMessages::SetupWidgetWindow(){
dispLog->setFocusPolicy(Qt::NoFocus);
dispLog->setTextColor(Qt::darkBlue);
QSizePolicy sizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
btnSave = new QPushButton("Save Log",this);
btnSave = new QPushButton("Save Log ",this);
btnSave->setFocusPolicy(Qt::NoFocus);
btnSave->setSizePolicy(sizePolicy);
btnSave->setFixedWidth(100);
btnSave->setIcon(QIcon( ":/icons/images/save.png" ));
btnClear = new QPushButton("Clear",this);
btnClear = new QPushButton("Clear ",this);
btnClear->setFocusPolicy(Qt::NoFocus);
btnClear->setSizePolicy(sizePolicy);
btnClear->setFixedWidth(100);
btnClear->setIcon(QIcon( ":/icons/images/erase.png" ));
gridLayout->addWidget(btnSave,0,0,1,1);
gridLayout->addWidget(btnClear,0,4,1,1);

View File

@ -17,8 +17,8 @@ using namespace std;
//-------------------------------------------------------------------------------------------------------------------------------------------------
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector,int detID):
QWidget(parent),myDet(detector),detID(detID){
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector):
QWidget(parent),myDet(detector){
setupUi(this);
SetupWidgetWindow();
@ -40,7 +40,7 @@ void qTabSettings::SetupWidgetWindow(){
// Settings
SetupDetectorSettings();
comboSettings->setCurrentIndex(myDet->getSettings(detID));
comboSettings->setCurrentIndex(myDet->getSettings());
//threshold
spinThreshold->setValue(myDet->getThresholdEnergy());
@ -68,7 +68,7 @@ void qTabSettings::SetupWidgetWindow(){
void qTabSettings::SetupDetectorSettings(){
// Get detector settings from detector
slsDetectorDefs::detectorSettings sett = myDet->getSettings(detID);
slsDetectorDefs::detectorSettings sett = myDet->getSettings();
// To be able to index items on a combo box
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
@ -163,7 +163,7 @@ void qTabSettings::setSettings(int index){
if(index!=(int)Uninitialized)
item[(int)Uninitialized]->setEnabled(false);
}
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index,detID);
slsDetectorDefs::detectorSettings sett = myDet->setSettings((slsDetectorDefs::detectorSettings)index);
#ifdef VERBOSE
cout << "Settings have been set to " << myDet->slsDetectorBase::getDetectorSettings(sett) << endl;
#endif
@ -256,7 +256,7 @@ void qTabSettings::SetEnergy(){
void qTabSettings::Refresh(){
// Settings
SetupDetectorSettings();
comboSettings->setCurrentIndex(myDet->getSettings(detID));
comboSettings->setCurrentIndex(myDet->getSettings());
// Number of Modules
spinNumModules->setValue(myDet->setNumberOfModules());