Commit f5d89a62 authored by Michael Carpenter's avatar Michael Carpenter

Change to how configuration view operates, menu on the left side rather than top

parent 0049997b
......@@ -178,8 +178,8 @@ QDoubleSpinBox::down-button {
}
QPushButton {
min-height: 20px;
max-height: 20px;
/*min-height: 20px;*/
/*max-height: 20px;*/
border: 1px solid #465158;
margin: 1px;
border-radius: 2px;
......
......@@ -184,8 +184,8 @@ QDoubleSpinBox::down-button {
QPushButton {
font-weight: bold;
min-height: 18px;
max-height: 18px;
/*min-height: 18px;*/
/*max-height: 18px;*/
border: 2px solid #4A4A4F;
border-radius: 5px;
padding-left: 10px;
......
......@@ -44,6 +44,12 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
setObjectName("QGC_VEHICLECONFIG");
ui->setupUi(this);
connect(ui->rcMenuButton,SIGNAL(clicked()),this,SLOT(rcMenuButtonClicked()));
connect(ui->sensorMenuButton,SIGNAL(clicked()),this,SLOT(sensorMenuButtonClicked()));
connect(ui->generalMenuButton,SIGNAL(clicked()),this,SLOT(generalMenuButtonClicked()));
connect(ui->advancedMenuButton,SIGNAL(clicked()),this,SLOT(advancedMenuButtonClicked()));
requestCalibrationRC();
if (mav) mav->requestParameter(0, "RC_TYPE");
......@@ -89,6 +95,25 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateView()));
updateTimer.start();
}
void QGCVehicleConfig::rcMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(0);
}
void QGCVehicleConfig::sensorMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(1);
}
void QGCVehicleConfig::generalMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->count()-2);
}
void QGCVehicleConfig::advancedMenuButtonClicked()
{
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->count()-1);
}
QGCVehicleConfig::~QGCVehicleConfig()
{
......@@ -247,8 +272,18 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
//Load tabs for general configuration
foreach (QString dir,generaldir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{
QWidget *tab = new QWidget(ui->tabWidget);
ui->tabWidget->insertTab(2,tab,dir);
QPushButton *button = new QPushButton(ui->scrollAreaWidgetContents_3);
connect(button,SIGNAL(clicked()),this,SLOT(menuButtonClicked()));
ui->navBarLayout->insertWidget(2,button);
button->setMinimumHeight(100);
button->setMinimumWidth(100);
button->show();
button->setText(dir);
//QWidget *tab = new QWidget(ui->tabWidget);
//ui->tabWidget->insertTab(2,tab,dir);
QWidget *tab = new QWidget(ui->stackedWidget);
ui->stackedWidget->insertWidget(2,tab);
buttonToWidgetMap[button] = tab;
tab->setLayout(new QVBoxLayout());
tab->show();
QScrollArea *area = new QScrollArea();
......@@ -283,8 +318,20 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
//Load tabs for vehicle specific configuration
foreach (QString dir,vehicledir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{
QWidget *tab = new QWidget(ui->tabWidget);
ui->tabWidget->insertTab(2,tab,dir);
//QWidget *tab = new QWidget(ui->tabWidget);
//ui->tabWidget->insertTab(2,tab,dir);
QPushButton *button = new QPushButton(ui->scrollAreaWidgetContents_3);
connect(button,SIGNAL(clicked()),this,SLOT(menuButtonClicked()));
ui->navBarLayout->insertWidget(2,button);
QWidget *tab = new QWidget(ui->stackedWidget);
ui->stackedWidget->insertWidget(2,tab);
buttonToWidgetMap[button] = tab;
button->setMinimumHeight(100);
button->setMinimumWidth(100);
button->show();
button->setText(dir);
tab->setLayout(new QVBoxLayout());
tab->show();
QScrollArea *area = new QScrollArea();
......@@ -361,6 +408,19 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
}
void QGCVehicleConfig::menuButtonClicked()
{
QPushButton *button = qobject_cast<QPushButton*>(sender());
if (!button)
{
return;
}
if (buttonToWidgetMap.contains(button))
{
ui->stackedWidget->setCurrentWidget(buttonToWidgetMap[button]);
}
}
void QGCVehicleConfig::loadConfig()
......
......@@ -5,6 +5,7 @@
#include <QTimer>
#include <QList>
#include <QGroupBox>
#include <QPushButton>
#include "QGCToolWidget.h"
#include "UASInterface.h"
......@@ -29,6 +30,11 @@ public:
};
public slots:
void rcMenuButtonClicked();
void sensorMenuButtonClicked();
void generalMenuButtonClicked();
void advancedMenuButtonClicked();
/** Set the MAV currently being calibrated */
void setActiveUAS(UASInterface* active);
/** Fallback function, automatically called by loadConfig() upon failure to find and xml file*/
......@@ -125,6 +131,7 @@ public slots:
}
protected slots:
void menuButtonClicked();
/** Reset the RC calibration */
void resetCalibrationRC();
/** Write the RC calibration */
......@@ -183,7 +190,7 @@ protected:
private:
Ui::QGCVehicleConfig *ui;
QMap<QPushButton*,QWidget*> buttonToWidgetMap;
signals:
void visibilityChanged(bool visible);
};
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment