Commit 78f9170f authored by lm's avatar lm

Improved documentation and linechart

parent cfce88d5
...@@ -154,6 +154,7 @@ linux-g++ { ...@@ -154,6 +154,7 @@ linux-g++ {
release { release {
DESTDIR = $$TARGETDIR/release DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
} }
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/. QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
...@@ -223,6 +224,7 @@ linux-g++-64 { ...@@ -223,6 +224,7 @@ linux-g++-64 {
release { release {
DESTDIR = $$TARGETDIR/release DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
} }
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/. QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
...@@ -295,6 +297,7 @@ win32-msvc2008 { ...@@ -295,6 +297,7 @@ win32-msvc2008 {
release { release {
CONFIG -= console CONFIG -= console
DEFINES += QT_NO_DEBUG
} }
# Special settings for debug # Special settings for debug
...@@ -380,6 +383,7 @@ win32-g++ { ...@@ -380,6 +383,7 @@ win32-g++ {
release { release {
CONFIG -= console CONFIG -= console
DEFINES += QT_NO_DEBUG
#DESTDIR = $$BUILDDIR/release #DESTDIR = $$BUILDDIR/release
} }
......
...@@ -62,26 +62,38 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : ...@@ -62,26 +62,38 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) :
horizontalLayout->addWidget(tree, 0, 0, 1, 3); horizontalLayout->addWidget(tree, 0, 0, 1, 3);
QPushButton* refreshButton = new QPushButton(tr("Refresh")); QPushButton* refreshButton = new QPushButton(tr("Refresh"));
refreshButton->setToolTip(tr("Load parameters currently in non-permanent memory of aircraft."));
refreshButton->setWhatsThis(tr("Load parameters currently in non-permanent memory of aircraft."));
connect(refreshButton, SIGNAL(clicked()), this, SLOT(requestParameterList())); connect(refreshButton, SIGNAL(clicked()), this, SLOT(requestParameterList()));
horizontalLayout->addWidget(refreshButton, 1, 0); horizontalLayout->addWidget(refreshButton, 1, 0);
QPushButton* setButton = new QPushButton(tr("Transmit")); QPushButton* setButton = new QPushButton(tr("Transmit"));
setButton->setToolTip(tr("Set current parameters in non-permanent onboard memory"));
setButton->setWhatsThis(tr("Set current parameters in non-permanent onboard memory"));
connect(setButton, SIGNAL(clicked()), this, SLOT(setParameters())); connect(setButton, SIGNAL(clicked()), this, SLOT(setParameters()));
horizontalLayout->addWidget(setButton, 1, 1); horizontalLayout->addWidget(setButton, 1, 1);
QPushButton* writeButton = new QPushButton(tr("Write (ROM)")); QPushButton* writeButton = new QPushButton(tr("Write (ROM)"));
writeButton->setToolTip(tr("Copy current parameters in non-permanent memory of the aircraft to permanent memory. Transmit your parameters first to write these."));
writeButton->setWhatsThis(tr("Copy current parameters in non-permanent memory of the aircraft to permanent memory. Transmit your parameters first to write these."));
connect(writeButton, SIGNAL(clicked()), this, SLOT(writeParameters())); connect(writeButton, SIGNAL(clicked()), this, SLOT(writeParameters()));
horizontalLayout->addWidget(writeButton, 1, 2); horizontalLayout->addWidget(writeButton, 1, 2);
QPushButton* readButton = new QPushButton(tr("Read (ROM)")); QPushButton* readButton = new QPushButton(tr("Read (ROM)"));
readButton->setToolTip(tr("Copy parameters from permanent memory to non-permanent current memory of aircraft. DOES NOT update the parameters in this view, click refresh after copying them to get them."));
readButton->setWhatsThis(tr("Copy parameters from permanent memory to non-permanent current memory of aircraft. DOES NOT update the parameters in this view, click refresh after copying them to get them."));
connect(readButton, SIGNAL(clicked()), this, SLOT(readParameters())); connect(readButton, SIGNAL(clicked()), this, SLOT(readParameters()));
horizontalLayout->addWidget(readButton, 2, 2); horizontalLayout->addWidget(readButton, 2, 2);
QPushButton* loadFileButton = new QPushButton(tr("Load File")); QPushButton* loadFileButton = new QPushButton(tr("Load File"));
loadFileButton->setToolTip(tr("Load parameters from a file on this computer in the view. To write them to the aircraft, use transmit after loading them."));
loadFileButton->setWhatsThis(tr("Load parameters from a file on this computer in the view. To write them to the aircraft, use transmit after loading them."));
connect(loadFileButton, SIGNAL(clicked()), this, SLOT(loadParameters())); connect(loadFileButton, SIGNAL(clicked()), this, SLOT(loadParameters()));
horizontalLayout->addWidget(loadFileButton, 2, 0); horizontalLayout->addWidget(loadFileButton, 2, 0);
QPushButton* saveFileButton = new QPushButton(tr("Save File")); QPushButton* saveFileButton = new QPushButton(tr("Save File"));
saveFileButton->setToolTip(tr("Save parameters in this view to a file on this computer."));
saveFileButton->setWhatsThis(tr("Save parameters in this view to a file on this computer."));
connect(saveFileButton, SIGNAL(clicked()), this, SLOT(saveParameters())); connect(saveFileButton, SIGNAL(clicked()), this, SLOT(saveParameters()));
horizontalLayout->addWidget(saveFileButton, 2, 1); horizontalLayout->addWidget(saveFileButton, 2, 1);
......
...@@ -221,8 +221,8 @@ public: ...@@ -221,8 +221,8 @@ public:
static const int SCALE_LOGARITHMIC = 2; static const int SCALE_LOGARITHMIC = 2;
static const int DEFAULT_REFRESH_RATE = 50; ///< The default refresh rate is 25 Hz / every 100 ms static const int DEFAULT_REFRESH_RATE = 50; ///< The default refresh rate is 25 Hz / every 100 ms
static const int DEFAULT_PLOT_INTERVAL = 1000 * 12; ///< The default plot interval is 15 seconds static const int DEFAULT_PLOT_INTERVAL = 1000 * 8; ///< The default plot interval is 15 seconds
static const int DEFAULT_SCALE_INTERVAL = 1000 * 5; static const int DEFAULT_SCALE_INTERVAL = 1000 * 8;
public slots: public slots:
void setRefreshRate(int ms); void setRefreshRate(int ms);
......
...@@ -81,16 +81,52 @@ updateTimer(new QTimer()) ...@@ -81,16 +81,52 @@ updateTimer(new QTimer())
curvesWidgetLayout->setMargin(2); curvesWidgetLayout->setMargin(2);
curvesWidgetLayout->setSpacing(4); curvesWidgetLayout->setSpacing(4);
curvesWidgetLayout->setSizeConstraint(QLayout::SetMinimumSize); curvesWidgetLayout->setSizeConstraint(QLayout::SetMinimumSize);
curvesWidgetLayout->setAlignment(Qt::AlignTop);
curvesWidget->setLayout(curvesWidgetLayout); curvesWidget->setLayout(curvesWidgetLayout);
// Create curve list headings
QWidget* form = new QWidget(this);
QHBoxLayout *horizontalLayout;
QLabel* label;
QLabel* value;
QLabel* mean;
QLabel* variance;
form->setAutoFillBackground(false);
horizontalLayout = new QHBoxLayout(form);
horizontalLayout->setSpacing(5);
horizontalLayout->setMargin(0);
horizontalLayout->setSizeConstraint(QLayout::SetMinimumSize);
//horizontalLayout->addWidget(checkBox);
label = new QLabel(form);
label->setText("Name");
horizontalLayout->addWidget(label);
// Value
value = new QLabel(form);
value->setText("Val");
horizontalLayout->addWidget(value);
// Mean
mean = new QLabel(form);
mean->setText("Mean");
horizontalLayout->addWidget(mean);
// Variance
variance = new QLabel(form);
variance->setText("Variance");
horizontalLayout->addWidget(variance);
curvesWidgetLayout->addWidget(form);
// Add and customize plot elements (right side) // Add and customize plot elements (right side)
// Create the layout // Create the layout
createLayout(); createLayout();
// Add the last actions // Add the last actions
connect(this, SIGNAL(plotWindowPositionUpdated(int)), scrollbar, SLOT(setValue(int))); //connect(this, SIGNAL(plotWindowPositionUpdated(int)), scrollbar, SLOT(setValue(int)));
connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(setPlotWindowPosition(int))); //connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(setPlotWindowPosition(int)));
updateTimer->setInterval(300); updateTimer->setInterval(300);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh())); connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh()));
...@@ -131,6 +167,8 @@ void LinechartWidget::createLayout() ...@@ -131,6 +167,8 @@ void LinechartWidget::createLayout()
scalingLinearButton = createButton(this); scalingLinearButton = createButton(this);
scalingLinearButton->setDefaultAction(setScalingLinear); scalingLinearButton->setDefaultAction(setScalingLinear);
scalingLinearButton->setCheckable(true); scalingLinearButton->setCheckable(true);
scalingLinearButton->setToolTip(tr("Set linear scale for Y axis"));
scalingLinearButton->setWhatsThis(tr("Set linear scale for Y axis"));
layout->addWidget(scalingLinearButton, 1, 0); layout->addWidget(scalingLinearButton, 1, 0);
layout->setColumnStretch(0, 0); layout->setColumnStretch(0, 0);
...@@ -138,13 +176,18 @@ void LinechartWidget::createLayout() ...@@ -138,13 +176,18 @@ void LinechartWidget::createLayout()
scalingLogButton = createButton(this); scalingLogButton = createButton(this);
scalingLogButton->setDefaultAction(setScalingLogarithmic); scalingLogButton->setDefaultAction(setScalingLogarithmic);
scalingLogButton->setCheckable(true); scalingLogButton->setCheckable(true);
scalingLogButton->setToolTip(tr("Set logarithmic scale for Y axis"));
scalingLogButton->setWhatsThis(tr("Set logarithmic scale for Y axis"));
layout->addWidget(scalingLogButton, 1, 1); layout->addWidget(scalingLogButton, 1, 1);
layout->setColumnStretch(1, 0); layout->setColumnStretch(1, 0);
// Averaging spin box // Averaging spin box
averageSpinBox = new QSpinBox(this); averageSpinBox = new QSpinBox(this);
averageSpinBox->setValue(200); averageSpinBox->setToolTip(tr("Sliding window size to calculate mean and variance"));
averageSpinBox->setWhatsThis(tr("Sliding window size to calculate mean and variance"));
averageSpinBox->setMinimum(2); averageSpinBox->setMinimum(2);
averageSpinBox->setValue(200);
setAverageWindow(200);
averageSpinBox->setMaximum(9999); averageSpinBox->setMaximum(9999);
layout->addWidget(averageSpinBox, 1, 2); layout->addWidget(averageSpinBox, 1, 2);
layout->setColumnStretch(2, 0); layout->setColumnStretch(2, 0);
...@@ -152,6 +195,8 @@ void LinechartWidget::createLayout() ...@@ -152,6 +195,8 @@ void LinechartWidget::createLayout()
// Log Button // Log Button
logButton = new QToolButton(this); logButton = new QToolButton(this);
logButton->setToolTip(tr("Start to log curve data into a CSV or TXT file"));
logButton->setWhatsThis(tr("Start to log curve data into a CSV or TXT file"));
logButton->setText(tr("Start Logging")); logButton->setText(tr("Start Logging"));
layout->addWidget(logButton, 1, 3); layout->addWidget(logButton, 1, 3);
layout->setColumnStretch(3, 0); layout->setColumnStretch(3, 0);
...@@ -161,6 +206,8 @@ void LinechartWidget::createLayout() ...@@ -161,6 +206,8 @@ void LinechartWidget::createLayout()
QToolButton* timeButton = new QToolButton(this); QToolButton* timeButton = new QToolButton(this);
timeButton->setText(tr("Ground Time")); timeButton->setText(tr("Ground Time"));
timeButton->setCheckable(true); timeButton->setCheckable(true);
timeButton->setToolTip(tr("Overwrite timestamp of data from vehicle with ground receive time. Helps if the plots are not visible because of missing or invalid onboard time."));
timeButton->setWhatsThis(tr("Overwrite timestamp of data from vehicle with ground receive time. Helps if the plots are not visible because of missing or invalid onboard time."));
bool gTimeDefault = true; bool gTimeDefault = true;
if (activePlot) activePlot->enforceGroundTime(gTimeDefault); if (activePlot) activePlot->enforceGroundTime(gTimeDefault);
timeButton->setChecked(gTimeDefault); timeButton->setChecked(gTimeDefault);
...@@ -169,18 +216,18 @@ void LinechartWidget::createLayout() ...@@ -169,18 +216,18 @@ void LinechartWidget::createLayout()
connect(timeButton, SIGNAL(clicked(bool)), activePlot, SLOT(enforceGroundTime(bool))); connect(timeButton, SIGNAL(clicked(bool)), activePlot, SLOT(enforceGroundTime(bool)));
// Create the scroll bar // Create the scroll bar
scrollbar = new QScrollBar(Qt::Horizontal, ui.diagramGroupBox); //scrollbar = new QScrollBar(Qt::Horizontal, ui.diagramGroupBox);
scrollbar->setMinimum(MIN_TIME_SCROLLBAR_VALUE); //scrollbar->setMinimum(MIN_TIME_SCROLLBAR_VALUE);
scrollbar->setMaximum(MAX_TIME_SCROLLBAR_VALUE); //scrollbar->setMaximum(MAX_TIME_SCROLLBAR_VALUE);
scrollbar->setPageStep(PAGESTEP_TIME_SCROLLBAR_VALUE); //scrollbar->setPageStep(PAGESTEP_TIME_SCROLLBAR_VALUE);
// Set scrollbar to maximum and disable it // Set scrollbar to maximum and disable it
scrollbar->setValue(MIN_TIME_SCROLLBAR_VALUE); //scrollbar->setValue(MIN_TIME_SCROLLBAR_VALUE);
scrollbar->setDisabled(true); //scrollbar->setDisabled(true);
// scrollbar->setFixedHeight(20); // scrollbar->setFixedHeight(20);
// Add scroll bar to layout and make sure it gets all available space // Add scroll bar to layout and make sure it gets all available space
layout->addWidget(scrollbar, 1, 5); //layout->addWidget(scrollbar, 1, 5);
layout->setColumnStretch(5, 10); layout->setColumnStretch(5, 10);
ui.diagramGroupBox->setLayout(layout); ui.diagramGroupBox->setLayout(layout);
...@@ -406,6 +453,8 @@ QWidget* LinechartWidget::createCurveItem(QString curve) ...@@ -406,6 +453,8 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
checkBox = new QCheckBox(form); checkBox = new QCheckBox(form);
checkBox->setCheckable(true); checkBox->setCheckable(true);
checkBox->setObjectName(curve); checkBox->setObjectName(curve);
checkBox->setToolTip(tr("Enable the curve in the graph window"));
checkBox->setWhatsThis(tr("Enable the curve in the graph window"));
horizontalLayout->addWidget(checkBox); horizontalLayout->addWidget(checkBox);
...@@ -431,12 +480,16 @@ QWidget* LinechartWidget::createCurveItem(QString curve) ...@@ -431,12 +480,16 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
// Value // Value
value = new QLabel(form); value = new QLabel(form);
value->setNum(0.00); value->setNum(0.00);
value->setToolTip(tr("Current value of ") + curve);
value->setWhatsThis(tr("Current value of ") + curve);
curveLabels->insert(curve, value); curveLabels->insert(curve, value);
horizontalLayout->addWidget(value); horizontalLayout->addWidget(value);
// Mean // Mean
mean = new QLabel(form); mean = new QLabel(form);
mean->setNum(0.00); mean->setNum(0.00);
mean->setToolTip(tr("Arithmetic mean of ") + curve);
mean->setWhatsThis(tr("Arithmetic mean of ") + curve);
curveMeans->insert(curve, mean); curveMeans->insert(curve, mean);
horizontalLayout->addWidget(mean); horizontalLayout->addWidget(mean);
...@@ -449,6 +502,8 @@ QWidget* LinechartWidget::createCurveItem(QString curve) ...@@ -449,6 +502,8 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
// Variance // Variance
variance = new QLabel(form); variance = new QLabel(form);
variance->setNum(0.00); variance->setNum(0.00);
variance->setToolTip(tr("Variance of ") + curve);
variance->setWhatsThis(tr("Variance of ") + curve);
curveVariances->insert(curve, variance); curveVariances->insert(curve, variance);
horizontalLayout->addWidget(variance); horizontalLayout->addWidget(variance);
...@@ -584,14 +639,14 @@ void LinechartWidget::setPlotWindowPosition(quint64 position) { ...@@ -584,14 +639,14 @@ void LinechartWidget::setPlotWindowPosition(quint64 position) {
// A relative position makes only sense if the plot is filled // A relative position makes only sense if the plot is filled
if(activePlot->getDataInterval() > activePlot->getPlotInterval()) { if(activePlot->getDataInterval() > activePlot->getPlotInterval()) {
//TODO @todo Implement the scrollbar enabling in a more elegant way //TODO @todo Implement the scrollbar enabling in a more elegant way
scrollbar->setDisabled(false); //scrollbar->setDisabled(false);
quint64 scrollInterval = position - activePlot->getMinTime() - activePlot->getPlotInterval(); quint64 scrollInterval = position - activePlot->getMinTime() - activePlot->getPlotInterval();
pos = (static_cast<double>(scrollInterval) / (activePlot->getDataInterval() - activePlot->getPlotInterval())); pos = (static_cast<double>(scrollInterval) / (activePlot->getDataInterval() - activePlot->getPlotInterval()));
} else { } else {
scrollbar->setDisabled(true); //scrollbar->setDisabled(true);
pos = 1; pos = 1;
} }
plotWindowLock.unlock(); plotWindowLock.unlock();
...@@ -607,7 +662,8 @@ void LinechartWidget::setPlotWindowPosition(quint64 position) { ...@@ -607,7 +662,8 @@ void LinechartWidget::setPlotWindowPosition(quint64 position) {
* *
* @param interval The time interval to plot * @param interval The time interval to plot
**/ **/
void LinechartWidget::setPlotInterval(quint64 interval) { void LinechartWidget::setPlotInterval(quint64 interval)
{
activePlot->setPlotInterval(interval); activePlot->setPlotInterval(interval);
} }
...@@ -618,7 +674,8 @@ void LinechartWidget::setPlotInterval(quint64 interval) { ...@@ -618,7 +674,8 @@ void LinechartWidget::setPlotInterval(quint64 interval) {
* *
* @param checked The visibility of the curve: true to display the curve, false otherwise * @param checked The visibility of the curve: true to display the curve, false otherwise
**/ **/
void LinechartWidget::takeButtonClick(bool checked) { void LinechartWidget::takeButtonClick(bool checked)
{
QCheckBox* button = qobject_cast<QCheckBox*>(QObject::sender()); QCheckBox* button = qobject_cast<QCheckBox*>(QObject::sender());
...@@ -635,7 +692,8 @@ void LinechartWidget::takeButtonClick(bool checked) { ...@@ -635,7 +692,8 @@ void LinechartWidget::takeButtonClick(bool checked) {
* @param text The button text * @param text The button text
* @param parent The parent object (to ensure that the memory is freed after the deletion of the button) * @param parent The parent object (to ensure that the memory is freed after the deletion of the button)
**/ **/
QToolButton* LinechartWidget::createButton(QWidget* parent) { QToolButton* LinechartWidget::createButton(QWidget* parent)
{
QToolButton* button = new QToolButton(parent); QToolButton* button = new QToolButton(parent);
button->setMinimumSize(QSize(20, 20)); button->setMinimumSize(QSize(20, 20));
button->setMaximumSize(60, 20); button->setMaximumSize(60, 20);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment