1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

GCS-Made the buttons on the object browser smaller.

This commit is contained in:
PT_Dreamer 2012-07-26 14:09:33 +01:00
parent 8c4806fa14
commit 95fb9255cc
6 changed files with 192 additions and 138 deletions

View File

@ -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

View File

@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/uavobjectbrowser">
<file>images/down_alt.png</file>
<file>images/install.png</file>
<file>images/remove.png</file>
<file>images/up_alt.png</file>
<file>images/trash.png</file>
<file>images/1343241276_eye.png</file>
</qresource>
</RCC>

View File

@ -17,12 +17,48 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="requestButton">
<widget class="QToolButton" name="requestButton">
<property name="toolTip">
<string>Request update</string>
<string>Request</string>
</property>
<property name="text">
<string>Request</string>
<string>...</string>
</property>
<property name="icon">
<iconset resource="uavobjectbrowser.qrc">
<normaloff>:/uavobjectbrowser/images/down_alt.png</normaloff>:/uavobjectbrowser/images/down_alt.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="sendButton">
<property name="toolTip">
<string>Send</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="uavobjectbrowser.qrc">
<normaloff>:/uavobjectbrowser/images/up_alt.png</normaloff>:/uavobjectbrowser/images/up_alt.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
@ -42,32 +78,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="sendButton">
<property name="toolTip">
<string>Send update</string>
</property>
<property name="text">
<string>Send</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
@ -76,28 +86,62 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="saveSDButton">
<widget class="QToolButton" name="saveSDButton">
<property name="toolTip">
<string>Save to SD Card</string>
<string>Save</string>
</property>
<property name="text">
<string>Save</string>
<string>...</string>
</property>
<property name="icon">
<iconset resource="uavobjectbrowser.qrc">
<normaloff>:/uavobjectbrowser/images/remove.png</normaloff>:/uavobjectbrowser/images/remove.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="readSDButton">
<property name="toolTip">
<string>Load</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="uavobjectbrowser.qrc">
<normaloff>:/uavobjectbrowser/images/install.png</normaloff>:/uavobjectbrowser/images/install.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="eraseSDButton">
<property name="toolTip">
<string>Erase</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="uavobjectbrowser.qrc">
<normaloff>:/uavobjectbrowser/images/trash.png</normaloff>:/uavobjectbrowser/images/trash.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
@ -117,58 +161,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="readSDButton">
<property name="toolTip">
<string>Load from SD Card</string>
</property>
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="eraseSDButton">
<property name="toolTip">
<string>Erase from SD card</string>
</property>
<property name="text">
<string>Erase</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
@ -193,35 +185,19 @@
</spacer>
</item>
<item>
<widget class="QCheckBox" name="metaCheckBox">
<property name="toolTip">
<string>Show Meta Data</string>
</property>
<widget class="QToolButton" name="tbView">
<property name="text">
<string>Show Meta Data</string>
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="categorizeCheckbox">
<property name="toolTip">
<string>Select to sort objects in to categories.</string>
<property name="icon">
<iconset resource="uavobjectbrowser.qrc">
<normaloff>:/uavobjectbrowser/images/1343241276_eye.png</normaloff>:/uavobjectbrowser/images/1343241276_eye.png</iconset>
</property>
<property name="text">
<string>Categorize Objects</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="scientificNotationCheckbox">
<property name="toolTip">
<string>Use scientific editors</string>
</property>
<property name="text">
<string>Scientific</string>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
@ -245,6 +221,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="uavobjectbrowser.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -29,6 +29,7 @@
#include "browseritemdelegate.h"
#include "treeitem.h"
#include "ui_uavobjectbrowser.h"
#include "ui_viewoptions.h"
#include "uavobjectmanager.h"
#include <QStringList>
#include <QtGui/QHBoxLayout>
@ -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 &current, 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);

View File

@ -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 &current, 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;

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>viewoptions</class>
<widget class="QDialog" name="viewoptions">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>169</width>
<height>96</height>
</rect>
</property>
<property name="windowTitle">
<string>View Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="cbMetaData">
<property name="text">
<string>Show MetaData</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbCategorized">
<property name="text">
<string>Show Categorized</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbScientific">
<property name="text">
<string>Show Scientific</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>