diff --git a/ground/openpilotgcs/src/plugins/config/config.pro b/ground/openpilotgcs/src/plugins/config/config.pro index d8298365e..aacb69834 100644 --- a/ground/openpilotgcs/src/plugins/config/config.pro +++ b/ground/openpilotgcs/src/plugins/config/config.pro @@ -25,8 +25,7 @@ HEADERS += configplugin.h \ mixercurvepoint.h \ mixercurveline.h \ configccpmwidget.h \ - configstabilizationwidget.h \ - widgetbar.h + configstabilizationwidget.h SOURCES += configplugin.cpp \ configgadgetconfiguration.cpp \ @@ -44,8 +43,7 @@ SOURCES += configplugin.cpp \ mixercurvepoint.cpp \ mixercurveline.cpp \ configccpmwidget.cpp \ - configstabilizationwidget.cpp \ - widgetbar.cpp + configstabilizationwidget.cpp FORMS += settingswidget.ui \ airframe.ui \ diff --git a/ground/openpilotgcs/src/plugins/config/configservowidget.cpp b/ground/openpilotgcs/src/plugins/config/configservowidget.cpp index 3971b981e..7c427ec24 100644 --- a/ground/openpilotgcs/src/plugins/config/configservowidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configservowidget.cpp @@ -129,15 +129,6 @@ ConfigServoWidget::ConfigServoWidget(QWidget *parent) : ConfigTaskWidget(parent) << m_config->inSlider6 << m_config->inSlider7; -// inWidgetBars << m_config->widgetBarCH0 -// << m_config->widgetBarCH1 -// << m_config->widgetBarCH2 -// << m_config->widgetBarCH3 -// << m_config->widgetBarCH4 -// << m_config->widgetBarCH5 -// << m_config->widgetBarCH6 -// << m_config->widgetBarCH7; - // Now connect the widget to the ManualControlCommand / Channel UAVObject UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("ManualControlCommand"))); @@ -724,9 +715,6 @@ void ConfigServoWidget::requestRCInputUpdate() inSliders[i]->setMaximum(max.toInt()); inSliders[i]->setMinimum(min.toInt()); inSliders[i]->setValue(neutral.toInt()); -// inWidgetBars[i]->setMaximum(max.toInt()); -// inWidgetBars[i]->setMinimum(min.toInt()); -// inWidgetBars[i]->setValue(neutral.toInt()); } // Update receiver type @@ -803,7 +791,6 @@ void ConfigServoWidget::sendRCInputUpdate() field = obj->getField(fieldName); for (int i = 0; i < 8; i++) field->setValue(inSliders[i]->value(), i); -// field->setValue(inWidgetBars[i]->value(), i); // Set RC Receiver type: fieldName = QString("InputMode"); @@ -1019,7 +1006,6 @@ void ConfigServoWidget::updateChannels(UAVObject* controlCommand) field = controlCommand->getField(QString("Channel")); for (int i = 0; i < 8; i++) updateChannelInSlider(inSliders[i], inMinLabels[i], inMaxLabels[i], reversals[i], field->getValue(i).toInt()); -// updateChannelWidgetBar(inWidgetBars[i], inMinLabels[i], inMaxLabels[i], reversals[i], field->getValue(i).toInt()); firstUpdate = false; } @@ -1053,9 +1039,6 @@ void ConfigServoWidget::updateChannels(UAVObject* controlCommand) int chMin = inSliders[chIndex]->minimum(); int chMax = inSliders[chIndex]->maximum(); int chNeutral = inSliders[chIndex]->value(); -// int chMin = inWidgetBars[chIndex]->minimum(); -// int chMax = inWidgetBars[chIndex]->maximum(); -// int chNeutral = inWidgetBars[chIndex]->value(); int value = controlCommand->getField("Channel")->getValue(chIndex).toInt(); if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral)) @@ -1118,41 +1101,3 @@ void ConfigServoWidget::updateChannelInSlider(QSlider *slider, QLabel *min, QLab slider->setValue(value); } } -/* -void ConfigServoWidget::updateChannelWidgetBar(WidgetBar *widget_bar, QLabel *min, QLabel *max, QCheckBox *rev, int value) -{ - Q_UNUSED(rev); - -// if (!widget_bar || !min || !max || !rev) - if (!widget_bar || !min || !max) - return; - - if (firstUpdate) - { // Reset all the min/max values of the progress bar since we are starting the calibration. - - widget_bar->setMaximum(value); - widget_bar->setMinimum(value); - widget_bar->setValue(value); - - max->setText(QString::number(value)); - min->setText(QString::number(value)); - - return; - } - - if (value > 0) - { // avoids glitches... - if (value > widget_bar->maximum()) - { - widget_bar->setMaximum(value); - max->setText(QString::number(value)); - } - if (value < widget_bar->minimum()) - { - widget_bar->setMinimum(value); - min->setText(QString::number(value)); - } - widget_bar->setValue(value); - } -} -*/ diff --git a/ground/openpilotgcs/src/plugins/config/configservowidget.h b/ground/openpilotgcs/src/plugins/config/configservowidget.h index 7c0510729..5da9a7ef8 100644 --- a/ground/openpilotgcs/src/plugins/config/configservowidget.h +++ b/ground/openpilotgcs/src/plugins/config/configservowidget.h @@ -34,7 +34,6 @@ #include "uavobject.h" #include #include -#include "widgetbar.h" class Ui_SettingsWidget; @@ -67,7 +66,6 @@ private: QList sliders; void updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, QCheckBox *rev, int value); -// void updateChannelWidgetBar(WidgetBar *widget_bar, QLabel *min, QLabel *max, QCheckBox *rev, int value); void assignChannel(UAVDataObject *obj, QString str); void assignOutputChannel(UAVDataObject *obj, QString str); @@ -83,7 +81,6 @@ private: QList outLabels; QList inSliders; - QList inWidgetBars; QList inMaxLabels; QList inMinLabels; QList inNeuLabels; diff --git a/ground/openpilotgcs/src/plugins/config/settingswidget.ui b/ground/openpilotgcs/src/plugins/config/settingswidget.ui index ccbe14d2f..bcd7ddbda 100644 --- a/ground/openpilotgcs/src/plugins/config/settingswidget.ui +++ b/ground/openpilotgcs/src/plugins/config/settingswidget.ui @@ -82,7 +82,7 @@ p, li { white-space: pre-wrap; } 205 - 60 + 70 36 17 @@ -112,7 +112,7 @@ p, li { white-space: pre-wrap; } 205 - 160 + 220 36 17 @@ -142,7 +142,7 @@ p, li { white-space: pre-wrap; } 150 - 180 + 250 51 17 @@ -170,7 +170,7 @@ p, li { white-space: pre-wrap; } 530 - 120 + 160 36 17 @@ -197,7 +197,7 @@ p, li { white-space: pre-wrap; } 205 - 180 + 250 36 17 @@ -227,7 +227,7 @@ p, li { white-space: pre-wrap; } 250 - 210 + 280 93 27 @@ -243,7 +243,7 @@ p, li { white-space: pre-wrap; } 205 - 80 + 100 36 17 @@ -273,7 +273,7 @@ p, li { white-space: pre-wrap; } 530 - 160 + 220 36 17 @@ -300,7 +300,7 @@ p, li { white-space: pre-wrap; } 530 - 140 + 190 36 17 @@ -327,7 +327,7 @@ p, li { white-space: pre-wrap; } 530 - 100 + 130 36 17 @@ -354,7 +354,7 @@ p, li { white-space: pre-wrap; } 430 - 210 + 280 93 27 @@ -371,7 +371,7 @@ Applies and Saves all settings to SD 150 - 120 + 160 51 17 @@ -399,7 +399,7 @@ p, li { white-space: pre-wrap; } 205 - 120 + 160 36 17 @@ -429,7 +429,7 @@ p, li { white-space: pre-wrap; } 340 - 210 + 280 93 27 @@ -471,7 +471,7 @@ Be sure to set the Neutral position on all sliders before sending! 205 - 100 + 130 36 17 @@ -501,7 +501,7 @@ p, li { white-space: pre-wrap; } 530 - 180 + 250 36 17 @@ -528,7 +528,7 @@ p, li { white-space: pre-wrap; } 150 - 80 + 100 51 17 @@ -556,7 +556,7 @@ p, li { white-space: pre-wrap; } 150 - 140 + 190 51 17 @@ -584,7 +584,7 @@ p, li { white-space: pre-wrap; } 205 - 140 + 190 36 17 @@ -614,7 +614,7 @@ p, li { white-space: pre-wrap; } 150 - 60 + 70 51 17 @@ -642,7 +642,7 @@ p, li { white-space: pre-wrap; } 150 - 160 + 220 51 17 @@ -670,7 +670,7 @@ p, li { white-space: pre-wrap; } 150 - 100 + 130 51 17 @@ -698,7 +698,7 @@ p, li { white-space: pre-wrap; } 530 - 80 + 100 36 17 @@ -725,7 +725,7 @@ p, li { white-space: pre-wrap; } 530 - 60 + 70 36 17 @@ -782,7 +782,7 @@ p, li { white-space: pre-wrap; } 20 - 60 + 70 121 21 @@ -798,7 +798,7 @@ p, li { white-space: pre-wrap; } 20 - 80 + 100 121 21 @@ -814,7 +814,7 @@ p, li { white-space: pre-wrap; } 20 - 100 + 130 121 21 @@ -830,7 +830,7 @@ p, li { white-space: pre-wrap; } 20 - 120 + 160 121 21 @@ -846,7 +846,7 @@ p, li { white-space: pre-wrap; } 20 - 140 + 190 121 21 @@ -862,7 +862,7 @@ p, li { white-space: pre-wrap; } 20 - 160 + 220 121 21 @@ -878,7 +878,7 @@ p, li { white-space: pre-wrap; } 20 - 180 + 250 121 21 @@ -894,7 +894,7 @@ p, li { white-space: pre-wrap; } 20 - 213 + 283 181 22 @@ -975,7 +975,7 @@ Neutral should be put at the bottom of the slider for the throttle. 20 - 240 + 310 531 41 @@ -1018,7 +1018,7 @@ p, li { white-space: pre-wrap; } 250 - 60 + 70 271 21 @@ -1043,7 +1043,7 @@ p, li { white-space: pre-wrap; } 250 - 80 + 100 271 21 @@ -1068,7 +1068,7 @@ p, li { white-space: pre-wrap; } 250 - 100 + 130 271 21 @@ -1093,7 +1093,7 @@ p, li { white-space: pre-wrap; } 250 - 120 + 160 271 21 @@ -1118,7 +1118,7 @@ p, li { white-space: pre-wrap; } 250 - 140 + 190 271 21 @@ -1143,7 +1143,7 @@ p, li { white-space: pre-wrap; } 250 - 160 + 220 271 21 @@ -1168,7 +1168,7 @@ p, li { white-space: pre-wrap; } 250 - 180 + 250 271 21 diff --git a/ground/openpilotgcs/src/plugins/config/widgetbar.cpp b/ground/openpilotgcs/src/plugins/config/widgetbar.cpp deleted file mode 100644 index 2ed3a9d6c..000000000 --- a/ground/openpilotgcs/src/plugins/config/widgetbar.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/** - ****************************************************************************** - * - * @file widgetbar.cpp - * @author Cathy Moss Copyright (C) 2011. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ConfigPlugin Configuration Plugin - * @{ - * @brief A bar display widget - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - #include - - #include "widgetbar.h" - - WidgetBar::WidgetBar(QWidget *parent) - : QWidget(parent) - { - m_maximum = 2000; - m_minimum = 1000; - m_value = 1500; - -// m_orientation = Qt::Vertical; - m_orientation = Qt::Horizontal; - - setBackgroundRole(QPalette::Base); - setAutoFillBackground(true); - } - - QSize WidgetBar::minimumSizeHint() const - { - return QSize(8, 8); - } - - QSize WidgetBar::sizeHint() const - { - return QSize(200, 400); - } - - void WidgetBar::setMaximum(int value) - { - m_maximum = value; - update(); - } - - void WidgetBar::setMinimum(int value) - { - m_minimum = value; - update(); - } - - void WidgetBar::setValue(int value) - { - if (value < m_minimum) value = m_minimum; - else - if (value > m_maximum) value = m_maximum; - - m_value = value; - update(); - } - -void WidgetBar::setOrientation(Qt::Orientation orientation) -{ - m_orientation = orientation; - update(); -} - -void WidgetBar::paintEvent(QPaintEvent * /* event */) -{ - QPainter painter(this); - painter.setRenderHint(QPainter::Antialiasing, false); - - int range = abs(m_maximum - m_minimum); - if (range < 1) range = 1; - - float level = (float)(m_value - m_minimum) / range; // 0 to +1 - - int length = 0; - QRect rect; - - switch (m_orientation) - { - case Qt::Horizontal: - { - length = (int)((width() - 5) * level + 0.5f); - rect.setLeft(2); - rect.setTop(2); - rect.setWidth(length); - rect.setHeight(height() - 5); - } - break; - - case Qt::Vertical: - { - length = (int)((height() - 5) * level + 0.5f); - rect.setLeft(2); - rect.setTop(height() - 3 - length); - rect.setWidth(width() - 5); - rect.setHeight(length); - } - break; - } - - // background -// painter.setPen(QColor(160, 160, 160)); -// painter.setBrush(QColor(255, 255, 255)); -// painter.setPen(QColor(80, 80, 80)); - painter.setPen(QColor(160, 160, 160)); - painter.setBrush(QColor(160, 160, 160)); - painter.drawRect(QRect(0, 0, width() - 1, height() - 1)); - - if ((m_maximum - m_minimum) > 0) - { - // solid bar -// painter.setPen(QColor(128, 128, 255)); -// painter.setBrush(QColor(128, 128, 255)); -// painter.drawRoundRect(rect, 3, 3); - - // colourful bar - for (int i = 0; i < length; i++) - { - if (!(i & 1)) - painter.setPen(QColor(0, 0, 0)); // black - else -// painter.setPen(QColor(0, 255, 0)); // green - painter.setPen(QColor(128, 128, 255)); // blue - - if (m_orientation == Qt::Horizontal) - painter.drawLine(rect.left() + i, rect.top(), rect.left() + i, rect.bottom() + 1); // horizontal bar - else - painter.drawLine(rect.left(), rect.bottom() + 1 - i, rect.right() + 1, rect.bottom() + 1 - i); // vertical bar - } - } -} diff --git a/ground/openpilotgcs/src/plugins/config/widgetbar.h b/ground/openpilotgcs/src/plugins/config/widgetbar.h deleted file mode 100644 index f7ce2fc94..000000000 --- a/ground/openpilotgcs/src/plugins/config/widgetbar.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - ****************************************************************************** - * - * @file widgetbar.h - * @author Cathy Moss Copyright (C) 2011. - * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2010. - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup ConfigPlugin Configuration Plugin - * @{ - * @brief A bar display widget - *****************************************************************************/ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef WIDGETBAR_H -#define WIDGETBAR_H - -#include -#include -#include -#include - -QT_MODULE(Gui) - -class WidgetBar : public QWidget -{ - Q_OBJECT - - Q_PROPERTY(int maximum READ maximum WRITE setMaximum) - Q_PROPERTY(int minimum READ minimum WRITE setMinimum) - Q_PROPERTY(int value READ value WRITE setValue) - - Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) - -public: - WidgetBar(QWidget *parent = 0); - - QSize minimumSizeHint() const; - QSize sizeHint() const; - - void setMaximum(int value); - void setMinimum(int value); - void setValue(int value); - - int maximum() { return m_maximum; } - int minimum() { return m_minimum; } - int value() { return m_value; } - - Qt::Orientation orientation() const { return m_orientation; } - void setOrientation(Qt::Orientation orientation); - -protected: - void paintEvent(QPaintEvent *event); - -private: - int m_maximum; - int m_minimum; - int m_value; - - Qt::Orientation m_orientation; -}; - -#endif