Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
fix Epos UI
Browse files Browse the repository at this point in the history
  • Loading branch information
MPIBR-tushevg committed Dec 7, 2018
1 parent cf9936c commit ec74a24
Show file tree
Hide file tree
Showing 3 changed files with 267 additions and 217 deletions.
75 changes: 59 additions & 16 deletions BrainATUMtome/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
ui(new Ui::MainWindow),
m_driverEpos(nullptr),
m_driverMicrotome(nullptr),
m_driverSyringe(nullptr),
m_thread_driverEpos(nullptr),
m_thread_driverMicrotome(nullptr),
m_thread_driverSyringe(nullptr)
{
ui->setupUi(this);

configure_controlEpos();

/* --- configure DriverEpos --- */
/*
m_driverEpos = new DriverEpos(nullptr);
m_thread_driverEpos = new QThread(this);
m_driverEpos->moveToThread(m_thread_driverEpos);
Expand Down Expand Up @@ -39,8 +48,10 @@ MainWindow::MainWindow(QWidget *parent) :
}
});
ui->radioButton_dep_motorsBoth->setChecked(true);
*/

/* --- configure DriverMicrotome --- */
/*
m_driverMicrotome = new DriverMicrotome(nullptr);
m_thread_driverMicrotome = new QThread(this);
m_driverMicrotome->moveToThread(m_thread_driverMicrotome);
Expand Down Expand Up @@ -100,9 +111,10 @@ MainWindow::MainWindow(QWidget *parent) :
QIntValidator *validator_feedStep = new QIntValidator(1, 15000, this);
ui->lineEdit_dmt_feedStep->setValidator(validator_feedStep);

*/

/* --- configure DriverSyringe --- */
/*
m_driverSyringe = new DriverSyringe(nullptr);
m_thread_driverSyringe = new QThread(this);
m_driverSyringe->moveToThread(m_thread_driverSyringe);
Expand All @@ -111,72 +123,98 @@ MainWindow::MainWindow(QWidget *parent) :
connect(m_driverSyringe, &DriverSyringe::error, this, &MainWindow::on_error_throw);
connect(ui->pushButton_dsy_pump, &QPushButton::clicked, m_driverSyringe, &DriverSyringe::on_uirequest_pump);

*/

/* --- configure VideoProducer --- */
/*
m_videoProducer = new VideoProducer(nullptr);
m_thread_videoProducer = new QThread(this);
m_videoProducer->moveToThread(m_thread_videoProducer);
connect(m_thread_videoProducer, &QThread::finished, m_videoProducer, &VideoProducer::deleteLater);
m_thread_videoProducer->start();
*/

/* --- configure VideoConverter --- */
/*
m_videoConverter = new VideoConverter(nullptr);
m_thread_videoConverter = new QThread(this);
m_videoConverter->moveToThread(m_thread_videoConverter);
connect(m_thread_videoConverter, &QThread::finished, m_videoConverter, &VideoConverter::deleteLater);
m_thread_videoConverter->start();
*/

/* --- configure VideoWriter --- */
/*
m_videoWriter = new VideoWriter(nullptr);
m_thread_videoWriter = new QThread(this);
m_videoWriter->moveToThread(m_thread_videoWriter);
connect(m_thread_videoWriter, &QThread::finished, m_videoWriter, &VideoWriter::deleteLater);
m_thread_videoWriter->start();
*/

/* --- connect Video Signal/Slots --- */
/*
connect(ui->pushButton_dvs_record, &QPushButton::clicked, m_videoProducer, &VideoProducer::start);
connect(ui->pushButton_dvs_snap, &QPushButton::clicked, m_videoProducer, &VideoProducer::stop);
connect(m_videoProducer, &VideoProducer::frameReady, m_videoConverter, &VideoConverter::on_convertFrame);
connect(m_videoConverter, &VideoConverter::pixmapReady, ui->widget_videoViewer, &VideoViewer::on_pixmapReady);
connect(m_videoProducer, &VideoProducer::error, this, &MainWindow::on_error_throw);
connect(m_videoWriter, &VideoWriter::error, this, &MainWindow::on_error_throw);

*/
}

