1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

OP-1590 Uncrustify

This commit is contained in:
m_thread 2014-11-04 22:06:38 +01:00
parent fc4766a25f
commit f7f92d2b3d
3 changed files with 29 additions and 20 deletions

View File

@ -144,6 +144,7 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
void ConfigStabilizationWidget::setupStabBanksGUI() void ConfigStabilizationWidget::setupStabBanksGUI()
{ {
StabilizationSettings *stabSettings = qobject_cast<StabilizationSettings *>(getObject("StabilizationSettings")); StabilizationSettings *stabSettings = qobject_cast<StabilizationSettings *>(getObject("StabilizationSettings"));
Q_ASSERT(stabSettings); Q_ASSERT(stabSettings);
m_stabSettingsBankCount = stabSettings->getField("FlightModeMap")->getOptions().count(); m_stabSettingsBankCount = stabSettings->getField("FlightModeMap")->getOptions().count();
@ -153,15 +154,15 @@ void ConfigStabilizationWidget::setupStabBanksGUI()
m_stabTabBars.append(ui->advancedPIDBankTabBar); m_stabTabBars.append(ui->advancedPIDBankTabBar);
QAction *defaultStabMenuAction = new QAction(QIcon(":configgadget/images/gear.png"), QString(), this); QAction *defaultStabMenuAction = new QAction(QIcon(":configgadget/images/gear.png"), QString(), this);
QAction *restoreAllAction = new QAction(tr("Restore all to saved"), this); QAction *restoreAllAction = new QAction(tr("Restore all to saved"), this);
connect(restoreAllAction, SIGNAL(triggered()), this, SLOT(restoreAllStabBanks())); connect(restoreAllAction, SIGNAL(triggered()), this, SLOT(restoreAllStabBanks()));
QAction *resetAllAction = new QAction(tr("Reset all to default"), this); QAction *resetAllAction = new QAction(tr("Reset all to default"), this);
connect(resetAllAction, SIGNAL(triggered()), this, SLOT(resetAllStabBanks())); connect(resetAllAction, SIGNAL(triggered()), this, SLOT(resetAllStabBanks()));
QAction *restoreCurrentAction = new QAction(tr("Restore to saved"), this); QAction *restoreCurrentAction = new QAction(tr("Restore to saved"), this);
connect(restoreCurrentAction, SIGNAL(triggered()), this, SLOT(restoreCurrentAction())); connect(restoreCurrentAction, SIGNAL(triggered()), this, SLOT(restoreCurrentAction()));
QAction *resetCurrentAction = new QAction(tr("Reset to default"), this); QAction *resetCurrentAction = new QAction(tr("Reset to default"), this);
connect(resetCurrentAction, SIGNAL(triggered()), this, SLOT(resetCurrentStabBank())); connect(resetCurrentAction, SIGNAL(triggered()), this, SLOT(resetCurrentStabBank()));
QAction *copyCurrentAction = new QAction(tr("Copy to others"), this); QAction *copyCurrentAction = new QAction(tr("Copy to others"), this);
connect(copyCurrentAction, SIGNAL(triggered()), this, SLOT(copyCurrentStabBank())); connect(copyCurrentAction, SIGNAL(triggered()), this, SLOT(copyCurrentStabBank()));
connect(&m_stabSettingsCopyFromSignalMapper, SIGNAL(mapped(int)), this, SLOT(copyFromBankToCurrent(int))); connect(&m_stabSettingsCopyFromSignalMapper, SIGNAL(mapped(int)), this, SLOT(copyFromBankToCurrent(int)));
connect(&m_stabSettingsCopyToSignalMapper, SIGNAL(mapped(int)), this, SLOT(copyToBankFromCurrent(int))); connect(&m_stabSettingsCopyToSignalMapper, SIGNAL(mapped(int)), this, SLOT(copyToBankFromCurrent(int)));
@ -178,11 +179,11 @@ void ConfigStabilizationWidget::setupStabBanksGUI()
tabButton->setPopupMode(QToolButton::InstantPopup); tabButton->setPopupMode(QToolButton::InstantPopup);
tabButton->setToolTip(tr("The functions in this menu effects on fields in the settings banks,\n" tabButton->setToolTip(tr("The functions in this menu effects on fields in the settings banks,\n"
"not only the ones visible on screen.")); "not only the ones visible on screen."));
QMenu *tabMenu = new QMenu(); QMenu *tabMenu = new QMenu();
QMenu *restoreMenu = new QMenu(tr("Restore")); QMenu *restoreMenu = new QMenu(tr("Restore"));
QMenu *resetMenu = new QMenu(tr("Reset")); QMenu *resetMenu = new QMenu(tr("Reset"));
QMenu *copyMenu = new QMenu(tr("Copy")); QMenu *copyMenu = new QMenu(tr("Copy"));
QMenu *swapMenu = new QMenu(tr("Swap")); QMenu *swapMenu = new QMenu(tr("Swap"));
QAction *menuAction; QAction *menuAction;
for (int j = 0; j < m_stabSettingsBankCount; j++) { for (int j = 0; j < m_stabSettingsBankCount; j++) {
if (j == i) { if (j == i) {
@ -235,6 +236,7 @@ ConfigStabilizationWidget::~ConfigStabilizationWidget()
void ConfigStabilizationWidget::refreshWidgetsValues(UAVObject *o) void ConfigStabilizationWidget::refreshWidgetsValues(UAVObject *o)
{ {
ConfigTaskWidget::refreshWidgetsValues(o); ConfigTaskWidget::refreshWidgetsValues(o);
updateThrottleCurveFromObject(); updateThrottleCurveFromObject();
ui->basicResponsivenessCheckBox->setChecked(ui->rateRollKp_3->value() == ui->ratePitchKp_4->value() && ui->basicResponsivenessCheckBox->setChecked(ui->rateRollKp_3->value() == ui->ratePitchKp_4->value() &&
@ -423,25 +425,28 @@ void ConfigStabilizationWidget::restoreCurrentAction()
restoreStabBank(m_currentStabSettingsBank); restoreStabBank(m_currentStabSettingsBank);
} }
UAVObject * ConfigStabilizationWidget::getStabBankObject(int bank) { UAVObject *ConfigStabilizationWidget::getStabBankObject(int bank)
{
return getObject(QString("StabilizationSettingsBank%1").arg(bank + 1)); return getObject(QString("StabilizationSettingsBank%1").arg(bank + 1));
} }
void ConfigStabilizationWidget::resetStabBank(int bank) void ConfigStabilizationWidget::resetStabBank(int bank)
{ {
UAVDataObject *stabBankObject = UAVDataObject *stabBankObject =
dynamic_cast<UAVDataObject *>(getStabBankObject(bank)); dynamic_cast<UAVDataObject *>(getStabBankObject(bank));
if (stabBankObject) { if (stabBankObject) {
UAVDataObject * defaultStabBankObject = stabBankObject->dirtyClone(); UAVDataObject *defaultStabBankObject = stabBankObject->dirtyClone();
quint8 data[stabBankObject->getNumBytes()]; quint8 data[stabBankObject->getNumBytes()];
defaultStabBankObject->pack(data); defaultStabBankObject->pack(data);
stabBankObject->unpack(data); stabBankObject->unpack(data);
} }
} }
void ConfigStabilizationWidget::restoreStabBank(int bank) void ConfigStabilizationWidget::restoreStabBank(int bank)
{ {
UAVObject *stabBankObject = getStabBankObject(bank); UAVObject *stabBankObject = getStabBankObject(bank);
if (stabBankObject) { if (stabBankObject) {
ObjectPersistence *objectPersistenceObject = ObjectPersistence::GetInstance(getObjectManager()); ObjectPersistence *objectPersistenceObject = ObjectPersistence::GetInstance(getObjectManager());
QTimer updateTimer(this); QTimer updateTimer(this);
@ -473,6 +478,7 @@ void ConfigStabilizationWidget::resetCurrentStabBank()
void ConfigStabilizationWidget::copyCurrentStabBank() void ConfigStabilizationWidget::copyCurrentStabBank()
{ {
UAVObject *fromStabBankObject = getStabBankObject(m_currentStabSettingsBank); UAVObject *fromStabBankObject = getStabBankObject(m_currentStabSettingsBank);
if (fromStabBankObject) { if (fromStabBankObject) {
quint8 fromStabBankObjectData[fromStabBankObject->getNumBytes()]; quint8 fromStabBankObjectData[fromStabBankObject->getNumBytes()];
fromStabBankObject->pack(fromStabBankObjectData); fromStabBankObject->pack(fromStabBankObjectData);
@ -487,9 +493,11 @@ void ConfigStabilizationWidget::copyCurrentStabBank()
} }
} }
void ConfigStabilizationWidget::copyFromBankToBank(int fromBank, int toBank) { void ConfigStabilizationWidget::copyFromBankToBank(int fromBank, int toBank)
{
UAVObject *fromStabBankObject = getStabBankObject(fromBank); UAVObject *fromStabBankObject = getStabBankObject(fromBank);
UAVObject *toStabBankObject = getStabBankObject(toBank); UAVObject *toStabBankObject = getStabBankObject(toBank);
if (fromStabBankObject && toStabBankObject) { if (fromStabBankObject && toStabBankObject) {
quint8 data[fromStabBankObject->getNumBytes()]; quint8 data[fromStabBankObject->getNumBytes()];
fromStabBankObject->pack(data); fromStabBankObject->pack(data);
@ -510,7 +518,8 @@ void ConfigStabilizationWidget::copyToBankFromCurrent(int bank)
void ConfigStabilizationWidget::swapBankAndCurrent(int bank) void ConfigStabilizationWidget::swapBankAndCurrent(int bank)
{ {
UAVObject *fromStabBankObject = getStabBankObject(m_currentStabSettingsBank); UAVObject *fromStabBankObject = getStabBankObject(m_currentStabSettingsBank);
UAVObject *toStabBankObject = getStabBankObject(bank); UAVObject *toStabBankObject = getStabBankObject(bank);
if (fromStabBankObject && toStabBankObject) { if (fromStabBankObject && toStabBankObject) {
quint8 fromStabBankObjectData[fromStabBankObject->getNumBytes()]; quint8 fromStabBankObjectData[fromStabBankObject->getNumBytes()];
quint8 toStabBankObjectData[toStabBankObject->getNumBytes()]; quint8 toStabBankObjectData[toStabBankObject->getNumBytes()];

View File

@ -37,23 +37,23 @@ ActuatorCommand::Metadata OutputCalibrationUtil::c_savedActuatorCommandMetaData;
OutputCalibrationUtil::OutputCalibrationUtil(QObject *parent) : OutputCalibrationUtil::OutputCalibrationUtil(QObject *parent) :
QObject(parent), m_outputChannel(-1), m_safeValue(1000) QObject(parent), m_outputChannel(-1), m_safeValue(1000)
{ {}
}
OutputCalibrationUtil::~OutputCalibrationUtil() OutputCalibrationUtil::~OutputCalibrationUtil()
{ {
stopChannelOutput(); stopChannelOutput();
} }
ActuatorCommand * OutputCalibrationUtil::getActuatorCommandObject() ActuatorCommand *OutputCalibrationUtil::getActuatorCommandObject()
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm); Q_ASSERT(pm);
UAVObjectManager *uavObjectManager = pm->getObject<UAVObjectManager>(); UAVObjectManager *uavObjectManager = pm->getObject<UAVObjectManager>();
Q_ASSERT(uavObjectManager); Q_ASSERT(uavObjectManager);
ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(uavObjectManager); ActuatorCommand *actuatorCommand = ActuatorCommand::GetInstance(uavObjectManager);
Q_ASSERT(actuatorCommand); Q_ASSERT(actuatorCommand);
return actuatorCommand; return actuatorCommand;

View File

@ -40,7 +40,7 @@ public:
static void startOutputCalibration(); static void startOutputCalibration();
static void stopOutputCalibration(); static void stopOutputCalibration();
static ActuatorCommand * getActuatorCommandObject(); static ActuatorCommand *getActuatorCommandObject();
public slots: public slots:
void startChannelOutput(quint16 channel, quint16 safeValue); void startChannelOutput(quint16 channel, quint16 safeValue);