From 95fb9255cc29ead1b8cb45f37ffa12699678e1e0 Mon Sep 17 00:00:00 2001 From: PT_Dreamer Date: Thu, 26 Jul 2012 14:09:33 +0100 Subject: [PATCH] GCS-Made the buttons on the object browser smaller. --- .../uavobjectbrowser/uavobjectbrowser.pro | 6 +- .../uavobjectbrowser/uavobjectbrowser.qrc | 10 + .../uavobjectbrowser/uavobjectbrowser.ui | 232 ++++++++---------- .../uavobjectbrowserwidget.cpp | 34 ++- .../uavobjectbrowser/uavobjectbrowserwidget.h | 6 +- .../plugins/uavobjectbrowser/viewoptions.ui | 42 ++++ 6 files changed, 192 insertions(+), 138 deletions(-) create mode 100644 ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.qrc create mode 100644 ground/openpilotgcs/src/plugins/uavobjectbrowser/viewoptions.ui diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.pro b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.pro index 482573693..dad4e601f 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.pro +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.pro @@ -24,4 +24,8 @@ SOURCES += browserplugin.cpp \ fieldtreeitem.cpp OTHER_FILES += UAVObjectBrowser.pluginspec FORMS += uavobjectbrowser.ui \ - uavobjectbrowseroptionspage.ui + uavobjectbrowseroptionspage.ui \ + viewoptions.ui + +RESOURCES += \ + uavobjectbrowser.qrc diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.qrc b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.qrc new file mode 100644 index 000000000..e5ac47658 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.qrc @@ -0,0 +1,10 @@ + + + images/down_alt.png + images/install.png + images/remove.png + images/up_alt.png + images/trash.png + images/1343241276_eye.png + + diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.ui b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.ui index 4669e7624..06d16d3a0 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.ui +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowser.ui @@ -17,12 +17,48 @@ - + - Request update + Request - Request + ... + + + + :/uavobjectbrowser/images/down_alt.png:/uavobjectbrowser/images/down_alt.png + + + + 32 + 32 + + + + false + + + false + + + + + + + Send + + + ... + + + + :/uavobjectbrowser/images/up_alt.png:/uavobjectbrowser/images/up_alt.png + + + + 32 + 32 + @@ -42,32 +78,6 @@ - - - - Send update - - - Send - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 5 - 20 - - - - @@ -76,28 +86,62 @@ - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 5 - 20 - - - - - - + - Save to SD Card + Save - Save + ... + + + + :/uavobjectbrowser/images/remove.png:/uavobjectbrowser/images/remove.png + + + + 32 + 32 + + + + + + + + Load + + + ... + + + + :/uavobjectbrowser/images/install.png:/uavobjectbrowser/images/install.png + + + + 32 + 32 + + + + + + + + Erase + + + ... + + + + :/uavobjectbrowser/images/trash.png:/uavobjectbrowser/images/trash.png + + + + 32 + 32 + @@ -117,58 +161,6 @@ - - - - Load from SD Card - - - Load - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 10 - 20 - - - - - - - - Erase from SD card - - - Erase - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 5 - 20 - - - - @@ -193,35 +185,19 @@ - - - Show Meta Data - + - Show Meta Data + ... - - - - - - Select to sort objects in to categories. + + + :/uavobjectbrowser/images/1343241276_eye.png:/uavobjectbrowser/images/1343241276_eye.png - - Categorize Objects - - - true - - - - - - - Use scientific editors - - - Scientific + + + 32 + 32 + @@ -245,6 +221,8 @@ - + + + diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp index a2ca44131..f638e3e0e 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp @@ -29,6 +29,7 @@ #include "browseritemdelegate.h" #include "treeitem.h" #include "ui_uavobjectbrowser.h" +#include "ui_viewoptions.h" #include "uavobjectmanager.h" #include #include @@ -42,6 +43,9 @@ UAVObjectBrowserWidget::UAVObjectBrowserWidget(QWidget *parent) : QWidget(parent) { m_browser = new Ui_UAVObjectBrowser(); + m_viewoptions = new Ui_viewoptions(); + m_viewoptionsDialog = new QDialog(this); + m_viewoptions->setupUi(m_viewoptionsDialog); m_browser->setupUi(this); m_model = new UAVObjectTreeModel(); m_browser->treeView->setModel(m_model); @@ -51,16 +55,17 @@ UAVObjectBrowserWidget::UAVObjectBrowserWidget(QWidget *parent) : QWidget(parent m_browser->treeView->setItemDelegate(m_delegate); m_browser->treeView->setEditTriggers(QAbstractItemView::AllEditTriggers); m_browser->treeView->setSelectionBehavior(QAbstractItemView::SelectItems); - showMetaData(m_browser->metaCheckBox->isChecked()); + showMetaData(m_viewoptions->cbMetaData->isChecked()); connect(m_browser->treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged(QModelIndex,QModelIndex))); - connect(m_browser->metaCheckBox, SIGNAL(toggled(bool)), this, SLOT(showMetaData(bool))); - connect(m_browser->categorizeCheckbox, SIGNAL(toggled(bool)), this, SLOT(categorize(bool))); + connect(m_viewoptions->cbMetaData, SIGNAL(toggled(bool)), this, SLOT(showMetaData(bool))); + connect(m_viewoptions->cbCategorized, SIGNAL(toggled(bool)), this, SLOT(categorize(bool))); connect(m_browser->saveSDButton, SIGNAL(clicked()), this, SLOT(saveObject())); connect(m_browser->readSDButton, SIGNAL(clicked()), this, SLOT(loadObject())); connect(m_browser->eraseSDButton, SIGNAL(clicked()), this, SLOT(eraseObject())); connect(m_browser->sendButton, SIGNAL(clicked()), this, SLOT(sendUpdate())); connect(m_browser->requestButton, SIGNAL(clicked()), this, SLOT(requestUpdate())); - connect(m_browser->scientificNotationCheckbox, SIGNAL(toggled(bool)), this, SLOT(useScientificNotation(bool))); + connect(m_browser->tbView,SIGNAL(clicked()),this,SLOT(viewSlot())); + connect(m_viewoptions->cbScientific, SIGNAL(toggled(bool)), this, SLOT(useScientificNotation(bool))); enableSendRequest(false); } @@ -86,13 +91,13 @@ void UAVObjectBrowserWidget::categorize(bool categorize) Q_ASSERT(objManager); UAVObjectTreeModel* tmpModel = m_model; - m_model = new UAVObjectTreeModel(0, categorize,m_browser->scientificNotationCheckbox->isChecked()); + m_model = new UAVObjectTreeModel(0, categorize,m_viewoptions->cbScientific->isChecked()); m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor); m_model->setManuallyChangedColor(m_manuallyChangedColor); m_model->setRecentlyUpdatedTimeout(m_recentlyUpdatedTimeout); m_model->setOnlyHilightChangedValues(m_onlyHilightChangedValues); m_browser->treeView->setModel(m_model); - showMetaData(m_browser->metaCheckBox->isChecked()); + showMetaData(m_viewoptions->cbMetaData->isChecked()); delete tmpModel; } @@ -105,12 +110,12 @@ void UAVObjectBrowserWidget::useScientificNotation(bool scientific) Q_ASSERT(objManager); UAVObjectTreeModel* tmpModel = m_model; - m_model = new UAVObjectTreeModel(0, m_browser->categorizeCheckbox->isChecked(),scientific); + m_model = new UAVObjectTreeModel(0, m_viewoptions->cbCategorized,scientific); m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor); m_model->setManuallyChangedColor(m_manuallyChangedColor); m_model->setRecentlyUpdatedTimeout(m_recentlyUpdatedTimeout); m_browser->treeView->setModel(m_model); - showMetaData(m_browser->metaCheckBox->isChecked()); + showMetaData(m_viewoptions->cbMetaData->isChecked()); delete tmpModel; } @@ -213,6 +218,19 @@ void UAVObjectBrowserWidget::currentChanged(const QModelIndex ¤t, const QM enableSendRequest(enable); } +void UAVObjectBrowserWidget::viewSlot() +{ + if(m_viewoptionsDialog->isVisible()) + m_viewoptionsDialog->setVisible(false); + else + { + QPoint pos=QCursor::pos(); + pos.setX(pos.x()-m_viewoptionsDialog->width()); + m_viewoptionsDialog->move(pos); + m_viewoptionsDialog->show(); + } +} + void UAVObjectBrowserWidget::enableSendRequest(bool enable) { m_browser->sendButton->setEnabled(enable); diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.h index 764ca2225..9a1a76d96 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.h @@ -36,7 +36,7 @@ class QPushButton; class ObjectTreeItem; class Ui_UAVObjectBrowser; - +class Ui_viewoptions; class UAVObjectBrowserWidget : public QWidget { @@ -63,11 +63,13 @@ private slots: void loadObject(); void eraseObject(); void currentChanged(const QModelIndex ¤t, const QModelIndex &previous); - + void viewSlot(); private: QPushButton *m_requestUpdate; QPushButton *m_sendUpdate; Ui_UAVObjectBrowser *m_browser; + Ui_viewoptions *m_viewoptions; + QDialog *m_viewoptionsDialog; UAVObjectTreeModel *m_model; int m_recentlyUpdatedTimeout; diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/viewoptions.ui b/ground/openpilotgcs/src/plugins/uavobjectbrowser/viewoptions.ui new file mode 100644 index 000000000..bc2c1d815 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/viewoptions.ui @@ -0,0 +1,42 @@ + + + viewoptions + + + + 0 + 0 + 169 + 96 + + + + View Options + + + + + + Show MetaData + + + + + + + Show Categorized + + + + + + + Show Scientific + + + + + + + +