MainWindow::~MainWindow()
{
// destroy DriverEpos thread
m_thread_driverEpos->quit();
m_thread_driverEpos->wait();
if (m_thread_driverEpos != nullptr)
{
m_thread_driverEpos->quit();
m_thread_driverEpos->wait();
}


// destroy DriverMicrotome thread
m_thread_driverMicrotome->quit();
m_thread_driverMicrotome->wait();
if (m_thread_driverMicrotome != nullptr)
{
m_thread_driverMicrotome->quit();
m_thread_driverMicrotome->wait();
}


// destroy DriverSyringe thread
m_thread_driverSyringe->quit();
m_thread_driverSyringe->wait();
if (m_thread_driverSyringe != nullptr)
{
m_thread_driverSyringe->quit();
m_thread_driverSyringe->wait();
}


// destroy VideoProducer thread
m_thread_videoProducer->quit();
m_thread_videoProducer->wait();
// m_thread_videoProducer->quit();
// m_thread_videoProducer->wait();

// destroy VideoConverter thread
m_thread_videoConverter->quit();
m_thread_videoConverter->wait();
// m_thread_videoConverter->quit();
// m_thread_videoConverter->wait();

// destroy VideoWriter thread
m_thread_videoWriter->quit();
m_thread_videoWriter->wait();
// m_thread_videoWriter->quit();
// m_thread_videoWriter->wait();

delete ui;
}


void MainWindow::configure_controlEpos()
{
//connect(ui->pushButton_epos_lower_cw, &Q)
}



void MainWindow::on_pushButton_dep_run_clicked()
{
/*
if (QString::compare(ui->pushButton_dep_run->text(), "Run") == 0)
{
ui->pushButton_dep_run->setText("Stop");
Expand All @@ -191,6 +229,7 @@ void MainWindow::on_pushButton_dep_run_clicked()
ui->groupBox_dep_direction->setEnabled(true);
command_DriverEpos(false);
}
*/
}


Expand All @@ -217,6 +256,7 @@ void MainWindow::on_pushButton_dmt_cut_clicked()

void MainWindow::command_DriverEpos(bool state)
{
/*
quint8 motors = 0x00;
if (ui->radioButton_dep_motorsLower->isChecked())
{
Expand All @@ -238,14 +278,17 @@ void MainWindow::command_DriverEpos(bool state)
bool tension = (state) ? ui->checkBox_dep_motorsTension->isChecked() : false; // false tension instructs stop
emit uirequest_dep_run(motors, velocity, direction, tension);
*/
}

void MainWindow::on_lineEdit_dep_velocity_returnPressed()
{
/*
if (QString::compare(ui->pushButton_dep_run->text(), "Stop") != 0)
return;
command_DriverEpos(true);
*/
}


Expand Down
23 changes: 13 additions & 10 deletions BrainATUMtome/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#include "driverepos.h"
#include "drivermicrotome.h"
#include "driversyringe.h"
#include "videoproducer.h"
#include "videoconverter.h"
#include "videowriter.h"
#include "videoviewer.h"
//#include "videoproducer.h"
//#include "videoconverter.h"
//#include "videowriter.h"
//#include "videoviewer.h"

namespace Ui {
class MainWindow;
Expand All @@ -32,19 +32,22 @@ class MainWindow : public QMainWindow
DriverEpos *m_driverEpos;
DriverMicrotome *m_driverMicrotome;
DriverSyringe *m_driverSyringe;
VideoProducer *m_videoProducer;
VideoConverter *m_videoConverter;
VideoWriter *m_videoWriter;
//VideoProducer *m_videoProducer;
//VideoConverter *m_videoConverter;
//VideoWriter *m_videoWriter;

QThread *m_thread_driverEpos;
QThread *m_thread_driverMicrotome;
QThread *m_thread_driverSyringe;
QThread *m_thread_videoProducer;
QThread *m_thread_videoConverter;
QThread *m_thread_videoWriter;
//QThread *m_thread_videoProducer;
//QThread *m_thread_videoConverter;
//sQThread *m_thread_videoWriter;

void command_DriverEpos(bool state);

void configure_controlEpos();


private slots:
void on_error_throw(const QString &errorSource, const QString &errorMessage);
void on_pushButton_dep_run_clicked();
Expand Down
Loading

0 comments on commit ec74a24

Please sign in to comment.