Commit 5e64b6ba authored by Marlin Frickenschmidt's avatar Marlin Frickenschmidt

Fixed minor bugs in snapshot dialog and added better display for light sources (on or off).

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10255 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9c2e23c6
......@@ -308,9 +308,22 @@ void DataControlPlugin::slotCustomContextMenuRequested ( const QPoint & _pos ) {
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-delete-item.png");
action->setIcon(icon);
menu.addSeparator();
action = menu.addAction(tr("Switch On/Off"),this,SLOT ( slotSwitchLight() ));
icon = typeIcon(DATA_LIGHT);
LightObject* light = 0;
if ( item->id() != -1 && PluginFunctions::getObject( item->id(), light ) ) {
if (light != 0 && !light->lightSource()->enabled()) {
action = menu.addAction(tr("Switch On"),this,SLOT ( slotSwitchLight() ));
icon = typeIcon(DATA_LIGHT);
}
}
if (light == 0 || light->lightSource()->enabled())
{
action = menu.addAction(tr("Switch Off"),this,SLOT ( slotSwitchLight() ));
icon = QIcon (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"LightOff.png");
}
action->setIcon(icon);
action = menu.addAction(tr("Edit Light"),this,SLOT ( slotEditLight() ));
icon = typeIcon(DATA_LIGHT);
action->setIcon(icon);
......@@ -574,7 +587,7 @@ void DataControlPlugin::slotSwitchLight() {
//******************************************************************************
/**
* \brief Switch light source on or off
* \brief Edit the light source's parameters
*/
void DataControlPlugin::slotEditLight() {
......
......@@ -50,6 +50,9 @@
#include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <ObjectTypes/Light/LightWidget.hh>
//******************************************************************************
......@@ -126,7 +129,16 @@ QVariant TreeModel::data(const QModelIndex &index, int role) const
// If we are setting the name, also add the icon
if ( role == Qt::DecorationRole ) {
return QVariant( typeIcon(item->dataType()) );
if (item->dataType() == DATA_LIGHT)
{
LightObject* light = 0;
if (item->id() != -1 && PluginFunctions::getObject( item->id(), light ) ) {
if (light != 0 && !light->lightSource()->enabled())
return QVariant (QIcon (OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"LightOff.png"));
}
}
return QVariant( typeIcon(item->dataType()) );
}
if (role != Qt::DisplayRole && role != Qt::EditRole )
......
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