CHANGED: #1471 Forgot to add new files in previous commit. Also when the GUI is loaded the NelGUIWidget emits a signal now.

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-07-24 04:48:12 +02:00
parent aa00672997
commit b60ec33fdf
8 changed files with 219 additions and 7 deletions

View file

@ -82,6 +82,9 @@ namespace GUIEditor
addDockWidget( Qt::RightDockWidgetArea, dock );
viewPort->init();
connect( viewPort, SIGNAL( guiLoadComplete() ), hierarchyView, SLOT( onGUILoaded() ) );
connect( viewPort, SIGNAL( guiLoadComplete() ), procList, SLOT( onGUILoaded() ) );
}
GUIEditorWindow::~GUIEditorWindow()
@ -151,7 +154,6 @@ namespace GUIEditor
if( viewPort->parse( projectFiles ) )
{
hierarchyView->buildHierarchy( projectFiles.masterGroup );
viewPort->draw();
}
else
{
@ -174,11 +176,6 @@ namespace GUIEditor
tr( "Error parsing GUI XML files" ),
tr( "There was an error while parsing the GUI XML files. See the log file for details." ) );
}
else
{
hierarchyView->buildHierarchy( projectFiles.masterGroup );
viewPort->draw();
}
setCursor( Qt::ArrowCursor );
}

View file

@ -105,6 +105,7 @@ namespace GUIEditor
timerID = startTimer( 200 );
guiLoaded = true;
Q_EMIT guiLoadComplete();
return true;
}

View file

@ -35,6 +35,9 @@ namespace GUIEditor
bool parse( SProjectFiles &files );
void draw();
Q_SIGNALS:
void guiLoadComplete();
protected:
void paintEvent( QPaintEvent *evnt );
void timerEvent( QTimerEvent *evnt );

View file

@ -0,0 +1,54 @@
// 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 "proc_list.h"
#include "proc_editor.h"
namespace GUIEditor
{
ProcList::ProcList( QWidget *parent ) :
QWidget( parent )
{
setupUi( this );
procEditor = new ProcEditor;
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOkButtonClicked() ) );
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( hide() ) );
connect( editButton, SIGNAL( clicked( bool ) ), this, SLOT( onEditButtonClicked() ) );
}
ProcList::~ProcList()
{
delete procEditor;
}
void ProcList::onGUILoaded()
{
}
void ProcList::onOkButtonClicked()
{
hide();
}
void ProcList::onEditButtonClicked()
{
procEditor->show();
}
}

View file

@ -0,0 +1,48 @@
// 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 PROC_LIST_H
#define PROC_LIST_H
#include "ui_proc_list.h"
namespace GUIEditor
{
class ProcEditor;
class ProcList : public QWidget, public Ui::ProcList
{
Q_OBJECT
public:
ProcList( QWidget *parent = NULL );
~ProcList();
public Q_SLOTS:
void onGUILoaded();
private Q_SLOTS:
void onOkButtonClicked();
void onEditButtonClicked();
private:
ProcEditor *procEditor;
};
}
#endif

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProcList</class>
<widget class="QWidget" name="ProcList">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>299</width>
<height>265</height>
</rect>
</property>
<property name="windowTitle">
<string>Procedure List</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2" colspan="2">
<widget class="QListWidget" name="procList"/>
</item>
<item row="0" column="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="addButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editButton">
<property name="text">
<string>Edit</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>124</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="okButton">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>114</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -125,6 +125,13 @@ namespace GUIEditor
}
}
void WidgetHierarchy::onGUILoaded()
{
if( masterGroup.empty() )
return;
buildHierarchy( masterGroup );
}
void WidgetHierarchy::onItemDblClicked( QTreeWidgetItem *item )
{
if( item->parent() == NULL )

View file

@ -35,17 +35,23 @@ namespace GUIEditor
WidgetHierarchy( QWidget *parent = NULL );
~WidgetHierarchy();
void setMasterGroup( const std::string &name ){ masterGroup = name; }
void clearHierarchy();
void buildHierarchy( std::string &masterGroup );
private:
void buildHierarchy( QTreeWidgetItem *parent, NLGUI::CInterfaceGroup *group );
public Q_SLOTS:
void onGUILoaded();
private Q_SLOTS:
void onItemDblClicked( QTreeWidgetItem *item );
private:
std::string currentSelection;
std::string masterGroup;
};
}