Commit 04b819b3 authored by Jan Möbius's avatar Jan Möbius
Browse files

Backup via system backup interface and tooltips



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12701 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c7fa0a50
......@@ -71,45 +71,65 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
// -------- create toolbox --------
// --------------------------------
// ---- options ----
// ---- options tab ----
// pointsizeScale
// pointsize scale
toolboxPointsizeScale_ = new QDoubleSpinBox();
toolboxPointsizeScale_->setRange( 0.0, 100.0 );
toolboxPointsizeScale_->setDecimals( 4 );
toolboxPointsizeScale_->setSingleStep( 0.1 );
toolboxPointsizeScale_->setValue( 1.0 );
toolboxPointsizeScale_->setToolTip( "The scaling factor of the pointsizes used during the rendering of objects" );
// pointsizeScale layout
// pointsize scale layout
QHBoxLayout *toolboxPointsizeScaleLayout = new QHBoxLayout();
toolboxPointsizeScaleLayout->addWidget( new QLabel( "Pointsize Scale:" ) );
toolboxPointsizeScaleLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
toolboxPointsizeScaleLayout->addWidget( toolboxPointsizeScale_ );
toolboxPointsizeScaleLayout->setSpacing( 6 );
toolboxPointsizeScaleLayout->addWidget( new QLabel( "Pointsize Scaling Factor:" ) );
toolboxPointsizeScaleLayout->addWidget( toolboxPointsizeScale_ );
// buttons
QPushButton *toolboxEnableBackfaceCullingButton = new QPushButton( "Enable Backface Culling" );
QPushButton *toolboxDisableBackfaceCullingButton = new QPushButton( "Disable Backface Culling" );
QPushButton *toolboxReloadShadersButton = new QPushButton( "Reload Shaders" );
QPushButton *toolboxRebuildVBOsButton = new QPushButton( "Rebuild VBOs" );
// buttons layout
QGridLayout *toolboxButtonsLayout = new QGridLayout();
toolboxButtonsLayout->setSpacing( 6 );
toolboxButtonsLayout->addWidget( toolboxEnableBackfaceCullingButton, 0, 0 );
toolboxButtonsLayout->addWidget( toolboxDisableBackfaceCullingButton, 0, 1 );
toolboxButtonsLayout->addWidget( toolboxReloadShadersButton, 1, 0 );
toolboxButtonsLayout->addWidget( toolboxRebuildVBOsButton, 1, 1 );
toolboxEnableBackfaceCullingButton->setToolTip ( "Enable the culling of backfaces" );
toolboxDisableBackfaceCullingButton->setToolTip( "Disable the culling of backfaces" );
toolboxReloadShadersButton->setToolTip ( "Reload all shader files" );
toolboxRebuildVBOsButton->setToolTip ( "Rebuild all vertex-buffer-objects" );
// buttonsA layout
QHBoxLayout *toolboxButtonsALayout = new QHBoxLayout();
toolboxButtonsALayout->setSpacing( 6 );
toolboxButtonsALayout->addWidget( toolboxEnableBackfaceCullingButton );
toolboxButtonsALayout->addWidget( toolboxDisableBackfaceCullingButton );
// separator frame
QFrame *toolboxSeparatorFrame = new QFrame();
toolboxSeparatorFrame->setFrameShape( QFrame::HLine );
toolboxSeparatorFrame->setFrameShadow( QFrame::Sunken );
// buttonsB layout
QHBoxLayout *toolboxButtonsBLayout = new QHBoxLayout();
toolboxButtonsBLayout->setSpacing( 6 );
toolboxButtonsBLayout->addWidget( toolboxReloadShadersButton );
toolboxButtonsBLayout->addWidget( toolboxRebuildVBOsButton );
// options layout
QVBoxLayout *toolboxOptionsLayout = new QVBoxLayout();
toolboxOptionsLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
toolboxOptionsLayout->setSpacing( 6 );
toolboxOptionsLayout->addItem ( toolboxPointsizeScaleLayout );
toolboxOptionsLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
toolboxOptionsLayout->addItem ( toolboxButtonsLayout );
toolboxOptionsLayout->addItem ( toolboxButtonsALayout );
toolboxOptionsLayout->addWidget( toolboxSeparatorFrame );
toolboxOptionsLayout->addItem ( toolboxButtonsBLayout );
// options widget
QWidget *toolboxOptionsWidget = new QWidget();
toolboxOptionsWidget->setLayout( toolboxOptionsLayout );
toolboxOptionsWidget->setToolTip( "Rendering options" );
// ---- defaults ----
// ---- defaults tab ----
// defaultNormal
// default normal
toolboxDefaultNormalX_ = new QDoubleSpinBox();
toolboxDefaultNormalY_ = new QDoubleSpinBox();
toolboxDefaultNormalZ_ = new QDoubleSpinBox();
......@@ -125,31 +145,19 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
toolboxDefaultNormalX_->setValue( 0.0 );
toolboxDefaultNormalY_->setValue( 0.0 );
toolboxDefaultNormalZ_->setValue( 1.0 );
toolboxDefaultNormalX_->setToolTip( "The default x-component of the normal used when an object has no normals" );
toolboxDefaultNormalY_->setToolTip( "The default y-component of the normal used when an object has no normals" );
toolboxDefaultNormalZ_->setToolTip( "The default z-component of the normal used when an object has no normals" );
// defaultNormal layout
QHBoxLayout *toolboxDefaultNormalLayout = new QHBoxLayout();
toolboxDefaultNormalLayout->addWidget( new QLabel( "Default Normal:" ) );
toolboxDefaultNormalLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalX_ );
toolboxDefaultNormalLayout->addItem ( new QSpacerItem( 6, 6 ) );
toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalY_ );
toolboxDefaultNormalLayout->addItem ( new QSpacerItem( 6, 6 ) );
toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalZ_ );
// defaultPointsize
// default pointsize
toolboxDefaultPointsize_ = new QDoubleSpinBox();
toolboxDefaultPointsize_->setRange( 0.0, 1000.0 );
toolboxDefaultPointsize_->setDecimals( 4 );
toolboxDefaultPointsize_->setSingleStep( 0.001 );
toolboxDefaultPointsize_->setValue( 0.01 );
toolboxDefaultPointsize_->setToolTip( "The default pointsize used when an object has no pointsizes" );
// defaultPointsize layout
QHBoxLayout *toolboxDefaultPointsizeLayout = new QHBoxLayout();
toolboxDefaultPointsizeLayout->addWidget( new QLabel( "Default Pointsize:" ) );
toolboxDefaultPointsizeLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
toolboxDefaultPointsizeLayout->addWidget( toolboxDefaultPointsize_ );
// defaultColor
// default color
toolboxDefaultColorR_ = new QSpinBox();
toolboxDefaultColorG_ = new QSpinBox();
toolboxDefaultColorB_ = new QSpinBox();
......@@ -162,37 +170,55 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
toolboxDefaultColorR_->setValue( 255 );
toolboxDefaultColorG_->setValue( 255 );
toolboxDefaultColorB_->setValue( 255 );
toolboxDefaultColorR_->setToolTip( "The default red-component of the color used when an object has no colors" );
toolboxDefaultColorG_->setToolTip( "The default green-component of the color used when an object has no colors" );
toolboxDefaultColorB_->setToolTip( "The default blue-component of the color used when an object has no colors" );
// default normal layout
QHBoxLayout *toolboxDefaultNormalLayout = new QHBoxLayout();
toolboxDefaultNormalLayout->setSpacing( 6 );
toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalX_ );
toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalY_ );
toolboxDefaultNormalLayout->addWidget( toolboxDefaultNormalZ_ );
// default pointsize layout
QHBoxLayout *toolboxDefaultPointsizeLayout = new QHBoxLayout();
toolboxDefaultPointsizeLayout->setSpacing( 6 );
toolboxDefaultPointsizeLayout->addWidget( toolboxDefaultPointsize_ );
// defaultColor layout
// default color layout
QHBoxLayout *toolboxDefaultColorLayout = new QHBoxLayout();
toolboxDefaultColorLayout->addWidget( new QLabel( "Default Color:" ) );
toolboxDefaultColorLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
toolboxDefaultColorLayout->addWidget( toolboxDefaultColorR_ );
toolboxDefaultColorLayout->addItem ( new QSpacerItem( 6, 6 ) );
toolboxDefaultColorLayout->addWidget( toolboxDefaultColorG_ );
toolboxDefaultColorLayout->addItem ( new QSpacerItem( 6, 6 ) );
toolboxDefaultColorLayout->addWidget( toolboxDefaultColorB_ );
// applyDefaults button
toolboxDefaultColorLayout->setSpacing( 6 );
toolboxDefaultColorLayout->addWidget( toolboxDefaultColorR_ );
toolboxDefaultColorLayout->addWidget( toolboxDefaultColorG_ );
toolboxDefaultColorLayout->addWidget( toolboxDefaultColorB_ );
// default options layout
QGridLayout *toolboxDefaultOptionsLayout = new QGridLayout();
toolboxDefaultOptionsLayout->setSpacing( 6 );
toolboxDefaultOptionsLayout->addWidget( new QLabel( "Default Normal:" ), 0, 0 );
toolboxDefaultOptionsLayout->addWidget( new QLabel( "Default Pointsize:" ), 1, 0 );
toolboxDefaultOptionsLayout->addWidget( new QLabel( "Default Color:" ), 2, 0 );
toolboxDefaultOptionsLayout->addItem ( toolboxDefaultNormalLayout, 0, 1 );
toolboxDefaultOptionsLayout->addItem ( toolboxDefaultPointsizeLayout, 1, 1 );
toolboxDefaultOptionsLayout->addItem ( toolboxDefaultColorLayout, 2, 1 );
// apply defaults button
QPushButton *toolboxApplyDefaultsButton = new QPushButton( "Apply Defaults" );
toolboxApplyDefaultsButton->setToolTip( "Apply the changes made" );
// defaults layout
QVBoxLayout *toolboxDefaultsLayout = new QVBoxLayout();
toolboxDefaultsLayout->addItem ( toolboxDefaultNormalLayout );
toolboxDefaultsLayout->addItem ( toolboxDefaultPointsizeLayout );
toolboxDefaultsLayout->addItem ( toolboxDefaultColorLayout );
toolboxDefaultsLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
toolboxDefaultsLayout->addWidget( toolboxApplyDefaultsButton );
// ----
// options widget
QWidget *toolboxOptionsWidget = new QWidget();
toolboxOptionsWidget->setLayout( toolboxOptionsLayout );
toolboxDefaultsLayout->setSpacing( 6 );
toolboxDefaultsLayout->addItem ( toolboxDefaultOptionsLayout );
toolboxDefaultsLayout->addWidget( toolboxApplyDefaultsButton );
// defaults widget
QWidget *toolboxDefaultsWidget = new QWidget();
toolboxDefaultsWidget->setLayout( toolboxDefaultsLayout );
toolboxDefaultsWidget->setToolTip( "Default values" );
// ----
// tab widget
QTabWidget *toolboxTabWidget = new QTabWidget();
......@@ -201,12 +227,16 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
// toolbox layout
QVBoxLayout *toolboxLayout = new QVBoxLayout();
toolboxLayout->setSpacing( 6 );
toolboxLayout->addWidget( toolboxTabWidget );
// toolbox
QWidget *toolbox = new QWidget();
toolbox->setLayout( toolboxLayout );
// toolbox icon
QIcon *toolboxIcon = new QIcon( OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "SplatCloudType.png" );
// ----
// connect events to slots
......@@ -218,74 +248,67 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
connect( toolboxApplyDefaultsButton, SIGNAL( clicked() ), this, SLOT( slotToolboxApplyDefaultsButtonClicked() ) );
// emit signal to add the new toolbox
toolBoxIcon_ = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"SplatCloudType.png");
emit addToolbox( tr("SplatCloud Rendering Control") , toolbox , toolBoxIcon_);
emit addToolbox( tr("SplatCloud Rendering Control") , toolbox , toolboxIcon );
// -------------------------------------
// -------- create context menu --------
// -------------------------------------
// scale action
menuScaleAction_ = new QAction( tr("Pointsize Scale..."), this );
// culling action
menuCullingAction_ = new QAction( tr("Backface Culling"), this );
menuCullingAction_->setCheckable( true );
// defaults action
menuDefaultsAction_ = new QAction( tr("Defaults..."), this );
// reloadShaders action
menuReloadShadersAction_ = new QAction( tr("Reload Shaders"), this );
// rebuildVBO action
menuRebuildVBOAction_ = new QAction( tr("Rebuild VBO"), this );
// menu
QMenu *menu = new QMenu( "SplatCloud Rendering Control" );
menu->addAction( menuScaleAction_ );
menu->addAction( menuCullingAction_ );
menu->addSeparator();
menu->addAction( menuDefaultsAction_ );
menu->addSeparator();
menu->addAction( menuReloadShadersAction_ );
menu->addAction( menuRebuildVBOAction_ );
// actions
contextScaleAction_ = new QAction( tr( "Pointsize Scaling Factor..."), this );
contextCullingAction_ = new QAction( tr( "Backface Culling" ), this );
contextDefaultsAction_ = new QAction( tr( "Defaults..." ), this );
contextReloadShadersAction_ = new QAction( tr( "Reload Shaders" ), this );
contextRebuildVBOAction_ = new QAction( tr( "Rebuild VBO" ), this );
contextCullingAction_->setCheckable( true );
// context menu
QMenu *contextMenu = new QMenu( "SplatCloud Rendering Control" );
contextMenu->addAction( contextScaleAction_ );
contextMenu->addAction( contextCullingAction_ );
contextMenu->addSeparator();
contextMenu->addAction( contextDefaultsAction_ );
contextMenu->addSeparator();
contextMenu->addAction( contextReloadShadersAction_ );
contextMenu->addAction( contextRebuildVBOAction_ );
// ----
// connect events to slots
connect( menuScaleAction_, SIGNAL( triggered() ), this, SLOT( slotMenuScaleActionTriggered() ) );
connect( menuCullingAction_, SIGNAL( triggered() ), this, SLOT( slotMenuCullingActionTriggered() ) );
connect( menuDefaultsAction_, SIGNAL( triggered() ), this, SLOT( slotMenuDefaultsActionTriggered() ) );
connect( menuReloadShadersAction_, SIGNAL( triggered() ), this, SLOT( slotMenuReloadShadersActionTriggered() ) );
connect( menuRebuildVBOAction_, SIGNAL( triggered() ), this, SLOT( slotMenuRebuildVBOActionTriggered() ) );
connect( contextScaleAction_, SIGNAL( triggered() ), this, SLOT( slotContextScaleActionTriggered() ) );
connect( contextCullingAction_, SIGNAL( triggered() ), this, SLOT( slotContextCullingActionTriggered() ) );
connect( contextDefaultsAction_, SIGNAL( triggered() ), this, SLOT( slotContextDefaultsActionTriggered() ) );
connect( contextReloadShadersAction_, SIGNAL( triggered() ), this, SLOT( slotContextReloadShadersActionTriggered() ) );
connect( contextRebuildVBOAction_, SIGNAL( triggered() ), this, SLOT( slotContextRebuildVBOActionTriggered() ) );
// emit signal to add the new contest menu
emit addContextMenuItem( menu->menuAction(), DATA_SPLATCLOUD, CONTEXTOBJECTMENU );
// emit signal to add the new context menu
emit addContextMenuItem( contextMenu->menuAction(), DATA_SPLATCLOUD, CONTEXTOBJECTMENU );
// -------------------------------------
// -------- create scale widget --------
// -------------------------------------
// pointsizeScale
// pointsize scale
scaleWidgetPointsizeScale_ = new QDoubleSpinBox();
scaleWidgetPointsizeScale_->setRange( 0.0, 100.0 );
scaleWidgetPointsizeScale_->setDecimals( 4 );
scaleWidgetPointsizeScale_->setSingleStep( 0.1 );
scaleWidgetPointsizeScale_->setToolTip( "The scaling factor of the pointsizes used during the rendering of the picked object" );
// pointsizeScale layout
// pointsize scale layout
QHBoxLayout *scaleWidgetPointsizeScaleLayout = new QHBoxLayout();
scaleWidgetPointsizeScaleLayout->addWidget( new QLabel( "Pointsize Scale:" ) );
scaleWidgetPointsizeScaleLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
scaleWidgetPointsizeScaleLayout->addWidget( scaleWidgetPointsizeScale_ );
scaleWidgetPointsizeScaleLayout->setSpacing( 6 );
scaleWidgetPointsizeScaleLayout->addWidget( new QLabel( "Pointsize Scaling Factor:" ) );
scaleWidgetPointsizeScaleLayout->addWidget( scaleWidgetPointsizeScale_ );
// widget layout
QVBoxLayout *scaleWidgetLayout = new QVBoxLayout();
scaleWidgetLayout->setSpacing( 6 );
scaleWidgetLayout->addItem( scaleWidgetPointsizeScaleLayout );
// widget
scaleWidget_ = new QWidget();
scaleWidget_->setWindowTitle( "Pointsize Scale" );
scaleWidget_->setWindowTitle( "Pointsize Scaling Factor" );
scaleWidget_->setLayout( scaleWidgetLayout );
// ----
......@@ -297,7 +320,7 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
// -------- create defaults widget --------
// ----------------------------------------
// defaultNormal
// default normal
defaultsWidgetDefaultNormalX_ = new QDoubleSpinBox();
defaultsWidgetDefaultNormalY_ = new QDoubleSpinBox();
defaultsWidgetDefaultNormalZ_ = new QDoubleSpinBox();
......@@ -310,30 +333,18 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
defaultsWidgetDefaultNormalX_->setSingleStep( 0.1 );
defaultsWidgetDefaultNormalY_->setSingleStep( 0.1 );
defaultsWidgetDefaultNormalZ_->setSingleStep( 0.1 );
defaultsWidgetDefaultNormalX_->setToolTip( "The default x-component of the normal used when the picked object has no normals" );
defaultsWidgetDefaultNormalY_->setToolTip( "The default y-component of the normal used when the picked object has no normals" );
defaultsWidgetDefaultNormalZ_->setToolTip( "The default z-component of the normal used when the picked object has no normals" );
// defaultNormal layout
QHBoxLayout *defaultsWidgetDefaultNormalLayout = new QHBoxLayout();
defaultsWidgetDefaultNormalLayout->addWidget( new QLabel( "Default Normal:" ) );
defaultsWidgetDefaultNormalLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
defaultsWidgetDefaultNormalLayout->addWidget( defaultsWidgetDefaultNormalX_ );
defaultsWidgetDefaultNormalLayout->addItem ( new QSpacerItem( 6, 6 ) );
defaultsWidgetDefaultNormalLayout->addWidget( defaultsWidgetDefaultNormalY_ );
defaultsWidgetDefaultNormalLayout->addItem ( new QSpacerItem( 6, 6 ) );
defaultsWidgetDefaultNormalLayout->addWidget( defaultsWidgetDefaultNormalZ_ );
// defaultPointsize
// default pointsize
defaultsWidgetDefaultPointsize_ = new QDoubleSpinBox();
defaultsWidgetDefaultPointsize_->setRange( 0.0, 1000.0 );
defaultsWidgetDefaultPointsize_->setDecimals( 4 );
defaultsWidgetDefaultPointsize_->setSingleStep( 0.001 );
defaultsWidgetDefaultPointsize_->setToolTip( "The default pointsize used when the picked object has no pointsizes" );
// defaultPointsize layout
QHBoxLayout *defaultsWidgetDefaultPointsizeLayout = new QHBoxLayout();
defaultsWidgetDefaultPointsizeLayout->addWidget( new QLabel( "Default Pointsize:" ) );
defaultsWidgetDefaultPointsizeLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
defaultsWidgetDefaultPointsizeLayout->addWidget( defaultsWidgetDefaultPointsize_ );
// defaultColor
// default color
defaultsWidgetDefaultColorR_ = new QSpinBox();
defaultsWidgetDefaultColorG_ = new QSpinBox();
defaultsWidgetDefaultColorB_ = new QSpinBox();
......@@ -343,34 +354,56 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
defaultsWidgetDefaultColorR_->setSingleStep( 1 );
defaultsWidgetDefaultColorG_->setSingleStep( 1 );
defaultsWidgetDefaultColorB_->setSingleStep( 1 );
defaultsWidgetDefaultColorR_->setToolTip( "The default red-component of the color used when the picked object has no colors" );
defaultsWidgetDefaultColorG_->setToolTip( "The default green-component of the color used when the picked object has no colors" );
defaultsWidgetDefaultColorB_->setToolTip( "The default blue-component of the color used when the picked object has no colors" );
// defaultColor layout
// default normal layout
QHBoxLayout *defaultsWidgetDefaultNormalLayout = new QHBoxLayout();
defaultsWidgetDefaultNormalLayout->setSpacing( 6 );
defaultsWidgetDefaultNormalLayout->addWidget( defaultsWidgetDefaultNormalX_ );
defaultsWidgetDefaultNormalLayout->addWidget( defaultsWidgetDefaultNormalY_ );
defaultsWidgetDefaultNormalLayout->addWidget( defaultsWidgetDefaultNormalZ_ );
// default pointsize layout
QHBoxLayout *defaultsWidgetDefaultPointsizeLayout = new QHBoxLayout();
defaultsWidgetDefaultPointsizeLayout->setSpacing( 6 );
defaultsWidgetDefaultPointsizeLayout->addWidget( defaultsWidgetDefaultPointsize_ );
// default color layout
QHBoxLayout *defaultsWidgetDefaultColorLayout = new QHBoxLayout();
defaultsWidgetDefaultColorLayout->addWidget( new QLabel( "Default Color:" ) );
defaultsWidgetDefaultColorLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
defaultsWidgetDefaultColorLayout->addWidget( defaultsWidgetDefaultColorR_ );
defaultsWidgetDefaultColorLayout->addItem ( new QSpacerItem( 6, 6 ) );
defaultsWidgetDefaultColorLayout->addWidget( defaultsWidgetDefaultColorG_ );
defaultsWidgetDefaultColorLayout->addItem ( new QSpacerItem( 6, 6 ) );
defaultsWidgetDefaultColorLayout->addWidget( defaultsWidgetDefaultColorB_ );
defaultsWidgetDefaultColorLayout->setSpacing( 6 );
defaultsWidgetDefaultColorLayout->addWidget( defaultsWidgetDefaultColorR_ );
defaultsWidgetDefaultColorLayout->addWidget( defaultsWidgetDefaultColorG_ );
defaultsWidgetDefaultColorLayout->addWidget( defaultsWidgetDefaultColorB_ );
// default options layout
QGridLayout *defaultsWidgetDefaultOptionsLayout = new QGridLayout();
defaultsWidgetDefaultOptionsLayout->setSpacing( 6 );
defaultsWidgetDefaultOptionsLayout->addWidget( new QLabel( "Default Normal:" ), 0, 0 );
defaultsWidgetDefaultOptionsLayout->addWidget( new QLabel( "Default Pointsize:" ), 1, 0 );
defaultsWidgetDefaultOptionsLayout->addWidget( new QLabel( "Default Color:" ), 2, 0 );
defaultsWidgetDefaultOptionsLayout->addItem ( defaultsWidgetDefaultNormalLayout, 0, 1 );
defaultsWidgetDefaultOptionsLayout->addItem ( defaultsWidgetDefaultPointsizeLayout, 1, 1 );
defaultsWidgetDefaultOptionsLayout->addItem ( defaultsWidgetDefaultColorLayout, 2, 1 );
// cancel and apply buttons
QPushButton *defaultsWidgetCancelButton = new QPushButton( "Cancel" );
QPushButton *defaultsWidgetApplyButton = new QPushButton( "Apply" );
defaultsWidgetCancelButton->setToolTip( "Return without applying any changes" );
defaultsWidgetApplyButton->setToolTip ( "Apply the changes made and return" );
// buttons layout
QHBoxLayout *defaultsWidgetButtonsLayout = new QHBoxLayout();
defaultsWidgetButtonsLayout->setSpacing( 6 );
defaultsWidgetButtonsLayout->addWidget( defaultsWidgetCancelButton );
defaultsWidgetButtonsLayout->addItem ( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
defaultsWidgetButtonsLayout->addWidget( defaultsWidgetApplyButton );
// widget layout
QVBoxLayout *defaultsWidgetLayout = new QVBoxLayout();
defaultsWidgetLayout->addItem( defaultsWidgetDefaultNormalLayout );
defaultsWidgetLayout->addItem( defaultsWidgetDefaultPointsizeLayout );
defaultsWidgetLayout->addItem( defaultsWidgetDefaultColorLayout );
defaultsWidgetLayout->addItem( new QSpacerItem( 6, 6, QSizePolicy::Expanding, QSizePolicy::Expanding ) );
defaultsWidgetLayout->addItem( defaultsWidgetButtonsLayout );
defaultsWidgetLayout->setSpacing( 6 );
defaultsWidgetLayout->addItem( defaultsWidgetDefaultOptionsLayout );
defaultsWidgetLayout->addItem( defaultsWidgetButtonsLayout );
// widget
defaultsWidget_ = new QWidget();
......@@ -391,10 +424,9 @@ void SplatCloudRenderingControlPlugin::initializePlugin()
void SplatCloudRenderingControlPlugin::slotUpdateContextMenu( int _objectId )
{
// get object by id
if( _objectId == -1 )
return;
//
BaseObjectData *object;
if( ! PluginFunctions::getObject( _objectId, object ) )
return;
......@@ -405,8 +437,8 @@ void SplatCloudRenderingControlPlugin::slotUpdateContextMenu( int _objectId )
// if object is a SplatCloud...
if( splatCloud )
{
// update context-menu value
menuCullingAction_->setChecked( splatCloud->isBackfaceCullingEnabled() );
// update context menu value
contextCullingAction_->setChecked( splatCloud->isBackfaceCullingEnabled() );
}
}
......@@ -551,16 +583,13 @@ void SplatCloudRenderingControlPlugin::slotToolboxApplyDefaultsButtonClicked()
//----------------------------------------------------------------
void SplatCloudRenderingControlPlugin::slotMenuScaleActionTriggered()
void SplatCloudRenderingControlPlugin::slotContextScaleActionTriggered()
{
// get picked object
QVariant contextObject = menuScaleAction_->data();
int objectId = contextObject.toInt();
// get picked object by id
int objectId = contextScaleAction_->data().toInt();
if( objectId == -1 )
return;
//
BaseObjectData *object;
if( ! PluginFunctions::getObject( objectId, object ) )
return;
......@@ -575,8 +604,7 @@ void SplatCloudRenderingControlPlugin::slotMenuScaleActionTriggered()
scaleWidgetPointsizeScale_->setValue( splatCloud->pointsizeScale() );
// move scale-widget to position of context menu entry
QWidget *menuWidget = menuScaleAction_->associatedWidgets()[0];
scaleWidget_->move( menuWidget->x(), menuWidget->y() );
scaleWidget_->move( contextScaleAction_->associatedWidgets()[0]->mapToGlobal( QPoint() ) );
// show scale-widget
scaleWidget_->show();
......@@ -589,14 +617,11 @@ void SplatCloudRenderingControlPlugin::slotMenuScaleActionTriggered()
void SplatCloudRenderingControlPlugin::slotScaleWidgetPointsizeScaleValueChanged()
{
// get picked object
QVariant contextObject = menuScaleAction_->data();
int objectId = contextObject.toInt();
// get picked object by id
int objectId = contextScaleAction_->data().toInt();
if( objectId == -1 )
return;
//
BaseObjectData *object;
if( ! PluginFunctions::getObject( objectId, object ) )
return;
......@@ -622,16 +647,13 @@ void SplatCloudRenderingControlPlugin::slotScaleWidgetPointsizeScaleValueChanged
//----------------------------------------------------------------
void SplatCloudRenderingControlPlugin::slotMenuCullingActionTriggered()
void SplatCloudRenderingControlPlugin::slotContextCullingActionTriggered()
{
// get picked object
QVariant contextObject = menuCullingAction_->data();
int objectId = contextObject.toInt();
// get picked object by id
int objectId = contextCullingAction_->data().toInt();
if( objectId == -1 )
return;
//
BaseObjectData *object;
if( ! PluginFunctions::getObject( objectId, object ) )
return;
......@@ -642,8 +664,8 @@ void SplatCloudRenderingControlPlugin::slotMenuCullingActionTriggered()
// if object is a SplatCloud...
if( splatCloud )
{
// get context-menu option value
bool enable = menuCullingAction_->isChecked();
// get context menu option value
bool enable = contextCullingAction_->isChecked();
// apply update
splatCloud->enableBackfaceCulling( enable );
......@@ -657,16 +679,13 @@ void SplatCloudRenderingControlPlugin::slotMenuCullingActionTriggered()
//----------------------------------------------------------------
void SplatCloudRenderingControlPlugin::slotMenuReloadShadersActionTriggered()
void SplatCloudRenderingControlPlugin::slotContextReloadShadersActionTriggered()
{
// get picked object
QVariant contextObject = menuReloadShadersAction_->data();
int objectId = contextObject.toInt();
// get picked object by id
int objectId = contextReloadShadersAction_->data().toInt();
if( objectId == -1 )
return;
//
BaseObjectData *object;
if( ! PluginFunctions::getObject( objectId, object ) )
return;
......@@ -691,16 +710,13 @@ void SplatCloudRenderingControlPlugin::slotMenuReloadShadersActionTriggered()
//----------------------------------------------------------------
void SplatCloudRenderingControlPlugin::slotMenuRebuildVBOActionTriggered()
void SplatCloudRenderingControlPlugin::slotContextRebuildVBOActionTriggered()
{
// get picked object
QVariant contextObject = menuRebuildVBOAction_->data();
int objectId = contextObject.toInt();
// get picked object by id
int objectId = contextRebuildVBOAction_->data().toInt();
if( objectId == -1 )
return;
//
BaseObjectData *object;
if( ! PluginFunctions::getObject( objectId, object ) )
return;
......@@ -723,16 +739,13 @@ void SplatCloudRenderingControlPlugin::slotMenuRebuildVBOActionTriggered()
//----------------------------------------------------------------
void SplatCloudRenderingControlPlugin::slotMenuDefaultsActionTriggered()
void SplatCloudRenderingControlPlugin::slotContextDefaultsActionTriggered()
{
// get picked object
QVariant contextObject = menuDefaultsAction_->data();
int objectId = contextObject.toInt();
// get picked object by id
int objectId = contextDefaultsAction_->data().toInt();
if( objectId == -1 )
return;
//