mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-984 UI changes. Added TabBars to visually simulate PID bank change.
This commit is contained in:
parent
15cf91aa53
commit
99cfa5339d
@ -35,6 +35,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QList>
|
||||
#include <QTabBar>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/generalsettings.h>
|
||||
@ -46,6 +47,16 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
|
||||
ui = new Ui_StabilizationWidget();
|
||||
ui->setupUi(this);
|
||||
|
||||
m_pidTabBars.append(ui->basicPIDBankTabBar);
|
||||
m_pidTabBars.append(ui->advancedPIDBankTabBar);
|
||||
m_pidTabBars.append(ui->expertPIDBankTabBar);
|
||||
foreach(QTabBar * tabBar, m_pidTabBars) {
|
||||
for (int i = 1; i <= PID_BANKS; i++) {
|
||||
tabBar->addTab(tr("PID Bank %1").arg(i));
|
||||
}
|
||||
tabBar->setExpanding(false);
|
||||
connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(pidBankChanged(int)));
|
||||
}
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
|
||||
@ -205,6 +216,13 @@ void ConfigStabilizationWidget::onBoardConnected()
|
||||
ui->AltitudeHold->setEnabled((boardModel & 0xff00) == 0x0900);
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::pidBankChanged(int index)
|
||||
{
|
||||
foreach(QTabBar * tabBar, m_pidTabBars) {
|
||||
tabBar->setCurrentIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
bool ConfigStabilizationWidget::shouldObjectBeSaved(UAVObject *object)
|
||||
{
|
||||
// AltitudeHoldSettings should only be saved for Revolution board to avoid error.
|
||||
|
@ -48,10 +48,13 @@ public:
|
||||
private:
|
||||
Ui_StabilizationWidget *ui;
|
||||
QTimer *realtimeUpdates;
|
||||
QList<QTabBar*> m_pidTabBars;
|
||||
|
||||
// Milliseconds between automatic 'Instant Updates'
|
||||
static const int AUTOMATIC_UPDATE_RATE = 500;
|
||||
|
||||
static const int PID_BANKS = 3;
|
||||
|
||||
int boardModel;
|
||||
|
||||
protected slots:
|
||||
@ -62,6 +65,7 @@ private slots:
|
||||
void linkCheckBoxes(bool value);
|
||||
void processLinkedWidgets(QWidget *);
|
||||
void onBoardConnected();
|
||||
void pidBankChanged(int index);
|
||||
};
|
||||
|
||||
#endif // ConfigStabilizationWidget_H
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user