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 { ...@@ -178,8 +178,8 @@ QDoubleSpinBox::down-button {
} }
QPushButton { QPushButton {
min-height: 20px; /*min-height: 20px;*/
max-height: 20px; /*max-height: 20px;*/
border: 1px solid #465158; border: 1px solid #465158;
margin: 1px; margin: 1px;
border-radius: 2px; border-radius: 2px;
......
...@@ -184,8 +184,8 @@ QDoubleSpinBox::down-button { ...@@ -184,8 +184,8 @@ QDoubleSpinBox::down-button {
QPushButton { QPushButton {
font-weight: bold; font-weight: bold;
min-height: 18px; /*min-height: 18px;*/
max-height: 18px; /*max-height: 18px;*/
border: 2px solid #4A4A4F; border: 2px solid #4A4A4F;
border-radius: 5px; border-radius: 5px;
padding-left: 10px; padding-left: 10px;
......
...@@ -44,6 +44,12 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : ...@@ -44,6 +44,12 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
setObjectName("QGC_VEHICLECONFIG"); setObjectName("QGC_VEHICLECONFIG");
ui->setupUi(this); 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(); requestCalibrationRC();
if (mav) mav->requestParameter(0, "RC_TYPE"); if (mav) mav->requestParameter(0, "RC_TYPE");
...@@ -89,6 +95,25 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : ...@@ -89,6 +95,25 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) :
connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateView())); connect(&updateTimer, SIGNAL(timeout()), this, SLOT(updateView()));
updateTimer.start(); 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() QGCVehicleConfig::~QGCVehicleConfig()
{ {
...@@ -247,8 +272,18 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) ...@@ -247,8 +272,18 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
//Load tabs for general configuration //Load tabs for general configuration
foreach (QString dir,generaldir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) foreach (QString dir,generaldir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{ {
QWidget *tab = new QWidget(ui->tabWidget); QPushButton *button = new QPushButton(ui->scrollAreaWidgetContents_3);
ui->tabWidget->insertTab(2,tab,dir); 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->setLayout(new QVBoxLayout());
tab->show(); tab->show();
QScrollArea *area = new QScrollArea(); QScrollArea *area = new QScrollArea();
...@@ -283,8 +318,20 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) ...@@ -283,8 +318,20 @@ void QGCVehicleConfig::loadQgcConfig(bool primary)
//Load tabs for vehicle specific configuration //Load tabs for vehicle specific configuration
foreach (QString dir,vehicledir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) foreach (QString dir,vehicledir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
{ {
QWidget *tab = new QWidget(ui->tabWidget); //QWidget *tab = new QWidget(ui->tabWidget);
ui->tabWidget->insertTab(2,tab,dir); //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->setLayout(new QVBoxLayout());
tab->show(); tab->show();
QScrollArea *area = new QScrollArea(); QScrollArea *area = new QScrollArea();
...@@ -361,6 +408,19 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) ...@@ -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() void QGCVehicleConfig::loadConfig()
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <QTimer> #include <QTimer>
#include <QList> #include <QList>
#include <QGroupBox> #include <QGroupBox>
#include <QPushButton>
#include "QGCToolWidget.h" #include "QGCToolWidget.h"
#include "UASInterface.h" #include "UASInterface.h"
...@@ -29,6 +30,11 @@ public: ...@@ -29,6 +30,11 @@ public:
}; };
public slots: public slots:
void rcMenuButtonClicked();
void sensorMenuButtonClicked();
void generalMenuButtonClicked();
void advancedMenuButtonClicked();
/** Set the MAV currently being calibrated */ /** Set the MAV currently being calibrated */
void setActiveUAS(UASInterface* active); void setActiveUAS(UASInterface* active);
/** Fallback function, automatically called by loadConfig() upon failure to find and xml file*/ /** Fallback function, automatically called by loadConfig() upon failure to find and xml file*/
...@@ -125,6 +131,7 @@ public slots: ...@@ -125,6 +131,7 @@ public slots:
} }
protected slots: protected slots:
void menuButtonClicked();
/** Reset the RC calibration */ /** Reset the RC calibration */
void resetCalibrationRC(); void resetCalibrationRC();
/** Write the RC calibration */ /** Write the RC calibration */
...@@ -183,7 +190,7 @@ protected: ...@@ -183,7 +190,7 @@ protected:
private: private:
Ui::QGCVehicleConfig *ui; Ui::QGCVehicleConfig *ui;
QMap<QPushButton*,QWidget*> buttonToWidgetMap;
signals: signals:
void visibilityChanged(bool visible); 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