From 88881227374884381f6608daf588c9e5f1a6ab35 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 10 May 2013 22:35:04 +0200 Subject: [PATCH] Inconsistent line ending style, according to VS. How it managed to do this is a mystery tho. --- .../gui_editor/editor_message_processor.cpp | 260 +++++++++--------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp index c784fa527..2a9810f24 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp @@ -1,131 +1,131 @@ -// Object Viewer Qt GUI Editor plugin -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include -#include "editor_message_processor.h" - -#include "nel/gui/interface_group.h" -#include "nel/gui/widget_manager.h" -#include "widget_info_tree.h" - -namespace GUIEditor -{ - void CEditorMessageProcessor::onDelete() - { - std::string selection = CWidgetManager::getInstance()->getCurrentEditorSelection(); - if( selection.empty() ) - return; - - QMessageBox::StandardButton r = - QMessageBox::question( NULL, - tr( "Deleting widget" ), - tr( "Are you sure you want to delete %1?" ).arg( selection.c_str() ), - QMessageBox::Yes | QMessageBox::No ); - if( r != QMessageBox::Yes ) - return; - - CInterfaceElement *e = - CWidgetManager::getInstance()->getElementFromId( selection ); - if( e == NULL ) - return; - - CInterfaceElement *p = e->getParent(); - if( p == NULL ) - return; - - CInterfaceGroup *g = dynamic_cast< CInterfaceGroup* >( p ); - if( g == NULL ) - return; - - if( g->delElement( e ) ) - { - CWidgetManager::getInstance()->setCurrentEditorSelection( "" ); - } - } - - void CEditorMessageProcessor::onAdd( const QString &parentGroup, const QString &widgetType, const QString &name ) - { - CWidgetInfoTreeNode *node = tree->findNodeByName( std::string( widgetType.toUtf8() ) ); - // No such widget - if( node == NULL ) - { - QMessageBox::critical( - NULL, - tr( "Error" ), - tr( "Error adding the new widget! No such widget type!" ), - QMessageBox::Ok - ); - - return; - } - - // No class name defined - std::string className = node->getInfo().className; - if( className.empty() ) - { - QMessageBox::critical( - NULL, - tr( "Error" ), - tr( "Error adding the new widget! Missing classname!" ), - QMessageBox::Ok - ); - - return; - } - - CInterfaceElement *e = - CWidgetManager::getInstance()->addWidgetToGroup( - std::string( parentGroup.toUtf8() ), - className, - std::string( name.toUtf8() ) - ); - - // Failed to add widget - if( e == NULL ) - { - QMessageBox::critical( - NULL, - tr( "Error" ), - tr( "Error adding the new widget!" ), - QMessageBox::Ok - ); - - return; - } - - // Setting the defaults will override the Id too - std::string id = e->getId(); - - // Set up the defaults - std::vector< SPropEntry >::const_iterator itr = node->getInfo().props.begin(); - while( itr != node->getInfo().props.end() ) - { - e->setProperty( itr->propName, itr->propDefault ); - ++itr; - } - - // Restore the Id - e->setId( id ); - // Make the widget aligned to the top left corner - e->setParentPosRef( Hotspot_TL ); - e->setPosRef( Hotspot_TL ); - +// Object Viewer Qt GUI Editor plugin +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include +#include "editor_message_processor.h" + +#include "nel/gui/interface_group.h" +#include "nel/gui/widget_manager.h" +#include "widget_info_tree.h" + +namespace GUIEditor +{ + void CEditorMessageProcessor::onDelete() + { + std::string selection = CWidgetManager::getInstance()->getCurrentEditorSelection(); + if( selection.empty() ) + return; + + QMessageBox::StandardButton r = + QMessageBox::question( NULL, + tr( "Deleting widget" ), + tr( "Are you sure you want to delete %1?" ).arg( selection.c_str() ), + QMessageBox::Yes | QMessageBox::No ); + if( r != QMessageBox::Yes ) + return; + + CInterfaceElement *e = + CWidgetManager::getInstance()->getElementFromId( selection ); + if( e == NULL ) + return; + + CInterfaceElement *p = e->getParent(); + if( p == NULL ) + return; + + CInterfaceGroup *g = dynamic_cast< CInterfaceGroup* >( p ); + if( g == NULL ) + return; + + if( g->delElement( e ) ) + { + CWidgetManager::getInstance()->setCurrentEditorSelection( "" ); + } + } + + void CEditorMessageProcessor::onAdd( const QString &parentGroup, const QString &widgetType, const QString &name ) + { + CWidgetInfoTreeNode *node = tree->findNodeByName( std::string( widgetType.toUtf8() ) ); + // No such widget + if( node == NULL ) + { + QMessageBox::critical( + NULL, + tr( "Error" ), + tr( "Error adding the new widget! No such widget type!" ), + QMessageBox::Ok + ); + + return; + } + + // No class name defined + std::string className = node->getInfo().className; + if( className.empty() ) + { + QMessageBox::critical( + NULL, + tr( "Error" ), + tr( "Error adding the new widget! Missing classname!" ), + QMessageBox::Ok + ); + + return; + } + + CInterfaceElement *e = + CWidgetManager::getInstance()->addWidgetToGroup( + std::string( parentGroup.toUtf8() ), + className, + std::string( name.toUtf8() ) + ); + + // Failed to add widget + if( e == NULL ) + { + QMessageBox::critical( + NULL, + tr( "Error" ), + tr( "Error adding the new widget!" ), + QMessageBox::Ok + ); + + return; + } + + // Setting the defaults will override the Id too + std::string id = e->getId(); + + // Set up the defaults + std::vector< SPropEntry >::const_iterator itr = node->getInfo().props.begin(); + while( itr != node->getInfo().props.end() ) + { + e->setProperty( itr->propName, itr->propDefault ); + ++itr; + } + + // Restore the Id + e->setId( id ); + // Make the widget aligned to the top left corner + e->setParentPosRef( Hotspot_TL ); + e->setPosRef( Hotspot_TL ); + // Apply the new settings - e->setActive( false ); - e->setActive( true ); - } -} - + e->setActive( false ); + e->setActive( true ); + } +} +