Commit 78f9170f authored by lm's avatar lm

Improved documentation and linechart

parent cfce88d5
......@@ -154,6 +154,7 @@ linux-g++ {
release {
DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
}
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
......@@ -223,6 +224,7 @@ linux-g++-64 {
release {
DESTDIR = $$TARGETDIR/release
DEFINES += QT_NO_DEBUG
}
QMAKE_POST_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/.
......@@ -295,6 +297,7 @@ win32-msvc2008 {
release {
CONFIG -= console
DEFINES += QT_NO_DEBUG
}
# Special settings for debug
......@@ -380,6 +383,7 @@ win32-g++ {
release {
CONFIG -= console
DEFINES += QT_NO_DEBUG
#DESTDIR = $$BUILDDIR/release
}
......
......@@ -62,26 +62,38 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) :
horizontalLayout->addWidget(tree, 0, 0, 1, 3);
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()));
horizontalLayout->addWidget(refreshButton, 1, 0);
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()));
horizontalLayout->addWidget(setButton, 1, 1);
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()));
horizontalLayout->addWidget(writeButton, 1, 2);
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()));
horizontalLayout->addWidget(readButton, 2, 2);
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()));
horizontalLayout->addWidget(loadFileButton, 2, 0);
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()));
horizontalLayout->addWidget(saveFileButton, 2, 1);
......
......@@ -221,8 +221,8 @@ public:
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_PLOT_INTERVAL = 1000 * 12; ///< The default plot interval is 15 seconds
static const int DEFAULT_SCALE_INTERVAL = 1000 * 5;
static const int DEFAULT_PLOT_INTERVAL = 1000 * 8; ///< The default plot interval is 15 seconds
static const int DEFAULT_SCALE_INTERVAL = 1000 * 8;
public slots:
void setRefreshRate(int ms);
......
......@@ -81,16 +81,52 @@ updateTimer(new QTimer())
curvesWidgetLayout->setMargin(2);
curvesWidgetLayout->setSpacing(4);
curvesWidgetLayout->setSizeConstraint(QLayout::SetMinimumSize);
curvesWidgetLayout->setAlignment(Qt::AlignTop);
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)
// Create the layout
createLayout();
// Add the last actions
connect(this, SIGNAL(plotWindowPositionUpdated(int)), scrollbar, SLOT(setValue(int)));
connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(setPlotWindowPosition(int)));
//connect(this, SIGNAL(plotWindowPositionUpdated(int)), scrollbar, SLOT(setValue(int)));
//connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(setPlotWindowPosition(int)));
updateTimer->setInterval(300);
connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh()));
......@@ -131,6 +167,8 @@ void LinechartWidget::createLayout()
scalingLinearButton = createButton(this);
scalingLinearButton->setDefaultAction(setScalingLinear);
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->setColumnStretch(0, 0);
......@@ -138,13 +176,18 @@ void LinechartWidget::createLayout()
scalingLogButton = createButton(this);
scalingLogButton->setDefaultAction(setScalingLogarithmic);
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->setColumnStretch(1, 0);
// Averaging spin box
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->setValue(200);
setAverageWindow(200);
averageSpinBox->setMaximum(9999);
layout->addWidget(averageSpinBox, 1, 2);
layout->setColumnStretch(2, 0);
......@@ -152,6 +195,8 @@ void LinechartWidget::createLayout()
// Log Button
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"));
layout->addWidget(logButton, 1, 3);
layout->setColumnStretch(3, 0);
......@@ -161,6 +206,8 @@ void LinechartWidget::createLayout()
QToolButton* timeButton = new QToolButton(this);
timeButton->setText(tr("Ground Time"));
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;
if (activePlot) activePlot->enforceGroundTime(gTimeDefault);
timeButton->setChecked(gTimeDefault);
......@@ -169,18 +216,18 @@ void LinechartWidget::createLayout()
connect(timeButton, SIGNAL(clicked(bool)), activePlot, SLOT(enforceGroundTime(bool)));
// Create the scroll bar
scrollbar = new QScrollBar(Qt::Horizontal, ui.diagramGroupBox);
scrollbar->setMinimum(MIN_TIME_SCROLLBAR_VALUE);
scrollbar->setMaximum(MAX_TIME_SCROLLBAR_VALUE);
scrollbar->setPageStep(PAGESTEP_TIME_SCROLLBAR_VALUE);
//scrollbar = new QScrollBar(Qt::Horizontal, ui.diagramGroupBox);
//scrollbar->setMinimum(MIN_TIME_SCROLLBAR_VALUE);
//scrollbar->setMaximum(MAX_TIME_SCROLLBAR_VALUE);
//scrollbar->setPageStep(PAGESTEP_TIME_SCROLLBAR_VALUE);
// Set scrollbar to maximum and disable it
scrollbar->setValue(MIN_TIME_SCROLLBAR_VALUE);
scrollbar->setDisabled(true);
//scrollbar->setValue(MIN_TIME_SCROLLBAR_VALUE);
//scrollbar->setDisabled(true);
// scrollbar->setFixedHeight(20);
// 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);
ui.diagramGroupBox->setLayout(layout);
......@@ -406,6 +453,8 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
checkBox = new QCheckBox(form);
checkBox->setCheckable(true);
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);
......@@ -431,12 +480,16 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
// Value
value = new QLabel(form);
value->setNum(0.00);
value->setToolTip(tr("Current value of ") + curve);
value->setWhatsThis(tr("Current value of ") + curve);
curveLabels->insert(curve, value);
horizontalLayout->addWidget(value);
// Mean
mean = new QLabel(form);
mean->setNum(0.00);
mean->setToolTip(tr("Arithmetic mean of ") + curve);
mean->setWhatsThis(tr("Arithmetic mean of ") + curve);
curveMeans->insert(curve, mean);
horizontalLayout->addWidget(mean);
......@@ -449,6 +502,8 @@ QWidget* LinechartWidget::createCurveItem(QString curve)
// Variance
variance = new QLabel(form);
variance->setNum(0.00);
variance->setToolTip(tr("Variance of ") + curve);
variance->setWhatsThis(tr("Variance of ") + curve);
curveVariances->insert(curve, variance);
horizontalLayout->addWidget(variance);
......@@ -584,14 +639,14 @@ void LinechartWidget::setPlotWindowPosition(quint64 position) {
// A relative position makes only sense if the plot is filled
if(activePlot->getDataInterval() > activePlot->getPlotInterval()) {
//TODO @todo Implement the scrollbar enabling in a more elegant way
scrollbar->setDisabled(false);
//scrollbar->setDisabled(false);
quint64 scrollInterval = position - activePlot->getMinTime() - activePlot->getPlotInterval();
pos = (static_cast<double>(scrollInterval) / (activePlot->getDataInterval() - activePlot->getPlotInterval()));
} else {
scrollbar->setDisabled(true);
//scrollbar->setDisabled(true);
pos = 1;
}
plotWindowLock.unlock();
......@@ -607,7 +662,8 @@ void LinechartWidget::setPlotWindowPosition(quint64 position) {
*
* @param interval The time interval to plot
**/
void LinechartWidget::setPlotInterval(quint64 interval) {
void LinechartWidget::setPlotInterval(quint64 interval)
{
activePlot->setPlotInterval(interval);
}
......@@ -618,7 +674,8 @@ void LinechartWidget::setPlotInterval(quint64 interval) {
*
* @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());
......@@ -635,7 +692,8 @@ void LinechartWidget::takeButtonClick(bool checked) {
* @param text The button text
* @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);
button->setMinimumSize(QSize(20, 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