1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

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
This commit is contained in:
PT_Dreamer 2012-09-12 11:09:30 +01:00
parent 09f950ff76
commit c11958c9b6
12 changed files with 165 additions and 164 deletions

View File

@ -1,4 +1,5 @@
MyListWidget {font-size: 11px;} 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));} 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));}

View File

@ -1,4 +1,5 @@
MyListWidget {font-size: 11px;} 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));} 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));}

View File

@ -67,7 +67,7 @@ MixerCurve::MixerCurve(QWidget *parent) :
connect(m_mixerUI->PopupCurve, SIGNAL(clicked()),this,SLOT(PopupCurve())); connect(m_mixerUI->PopupCurve, SIGNAL(clicked()),this,SLOT(PopupCurve()));
connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve())); connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve()));
connect(m_curve, SIGNAL(curveUpdated()), this, SLOT(UpdateSettingsTable())); 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_settings, SIGNAL(cellChanged(int,int)), this, SLOT(SettingsTableChanged()));
connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double))); connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double)));
connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double))); connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double)));
@ -370,7 +370,7 @@ void MixerCurve::SettingsTableChanged()
m_curve->setCurve(&points); m_curve->setCurve(&points);
} }
void MixerCurve::CommandActivated(Node* node) void MixerCurve::CommandActivated(MixerNode* node)
{ {
QString name = (node) ? node->getName() : "Reset"; QString name = (node) ? node->getName() : "Reset";

View File

@ -84,7 +84,7 @@ public slots:
void UpdateSettingsTable(); void UpdateSettingsTable();
private slots: private slots:
void CommandActivated(Node* node = 0); void CommandActivated(MixerNode* node = 0);
void SettingsTableChanged(); void SettingsTableChanged();
void CurveTypeChanged(); void CurveTypeChanged();
void CurveMinChanged(double value); void CurveMinChanged(double value);

View File

@ -103,7 +103,6 @@ private slots:
void onConnectClicked(); void onConnectClicked();
void devChanged(IConnection *connection); 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 connectionsCallBack(); //used to call devChange after all the plugins are loaded
void reconnectSlot(); void reconnectSlot();

View File

@ -17,14 +17,14 @@
<string>General settings</string> <string>General settings</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="1" column="0">
<widget class="QLabel" name="colorLabel"> <widget class="QLabel" name="colorLabel">
<property name="text"> <property name="text">
<string>User interface color:</string> <string>User interface color:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1">
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<property name="margin"> <property name="margin">
@ -79,7 +79,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="9" column="1">
<widget class="QWidget" name="widget_2" native="true"> <widget class="QWidget" name="widget_2" native="true">
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<property name="margin"> <property name="margin">
@ -88,14 +88,98 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="10" column="1">
<widget class="QLabel" name="label_3"> <widget class="QCheckBox" name="checkBoxSaveOnExit">
<property name="text"> <property name="text">
<string>Language:</string> <string/>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="10" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Save configuration settings on exit:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Automatically connect an OpenPilot USB device:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="checkAutoConnect">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Automatically select an OpenPilot USB device:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="checkAutoSelect">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="cbUseUDPMirror">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="labelUDP">
<property name="text">
<string>Use UDP Mirror</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="labelExpert">
<property name="text">
<string>Expert Mode</string>
</property>
</widget>
</item>
<item row="14" column="1">
<widget class="QCheckBox" name="cbExpertMode">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QComboBox" name="languageBox"/> <widget class="QComboBox" name="languageBox"/>
@ -115,94 +199,10 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="9" column="1"> <item row="0" column="0">
<widget class="QCheckBox" name="checkBoxSaveOnExit"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string/> <string>Language:</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Save configuration settings on exit:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Automatically connect an OpenPilot USB device:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="checkAutoConnect">
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Automatically select an OpenPilot USB device:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="checkAutoSelect">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="cbUseUDPMirror">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="labelUDP">
<property name="text">
<string>Use UDP Mirror</string>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="labelExpert">
<property name="text">
<string>Expert Mode</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="cbExpertMode">
<property name="text">
<string/>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -35,7 +35,7 @@
static const double Pi = 3.14159265358979323846264338327950288419717; static const double Pi = 3.14159265358979323846264338327950288419717;
// static double TwoPi = 2.0 * Pi; // static double TwoPi = 2.0 * Pi;
Edge::Edge(Node *sourceNode, Node *destNode) Edge::Edge(MixerNode *sourceNode, MixerNode *destNode)
: arrowSize(10) : arrowSize(10)
{ {
setAcceptedMouseButtons(0); setAcceptedMouseButtons(0);
@ -50,23 +50,23 @@ Edge::~Edge()
{ {
} }
Node *Edge::sourceNode() const MixerNode *Edge::sourceNode() const
{ {
return source; return source;
} }
void Edge::setSourceNode(Node *node) void Edge::setSourceNode(MixerNode *node)
{ {
source = node; source = node;
adjust(); adjust();
} }
Node *Edge::destNode() const MixerNode *Edge::destNode() const
{ {
return dest; return dest;
} }
void Edge::setDestNode(Node *node) void Edge::setDestNode(MixerNode *node)
{ {
dest = node; dest = node;
adjust(); adjust();

View File

@ -35,19 +35,19 @@
#include <QGraphicsItem> #include <QGraphicsItem>
class Node; class MixerNode;
class Edge : public QGraphicsItem class Edge : public QGraphicsItem
{ {
public: public:
Edge(Node *sourceNode, Node *destNode); Edge(MixerNode *sourceNode, MixerNode *destNode);
~Edge(); ~Edge();
Node *sourceNode() const; MixerNode *sourceNode() const;
void setSourceNode(Node *node); void setSourceNode(MixerNode *node);
Node *destNode() const; MixerNode *destNode() const;
void setDestNode(Node *node); void setDestNode(MixerNode *node);
void adjust(); void adjust();
@ -59,7 +59,7 @@ protected:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private: private:
Node *source, *dest; MixerNode *source, *dest;
QPointF sourcePoint; QPointF sourcePoint;
QPointF destPoint; QPointF destPoint;

View File

@ -36,7 +36,7 @@
#include "mixercurvepoint.h" #include "mixercurvepoint.h"
#include "mixercurvewidget.h" #include "mixercurvewidget.h"
Node::Node(MixerCurveWidget *graphWidget) MixerNode::MixerNode(MixerCurveWidget *graphWidget)
: graph(graphWidget) : graph(graphWidget)
{ {
setFlag(ItemIsMovable); setFlag(ItemIsMovable);
@ -54,37 +54,36 @@ Node::Node(MixerCurveWidget *graphWidget)
posColor1 = "#116703"; //greenish? posColor1 = "#116703"; //greenish?
negColor0 = "#aa0000"; //red negColor0 = "#aa0000"; //red
negColor1 = "#aa0000"; //red negColor1 = "#aa0000"; //red
} }
void Node::addEdge(Edge *edge) void MixerNode::addEdge(Edge *edge)
{ {
edgeList << edge; edgeList << edge;
edge->adjust(); edge->adjust();
} }
QList<Edge *> Node::edges() const QList<Edge *> MixerNode::edges() const
{ {
return edgeList; return edgeList;
} }
QRectF Node::boundingRect() const QRectF MixerNode::boundingRect() const
{ {
return cmdNode ? QRectF(-4, -4, 15, 10) : QRectF(-13, -13, 26, 26); return cmdNode ? QRectF(-4, -4, 15, 10) : QRectF(-13, -13, 26, 26);
} }
QPainterPath Node::shape() const QPainterPath MixerNode::shape() const
{ {
QPainterPath path; QPainterPath path;
path.addEllipse(boundingRect()); path.addEllipse(boundingRect());
return path; 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()); QString text = cmdNode ? cmdText : QString().sprintf("%.2f", value());
painter->setFont(graph->font());
if (drawNode) { if (drawNode) {
QRadialGradient gradient(-3, -3, 10); QRadialGradient gradient(-3, -3, 10);
if (option->state & QStyle::State_Sunken) { 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; vertical = flag;
} }
void Node::commandNode(bool enable){ void MixerNode::commandNode(bool enable){
cmdNode = enable; cmdNode = enable;
} }
void Node::commandText(QString text){ void MixerNode::commandText(QString text){
cmdText = text; cmdText = text;
} }
double Node::value() { double MixerNode::value() {
double h = graph->sceneRect().height(); double h = graph->sceneRect().height();
double ratio = (h - pos().y()) / h; double ratio = (h - pos().y()) / h;
return ((graph->getMax() - graph->getMin()) * ratio ) + graph->getMin(); 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(); QPointF newPos = val.toPointF();
double h = graph->sceneRect().height(); double h = graph->sceneRect().height();
@ -185,7 +184,7 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &val)
return QGraphicsItem::itemChange(change, val); return QGraphicsItem::itemChange(change, val);
} }
void Node::mousePressEvent(QGraphicsSceneMouseEvent *event) void MixerNode::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
if (cmdNode) { if (cmdNode) {
graph->cmdActivated(this); graph->cmdActivated(this);
@ -195,7 +194,7 @@ void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
QGraphicsItem::mousePressEvent(event); QGraphicsItem::mousePressEvent(event);
} }
void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void MixerNode::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{ {
update(); update();
QGraphicsItem::mouseReleaseEvent(event); QGraphicsItem::mouseReleaseEvent(event);

View File

@ -31,6 +31,7 @@
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QColor> #include <QColor>
#include <QList> #include <QList>
#include <QFont>
class Edge; class Edge;
class MixerCurveWidget; class MixerCurveWidget;
@ -38,11 +39,11 @@ QT_BEGIN_NAMESPACE
class QGraphicsSceneMouseEvent; class QGraphicsSceneMouseEvent;
QT_END_NAMESPACE QT_END_NAMESPACE
class Node : public QGraphicsItem class MixerNode : public QObject,public QGraphicsItem
{ {
Q_OBJECT
public: public:
Node(MixerCurveWidget *graphWidget); MixerNode(MixerCurveWidget *graphWidget);
void addEdge(Edge *edge); void addEdge(Edge *edge);
QList<Edge *> edges() const; QList<Edge *> edges() const;

View File

@ -80,7 +80,7 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
// commmand nodes // commmand nodes
// reset // reset
Node* node = getCommandNode(0); MixerNode* node = getCommandNode(0);
node->setName("Reset"); node->setName("Reset");
node->setToolTip("Reset Curve to Defaults"); node->setToolTip("Reset Curve to Defaults");
node->setToggle(false); node->setToggle(false);
@ -274,16 +274,16 @@ MixerCurveWidget::~MixerCurveWidget()
delete cmdNodePool.takeFirst(); delete cmdNodePool.takeFirst();
} }
Node* MixerCurveWidget::getCommandNode(int index) MixerNode* MixerCurveWidget::getCommandNode(int index)
{ {
Node* node; MixerNode* node;
if (index >= 0 && index < cmdNodePool.count()) if (index >= 0 && index < cmdNodePool.count())
{ {
node = cmdNodePool.at(index); node = cmdNodePool.at(index);
} }
else { else {
node = new Node(this); node = new MixerNode(this);
node->commandNode(true); node->commandNode(true);
node->commandText(""); node->commandText("");
node->setCommandIndex(index); 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()) if (index >= 0 && index < nodePool.count())
{ {
node = nodePool.at(index); node = nodePool.at(index);
} }
else { else {
node = new Node(this); node = new MixerNode(this);
nodePool.append(node); nodePool.append(node);
} }
return node; return node;
} }
Edge* MixerCurveWidget::getEdge(int index, Node* sourceNode, Node* destNode) Edge* MixerCurveWidget::getEdge(int index, MixerNode* sourceNode, MixerNode* destNode)
{ {
Edge* edge; Edge* edge;
@ -332,7 +332,7 @@ void MixerCurveWidget::setPositiveColor(QString color0, QString color1)
posColor0 = color0; posColor0 = color0;
posColor1 = color1; posColor1 = color1;
for (int i=0; i<nodePool.count(); i++) { for (int i=0; i<nodePool.count(); i++) {
Node* node = nodePool.at(i); MixerNode* node = nodePool.at(i);
node->setPositiveColor(color0, color1); node->setPositiveColor(color0, color1);
} }
} }
@ -341,7 +341,7 @@ void MixerCurveWidget::setNegativeColor(QString color0, QString color1)
negColor0 = color0; negColor0 = color0;
negColor1 = color1; negColor1 = color1;
for (int i=0; i<nodePool.count(); i++) { for (int i=0; i<nodePool.count(); i++) {
Node* node = nodePool.at(i); MixerNode* node = nodePool.at(i);
node->setNegativeColor(color0, color1); node->setNegativeColor(color0, color1);
} }
} }
@ -366,7 +366,7 @@ void MixerCurveWidget::initNodes(int numPoints)
{ {
// First of all, clear any existing list // First of all, clear any existing list
if (nodeList.count()) { if (nodeList.count()) {
foreach (Node *node, nodeList ) { foreach (MixerNode *node, nodeList ) {
foreach(Edge *edge, node->edges()) { foreach(Edge *edge, node->edges()) {
if (edge->sourceNode() == node) { if (edge->sourceNode() == node) {
scene()->removeItem(edge); scene()->removeItem(edge);
@ -379,10 +379,10 @@ void MixerCurveWidget::initNodes(int numPoints)
} }
// Create the nodes and edges // Create the nodes and edges
Node* prevNode = 0; MixerNode* prevNode = 0;
for (int i=0; i<numPoints; i++) { for (int i=0; i<numPoints; i++) {
Node *node = getNode(i); MixerNode *node = getNode(i);
nodeList.append(node); nodeList.append(node);
scene()->addItem(node); scene()->addItem(node);
@ -404,7 +404,7 @@ QList<double> MixerCurveWidget::getCurve() {
QList<double> list; QList<double> list;
foreach(Node *node, nodeList) { foreach(MixerNode *node, nodeList) {
list.append(node->value()); list.append(node->value());
} }
@ -447,7 +447,7 @@ void MixerCurveWidget::setCurve(const QList<double>* points)
val -= (curveMin + range); val -= (curveMin + range);
val /= range; val /= range;
Node* node = nodeList.at(i); MixerNode* node = nodeList.at(i);
node->setPos(w*i, h - (val*h)); node->setPos(w*i, h - (val*h));
node->verticalMove(true); node->verticalMove(true);
@ -486,7 +486,7 @@ void MixerCurveWidget::resizeCommands()
{ {
QRectF rect = plot->boundingRect(); QRectF rect = plot->boundingRect();
Node* node; MixerNode* node;
//popup //popup
node = getCommandNode(14); node = getCommandNode(14);
node->setPos((rect.left() + rect.width() / 2) - 20, rect.height() + 10); 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; 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; i<cmdNodePool.count(); i++) { for (int i=0; i<cmdNodePool.count(); i++) {
Node* n = cmdNodePool.at(i); MixerNode* n = cmdNodePool.at(i);
if (n->getName() == name) if (n->getName() == name)
node = n; node = n;
} }
@ -589,7 +589,7 @@ Node* MixerCurveWidget::getCmdNode(const QString& name)
void MixerCurveWidget::setCommandText(const QString& name, const QString& text) void MixerCurveWidget::setCommandText(const QString& name, const QString& text)
{ {
for (int i=0; i<cmdNodePool.count(); i++) { for (int i=0; i<cmdNodePool.count(); i++) {
Node* n = cmdNodePool.at(i); MixerNode* n = cmdNodePool.at(i);
if (n->getName() == name) { if (n->getName() == name) {
n->commandText(text); n->commandText(text);
n->update(); n->update();
@ -599,7 +599,7 @@ void MixerCurveWidget::setCommandText(const QString& name, const QString& text)
void MixerCurveWidget::activateCommand(const QString& name) void MixerCurveWidget::activateCommand(const QString& name)
{ {
for (int i=1; i<cmdNodePool.count()-2; i++) { for (int i=1; i<cmdNodePool.count()-2; i++) {
Node* node = cmdNodePool.at(i); MixerNode* node = cmdNodePool.at(i);
node->setCommandActive(node->getName() == name); node->setCommandActive(node->getName() == name);
node->update(); node->update();
} }
@ -607,7 +607,7 @@ void MixerCurveWidget::activateCommand(const QString& name)
void MixerCurveWidget::showCommand(const QString& name, bool show) void MixerCurveWidget::showCommand(const QString& name, bool show)
{ {
Node* node = getCmdNode(name); MixerNode* node = getCmdNode(name);
if (node) { if (node) {
if (show) if (show)
node->show(); node->show();
@ -618,7 +618,7 @@ void MixerCurveWidget::showCommand(const QString& name, bool show)
void MixerCurveWidget::showCommands(bool show) void MixerCurveWidget::showCommands(bool show)
{ {
for (int i=1; i<cmdNodePool.count()-2; i++) { for (int i=1; i<cmdNodePool.count()-2; i++) {
Node* node = cmdNodePool.at(i); MixerNode* node = cmdNodePool.at(i);
if (show) if (show)
node->show(); node->show();
else else
@ -630,14 +630,14 @@ void MixerCurveWidget::showCommands(bool show)
bool MixerCurveWidget::isCommandActive(const QString& name) bool MixerCurveWidget::isCommandActive(const QString& name)
{ {
bool active = false; bool active = false;
Node* node = getCmdNode(name); MixerNode* node = getCmdNode(name);
if (node) { if (node) {
active = node->getCommandActive(); active = node->getCommandActive();
} }
return active; return active;
} }
void MixerCurveWidget::cmdActivated(Node* node) void MixerCurveWidget::cmdActivated(MixerNode* node)
{ {
if (node->getToggle()) { if (node->getToggle()) {
if (node->getName() == "Commands") { if (node->getName() == "Commands") {
@ -646,7 +646,7 @@ void MixerCurveWidget::cmdActivated(Node* node)
} }
else { else {
for (int i=1; i<cmdNodePool.count()-2; i++) { for (int i=1; i<cmdNodePool.count()-2; i++) {
Node* n = cmdNodePool.at(i); MixerNode* n = cmdNodePool.at(i);
n->setCommandActive(false); n->setCommandActive(false);
n->update(); n->update();
} }

View File

@ -59,12 +59,12 @@ public:
double setRange(double min, double max); double setRange(double min, double max);
void cmdActivated(Node* node); void cmdActivated(MixerNode* node);
void activateCommand(const QString& name); void activateCommand(const QString& name);
bool isCommandActive(const QString& name); bool isCommandActive(const QString& name);
void showCommand(const QString& name, bool show); void showCommand(const QString& name, bool show);
void showCommands(bool show); void showCommands(bool show);
Node* getCmdNode(const QString& name); MixerNode* getCmdNode(const QString& name);
void setCommandText(const QString& name, const QString& text); void setCommandText(const QString& name, const QString& text);
static const int NODE_NUMELEM = 5; static const int NODE_NUMELEM = 5;
@ -73,17 +73,17 @@ signals:
void curveUpdated(); void curveUpdated();
void curveMinChanged(double value); void curveMinChanged(double value);
void curveMaxChanged(double value); void curveMaxChanged(double value);
void commandActivated(Node* node); void commandActivated(MixerNode* node);
private slots: private slots:
private: private:
QGraphicsSvgItem *plot; QGraphicsSvgItem *plot;
QList<Node*> nodePool; QList<MixerNode*> nodePool;
QList<Node*> cmdNodePool; QList<MixerNode*> cmdNodePool;
QList<Edge*> edgePool; QList<Edge*> edgePool;
QList<Node*> nodeList; QList<MixerNode*> nodeList;
double curveMin; double curveMin;
double curveMax; double curveMax;
@ -95,9 +95,9 @@ private:
QString negColor1; QString negColor1;
void initNodes(int numPoints); void initNodes(int numPoints);
Node* getNode(int index); MixerNode* getNode(int index);
Node* getCommandNode(int index); MixerNode* getCommandNode(int index);
Edge* getEdge(int index, Node* sourceNode, Node* destNode); Edge* getEdge(int index, MixerNode* sourceNode, MixerNode* destNode);
void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00"); void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00");
void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000"); void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000");