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

MixerCurve: disable command buttons; add conventional Reset/Advanced buttons;

move min/max/step into SettingsGroup;
This commit is contained in:
Mike LaBranche 2012-07-14 07:25:57 -07:00
parent 685fb4e1d4
commit 4a13554e1f
3 changed files with 108 additions and 92 deletions

View File

@ -43,8 +43,10 @@ MixerCurve::MixerCurve(QWidget *parent) :
m_mixerUI->SettingsGroup->hide();
m_mixerUI->ValuesGroup->hide();
m_curve->showCommands(false);
m_curve->showCommand("Reset", false);
m_curve->showCommand("Popup", false);
m_curve->showCommand("Commands", false);
// create our spin delegate
m_spinDelegate = new DoubleSpinDelegate();
@ -62,6 +64,7 @@ MixerCurve::MixerCurve(QWidget *parent) :
connect(m_mixerUI->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(CurveTypeChanged()));
connect(m_mixerUI->ResetCurve, SIGNAL(clicked()), this, SLOT(ResetCurve()));
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*)));
@ -128,6 +131,21 @@ void MixerCurve::ResetCurve()
UpdateSettingsTable();
}
void MixerCurve::PopupCurve()
{
if (!m_curve->isCommandActive("Popup")) {
m_mixerUI->SettingsGroup->show();
m_mixerUI->PopupCurve->hide();
PopupWidget* popup = new PopupWidget();
popup->popUp(this);
m_mixerUI->SettingsGroup->hide();
m_mixerUI->PopupCurve->show();
m_curve->showCommands(false);
}
}
void MixerCurve::UpdateCurveUI()
{
//get the user settings
@ -363,18 +381,8 @@ void MixerCurve::CommandActivated(Node* node)
else if (name == "Commands") {
}
else if (name == "Popup" && !m_curve->isCommandActive("Popup")) {
m_mixerUI->SettingsGroup->show();
m_mixerUI->ValuesGroup->show();
m_curve->showCommand("Popup", false);
PopupWidget* popup = new PopupWidget();
popup->popUp(this);
m_mixerUI->SettingsGroup->hide();
m_mixerUI->ValuesGroup->hide();
m_curve->showCommands(false);
m_curve->showCommand("Popup", true);
else if (name == "Popup" ) {
PopupCurve();
}
else if (name == "Linear") {
m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Linear"));

View File

@ -79,6 +79,7 @@ protected:
public slots:
void ResetCurve();
void PopupCurve();
void GenerateCurve();
void UpdateSettingsTable();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>441</width>
<height>334</height>
<width>543</width>
<height>467</height>
</rect>
</property>
<property name="sizePolicy">
@ -183,79 +183,6 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ResetCurve">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
<zorder>GenerateCurve</zorder>
<zorder>CurveSettings</zorder>
<zorder>ResetCurve</zorder>
<zorder>CurveType</zorder>
<zorder>verticalSpacer</zorder>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="MixerCurveWidget" name="CurveWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>5</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="ValuesGroup">
<property name="title">
<string/>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="minLabel">
<property name="text">
@ -332,21 +259,101 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>GenerateCurve</zorder>
<zorder>CurveSettings</zorder>
<zorder>CurveType</zorder>
<zorder>CurveMin</zorder>
<zorder>minLabel</zorder>
<zorder>CurveMax</zorder>
<zorder>maxLabel</zorder>
<zorder>CurveStep</zorder>
<zorder>stepLabel</zorder>
<zorder>verticalSpacer</zorder>
</widget>
</item>
<item row="0" column="1">
<widget class="MixerCurveWidget" name="CurveWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>5</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ResetCurve">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PopupCurve">
<property name="text">
<string>Advanced...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>