More GUI skeleton work. Added Shader Editor widget.
--HG-- branch : gsoc2013-dfighterhg/feature/gsoc2013-dfighter
parent
e87e265c42
commit
d46944f258
@ -0,0 +1,91 @@
|
||||
// Object Viewer Qt Material 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 "shader_editor.h"
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
ShaderEditorWidget::ShaderEditorWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
ShaderEditorWidget::~ShaderEditorWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::getName( QString &name )
|
||||
{
|
||||
name = nameEdit->text();
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::getDescription( QString &desc )
|
||||
{
|
||||
desc = descriptionEdit->toPlainText();
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::getVertexShader( QString &vs )
|
||||
{
|
||||
vs = vsEdit->toPlainText();
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::getFragmentShader( QString &fs )
|
||||
{
|
||||
fs = fsEdit->toPlainText();
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::setName( const QString &name )
|
||||
{
|
||||
nameEdit->setText( name );
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::setDescription( const QString &desc )
|
||||
{
|
||||
descriptionEdit->setPlainText( desc );
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::setVertexShader( const QString &vs )
|
||||
{
|
||||
vsEdit->setPlainText( vs );
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::setFragmentShader( const QString &fs )
|
||||
{
|
||||
fsEdit->setPlainText( fs );
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::setupConnections()
|
||||
{
|
||||
connect( okButton, SIGNAL( clicked( bool ) ), this, SLOT( onOKClicked() ) ) ;
|
||||
connect( cancelButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::onOKClicked()
|
||||
{
|
||||
close();
|
||||
Q_EMIT okClicked();
|
||||
}
|
||||
|
||||
void ShaderEditorWidget::onCancelClicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
// Object Viewer Qt Material 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 SHADER_EDITOR_H
|
||||
#define SHADER_EDITOR_H
|
||||
|
||||
#include "ui_shader_editor.h"
|
||||
|
||||
namespace MaterialEditor
|
||||
{
|
||||
class ShaderEditorWidget : public QWidget, public Ui::ShaderEditorWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShaderEditorWidget( QWidget *parent = NULL );
|
||||
~ShaderEditorWidget();
|
||||
|
||||
void getName( QString &name );
|
||||
void getDescription( QString &desc );
|
||||
void getVertexShader( QString &vs );
|
||||
void getFragmentShader( QString &fs );
|
||||
|
||||
void setName( const QString &name );
|
||||
void setDescription( const QString &desc );
|
||||
void setVertexShader( const QString &vs );
|
||||
void setFragmentShader( const QString &fs );
|
||||
|
||||
private Q_SLOTS:
|
||||
void onOKClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
Q_SIGNALS:
|
||||
void okClicked();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ShaderEditorWidget</class>
|
||||
<widget class="QWidget" name="ShaderEditorWidget">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>750</width>
|
||||
<height>729</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Shader Editor</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="nameLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="nameEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="descrLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="descriptionEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="vsLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Vertex Shader</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="vsEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="fsLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Fragment Shader</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="fsEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<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>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>468</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue