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

View file

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

View file

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

View file

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

View file

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