Skip to content

Commit

Permalink
disabled actions when prereqs not complete
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Bramble committed Jun 25, 2012
1 parent 679f953 commit 5ca10f3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 57 deletions.
3 changes: 0 additions & 3 deletions frapmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ public slots:
static double fill_lambda_array(const FrapTool::result& res){ return res.lambda_2; };
static double fill_lambda_err_array(const FrapTool::result& res){ return res.lambda_err_2; };




};

#endif // FRAPMODEL_H
55 changes: 15 additions & 40 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ MainWindow::MainWindow(QWidget *parent) :
connect(ui->actionImage_Stack, SIGNAL(triggered()), this, SLOT(imagelist_file_open()));
connect(ui->actionRun_Experiment, SIGNAL(triggered()), this, SLOT(run_experiment()));


set_background = false;
set_closed = false;
set_image_list = false;

frapmodel = new FrapModel(0);
ui->actionClosed_Aperature->setDisabled(true);
ui->actionImage_Stack->setDisabled(true);
ui->actionRun_Experiment->setDisabled(true);
ui->actionShow_Graph->setDisabled(true);

//QList<QByteArray> list;
//list = QImageReader::supportedImageFormats ();
//qDebug() << list;
frapmodel = new FrapModel(0);

connect(this,SIGNAL(primaset(QString)),frapmodel,SLOT(setPrima(QString)));
connect(this,SIGNAL(closedset(QString)),frapmodel,SLOT(setClosed(QString)));
Expand All @@ -32,7 +32,6 @@ MainWindow::MainWindow(QWidget *parent) :

//connect(frapmodel,SIGNAL(dataChanged(QModelIndex,QModelIndex)), ui->tableView,SLOT(dataChanged(QModelIndex,QModelIndex)));
connect(frapmodel,SIGNAL(update_result(QString)), this, SLOT(show_result(QString)));

connect(frapmodel,SIGNAL(plotLinearFit(int,std::vector<double>&,std::vector<double>&,std::vector<double>&,double,double)), ui->pl_widget, SLOT(plotLinearFit(int,std::vector<double>&,std::vector<double>&,std::vector<double>&,double,double)));

ui->tabWidget->setCurrentIndex(0);
Expand All @@ -43,59 +42,35 @@ MainWindow::~MainWindow()
{
delete frapmodel;
delete ui;

}

void MainWindow::show_result(QString diffusion){
ui->label_result->setText(diffusion);
}

void MainWindow::linear_fit_image_show(){

ui->tabWidget->setCurrentIndex(1);
}

void MainWindow::run_experiment()
{

if(set_background && set_closed && set_image_list)
{
emit doselection();
qDebug() << QString("called table show");
ui->tableView->setModel( frapmodel );
ui->tableView->show();
}
else {
QMessageBox::warning(this,
tr("qt-frap-tool"),
tr("Image files not set.") );
}

// experiment = new FrapTool::Frap(background_file_name.toStdString(),closedapp_file_name.toStdString(),false);
// experiment->doselection();
// experiment->setimagenames(ifiles);
// experiment->processdata();
// experiment->plplot_chart("prefix");
// experiment->print_data();
// experiment->save_data_file(prefix);
// double dif_const = experiment->dif_const();
// QString result = QString::number(dif_const,'g',3);
// ui->label_result->setText(result);
// delete experiment;
emit doselection();
ui->tableView->setModel( frapmodel );
ui->tableView->show();
}



void MainWindow::background_file_open()
{
QFileDialog dialog;

dialog.setDirectory( starting_dir );
//dialog.setDirectory( starting_dir );
dialog.setFileMode(QFileDialog::ExistingFile);
if (dialog.exec()) {
QStringList filenames = dialog.selectedFiles();
background_file_name = filenames.at(0);
set_background = true;
starting_dir = QDir::currentPath();
starting_dir = dialog.directory();
ui->actionClosed_Aperature->setDisabled(false);
emit primaset(background_file_name);
}
else
Expand All @@ -113,7 +88,7 @@ void MainWindow::closedapp_file_open(){
QStringList filenames = dialog.selectedFiles();
closedapp_file_name = filenames.at(0);
set_closed = true;
starting_dir = QDir::currentPath();
ui->actionImage_Stack->setDisabled(false);
emit closedset(closedapp_file_name);

}
Expand All @@ -131,9 +106,9 @@ void MainWindow::imagelist_file_open(){
if (dialog.exec()) {
image_string_list = dialog.selectedFiles();
set_image_list = true;
starting_dir = QDir::currentPath();
ui->actionRun_Experiment->setDisabled(false);
ui->actionShow_Graph->setDisabled(false);
emit imagelistset(image_string_list);

}
else
{
Expand Down
2 changes: 1 addition & 1 deletion mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public slots:

FrapModel *frapmodel;

QString starting_dir;
QDir starting_dir;
};

#endif // MAINWINDOW_H
8 changes: 4 additions & 4 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>731</width>
<height>441</height>
<width>761</width>
<height>501</height>
</rect>
</property>
<property name="currentIndex">
Expand Down Expand Up @@ -76,8 +76,8 @@
<rect>
<x>9</x>
<y>9</y>
<width>711</width>
<height>391</height>
<width>741</width>
<height>451</height>
</rect>
</property>
</widget>
Expand Down
8 changes: 4 additions & 4 deletions plplotwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ PlPlotWidget::PlPlotWidget(QWidget *parent) :
plinit();

plot->setBackgroundColor(255,255,255,1);

//resize( 400, 320 );
pladv( 0 );
//unsigned int col = 255;
//plscolbg(col,col,col);
unsigned int col = 255;
plscolbg(col,col,col);
}

PlPlotWidget::~PlPlotWidget(){
qDebug() << "plplot destructor called";
//qDebug() << "plplot destructor called";
PLINT cur_strm;
plgstrm( &cur_strm );
plsstrm( strm );
Expand All @@ -33,6 +32,7 @@ PlPlotWidget::~PlPlotWidget(){
void PlPlotWidget::plotLinearFit(int size, std::vector<double> &xp,std::vector<double> &yp,std::vector<double> &yp_err, double m, double c){

plot->clearWidget();
//plot->setBackgroundColor(255,255,255,1);

int i;
double max_x, max_y;
Expand Down
10 changes: 5 additions & 5 deletions qt-frap-tool.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.4.1, 2012-06-24T15:32:46. -->
<!-- Written by Qt Creator 2.4.1, 2012-06-25T10:45:26. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
Expand Down Expand Up @@ -52,7 +52,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
Expand Down Expand Up @@ -101,7 +101,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/jon/Programming/C/qt-frap-tool-build-desktop-Qt_4_8_1_in_PATH__System__Release</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/DS/phyjpb/Programming/C/qt-frap-tool-build-desktop-Qt_4_8_1_in_PATH__System__Release</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
Expand Down Expand Up @@ -151,7 +151,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/jon/Programming/C/qt-frap-tool-build-desktop-Qt_4_8_1_in_PATH__System__Debug</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/home/DS/phyjpb/Programming/C/qt-frap-tool-build-desktop-Qt_4_8_1_in_PATH__System__Debug</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
Expand Down Expand Up @@ -256,7 +256,7 @@
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QString">{039551df-d4f3-45c0-a2ec-66c7eda81a9e}</value>
<value type="QString">{973957c6-bafc-4d27-9e1b-d91fb6b68c74}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
Expand Down

0 comments on commit 5ca10f3

Please sign in to comment.