1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +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:
andrew 2010-12-12 04:09:32 +00:00 committed by andrew
parent b4e4d4ed5e
commit 1007cbd115
6 changed files with 30 additions and 1 deletions

View File

@ -247,6 +247,9 @@ void GCSControlGadget::buttonState(ButtonNumber number, bool pressed)
}
break;
case 2://GCS Control
bool currentCGSControl = ((GCSControlGadgetWidget *)m_widget)->getGCSControl();
((GCSControlGadgetWidget *)m_widget)->setGCSControl(!currentCGSControl);
break;
}

View File

@ -71,6 +71,11 @@ void GCSControlGadgetOptionsPage::buttonState(ButtonNumber number, bool pressed)
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(buttonState(ButtonNumber,bool)),this,SLOT(buttonState(ButtonNumber,bool)));
connect(sdlGamepad,SIGNAL(gamepads(quint8)),this,SLOT(gamepads(quint8)));
return optionsPageWidget;
}

View File

@ -31,6 +31,8 @@
#include "coreplugin/dialogs/ioptionspage.h"
#include "gcscontrolplugin.h"
#include "sdlgamepad/sdlgamepad.h"
#include <SDL/SDL.h>
#include <QDebug>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>

View File

@ -122,8 +122,13 @@
<item>
<widget class="QComboBox" name="AvailableControllerList">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<item>
<property name="text">
<string>Default</string>
</property>
</item>
</widget>
</item>
</layout>

View File

@ -157,7 +157,18 @@ void GCSControlGadgetWidget::selectFlightMode(int state)
obj->updated();
}
void GCSControlGadgetWidget::setGCSControl(bool newState)
{
m_gcscontrol->checkBoxGcsControl->setChecked(newState);
};
bool GCSControlGadgetWidget::getGCSControl(void)
{
return m_gcscontrol->checkBoxGcsControl->isChecked();
};
/**
* @}
* @}
*/

View File

@ -40,6 +40,8 @@ class GCSControlGadgetWidget : public QLabel
public:
GCSControlGadgetWidget(QWidget *parent = 0);
~GCSControlGadgetWidget();
void setGCSControl(bool newState);
bool getGCSControl(void);
signals:
void sticksChanged(double leftX, double leftY, double rightX, double rightY);