Inconsistent line ending style, according to VS. How it managed to do this is a mystery tho.

This commit is contained in:
dfighter1985 2013-05-10 22:35:04 +02:00
parent 6c3d300753
commit df281b1019

View file

@ -1,131 +1,131 @@
// Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/> // Object Viewer Qt GUI Editor plugin <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as // it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the // published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. // License, or (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QMessageBox> #include <QMessageBox>
#include "editor_message_processor.h" #include "editor_message_processor.h"
#include "nel/gui/interface_group.h" #include "nel/gui/interface_group.h"
#include "nel/gui/widget_manager.h" #include "nel/gui/widget_manager.h"
#include "widget_info_tree.h" #include "widget_info_tree.h"
namespace GUIEditor namespace GUIEditor
{ {
void CEditorMessageProcessor::onDelete() void CEditorMessageProcessor::onDelete()
{ {
std::string selection = CWidgetManager::getInstance()->getCurrentEditorSelection(); std::string selection = CWidgetManager::getInstance()->getCurrentEditorSelection();
if( selection.empty() ) if( selection.empty() )
return; return;
QMessageBox::StandardButton r = QMessageBox::StandardButton r =
QMessageBox::question( NULL, QMessageBox::question( NULL,
tr( "Deleting widget" ), tr( "Deleting widget" ),
tr( "Are you sure you want to delete %1?" ).arg( selection.c_str() ), tr( "Are you sure you want to delete %1?" ).arg( selection.c_str() ),
QMessageBox::Yes | QMessageBox::No ); QMessageBox::Yes | QMessageBox::No );
if( r != QMessageBox::Yes ) if( r != QMessageBox::Yes )
return; return;
CInterfaceElement *e = CInterfaceElement *e =
CWidgetManager::getInstance()->getElementFromId( selection ); CWidgetManager::getInstance()->getElementFromId( selection );
if( e == NULL ) if( e == NULL )
return; return;
CInterfaceElement *p = e->getParent(); CInterfaceElement *p = e->getParent();
if( p == NULL ) if( p == NULL )
return; return;
CInterfaceGroup *g = dynamic_cast< CInterfaceGroup* >( p ); CInterfaceGroup *g = dynamic_cast< CInterfaceGroup* >( p );
if( g == NULL ) if( g == NULL )
return; return;
if( g->delElement( e ) ) if( g->delElement( e ) )
{ {
CWidgetManager::getInstance()->setCurrentEditorSelection( "" ); CWidgetManager::getInstance()->setCurrentEditorSelection( "" );
} }
} }
void CEditorMessageProcessor::onAdd( const QString &parentGroup, const QString &widgetType, const QString &name ) void CEditorMessageProcessor::onAdd( const QString &parentGroup, const QString &widgetType, const QString &name )
{ {
CWidgetInfoTreeNode *node = tree->findNodeByName( std::string( widgetType.toUtf8() ) ); CWidgetInfoTreeNode *node = tree->findNodeByName( std::string( widgetType.toUtf8() ) );
// No such widget // No such widget
if( node == NULL ) if( node == NULL )
{ {
QMessageBox::critical( QMessageBox::critical(
NULL, NULL,
tr( "Error" ), tr( "Error" ),
tr( "Error adding the new widget! No such widget type!" ), tr( "Error adding the new widget! No such widget type!" ),
QMessageBox::Ok QMessageBox::Ok
); );
return; return;
} }
// No class name defined // No class name defined
std::string className = node->getInfo().className; std::string className = node->getInfo().className;
if( className.empty() ) if( className.empty() )
{ {
QMessageBox::critical( QMessageBox::critical(
NULL, NULL,
tr( "Error" ), tr( "Error" ),
tr( "Error adding the new widget! Missing classname!" ), tr( "Error adding the new widget! Missing classname!" ),
QMessageBox::Ok QMessageBox::Ok
); );
return; return;
} }
CInterfaceElement *e = CInterfaceElement *e =
CWidgetManager::getInstance()->addWidgetToGroup( CWidgetManager::getInstance()->addWidgetToGroup(
std::string( parentGroup.toUtf8() ), std::string( parentGroup.toUtf8() ),
className, className,
std::string( name.toUtf8() ) std::string( name.toUtf8() )
); );
// Failed to add widget // Failed to add widget
if( e == NULL ) if( e == NULL )
{ {
QMessageBox::critical( QMessageBox::critical(
NULL, NULL,
tr( "Error" ), tr( "Error" ),
tr( "Error adding the new widget!" ), tr( "Error adding the new widget!" ),
QMessageBox::Ok QMessageBox::Ok
); );
return; return;
} }
// Setting the defaults will override the Id too // Setting the defaults will override the Id too
std::string id = e->getId(); std::string id = e->getId();
// Set up the defaults // Set up the defaults
std::vector< SPropEntry >::const_iterator itr = node->getInfo().props.begin(); std::vector< SPropEntry >::const_iterator itr = node->getInfo().props.begin();
while( itr != node->getInfo().props.end() ) while( itr != node->getInfo().props.end() )
{ {
e->setProperty( itr->propName, itr->propDefault ); e->setProperty( itr->propName, itr->propDefault );
++itr; ++itr;
} }
// Restore the Id // Restore the Id
e->setId( id ); e->setId( id );
// Make the widget aligned to the top left corner // Make the widget aligned to the top left corner
e->setParentPosRef( Hotspot_TL ); e->setParentPosRef( Hotspot_TL );
e->setPosRef( Hotspot_TL ); e->setPosRef( Hotspot_TL );
// Apply the new settings // Apply the new settings
e->setActive( false ); e->setActive( false );
e->setActive( true ); e->setActive( true );
} }
} }