From c11958c9b635119546000959ad5bb73741931f6b Mon Sep 17 00:00:00 2001 From: PT_Dreamer Date: Wed, 12 Sep 2012 11:09:30 +0100 Subject: [PATCH] GCS-Review comments changes Added font mixer curve font size to linux default and wide stylesheets Change Node class name to MixerNode to ease stylesheet access Changed language selection to top of the list --- .../stylesheets/default_linux.qss | 1 + .../openpilotgcs/stylesheets/wide_linux.qss | 1 + .../src/plugins/config/mixercurve.cpp | 4 +- .../src/plugins/config/mixercurve.h | 2 +- .../plugins/coreplugin/connectionmanager.h | 3 +- .../src/plugins/coreplugin/generalsettings.ui | 188 +++++++++--------- .../uavobjectwidgetutils/mixercurveline.cpp | 10 +- .../uavobjectwidgetutils/mixercurveline.h | 14 +- .../uavobjectwidgetutils/mixercurvepoint.cpp | 29 ++- .../uavobjectwidgetutils/mixercurvepoint.h | 7 +- .../uavobjectwidgetutils/mixercurvewidget.cpp | 52 ++--- .../uavobjectwidgetutils/mixercurvewidget.h | 18 +- 12 files changed, 165 insertions(+), 164 deletions(-) diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss index 035fa5633..558054cc1 100644 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss +++ b/ground/openpilotgcs/share/openpilotgcs/stylesheets/default_linux.qss @@ -1,4 +1,5 @@ MyListWidget {font-size: 11px;} +MixerCurveWidget {font-size: 12px;} Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} diff --git a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_linux.qss b/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_linux.qss index 035fa5633..558054cc1 100644 --- a/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_linux.qss +++ b/ground/openpilotgcs/share/openpilotgcs/stylesheets/wide_linux.qss @@ -1,4 +1,5 @@ MyListWidget {font-size: 11px;} +MixerCurveWidget {font-size: 12px;} Utils--StyledBar { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(200, 200, 200, 255));} diff --git a/ground/openpilotgcs/src/plugins/config/mixercurve.cpp b/ground/openpilotgcs/src/plugins/config/mixercurve.cpp index 4ad2e3afe..b55974c86 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurve.cpp +++ b/ground/openpilotgcs/src/plugins/config/mixercurve.cpp @@ -67,7 +67,7 @@ MixerCurve::MixerCurve(QWidget *parent) : connect(m_mixerUI->PopupCurve, SIGNAL(clicked()),this,SLOT(PopupCurve())); connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve())); connect(m_curve, SIGNAL(curveUpdated()), this, SLOT(UpdateSettingsTable())); - connect(m_curve, SIGNAL(commandActivated(Node*)),this, SLOT(CommandActivated(Node*))); + connect(m_curve, SIGNAL(commandActivated(MixerNode*)),this, SLOT(CommandActivated(MixerNode*))); connect(m_settings, SIGNAL(cellChanged(int,int)), this, SLOT(SettingsTableChanged())); connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double))); connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double))); @@ -370,7 +370,7 @@ void MixerCurve::SettingsTableChanged() m_curve->setCurve(&points); } -void MixerCurve::CommandActivated(Node* node) +void MixerCurve::CommandActivated(MixerNode* node) { QString name = (node) ? node->getName() : "Reset"; diff --git a/ground/openpilotgcs/src/plugins/config/mixercurve.h b/ground/openpilotgcs/src/plugins/config/mixercurve.h index 1e60534f6..ef98414bc 100644 --- a/ground/openpilotgcs/src/plugins/config/mixercurve.h +++ b/ground/openpilotgcs/src/plugins/config/mixercurve.h @@ -84,7 +84,7 @@ public slots: void UpdateSettingsTable(); private slots: - void CommandActivated(Node* node = 0); + void CommandActivated(MixerNode* node = 0); void SettingsTableChanged(); void CurveTypeChanged(); void CurveMinChanged(double value); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h index 6c2533fec..52cf2836f 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h +++ b/ground/openpilotgcs/src/plugins/coreplugin/connectionmanager.h @@ -103,8 +103,7 @@ private slots: void onConnectClicked(); void devChanged(IConnection *connection); -// void onConnectionClosed(QObject *obj); - void onConnectionDestroyed(QObject *obj); + void onConnectionDestroyed(QObject *obj); void connectionsCallBack(); //used to call devChange after all the plugins are loaded void reconnectSlot(); void reconnectCheckSlot(); diff --git a/ground/openpilotgcs/src/plugins/coreplugin/generalsettings.ui b/ground/openpilotgcs/src/plugins/coreplugin/generalsettings.ui index 9e3dd68df..8861aa752 100644 --- a/ground/openpilotgcs/src/plugins/coreplugin/generalsettings.ui +++ b/ground/openpilotgcs/src/plugins/coreplugin/generalsettings.ui @@ -17,14 +17,14 @@ General settings - + User interface color: - + @@ -79,7 +79,7 @@ - + @@ -88,14 +88,98 @@ - - + + - Language: + + + + true - + + + + Save configuration settings on exit: + + + true + + + + + + + Automatically connect an OpenPilot USB device: + + + true + + + + + + + + + + true + + + + + + + Automatically select an OpenPilot USB device: + + + true + + + + + + + false + + + + + + true + + + + + + + + + + + + + + Use UDP Mirror + + + + + + + Expert Mode + + + + + + + + + + + @@ -115,94 +199,10 @@ - - + + - - - - true - - - - - - - Save configuration settings on exit: - - - true - - - - - - - Automatically connect an OpenPilot USB device: - - - true - - - - - - - - - - true - - - - - - - Automatically select an OpenPilot USB device: - - - true - - - - - - - false - - - - - - true - - - - - - - - - - - - - - Use UDP Mirror - - - - - - - Expert Mode - - - - - - - + Language: diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp index e0498366c..1a7ed4388 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.cpp @@ -35,7 +35,7 @@ static const double Pi = 3.14159265358979323846264338327950288419717; // static double TwoPi = 2.0 * Pi; -Edge::Edge(Node *sourceNode, Node *destNode) +Edge::Edge(MixerNode *sourceNode, MixerNode *destNode) : arrowSize(10) { setAcceptedMouseButtons(0); @@ -50,23 +50,23 @@ Edge::~Edge() { } -Node *Edge::sourceNode() const +MixerNode *Edge::sourceNode() const { return source; } -void Edge::setSourceNode(Node *node) +void Edge::setSourceNode(MixerNode *node) { source = node; adjust(); } -Node *Edge::destNode() const +MixerNode *Edge::destNode() const { return dest; } -void Edge::setDestNode(Node *node) +void Edge::setDestNode(MixerNode *node) { dest = node; adjust(); diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.h index 417f5b1ca..1c4281c4a 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurveline.h @@ -35,19 +35,19 @@ #include -class Node; +class MixerNode; class Edge : public QGraphicsItem { public: - Edge(Node *sourceNode, Node *destNode); + Edge(MixerNode *sourceNode, MixerNode *destNode); ~Edge(); - Node *sourceNode() const; - void setSourceNode(Node *node); + MixerNode *sourceNode() const; + void setSourceNode(MixerNode *node); - Node *destNode() const; - void setDestNode(Node *node); + MixerNode *destNode() const; + void setDestNode(MixerNode *node); void adjust(); @@ -59,7 +59,7 @@ protected: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); private: - Node *source, *dest; + MixerNode *source, *dest; QPointF sourcePoint; QPointF destPoint; diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp index f81d283d9..c4462fc94 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.cpp @@ -36,7 +36,7 @@ #include "mixercurvepoint.h" #include "mixercurvewidget.h" -Node::Node(MixerCurveWidget *graphWidget) +MixerNode::MixerNode(MixerCurveWidget *graphWidget) : graph(graphWidget) { setFlag(ItemIsMovable); @@ -54,37 +54,36 @@ Node::Node(MixerCurveWidget *graphWidget) posColor1 = "#116703"; //greenish? negColor0 = "#aa0000"; //red negColor1 = "#aa0000"; //red - } -void Node::addEdge(Edge *edge) +void MixerNode::addEdge(Edge *edge) { edgeList << edge; edge->adjust(); } -QList Node::edges() const +QList MixerNode::edges() const { return edgeList; } -QRectF Node::boundingRect() const +QRectF MixerNode::boundingRect() const { return cmdNode ? QRectF(-4, -4, 15, 10) : QRectF(-13, -13, 26, 26); } -QPainterPath Node::shape() const +QPainterPath MixerNode::shape() const { QPainterPath path; path.addEllipse(boundingRect()); return path; } -void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) +void MixerNode::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) { QString text = cmdNode ? cmdText : QString().sprintf("%.2f", value()); - + painter->setFont(graph->font()); if (drawNode) { QRadialGradient gradient(-3, -3, 10); if (option->state & QStyle::State_Sunken) { @@ -128,25 +127,25 @@ void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid } } -void Node::verticalMove(bool flag){ +void MixerNode::verticalMove(bool flag){ vertical = flag; } -void Node::commandNode(bool enable){ +void MixerNode::commandNode(bool enable){ cmdNode = enable; } -void Node::commandText(QString text){ +void MixerNode::commandText(QString text){ cmdText = text; } -double Node::value() { +double MixerNode::value() { double h = graph->sceneRect().height(); double ratio = (h - pos().y()) / h; return ((graph->getMax() - graph->getMin()) * ratio ) + graph->getMin(); } -QVariant Node::itemChange(GraphicsItemChange change, const QVariant &val) +QVariant MixerNode::itemChange(GraphicsItemChange change, const QVariant &val) { QPointF newPos = val.toPointF(); double h = graph->sceneRect().height(); @@ -185,7 +184,7 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &val) return QGraphicsItem::itemChange(change, val); } -void Node::mousePressEvent(QGraphicsSceneMouseEvent *event) +void MixerNode::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (cmdNode) { graph->cmdActivated(this); @@ -195,7 +194,7 @@ void Node::mousePressEvent(QGraphicsSceneMouseEvent *event) QGraphicsItem::mousePressEvent(event); } -void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void MixerNode::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { update(); QGraphicsItem::mouseReleaseEvent(event); diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h index 68d6b9cec..3c4b0cc5d 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvepoint.h @@ -31,6 +31,7 @@ #include #include #include +#include class Edge; class MixerCurveWidget; @@ -38,11 +39,11 @@ QT_BEGIN_NAMESPACE class QGraphicsSceneMouseEvent; QT_END_NAMESPACE -class Node : public QGraphicsItem +class MixerNode : public QObject,public QGraphicsItem { + Q_OBJECT public: - Node(MixerCurveWidget *graphWidget); - + MixerNode(MixerCurveWidget *graphWidget); void addEdge(Edge *edge); QList edges() const; diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp index 90a84f490..63e388a28 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.cpp @@ -80,7 +80,7 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent) // commmand nodes // reset - Node* node = getCommandNode(0); + MixerNode* node = getCommandNode(0); node->setName("Reset"); node->setToolTip("Reset Curve to Defaults"); node->setToggle(false); @@ -274,16 +274,16 @@ MixerCurveWidget::~MixerCurveWidget() delete cmdNodePool.takeFirst(); } -Node* MixerCurveWidget::getCommandNode(int index) +MixerNode* MixerCurveWidget::getCommandNode(int index) { - Node* node; + MixerNode* node; if (index >= 0 && index < cmdNodePool.count()) { node = cmdNodePool.at(index); } else { - node = new Node(this); + node = new MixerNode(this); node->commandNode(true); node->commandText(""); node->setCommandIndex(index); @@ -296,21 +296,21 @@ Node* MixerCurveWidget::getCommandNode(int index) } -Node* MixerCurveWidget::getNode(int index) +MixerNode* MixerCurveWidget::getNode(int index) { - Node* node; + MixerNode* node; if (index >= 0 && index < nodePool.count()) { node = nodePool.at(index); } else { - node = new Node(this); + node = new MixerNode(this); nodePool.append(node); } return node; } -Edge* MixerCurveWidget::getEdge(int index, Node* sourceNode, Node* destNode) +Edge* MixerCurveWidget::getEdge(int index, MixerNode* sourceNode, MixerNode* destNode) { Edge* edge; @@ -332,7 +332,7 @@ void MixerCurveWidget::setPositiveColor(QString color0, QString color1) posColor0 = color0; posColor1 = color1; for (int i=0; isetPositiveColor(color0, color1); } } @@ -341,7 +341,7 @@ void MixerCurveWidget::setNegativeColor(QString color0, QString color1) negColor0 = color0; negColor1 = color1; for (int i=0; isetNegativeColor(color0, color1); } } @@ -366,7 +366,7 @@ void MixerCurveWidget::initNodes(int numPoints) { // First of all, clear any existing list if (nodeList.count()) { - foreach (Node *node, nodeList ) { + foreach (MixerNode *node, nodeList ) { foreach(Edge *edge, node->edges()) { if (edge->sourceNode() == node) { scene()->removeItem(edge); @@ -379,10 +379,10 @@ void MixerCurveWidget::initNodes(int numPoints) } // Create the nodes and edges - Node* prevNode = 0; + MixerNode* prevNode = 0; for (int i=0; iaddItem(node); @@ -404,7 +404,7 @@ QList MixerCurveWidget::getCurve() { QList list; - foreach(Node *node, nodeList) { + foreach(MixerNode *node, nodeList) { list.append(node->value()); } @@ -447,7 +447,7 @@ void MixerCurveWidget::setCurve(const QList* points) val -= (curveMin + range); val /= range; - Node* node = nodeList.at(i); + MixerNode* node = nodeList.at(i); node->setPos(w*i, h - (val*h)); node->verticalMove(true); @@ -486,7 +486,7 @@ void MixerCurveWidget::resizeCommands() { QRectF rect = plot->boundingRect(); - Node* node; + MixerNode* node; //popup node = getCommandNode(14); node->setPos((rect.left() + rect.width() / 2) - 20, rect.height() + 10); @@ -575,11 +575,11 @@ double MixerCurveWidget::setRange(double min, double max) return curveMax - curveMin; } -Node* MixerCurveWidget::getCmdNode(const QString& name) +MixerNode* MixerCurveWidget::getCmdNode(const QString& name) { - Node* node = 0; + MixerNode* node = 0; for (int i=0; igetName() == name) node = n; } @@ -589,7 +589,7 @@ Node* MixerCurveWidget::getCmdNode(const QString& name) void MixerCurveWidget::setCommandText(const QString& name, const QString& text) { for (int i=0; igetName() == name) { n->commandText(text); n->update(); @@ -599,7 +599,7 @@ void MixerCurveWidget::setCommandText(const QString& name, const QString& text) void MixerCurveWidget::activateCommand(const QString& name) { for (int i=1; isetCommandActive(node->getName() == name); node->update(); } @@ -607,7 +607,7 @@ void MixerCurveWidget::activateCommand(const QString& name) void MixerCurveWidget::showCommand(const QString& name, bool show) { - Node* node = getCmdNode(name); + MixerNode* node = getCmdNode(name); if (node) { if (show) node->show(); @@ -618,7 +618,7 @@ void MixerCurveWidget::showCommand(const QString& name, bool show) void MixerCurveWidget::showCommands(bool show) { for (int i=1; ishow(); else @@ -630,14 +630,14 @@ void MixerCurveWidget::showCommands(bool show) bool MixerCurveWidget::isCommandActive(const QString& name) { bool active = false; - Node* node = getCmdNode(name); + MixerNode* node = getCmdNode(name); if (node) { active = node->getCommandActive(); } return active; } -void MixerCurveWidget::cmdActivated(Node* node) +void MixerCurveWidget::cmdActivated(MixerNode* node) { if (node->getToggle()) { if (node->getName() == "Commands") { @@ -646,7 +646,7 @@ void MixerCurveWidget::cmdActivated(Node* node) } else { for (int i=1; isetCommandActive(false); n->update(); } diff --git a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h index f2e8226cf..d9469ba58 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h +++ b/ground/openpilotgcs/src/plugins/uavobjectwidgetutils/mixercurvewidget.h @@ -59,12 +59,12 @@ public: double setRange(double min, double max); - void cmdActivated(Node* node); + void cmdActivated(MixerNode* node); void activateCommand(const QString& name); bool isCommandActive(const QString& name); void showCommand(const QString& name, bool show); void showCommands(bool show); - Node* getCmdNode(const QString& name); + MixerNode* getCmdNode(const QString& name); void setCommandText(const QString& name, const QString& text); static const int NODE_NUMELEM = 5; @@ -73,17 +73,17 @@ signals: void curveUpdated(); void curveMinChanged(double value); void curveMaxChanged(double value); - void commandActivated(Node* node); + void commandActivated(MixerNode* node); private slots: private: QGraphicsSvgItem *plot; - QList nodePool; - QList cmdNodePool; + QList nodePool; + QList cmdNodePool; QList edgePool; - QList nodeList; + QList nodeList; double curveMin; double curveMax; @@ -95,9 +95,9 @@ private: QString negColor1; void initNodes(int numPoints); - Node* getNode(int index); - Node* getCommandNode(int index); - Edge* getEdge(int index, Node* sourceNode, Node* destNode); + MixerNode* getNode(int index); + MixerNode* getCommandNode(int index); + Edge* getEdge(int index, MixerNode* sourceNode, MixerNode* destNode); void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00"); void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000");