mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
GCS Control - Joystick buttons can now toggle GCSControl.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2220 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
b4e4d4ed5e
commit
1007cbd115
@ -247,6 +247,9 @@ void GCSControlGadget::buttonState(ButtonNumber number, bool pressed)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2://GCS Control
|
case 2://GCS Control
|
||||||
|
bool currentCGSControl = ((GCSControlGadgetWidget *)m_widget)->getGCSControl();
|
||||||
|
((GCSControlGadgetWidget *)m_widget)->setGCSControl(!currentCGSControl);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,11 @@ void GCSControlGadgetOptionsPage::buttonState(ButtonNumber number, bool pressed)
|
|||||||
|
|
||||||
void GCSControlGadgetOptionsPage::gamepads(quint8 count)
|
void GCSControlGadgetOptionsPage::gamepads(quint8 count)
|
||||||
{
|
{
|
||||||
|
/*options_page->AvailableControllerList->clear();
|
||||||
|
for (int i=0;i<count;i++)
|
||||||
|
{
|
||||||
|
options_page->AvailableControllerList->addItem(QString().sprintf("%d",i));//SDL_JoystickName(i));
|
||||||
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,6 +207,7 @@ QWidget *GCSControlGadgetOptionsPage::createPage(QWidget *parent)
|
|||||||
|
|
||||||
connect(sdlGamepad,SIGNAL(axesValues(QListInt16)),this,SLOT(axesValues(QListInt16)));
|
connect(sdlGamepad,SIGNAL(axesValues(QListInt16)),this,SLOT(axesValues(QListInt16)));
|
||||||
connect(sdlGamepad,SIGNAL(buttonState(ButtonNumber,bool)),this,SLOT(buttonState(ButtonNumber,bool)));
|
connect(sdlGamepad,SIGNAL(buttonState(ButtonNumber,bool)),this,SLOT(buttonState(ButtonNumber,bool)));
|
||||||
|
connect(sdlGamepad,SIGNAL(gamepads(quint8)),this,SLOT(gamepads(quint8)));
|
||||||
|
|
||||||
return optionsPageWidget;
|
return optionsPageWidget;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
#include "coreplugin/dialogs/ioptionspage.h"
|
#include "coreplugin/dialogs/ioptionspage.h"
|
||||||
#include "gcscontrolplugin.h"
|
#include "gcscontrolplugin.h"
|
||||||
#include "sdlgamepad/sdlgamepad.h"
|
#include "sdlgamepad/sdlgamepad.h"
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
|
@ -122,8 +122,13 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="AvailableControllerList">
|
<widget class="QComboBox" name="AvailableControllerList">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Default</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -157,7 +157,18 @@ void GCSControlGadgetWidget::selectFlightMode(int state)
|
|||||||
obj->updated();
|
obj->updated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GCSControlGadgetWidget::setGCSControl(bool newState)
|
||||||
|
{
|
||||||
|
m_gcscontrol->checkBoxGcsControl->setChecked(newState);
|
||||||
|
};
|
||||||
|
bool GCSControlGadgetWidget::getGCSControl(void)
|
||||||
|
{
|
||||||
|
return m_gcscontrol->checkBoxGcsControl->isChecked();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ class GCSControlGadgetWidget : public QLabel
|
|||||||
public:
|
public:
|
||||||
GCSControlGadgetWidget(QWidget *parent = 0);
|
GCSControlGadgetWidget(QWidget *parent = 0);
|
||||||
~GCSControlGadgetWidget();
|
~GCSControlGadgetWidget();
|
||||||
|
void setGCSControl(bool newState);
|
||||||
|
bool getGCSControl(void);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sticksChanged(double leftX, double leftY, double rightX, double rightY);
|
void sticksChanged(double leftX, double leftY, double rightX, double rightY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user