mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-11 03:29:17 +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 <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QTabBar>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <coreplugin/generalsettings.h>
|
#include <coreplugin/generalsettings.h>
|
||||||
@ -46,6 +47,16 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
|
|||||||
ui = new Ui_StabilizationWidget();
|
ui = new Ui_StabilizationWidget();
|
||||||
ui->setupUi(this);
|
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();
|
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||||
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
|
Core::Internal::GeneralSettings *settings = pm->getObject<Core::Internal::GeneralSettings>();
|
||||||
@ -205,6 +216,13 @@ void ConfigStabilizationWidget::onBoardConnected()
|
|||||||
ui->AltitudeHold->setEnabled((boardModel & 0xff00) == 0x0900);
|
ui->AltitudeHold->setEnabled((boardModel & 0xff00) == 0x0900);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigStabilizationWidget::pidBankChanged(int index)
|
||||||
|
{
|
||||||
|
foreach(QTabBar * tabBar, m_pidTabBars) {
|
||||||
|
tabBar->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool ConfigStabilizationWidget::shouldObjectBeSaved(UAVObject *object)
|
bool ConfigStabilizationWidget::shouldObjectBeSaved(UAVObject *object)
|
||||||
{
|
{
|
||||||
// AltitudeHoldSettings should only be saved for Revolution board to avoid error.
|
// AltitudeHoldSettings should only be saved for Revolution board to avoid error.
|
||||||
|
@ -48,10 +48,13 @@ public:
|
|||||||
private:
|
private:
|
||||||
Ui_StabilizationWidget *ui;
|
Ui_StabilizationWidget *ui;
|
||||||
QTimer *realtimeUpdates;
|
QTimer *realtimeUpdates;
|
||||||
|
QList<QTabBar*> m_pidTabBars;
|
||||||
|
|
||||||
// Milliseconds between automatic 'Instant Updates'
|
// Milliseconds between automatic 'Instant Updates'
|
||||||
static const int AUTOMATIC_UPDATE_RATE = 500;
|
static const int AUTOMATIC_UPDATE_RATE = 500;
|
||||||
|
|
||||||
|
static const int PID_BANKS = 3;
|
||||||
|
|
||||||
int boardModel;
|
int boardModel;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
@ -62,6 +65,7 @@ private slots:
|
|||||||
void linkCheckBoxes(bool value);
|
void linkCheckBoxes(bool value);
|
||||||
void processLinkedWidgets(QWidget *);
|
void processLinkedWidgets(QWidget *);
|
||||||
void onBoardConnected();
|
void onBoardConnected();
|
||||||
|
void pidBankChanged(int index);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ConfigStabilizationWidget_H
|
#endif // ConfigStabilizationWidget_H
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user