This commit is contained in:
kaetemi 2014-04-30 12:53:06 +02:00
parent a607fab7e9
commit 989965e33f
4 changed files with 187 additions and 187 deletions

View file

@ -1,32 +1,32 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/> // Ryzom - MMORPG Framework <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/>.
#ifndef WIDGET_ADD_WATCHER #ifndef WIDGET_ADD_WATCHER
#define WIDGET_ADD_WATCHER #define WIDGET_ADD_WATCHER
#include <string> #include <string>
namespace NLGUI namespace NLGUI
{ {
class IWidgetAdditionWatcher class IWidgetAdditionWatcher
{ {
public: public:
virtual void widgetAdded( const std::string &name ) = 0; virtual void widgetAdded( const std::string &name ) = 0;
}; };
} }
#endif #endif

View file

@ -1,77 +1,77 @@
#include "add_widget_widget.h" #include "add_widget_widget.h"
#include "widget_info_tree.h" #include "widget_info_tree.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <QMessageBox> #include <QMessageBox>
namespace GUIEditor namespace GUIEditor
{ {
AddWidgetWidget::AddWidgetWidget( QWidget *parent ) : AddWidgetWidget::AddWidgetWidget( QWidget *parent ) :
QWidget( parent ) QWidget( parent )
{ {
setupUi( this ); setupUi( this );
setupConnections(); setupConnections();
} }
AddWidgetWidget::~AddWidgetWidget() AddWidgetWidget::~AddWidgetWidget()
{ {
} }
void AddWidgetWidget::setCurrentGroup( const QString &g ) void AddWidgetWidget::setCurrentGroup( const QString &g )
{ {
groupEdit->setText( g ); groupEdit->setText( g );
} }
void AddWidgetWidget::setupWidgetInfo( const CWidgetInfoTree *tree ) void AddWidgetWidget::setupWidgetInfo( const CWidgetInfoTree *tree )
{ {
std::vector< std::string > names; std::vector< std::string > names;
tree->getNames( names, false ); tree->getNames( names, false );
widgetCB->clear(); widgetCB->clear();
std::sort( names.begin(), names.end() ); std::sort( names.begin(), names.end() );
std::vector< std::string >::const_iterator itr = names.begin(); std::vector< std::string >::const_iterator itr = names.begin();
while( itr != names.end() ) while( itr != names.end() )
{ {
widgetCB->addItem( QString( itr->c_str() ) ); widgetCB->addItem( QString( itr->c_str() ) );
++itr; ++itr;
} }
} }
void AddWidgetWidget::setupConnections() void AddWidgetWidget::setupConnections()
{ {
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( close() ) ); connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( close() ) );
connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) ); connect( addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
} }
void AddWidgetWidget::onAddClicked() void AddWidgetWidget::onAddClicked()
{ {
if( groupEdit->text().isEmpty() ) if( groupEdit->text().isEmpty() )
{ {
QMessageBox::warning( NULL, QMessageBox::warning( NULL,
tr( "WARNING" ), tr( "WARNING" ),
tr( "You need to be adding the new widget into a group!" ), tr( "You need to be adding the new widget into a group!" ),
QMessageBox::Ok ); QMessageBox::Ok );
return; return;
} }
if( nameEdit->text().isEmpty() ) if( nameEdit->text().isEmpty() )
{ {
QMessageBox::warning( NULL, QMessageBox::warning( NULL,
tr( "WARNING" ), tr( "WARNING" ),
tr( "You need to specify a name for your new widget!" ), tr( "You need to specify a name for your new widget!" ),
QMessageBox::Ok ); QMessageBox::Ok );
return; return;
} }
close(); close();
Q_EMIT adding( groupEdit->text(), widgetCB->currentText(), nameEdit->text() ); Q_EMIT adding( groupEdit->text(), widgetCB->currentText(), nameEdit->text() );
} }
} }

View file

@ -1,32 +1,32 @@
#ifndef ADD_WIDGET_WIDGET_H #ifndef ADD_WIDGET_WIDGET_H
#define ADD_WIDGET_WIDGET_H #define ADD_WIDGET_WIDGET_H
#include "ui_add_widget_widget.h" #include "ui_add_widget_widget.h"
namespace GUIEditor namespace GUIEditor
{ {
class CWidgetInfoTree; class CWidgetInfoTree;
class AddWidgetWidget : public QWidget, public Ui::AddWidgetWidget class AddWidgetWidget : public QWidget, public Ui::AddWidgetWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
AddWidgetWidget( QWidget *parent = NULL ); AddWidgetWidget( QWidget *parent = NULL );
~AddWidgetWidget(); ~AddWidgetWidget();
void setCurrentGroup( const QString &g ); void setCurrentGroup( const QString &g );
void setupWidgetInfo( const CWidgetInfoTree *tree ); void setupWidgetInfo( const CWidgetInfoTree *tree );
private: private:
void setupConnections(); void setupConnections();
private Q_SLOTS: private Q_SLOTS:
void onAddClicked(); void onAddClicked();
Q_SIGNALS: Q_SIGNALS:
void adding( const QString &parentGroup, const QString &widgetType, const QString &name ); void adding( const QString &parentGroup, const QString &widgetType, const QString &name );
}; };
} }
#endif #endif

View file

@ -1,46 +1,46 @@
// 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 <QObject> #include <QObject>
namespace GUIEditor namespace GUIEditor
{ {
class CWidgetInfoTree; class CWidgetInfoTree;
/// Processes the GUI Editor's editor messages like delete, new, etc... /// Processes the GUI Editor's editor messages like delete, new, etc...
class CEditorMessageProcessor : public QObject class CEditorMessageProcessor : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
CEditorMessageProcessor( QObject *parent = NULL ) : CEditorMessageProcessor( QObject *parent = NULL ) :
QObject( parent ) QObject( parent )
{ {
tree = NULL; tree = NULL;
} }
~CEditorMessageProcessor(){} ~CEditorMessageProcessor(){}
void setTree( CWidgetInfoTree *tree ){ this->tree = tree; } void setTree( CWidgetInfoTree *tree ){ this->tree = tree; }
public Q_SLOTS: public Q_SLOTS:
void onDelete(); void onDelete();
void onAdd( const QString &parentGroup, const QString &widgetType, const QString &name ); void onAdd( const QString &parentGroup, const QString &widgetType, const QString &name );
private: private:
CWidgetInfoTree *tree; CWidgetInfoTree *tree;
}; };
} }