Commit 81b26309 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Plugin-Datacontrol: Using new customizable side pane area to display advanced...

Plugin-Datacontrol: Using new customizable side pane area to display advanced settings button (and save some space).
parent bffb0561
......@@ -83,7 +83,8 @@ DataControlPlugin::DataControlPlugin() :
headerPopupType_(0),
targetAction_(0),
sourceAction_(0),
removeAction_(0)
removeAction_(0),
advancedSettingsBtn_(0)
{
}
......@@ -160,7 +161,7 @@ void DataControlPlugin::pluginsInitialized() {
PluginFunctions::setDefaultViewObjectMarker (&objectMarker);
PluginFunctions::setViewObjectMarker (&objectMarker);
connect(tool_->lightSources, SIGNAL(stateChanged(int)), this, SLOT(slotShowLightSources(int)));
connect(tool_->lightSources, SIGNAL(toggled(bool)), this, SLOT(slotShowLightSources(bool)));
//update light visibility, if layout was changed
connect(model_, SIGNAL(layoutChanged ()), this, SLOT(slotShowLightSources()) );
connect(model_, SIGNAL(rowsRemoved(const QModelIndex& , int , int )), this, SLOT(slotShowLightSources()));
......@@ -200,11 +201,11 @@ void DataControlPlugin::initializePlugin()
connect( view_,SIGNAL(customContextMenuRequested ( const QPoint & ) ),
this,SLOT(slotCustomContextMenuRequested ( const QPoint & ) ));
connect( tool_->notSelected, SIGNAL(stateChanged ( int ) ),
connect( tool_->notSelected, SIGNAL(toggled ( bool ) ),
this, SLOT (slotBoundingBoxChange ( ) ));
connect( tool_->sourceSelected, SIGNAL(stateChanged ( int ) ),
connect( tool_->sourceSelected, SIGNAL(toggled ( bool ) ),
this, SLOT (slotBoundingBoxChange ( ) ));
connect( tool_->targetSelected, SIGNAL(stateChanged ( int ) ),
connect( tool_->targetSelected, SIGNAL(toggled ( bool ) ),
this, SLOT (slotBoundingBoxChange ( ) ));
......@@ -219,14 +220,31 @@ void DataControlPlugin::initializePlugin()
emit addToolbox("Data Control", tool_, toolIcon_);
QIcon icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-boundingBox.png");
tool_->boundingBoxBtn->setIcon( icon );
icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-hide-object.png");
tool_->visibleDataBtn->setIcon( icon );
//hide additional boxes
tool_->visibleDataBtn->setChecked(false);
tool_->boundingBoxBtn->setChecked(false);
QWidget *childControlArea = tool_->parent()->findChild<QWidget*>(
"ChildControlArea");
if (childControlArea) {
std::cout << "Child Control Area found." << std::endl;
advancedSettingsBtn_ = new QToolButton();
advancedSettingsBtn_->setAutoRaise(true);
advancedSettingsBtn_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"preferences.png"));
advancedSettingsBtn_->setIconSize(QSize(16, 16));
advancedSettingsBtn_->setPopupMode(QToolButton::InstantPopup);
advancedSettingsBtn_->setToolTip(tr("Advanced Settings"));
QHBoxLayout *hl = new QHBoxLayout;
hl->addWidget(advancedSettingsBtn_);
hl->addStretch(1);
hl->setContentsMargins(8, 0, 0, 0);
childControlArea->setLayout(hl);
QMenu *menu = new QMenu();
menu->addAction(tool_->lightSources);
menu->addAction(tool_->notSelected);
menu->addAction(tool_->sourceSelected);
menu->addAction(tool_->targetSelected);
advancedSettingsBtn_->setMenu(menu);
} else {
std::cout << "Child Control Area NOT found." << std::endl;
}
}
......@@ -395,7 +413,7 @@ void DataControlPlugin::fileOpened(int _id){
// Only if the added object was a light source, we will traverse the objects!
if ( obj->dataType() == DATA_LIGHT)
slotShowLightSources(tool_->lightSources->checkState());
slotShowLightSources(tool_->lightSources->isChecked());
view_->resizeColumnToContents(0);
}
......@@ -535,14 +553,14 @@ void DataControlPlugin::slotMoveBaseObject(int _id, int _newParentId){
//******************************************************************************
void DataControlPlugin::slotShowLightSources( int _state ) {
void DataControlPlugin::slotShowLightSources( bool _state ) {
int rows = model_->rowCount();
for(int i = 0; i < rows; ++i) {
TreeItem* item = model_->getItem(model_->index(i,0));
if(item->dataType() == DATA_LIGHT) {
view_->setRowHidden(i, model_->parent(model_->index(i,0)), !(_state == Qt::Checked));
view_->setRowHidden(i, model_->parent(model_->index(i,0)), !_state);
}else{
//always show, if it is not a light
view_->setRowHidden(i, model_->parent(model_->index(i,0)), false);
......@@ -553,7 +571,7 @@ void DataControlPlugin::slotShowLightSources( int _state ) {
void DataControlPlugin::slotShowLightSources()
{
slotShowLightSources( tool_->lightSources->checkState() );
slotShowLightSources( tool_->lightSources->isChecked() );
}
//******************************************************************************
......@@ -885,11 +903,7 @@ void DataControlPlugin::saveOnExit(INIFile& _ini){
}
void DataControlPlugin::showReducedUi(bool reduced) {
tool_->boundingBoxWidget->setVisible(!reduced);
tool_->boundingBoxBtn->setVisible(!reduced);
tool_->line_2->setVisible(!reduced);
tool_->visibleDataWidget->setVisible(!reduced);
tool_->visibleDataBtn->setVisible(!reduced);
advancedSettingsBtn_->setVisible(reduced);
}
void DataControlPlugin::slotObjectUpdated( int _identifier, const UpdateType& _type )
......
......@@ -255,7 +255,7 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
void slotNodeChanged( ACG::SceneGraph::BaseNode* _node );
/// Hide/Show all light sources if checkbox has been checked
void slotShowLightSources( int _state );
void slotShowLightSources( bool _state );
void slotShowLightSources();
private :
......@@ -300,6 +300,8 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
QAction* sourceAction_;
QAction* removeAction_;
QToolButton *advancedSettingsBtn_;
/** @} */
//===========================================================================
......
......@@ -2,12 +2,29 @@
<ui version="4.0">
<class>dctoolbox</class>
<widget class="QWidget" name="dctoolbox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>274</width>
<height>268</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="margin">
<number>2</number>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="DataControlTreeView" name="treeView">
......@@ -31,86 +48,39 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="visibleDataBtn">
<property name="text">
<string>Object Visibility</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="visibleDataWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="lightSources">
<property name="text">
<string>Show Light Sources</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="boundingBoxBtn">
<property name="text">
<string>Object Bounding Box</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QWidget" name="boundingBoxWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="notSelected">
<property name="text">
<string>Show always</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="sourceSelected">
<property name="text">
<string>Show on source objects</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="targetSelected">
<property name="text">
<string>Show on target objects</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<action name="lightSources">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show &amp;Light Sources</string>
</property>
</action>
<action name="notSelected">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show &amp;All Bounding Boxes</string>
</property>
</action>
<action name="sourceSelected">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show Bounding Boxes of &amp;Source Objects</string>
</property>
</action>
<action name="targetSelected">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Show Bounding Boxes of &amp;Targeted Objects</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
......@@ -120,38 +90,5 @@
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>visibleDataBtn</sender>
<signal>toggled(bool)</signal>
<receiver>visibleDataWidget</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>161</x>
<y>276</y>
</hint>
<hint type="destinationlabel">
<x>160</x>
<y>302</y>
</hint>
</hints>
</connection>
<connection>
<sender>boundingBoxBtn</sender>
<signal>toggled(bool)</signal>
<receiver>boundingBoxWidget</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>138</x>
<y>345</y>
</hint>
<hint type="destinationlabel">
<x>133</x>
<y>373</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
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