ADDED: #1471 My work on the link editor so far. Not yet fully implemented.
--HG-- branch : gsoc2012-gui-editorhg/feature/sse2
parent
00afb70bb8
commit
c14d91cfaf
@ -0,0 +1,40 @@
|
||||
// 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 LINKDATA_H
|
||||
#define LINKDATA_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace NLGUI
|
||||
{
|
||||
|
||||
struct SLinkData
|
||||
{
|
||||
public:
|
||||
std::string parent;
|
||||
std::string expr;
|
||||
std::string target;
|
||||
std::string action;
|
||||
std::string params;
|
||||
std::string cond;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,79 @@
|
||||
// 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 "link_list.h"
|
||||
#include "link_editor.h"
|
||||
#include "nel/gui/interface_group.h"
|
||||
#include "nel/gui/widget_manager.h"
|
||||
#include "nel/gui/link_data.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
LinkList::LinkList( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
linkEditor = new LinkEditor();
|
||||
|
||||
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
|
||||
connect( editButton, SIGNAL( clicked( bool ) ), this, SLOT( onEditButtonClicked() ) );
|
||||
}
|
||||
|
||||
LinkList::~LinkList()
|
||||
{
|
||||
delete linkEditor;
|
||||
}
|
||||
|
||||
void LinkList::onGUILoaded()
|
||||
{
|
||||
const std::map< uint32, SLinkData > &linkMap =
|
||||
CWidgetManager::getInstance()->getParser()->getLinkMap();
|
||||
|
||||
std::map< uint32, SLinkData >::const_iterator itr;
|
||||
for( itr = linkMap.begin(); itr != linkMap.end(); ++itr )
|
||||
{
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem( linkTree );
|
||||
item->setText( 0, itr->second.parent.c_str() );
|
||||
item->setText( 1, itr->second.target.c_str() );
|
||||
item->setText( 2, itr->second.action.c_str() );
|
||||
item->setData( 3, Qt::UserRole, itr->first );
|
||||
linkTree->addTopLevelItem( item );
|
||||
}
|
||||
linkTree->sortByColumn( 0 );
|
||||
}
|
||||
|
||||
void LinkList::onEditButtonClicked()
|
||||
{
|
||||
|
||||
QTreeWidgetItem *item =
|
||||
linkTree->currentItem();
|
||||
if( item == NULL )
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
uint32 id = item->data( 3, Qt::UserRole ).toUInt( &ok );
|
||||
if( !ok )
|
||||
return;
|
||||
|
||||
linkEditor->setLinkId( id );
|
||||
linkEditor->show();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +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/>.
|
||||
|
||||
|
||||
#ifndef LINK_LIST_H
|
||||
#define LINK_LIST_H
|
||||
|
||||
#include "ui_link_list.h"
|
||||
|
||||
namespace GUIEditor
|
||||
{
|
||||
class LinkEditor;
|
||||
|
||||
class LinkList : public QWidget, public Ui::LinkList
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LinkList( QWidget *parent = NULL );
|
||||
~LinkList();
|
||||
|
||||
public Q_SLOTS:
|
||||
void onGUILoaded();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onEditButtonClicked();
|
||||
|
||||
private:
|
||||
LinkEditor *linkEditor;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LinkList</class>
|
||||
<widget class="QWidget" name="LinkList">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>539</width>
|
||||
<height>353</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LinkList</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="5">
|
||||
<widget class="QTreeWidget" name="linkTree">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>parent</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>target(s)</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>action handler</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>273</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QPushButton" name="editButton">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue