one dataQueue per application
This commit is contained in:
parent
b87b254233
commit
1dd49f23f8
@ -21,6 +21,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(dataService, SIGNAL(resultReady()), this, SLOT(handleResult()));
|
connect(dataService, SIGNAL(resultReady()), this, SLOT(handleResult()));
|
||||||
dataServiceThread.start();
|
dataServiceThread.start();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
DataLoader *loader = new DataLoader();
|
||||||
|
loader->moveToThread(&dataQueue);
|
||||||
|
dataQueue.start();
|
||||||
file = nix::File::open("/home/grewe/zwischenlager/2017-08-17-af-invivo-1/2017-08-17-af-invivo-1.nix",
|
file = nix::File::open("/home/grewe/zwischenlager/2017-08-17-af-invivo-1/2017-08-17-af-invivo-1.nix",
|
||||||
nix::FileMode::ReadOnly);
|
nix::FileMode::ReadOnly);
|
||||||
|
|
||||||
@ -30,7 +34,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
this->voltage = b.getDataArray("V-1");
|
this->voltage = b.getDataArray("V-1");
|
||||||
this->eod = b.getDataArray("EOD");
|
this->eod = b.getDataArray("EOD");
|
||||||
|
|
||||||
MultiChartView *mcv = new MultiChartView();
|
MultiChartView *mcv = new MultiChartView(&dataQueue);
|
||||||
ui->vbox->addWidget(mcv);
|
ui->vbox->addWidget(mcv);
|
||||||
|
|
||||||
mcv->addArray(eod);
|
mcv->addArray(eod);
|
||||||
@ -42,5 +46,8 @@ MainWindow::~MainWindow() {
|
|||||||
if (file) {
|
if (file) {
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
dataQueue.stop();
|
||||||
|
dataQueue.quit();
|
||||||
|
dataQueue.wait();
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
DataQueue dataQueue;
|
||||||
nix::DataArray voltage, eod;
|
nix::DataArray voltage, eod;
|
||||||
nix::File file;
|
nix::File file;
|
||||||
};
|
};
|
||||||
|
@ -4,18 +4,16 @@
|
|||||||
|
|
||||||
using namespace QtCharts;
|
using namespace QtCharts;
|
||||||
|
|
||||||
MultiChartView::MultiChartView(QWidget *parent) :
|
MultiChartView::MultiChartView(DataQueue *queue, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent), dataQueue(queue),
|
||||||
ui(new Ui::MultiChartView)
|
ui(new Ui::MultiChartView)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
xRangeMax = 0.0;
|
xRangeMax = 0.0;
|
||||||
xRangeMin = 0.0;
|
xRangeMin = 0.0;
|
||||||
connect(&dataQueue, SIGNAL(resultReady(QString)), this, SLOT(dataReady(QString)));
|
connect(dataQueue, SIGNAL(resultReady(QString)), this, SLOT(dataReady(QString)));
|
||||||
//connect(&dataQueue, SIGNAL(finished()), &dataQueue, SLOT(deleteLater()));
|
//connect(&dataQueue, SIGNAL(finished()), &dataQueue, SLOT(deleteLater()));
|
||||||
DataLoader *loader = new DataLoader();
|
|
||||||
loader->moveToThread(&dataQueue);
|
|
||||||
dataQueue.start();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,15 +27,12 @@ MultiChartView::~MultiChartView()
|
|||||||
for (vit = viewMap.begin(); vit != viewMap.end(); vit++) {
|
for (vit = viewMap.begin(); vit != viewMap.end(); vit++) {
|
||||||
delete vit->second;
|
delete vit->second;
|
||||||
}
|
}
|
||||||
dataQueue.stop();
|
|
||||||
dataQueue.quit();
|
|
||||||
dataQueue.wait();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MultiChartView::addArray(const nix::DataArray &array) {
|
void MultiChartView::addArray(const nix::DataArray &array) {
|
||||||
while (dataQueue.isRunning()){
|
while (dataQueue->isRunning()){
|
||||||
// uncool!!!
|
// uncool!!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,12 +89,12 @@ void MultiChartView::loadData(const ArrayInfo &info) {
|
|||||||
nix::NDSize count(1, 100000);
|
nix::NDSize count(1, 100000);
|
||||||
nix::NDSize start(1, 0);
|
nix::NDSize start(1, 0);
|
||||||
std::string vId, eodId;
|
std::string vId, eodId;
|
||||||
dataQueue.requestData(arrayMap.at(info.arrayid), count, start, vId);
|
dataQueue->requestData(arrayMap.at(info.arrayid), count, start, vId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiChartView::dataReady(QString requestId){
|
void MultiChartView::dataReady(QString requestId){
|
||||||
DataResult1D data = dataQueue.getData(requestId);
|
DataResult1D data = dataQueue->getData(requestId);
|
||||||
if (data.id.empty()) {
|
if (data.id.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -87,15 +87,15 @@ class MultiChartView : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MultiChartView(QWidget *parent = 0);
|
explicit MultiChartView(DataQueue *queue, QWidget *parent = 0);
|
||||||
~MultiChartView();
|
~MultiChartView();
|
||||||
|
|
||||||
void addArray(const nix::DataArray &array);
|
void addArray(const nix::DataArray &array);
|
||||||
void loadData(const ArrayInfo &info);
|
void loadData(const ArrayInfo &info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
DataQueue *dataQueue;
|
||||||
Ui::MultiChartView *ui;
|
Ui::MultiChartView *ui;
|
||||||
DataQueue dataQueue;
|
|
||||||
double xRangeMin, xRangeMax;
|
double xRangeMin, xRangeMax;
|
||||||
std::map<std::string, nix::DataArray> arrayMap;
|
std::map<std::string, nix::DataArray> arrayMap;
|
||||||
std::map<std::string, Chart*> chartMap;
|
std::map<std::string, Chart*> chartMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user