Merged in dfighter1985/ryzomcore/dfighter-tools (pull request #93)
Further GUI Editor improvements --HG-- branch : develop
commit
cd7f9035bc
@ -0,0 +1,46 @@
|
|||||||
|
// 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 ROOT_GROUP_H
|
||||||
|
#define ROOT_GROUP_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include "nel/gui/interface_group.h"
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
|
||||||
|
class CRootGroup : public CInterfaceGroup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CRootGroup(const TCtorParam ¶m);
|
||||||
|
virtual ~CRootGroup();
|
||||||
|
|
||||||
|
virtual CInterfaceElement* getElement (const std::string &id);
|
||||||
|
virtual void addGroup (CInterfaceGroup *child, sint eltOrder = -1);
|
||||||
|
virtual bool delGroup (CInterfaceGroup *child, bool dontDelete = false);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::map< std::string, CInterfaceGroup* > _Accel;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
// 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 VARIABLE_DATA_H
|
||||||
|
#define VARIABLE_DATA_H
|
||||||
|
|
||||||
|
#include "nel/misc/types_nl.h"
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
struct VariableData
|
||||||
|
{
|
||||||
|
std::string entry;
|
||||||
|
std::string type;
|
||||||
|
std::string value;
|
||||||
|
uint32 size;
|
||||||
|
|
||||||
|
VariableData()
|
||||||
|
{
|
||||||
|
size = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,94 @@
|
|||||||
|
// 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/>.
|
||||||
|
|
||||||
|
|
||||||
|
#include "nel/gui/root_group.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace NLGUI
|
||||||
|
{
|
||||||
|
|
||||||
|
CRootGroup::CRootGroup(const TCtorParam ¶m) :
|
||||||
|
CInterfaceGroup(param)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CRootGroup::~CRootGroup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CInterfaceElement* CRootGroup::getElement (const std::string &id)
|
||||||
|
{
|
||||||
|
if (_Id == id)
|
||||||
|
return this;
|
||||||
|
|
||||||
|
if (id.substr(0, _Id.size()) != _Id)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
std::vector<CViewBase*>::const_iterator itv;
|
||||||
|
for (itv = _Views.begin(); itv != _Views.end(); itv++)
|
||||||
|
{
|
||||||
|
CViewBase *pVB = *itv;
|
||||||
|
if (pVB->getId() == id)
|
||||||
|
return pVB;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CCtrlBase*>::const_iterator itc;
|
||||||
|
for (itc = _Controls.begin(); itc != _Controls.end(); itc++)
|
||||||
|
{
|
||||||
|
CCtrlBase* ctrl = *itc;
|
||||||
|
if (ctrl->getId() == id)
|
||||||
|
return ctrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Accelerate
|
||||||
|
std::string sTmp = id;
|
||||||
|
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
|
||||||
|
std::string::size_type pos = sTmp.find(':');
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
sTmp = sTmp.substr(0,pos);
|
||||||
|
|
||||||
|
std::map<std::string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
|
||||||
|
if (it != _Accel.end())
|
||||||
|
{
|
||||||
|
CInterfaceGroup *pIG = it->second;
|
||||||
|
return pIG->getElement(id);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRootGroup::addGroup (CInterfaceGroup *child, sint eltOrder)
|
||||||
|
{
|
||||||
|
std::string sTmp = child->getId();
|
||||||
|
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
|
||||||
|
_Accel.insert(std::pair<std::string,CInterfaceGroup*>(sTmp, child));
|
||||||
|
CInterfaceGroup::addGroup(child,eltOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CRootGroup::delGroup (CInterfaceGroup *child, bool dontDelete)
|
||||||
|
{
|
||||||
|
std::string sTmp = child->getId();
|
||||||
|
sTmp = sTmp.substr(_Id.size()+1,sTmp.size());
|
||||||
|
std::map<std::string,CInterfaceGroup*>::iterator it = _Accel.find(sTmp);
|
||||||
|
if (it != _Accel.end())
|
||||||
|
{
|
||||||
|
_Accel.erase(it);
|
||||||
|
}
|
||||||
|
return CInterfaceGroup::delGroup(child,dontDelete);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,135 @@
|
|||||||
|
// Ryzom Core Studio - GUI Editor Plugin
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||||
|
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||||
|
//
|
||||||
|
// 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 "new_gui_dlg.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
|
NewGUIDlg::NewGUIDlg( QWidget *parent ) :
|
||||||
|
QDialog( parent )
|
||||||
|
{
|
||||||
|
m_ui.setupUi( this );
|
||||||
|
|
||||||
|
connect( m_ui.okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) );
|
||||||
|
connect( m_ui.cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
||||||
|
connect( m_ui.projectDirTB, SIGNAL( clicked( bool ) ), this, SLOT( onProjectDirTBClicked() ) );
|
||||||
|
connect( m_ui.addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
|
||||||
|
connect( m_ui.removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
NewGUIDlg::~NewGUIDlg()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NewGUIDlg::getProjectName() const
|
||||||
|
{
|
||||||
|
return m_ui.projectEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NewGUIDlg::getWindowName() const
|
||||||
|
{
|
||||||
|
return m_ui.windowEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString NewGUIDlg::getProjectDirectory() const
|
||||||
|
{
|
||||||
|
return m_ui.projectDirEdit->text();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGUIDlg::getMapList( QList< QString > &l )
|
||||||
|
{
|
||||||
|
l.clear();
|
||||||
|
|
||||||
|
for( int i = 0; i < m_ui.mapList->count(); i++ )
|
||||||
|
{
|
||||||
|
l.push_back( m_ui.mapList->item( i )->text() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGUIDlg::onOKClicked()
|
||||||
|
{
|
||||||
|
if( m_ui.projectEdit->text().isEmpty() )
|
||||||
|
{
|
||||||
|
QMessageBox::information( this,
|
||||||
|
tr( "New project" ),
|
||||||
|
tr( "You must specify a project name!" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_ui.windowEdit->text().isEmpty() )
|
||||||
|
{
|
||||||
|
QMessageBox::information( this,
|
||||||
|
tr( "New project" ),
|
||||||
|
tr( "You must specify a window name!" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_ui.projectDirEdit->text().isEmpty() )
|
||||||
|
{
|
||||||
|
QMessageBox::information( this,
|
||||||
|
tr( "New project" ),
|
||||||
|
tr( "You must specify a project directory!" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGUIDlg::onCancelClicked()
|
||||||
|
{
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGUIDlg::onProjectDirTBClicked()
|
||||||
|
{
|
||||||
|
QString dir = QFileDialog::getExistingDirectory( this,
|
||||||
|
tr( "Specify project directory" ),
|
||||||
|
"." );
|
||||||
|
if( dir.isEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_ui.projectDirEdit->setText( dir );
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGUIDlg::onAddClicked()
|
||||||
|
{
|
||||||
|
if( m_ui.mapEdit->text().isEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
QList< QListWidgetItem* > l = m_ui.mapList->findItems( m_ui.mapEdit->text(), Qt::MatchContains );
|
||||||
|
if( !l.isEmpty() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui.mapList->addItem( m_ui.mapEdit->text() );
|
||||||
|
m_ui.mapEdit->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NewGUIDlg::onRemoveClicked()
|
||||||
|
{
|
||||||
|
QListWidgetItem *item = m_ui.mapList->currentItem();
|
||||||
|
if( item == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
|||||||
|
// Ryzom Core Studio - GUI Editor Plugin
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Laszlo Kis-Adam
|
||||||
|
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||||
|
//
|
||||||
|
// 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 NEW_GUI_DLG_H
|
||||||
|
#define NEW_GUI_DLG_H
|
||||||
|
|
||||||
|
#include "ui_new_gui_dlg.h"
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
|
class NewGUIDlg : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
NewGUIDlg( QWidget *parent = NULL );
|
||||||
|
~NewGUIDlg();
|
||||||
|
|
||||||
|
QString getProjectName() const;
|
||||||
|
QString getWindowName() const;
|
||||||
|
QString getProjectDirectory() const;
|
||||||
|
void getMapList( QList< QString > &l );
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void onOKClicked();
|
||||||
|
void onCancelClicked();
|
||||||
|
void onProjectDirTBClicked();
|
||||||
|
void onAddClicked();
|
||||||
|
void onRemoveClicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::NewGUIDialog m_ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>NewGUIDialog</class>
|
||||||
|
<widget class="QDialog" name="NewGUIDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>399</width>
|
||||||
|
<height>354</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>New GUI</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Project name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="projectEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Window name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="windowEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Project directory</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="2">
|
||||||
|
<widget class="QLineEdit" name="projectDirEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QToolButton" name="projectDirTB">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="4">
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Map files</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="addButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Add</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLineEdit" name="mapEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QPushButton" name="removeButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Remove</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" rowspan="2">
|
||||||
|
<widget class="QListWidget" name="mapList"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>107</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="okButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="cancelButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue