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()));
|
||||
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",
|
||||
nix::FileMode::ReadOnly);
|
||||
|
||||
@ -30,7 +34,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
this->voltage = b.getDataArray("V-1");
|
||||
this->eod = b.getDataArray("EOD");
|
||||
|
||||
MultiChartView *mcv = new MultiChartView();
|
||||
MultiChartView *mcv = new MultiChartView(&dataQueue);
|
||||
ui->vbox->addWidget(mcv);
|
||||
|
||||
mcv->addArray(eod);
|
||||
@ -42,5 +46,8 @@ MainWindow::~MainWindow() {
|
||||
if (file) {
|
||||
file.close();
|
||||
}
|
||||
dataQueue.stop();
|
||||
dataQueue.quit();
|
||||
dataQueue.wait();
|
||||
delete ui;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
DataQueue dataQueue;
|
||||
nix::DataArray voltage, eod;
|
||||
nix::File file;
|
||||
};
|
||||
|
@ -4,18 +4,16 @@
|
||||
|
||||
using namespace QtCharts;
|
||||
|
||||
MultiChartView::MultiChartView(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
MultiChartView::MultiChartView(DataQueue *queue, QWidget *parent) :
|
||||
QWidget(parent), dataQueue(queue),
|
||||
ui(new Ui::MultiChartView)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
xRangeMax = 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()));
|
||||
DataLoader *loader = new DataLoader();
|
||||
loader->moveToThread(&dataQueue);
|
||||
dataQueue.start();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -29,15 +27,12 @@ MultiChartView::~MultiChartView()
|
||||
for (vit = viewMap.begin(); vit != viewMap.end(); vit++) {
|
||||
delete vit->second;
|
||||
}
|
||||
dataQueue.stop();
|
||||
dataQueue.quit();
|
||||
dataQueue.wait();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void MultiChartView::addArray(const nix::DataArray &array) {
|
||||
while (dataQueue.isRunning()){
|
||||
while (dataQueue->isRunning()){
|
||||
// uncool!!!
|
||||
}
|
||||
|
||||
@ -94,12 +89,12 @@ void MultiChartView::loadData(const ArrayInfo &info) {
|
||||
nix::NDSize count(1, 100000);
|
||||
nix::NDSize start(1, 0);
|
||||
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){
|
||||
DataResult1D data = dataQueue.getData(requestId);
|
||||
DataResult1D data = dataQueue->getData(requestId);
|
||||
if (data.id.empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -87,15 +87,15 @@ class MultiChartView : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MultiChartView(QWidget *parent = 0);
|
||||
explicit MultiChartView(DataQueue *queue, QWidget *parent = 0);
|
||||
~MultiChartView();
|
||||
|
||||
void addArray(const nix::DataArray &array);
|
||||
void loadData(const ArrayInfo &info);
|
||||
|
||||
private:
|
||||
DataQueue *dataQueue;
|
||||
Ui::MultiChartView *ui;
|
||||
DataQueue dataQueue;
|
||||
double xRangeMin, xRangeMax;
|
||||
std::map<std::string, nix::DataArray> arrayMap;
|
||||
std::map<std::string, Chart*> chartMap;
|
||||
|
Loading…
Reference in New Issue
Block a user