diff --git a/core/core.pro b/core/core.pro index f935fee..eda4707 100644 --- a/core/core.pro +++ b/core/core.pro @@ -60,7 +60,7 @@ DEFINES += GIT_DATE=\""$$system(date)"\" DEFINES += GIT_HASH=$$system(git log -n 1 --pretty=format:%H) DEFINES += GIT_DATE=\""$$system(date)"\" } else:unix { - QMAKE_CXXFLAGS += -Werror + #QMAKE_CXXFLAGS += -Werror target.path = /usr/bin dashboard.path = /usr/share/EMStudio/dashboards dashboard.files += src/gauges.qml @@ -118,7 +118,6 @@ SOURCES += src/main.cpp\ src/scalarparam.cpp \ src/comboparam.cpp \ src/ramdiffwindow.cpp \ - src/pluginmanager.cpp \ src/qcustomplot.cpp \ src/tableviewnew3d.cpp @@ -172,9 +171,9 @@ HEADERS += src/mainwindow.h \ src/scalarparam.h \ src/comboparam.h \ src/ramdiffwindow.h \ - src/pluginmanager.h \ src/qcustomplot.h \ - src/tableviewnew3d.h + src/tableviewnew3d.h \ + src/qcustomplot.h FORMS += src/mainwindow.ui \ src/comsettings.ui \ diff --git a/core/src/tableview3d.cpp b/core/src/tableview3d.cpp index 5278f96..866a75c 100644 --- a/core/src/tableview3d.cpp +++ b/core/src/tableview3d.cpp @@ -79,8 +79,8 @@ TableView3D::TableView3D(QWidget *parent) //Is both ram and flash }*/ //ui.importPushButton->setVisible(false); - ui.tracingCheckBox->setVisible(false); - ui.tracingCheckBox->setEnabled(false); + //ui.tracingCheckBox->setVisible(false); + //ui.tracingCheckBox->setEnabled(false); connect(ui.showMapPushButton,SIGNAL(clicked()),this,SLOT(showMapClicked())); } void TableView3D::tracingCheckBoxStateChanged(int newstate) @@ -88,20 +88,12 @@ void TableView3D::tracingCheckBoxStateChanged(int newstate) if (newstate == Qt::Checked) { m_tracingEnabled = true; + ui.tableWidget->setTracingEnabled(true); } else { m_tracingEnabled = false; - ui.tableWidget->disconnect(SIGNAL(cellChanged(int,int))); - ui.tableWidget->disconnect(SIGNAL(currentCellChanged(int,int,int,int))); - for (int i=0;iitem(m_highlightItemList[i].first,m_highlightItemList[i].second)->setTextColor(QColor::fromRgb(0,0,0)); - //ui.tableWidget->item(m_highlightItemList[i].first,m_highlightItemList[i].second)->setData(Qt::UserRole+1,false); - } - m_highlightItemList.clear(); - connect(ui.tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(tableCellChanged(int,int))); - connect(ui.tableWidget,SIGNAL(currentCellChanged(int,int,int,int)),this,SLOT(tableCurrentCellChanged(int,int,int,int))); + ui.tableWidget->setTracingEnabled(false); } } @@ -1165,207 +1157,7 @@ void TableView3D::passDatalog(QVariantMap data) { double xval = data[m_metaData.xHighlight].toDouble(); double yval = data[m_metaData.yHighlight].toDouble(); - int xloc = 1; - int yloc = ui.tableWidget->rowCount()-2; - int lowerrow = 0; - double lowerrowratio = 0; - double upperrowratio = 0; - double lowercolumnratio = 0; - double uppercolumnratio = 0; - int higherrow = 0; - int lowercolumn = 0; - int highercolumn = 1; - for (int x=1;xcolumnCount()-1;x++) - { - double testval = 0;//ui.tableWidget->item(ui.tableWidget->rowCount()-1,x)->text().toDouble(); - double prevtestval; - double nexttestval; - if (x == 1) - { - prevtestval = 0; - } - else - { - //prevtestval = ui.tableWidget->item(ui.tableWidget->rowCount()-1,x-1)->text().toDouble(); - } - if (x == ui.tableWidget->columnCount()-1) - { - nexttestval = testval + 1; - } - else - { - //nexttestval = ui.tableWidget->item(ui.tableWidget->rowCount()-1,x+1)->text().toDouble(); - } - double lowerlimit = testval - ((testval - prevtestval) / 2.0); - double upperlimit = testval + ((nexttestval - testval) / 2.0); - if (xval > lowerlimit && xval < upperlimit) - { - xloc = x; - lowercolumn = x-1; - highercolumn = x+1; - lowercolumnratio = (xval - lowerlimit) / (upperlimit - lowerlimit); - uppercolumnratio = (upperlimit - xval) / (upperlimit - lowerlimit); - if (xval > testval) - { - lowercolumn = x+1; - highercolumn = x+2; - lowercolumnratio = (xval - testval) / (nexttestval - testval); - uppercolumnratio = (nexttestval - xval) / (nexttestval - testval); - } - else - { - lowercolumn = x; - highercolumn = x+1; - lowercolumnratio = (xval - prevtestval) / (testval - prevtestval); - uppercolumnratio = (testval - xval) / (testval - prevtestval); - } - //0 500 1000 - //Val is at 750. - //lowerrowratio should be 50%, and upper should be 50% - //(xval - lowerlimit) / (upperlimit - lowerlimit) //0-1.0 - //(upperlimit - xval) / (upperlimit - lowerlimit) //0-1.0 - - - break; - } - } - for (int y=ui.tableWidget->rowCount()-2;y>=1;y--) - { -/* if (ui.tableWidget->item(y,0)) - { - double testval = ui.tableWidget->item(y,0)->text().toDouble(); - double prevtestval; - double nexttestval; - if (y == ui.tableWidget->rowCount()-2) - { - prevtestval = 0; - } - else - { - prevtestval = ui.tableWidget->item(y+1,0)->text().toDouble(); - } - if (y == 0) - { - nexttestval = testval + 1; - } - else - { - nexttestval = ui.tableWidget->item(y-1,0)->text().toDouble(); - } - double lowerlimit = testval - ((testval - prevtestval) / 2.0); - double upperlimit = testval + ((nexttestval - testval) / 2.0); - if (yval > lowerlimit && yval < upperlimit) - { - yloc = y; - if (yval > testval) - { - lowerrow = y-1; - higherrow = y; - lowerrowratio = (yval - testval) / (nexttestval - testval); - upperrowratio = (nexttestval - yval) / (nexttestval - testval); - } - else - { - lowerrow = y-2; - higherrow = y-1; - lowerrowratio = (yval - prevtestval) / (testval - prevtestval); - upperrowratio = (testval - yval) / (testval - prevtestval); - } - //0 500 1000 - //Val is at 750. - //lowerrowratio should be 50%, and upper should be 50% - //(xval - lowerlimit) / (upperlimit - lowerlimit) //0-1.0 - //(upperlimit - xval) / (upperlimit - lowerlimit) //0-1.0 - break; - } - }*/ - } - if (xloc != -1 && yloc != -1) - { - if (xloc == m_oldXLoc && yloc == m_oldYLoc) - { - //No change, no reason to continue; - //return; - } - ui.tableWidget->disconnect(SIGNAL(cellChanged(int,int))); - ui.tableWidget->disconnect(SIGNAL(currentCellChanged(int,int,int,int))); - QList > undonelist; - /*for (int i=0;iitem(m_highlightItemList[i].first,m_highlightItemList[i].second)->isSelected()) - { - ui.tableWidget->item(m_highlightItemList[i].first,m_highlightItemList[i].second)->setTextColor(QColor::fromRgb(0,0,0)); - ui.tableWidget->item(m_highlightItemList[i].first,m_highlightItemList[i].second)->setData(Qt::UserRole+1,false); - } - else - { - undonelist.append(QPair(m_highlightItemList[i].first,m_highlightItemList[i].second)); - } - }*/ - m_highlightItemList.clear(); - m_highlightItemList.append(undonelist); - m_oldXLoc = xloc; - m_oldYLoc = yloc; - - if (lowercolumn > 0 ) - { - /*if (lowerrow > 0) - { - if (!ui.tableWidget->item(lowerrow,lowercolumn)->isSelected()) - { - m_highlightItemList.append(QPair(lowerrow,lowercolumn)); - ui.tableWidget->item(lowerrow,lowercolumn)->setData(Qt::UserRole+1,true); - ui.tableWidget->item(lowerrow,lowercolumn)->setData(Qt::UserRole+2,lowerrowratio); - } - } - if (higherrow < ui.tableWidget->rowCount()-1) - { - if (!ui.tableWidget->item(higherrow,lowercolumn)->isSelected()) - { - m_highlightItemList.append(QPair(higherrow,lowercolumn)); - ui.tableWidget->item(higherrow,lowercolumn)->setData(Qt::UserRole+1,true); - ui.tableWidget->item(higherrow,lowercolumn)->setData(Qt::UserRole+2,upperrowratio); - } - }*/ - } - - - - /*if (lowerrow > 0) - { - if (!ui.tableWidget->item(lowerrow,highercolumn)->isSelected()) - { - if (lowercolumnratio != uppercolumnratio) - { - } - //m_highlightItemList.append(QPair(lowerrow,highercolumn)); - //ui.tableWidget->item(lowerrow,highercolumn)->setData(Qt::UserRole+1,true); - //ui.tableWidget->item(lowerrow,highercolumn)->setData(Qt::UserRole+2,lowercolumnratio); - } - } - - - if (higherrow < ui.tableWidget->rowCount()-1) - { - if (!ui.tableWidget->item(higherrow,highercolumn)->isSelected()) - { - //m_highlightItemList.append(QPair(higherrow,highercolumn)); - //ui.tableWidget->item(higherrow,highercolumn)->setData(Qt::UserRole+1,true); - //ui.tableWidget->item(higherrow,highercolumn)->setData(Qt::UserRole+2,uppercolumnratio); - } - }*/ - /*if (ui.tableWidget->item(m_oldYLoc,m_oldXLoc)) - { - ui.tableWidget->item(m_oldYLoc,m_oldXLoc)->setTextColor(QColor::fromRgb(255,255,255)); - ui.tableWidget->item(m_oldYLoc,m_oldXLoc)->setData(Qt::UserRole+1,true); - }*/ - connect(ui.tableWidget,SIGNAL(cellChanged(int,int)),this,SLOT(tableCellChanged(int,int))); - connect(ui.tableWidget,SIGNAL(currentCellChanged(int,int,int,int)),this,SLOT(tableCurrentCellChanged(int,int,int,int))); - } - else - { - QLOG_ERROR() << "Error parsing datalog, xloc and yloc aren't != -1"; - } + ui.tableWidget->setTracingValue(xval,yval); } } /*bool TableView3D::setData(unsigned short locationid,QByteArray data,Table3DMetaData metadata,TableData *newtabledata) diff --git a/core/src/tableviewnew3d.cpp b/core/src/tableviewnew3d.cpp index e1c08f9..b951d36 100644 --- a/core/src/tableviewnew3d.cpp +++ b/core/src/tableviewnew3d.cpp @@ -7,9 +7,19 @@ TableViewNew3D::TableViewNew3D(QWidget *parent) : QWidget(parent) m_itemHeight = 30; m_itemWidth = 60; multiSelect = false; + m_rowCount = 16; + m_columnCount = 16; setFocusPolicy(Qt::ClickFocus); + m_traceEnabled = false; } +void TableViewNew3D::setTracingValue(double x,double y) +{ + m_traceX = x; + m_traceY = y; + update(); +} + void TableViewNew3D::addHotkey(int key,Qt::KeyboardModifier modifier) { m_hotkeyMap.append(QPair(key,modifier)); @@ -154,6 +164,13 @@ void TableViewNew3D::paintEvent (QPaintEvent *evt) painter.drawRect(0,0,width()-1,height()-1); //item width = 40 //item height = 20 + double m_currentTrace = 0; + double drawTraceY = 0; + bool foundy = false; + + double drawTraceX = 0; + bool foundx = false; + for (int y=0;y m_currentTrace) + { + if (x == m_columnCount-1) + { + double prev = xaxis.at(x-1).toDouble(); + double curr = xaxis.at(x).toDouble(); + curr = curr - ((prev - curr) / 2.0); + if (m_traceX < curr) + { + //No go, don't trace. + continue; + } + else + { + + } + } + } + else if (!foundx) + { + double prev = 0; + if (x == 0) + { + //Value is between the top and null values + prev = xaxis.at(x).toDouble() - ((xaxis.at(x+1).toDouble() - xaxis.at(x).toDouble()) / 2.0); + } + else + { + prev = xaxis.at(x-1).toDouble(); + } + //Between the current trace and the last one, we have our value + + double diff = prev - m_currentTrace; + double percent =(prev - m_traceX) / diff; + //Percent is a 0.0-1.0 of where the trace should lie,between i-1, and i; + double currentX = (x+1)*m_itemWidth+ ((m_itemWidth/2.0)-2); + double lastX = (x)*m_itemWidth+ ((m_itemWidth/2.0)-2); + drawTraceX = (lastX + (percent * (currentX - lastX))); + foundx = true; + } + } + } for (int y=0;y > m_hotkeyMap; double m_itemHeight; double m_itemWidth;