Changed: #1306 added basic sheet viewing

This commit is contained in:
aquiles 2011-08-14 20:28:16 +02:00
parent 55f26e7f16
commit 1e4a4b6724
22 changed files with 2218 additions and 137 deletions

View file

@ -87,9 +87,11 @@ void GeneralSettingsPage::applyGeneralSettings()
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString primitivePath = settings->value(Core::Constants::PRIMITIVES_PATH, "l:/primitives").toString();
QString ligoConfigFile = settings->value(Core::Constants::LIGOCONFIG_FILE, "l:/leveldesign/world_editor_files/world_editor_classes.xml").toString();
QString leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
NLMISC::CPath::addSearchPath(primitivePath.toStdString(), true, false);
NLMISC::CPath::display();
NLMISC::CPath::addSearchFile(ligoConfigFile.toStdString());
NLMISC::CPath::addSearchPath(leveldesignPath.toStdString(), true, false);
settings->endGroup();
}

View file

@ -10,10 +10,13 @@ SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin
SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h
georges_editor_form.h
georges_dirtree_dialog.h)
georges_dirtree_dialog.h
georges_filesystem_model.h
georges_treeview_dialog.h)
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui
georges_dirtree_form.ui)
georges_dirtree_form.ui
georges_treeview_form.ui)
SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc)
@ -32,7 +35,7 @@ SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(ovqt_plugin_georges_editor MODULE ${SRC} ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC} ${OVQT_EXT_SYS_SRC} ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS} ${OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS})
TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc ${QT_LIBRARIES})
TARGET_LINK_LIBRARIES(ovqt_plugin_georges_editor ovqt_plugin_core nelmisc nelgeorges ${QT_LIBRARIES})
NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor)

View file

@ -0,0 +1,162 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "formitem.h"
// Qt includes
// NeL includes
#include <nel/misc/o_xml.h>
#include <nel/georges/u_type.h>
#include <nel/georges/form.h>
namespace Plugin
{
CFormItem::CFormItem(NLGEORGES::UFormElm* elm, const QList<QVariant> &data, CFormItem *parent,
NLGEORGES::UFormElm::TWhereIsValue wV, NLGEORGES::UFormElm::TWhereIsNode wN)
{
parentItem = parent;
itemData = data;
formElm = elm;
whereV = wV;
whereN = wN;
}
CFormItem::~CFormItem()
{
qDeleteAll(childItems);
}
void CFormItem::appendChild(CFormItem *item)
{
childItems.append(item);
}
CFormItem *CFormItem::child(int row)
{
return childItems.value(row);
}
int CFormItem::childCount() const
{
return childItems.count();
}
int CFormItem::columnCount() const
{
//nlinfo("columnCount %d",itemData.count());
return itemData.count();
}
QVariant CFormItem::data(int column) const
{
return itemData.value(column);
}
CFormItem *CFormItem::parent()
{
return parentItem;
}
int CFormItem::row() const
{
if (parentItem)
return parentItem->childItems.indexOf(const_cast<CFormItem*>(this));
return 0;
}
bool CFormItem::setData(int column, const QVariant &value)
{
if (column < 0 || column >= itemData.size())
return false;
// TODO: default values
if (!formElm)
return false;
itemData[column] = value;
if (formElm->isAtom())
{
const NLGEORGES::UType *type = formElm->getType();
if (type)
{
switch (type->getType())
{
case NLGEORGES::UType::UnsignedInt:
case NLGEORGES::UType::SignedInt:
case NLGEORGES::UType::Double:
case NLGEORGES::UType::String:
if (parentItem->formElm->isArray())
{
//((NLGEORGES::CFormElm*)parentItem->formElm);//->arrayInsertNodeByName(
//if(parentItem->formElm->getArrayNode(elmName, num))
//{
//}
bool ok;
// TODO: the node can be renamed from eg "#0" to "foobar"
int arrayIndex = itemData[0].toString().remove("#").toInt(&ok);
if(ok)
{
NLGEORGES::UFormElm *elmt = 0;
if(parentItem->formElm->getArrayNode(&elmt, arrayIndex) && elmt)
{
if (elmt->isAtom())
{
((NLGEORGES::CFormElmAtom*)elmt)->setValue(value.toString().toStdString().c_str());
nldebug(QString("array element string %1 %2")
.arg(itemData[0].toString()).arg(value.toString())
.toStdString().c_str());
}
}
}
}
else
{
if(parentItem->formElm->setValueByName(
value.toString().toStdString().c_str(),
itemData[0].toString().toStdString().c_str()))
{
nldebug(QString("string %1 %2")
.arg(itemData[0].toString()).arg(value.toString())
.toStdString().c_str());
}
else
{
nldebug(QString("FAILED string %1 %2")
.arg(itemData[0].toString()).arg(value.toString())
.toStdString().c_str());
}
}
break;
case NLGEORGES::UType::Color:
nldebug("Color is TODO");
break;
default:
break;
}
}
}
else
{
nldebug("setting sth other than Atom");
}
//formElm->setValueByName();
return true;
}
}

View file

@ -0,0 +1,69 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 FORMITEM_H
#define FORMITEM_H
// NeL includes
#include <nel/georges/u_form_elm.h>
// Qt includes
#include <QList>
#include <QVariant>
namespace Plugin
{
class CFormItem
{
public:
CFormItem(NLGEORGES::UFormElm *elm, const QList<QVariant> &data,
CFormItem *parent = 0,
NLGEORGES::UFormElm::TWhereIsValue = NLGEORGES::UFormElm::ValueForm,
NLGEORGES::UFormElm::TWhereIsNode = NLGEORGES::UFormElm::NodeForm);
~CFormItem();
void appendChild(CFormItem *child);
CFormItem *child(int row);
int childCount() const;
int columnCount() const;
QVariant data(int column) const;
int row() const;
CFormItem *parent();
bool setData(int column, const QVariant &value);
NLGEORGES::UFormElm* getFormElm() {return formElm;}
NLGEORGES::UFormElm::TWhereIsValue valueFrom()
{
return whereV;
}
NLGEORGES::UFormElm::TWhereIsNode nodeFrom()
{
return whereN;
}
private:
QList<CFormItem*> childItems;
QList<QVariant> itemData;
CFormItem *parentItem;
NLGEORGES::UFormElm* formElm;
NLGEORGES::UFormElm::TWhereIsValue whereV;
NLGEORGES::UFormElm::TWhereIsNode whereN;
}; // CFormItem
}
#endif // FORMITEM_H

View file

@ -0,0 +1,64 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "georges.h"
#include "nel/misc/o_xml.h"
// STL includes
// NeL includes
#include <nel/georges/u_form_loader.h>
#include <nel/georges/u_form.h>
#include <nel/georges/u_type.h>
// Project includes
using namespace NLGEORGES;
namespace Plugin
{
CGeorges::CGeorges(): FormLoader(0)
{
FormLoader = UFormLoader::createLoader();
}
CGeorges::~CGeorges()
{
}
UForm *CGeorges::loadForm(std::string formName)
{
UForm *form = FormLoader->loadForm(formName.c_str());
return form;
}
UFormDfn *CGeorges::loadFormDfn(std::string formName)
{
UFormDfn *formdfn = FormLoader->loadFormDfn(formName.c_str());
return formdfn;
}
UType *CGeorges::loadFormType(std::string formName)
{
UType *type = FormLoader->loadFormType(formName.c_str());
return type;
}
} /* namespace Plugin */

View file

@ -0,0 +1,69 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 GEORGES_H
#define GEORGES_H
// Misc
// STL includes
#include <string>
// NeL includes
// Qt includes
// Project includes
namespace NLGEORGES
{
class UType;
class UForm;
class UFormDfn;
class UFormLoader;
}
using namespace NLGEORGES;
namespace Plugin
{
/**
@class CGeorges
A CGeorges class loading and viewing sheets.
*/
class CGeorges
{
public:
/// Default constructor.
CGeorges();
virtual ~CGeorges();
// Load the given form root
UForm* loadForm(std::string formName);
// Load a dfn
UFormDfn* loadFormDfn(std::string formName);
// Load a type
UType *loadFormType (std::string formName);
// A form loader
UFormLoader *FormLoader;
};/* class CGeorges */
} /* namespace Plugin */
#endif // GEORGES_H

View file

@ -23,24 +23,35 @@
// NeL includes
//using namespace NLMISC;
namespace Plugin
{
CGeorgesDirTreeDialog::CGeorgesDirTreeDialog(QString ldPath, QWidget *parent)
:QDockWidget(parent), m_ldPath(ldPath)
:QDockWidget(parent),
m_ldPath(ldPath),
m_proxyModel(0)
{
m_ui.setupUi(this);
m_ui.filterResetButton->setIcon(
QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton));
m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
m_ui.dirTree->setModel(m_dirModel);
m_proxyModel = new CGeorgesFileSystemProxyModel(this);
m_proxyModel->setSourceModel(m_dirModel);
m_ui.dirTree->setModel(m_proxyModel);
// TODO: filtering in tree model is ... complicated - so hide it for now
m_ui.filterLineEdit->hide();
m_ui.filterResetButton->hide();
m_ui.label->hide();
if (m_dirModel->isCorrectLDPath())
{
m_dirModel->setRootPath(m_ldPath);
m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath));
m_ui.dirTree->setRootIndex(m_proxyModel->mapFromSource(m_dirModel->index(m_ldPath)));
}
else
{
@ -61,10 +72,9 @@ CGeorgesDirTreeDialog::~CGeorgesDirTreeDialog()
void CGeorgesDirTreeDialog::fileSelected(QModelIndex index)
{
QString name;
if (index.isValid() && !m_dirModel->isDir(index))
if (index.isValid() && !m_dirModel->isDir(m_proxyModel->mapToSource(index)))
{
Q_EMIT selectedForm(m_dirModel->fileName(index));
Q_EMIT selectedForm(m_dirModel->fileName(m_proxyModel->mapToSource(index)));
}
}
@ -81,14 +91,18 @@ void CGeorgesDirTreeDialog::ldPathChanged(QString path)
m_ldPath = path;
delete m_dirModel;
delete m_proxyModel;
m_dirModel = new CGeorgesFileSystemModel(m_ldPath);
m_ui.dirTree->setModel(m_dirModel);
m_proxyModel = new CGeorgesFileSystemProxyModel(this);
m_proxyModel->setSourceModel(m_dirModel);
m_ui.dirTree->setModel(m_proxyModel);
if (m_dirModel->isCorrectLDPath())
{
m_dirModel->setRootPath(m_ldPath);
m_ui.dirTree->setRootIndex(m_dirModel->index(m_ldPath));
m_ui.dirTree->setRootIndex(m_proxyModel->mapFromSource(m_dirModel->index(m_ldPath)));
}
else
{

View file

@ -45,6 +45,7 @@ private:
Ui::CGeorgesDirTreeDialog m_ui;
CGeorgesFileSystemModel *m_dirModel;
CGeorgesFileSystemProxyModel *m_proxyModel;
QString m_ldPath;
Q_SIGNALS:
@ -54,7 +55,6 @@ private Q_SLOTS:
void fileSelected(QModelIndex index);
void changeFile(QString file);
friend class CMainWindow;
}; /* CGEorgesDirTreeDialog */
} /* namespace NLQT */

View file

@ -19,7 +19,7 @@
<property name="minimumSize">
<size>
<width>200</width>
<height>111</height>
<height>141</height>
</size>
</property>
<property name="features">
@ -36,7 +36,7 @@
</size>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="1" column="0" colspan="3">
<widget class="QTreeView" name="dirTree">
<property name="minimumSize">
<size>
@ -46,9 +46,37 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="filterLineEdit"/>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="filterResetButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="georges_editor.qrc">
<normaloff>:/images/ic_nel_georges_editor.png</normaloff>:/images/ic_nel_georges_editor.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Filter</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<resources/>
<resources>
<include location="../../object_viewer_qt.qrc"/>
<include location="../core/core.qrc"/>
<include location="georges_editor.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -18,6 +18,7 @@
#include "georges_editor_form.h"
#include "georges_editor_constants.h"
#include "georges_dirtree_dialog.h"
#include "georges_treeview_dialog.h"
#include "../core/icore.h"
#include "../core/imenu_manager.h"
@ -30,110 +31,190 @@
#include <QSettings>
#include <QFileDialog>
#include <QToolBar>
#include <QDebug>
namespace Plugin
{
GeorgesEditorForm::GeorgesEditorForm(QWidget *parent)
: QMainWindow(parent),
m_georgesDirTreeDialog(0)
{
m_ui.setupUi(this);
m_undoStack = new QUndoStack(this);
_openAction = new QAction(tr("&Open..."), this);
_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
_openAction->setShortcut(QKeySequence::Open);
_openAction->setStatusTip(tr("Open an existing file"));
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));
_newAction = new QAction(tr("&New..."), this);
_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
_newAction->setShortcut(QKeySequence::New);
_newAction->setStatusTip(tr("Create a new file"));
connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
_saveAction = new QAction(tr("&Save..."), this);
_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
_saveAction->setShortcut(QKeySequence::Save);
_saveAction->setStatusTip(tr("Save the current file"));
connect(_saveAction, SIGNAL(triggered()), this, SLOT(save()));
_fileToolBar = addToolBar(tr("&File"));
_fileToolBar->addAction(_openAction);
_fileToolBar->addAction(_newAction);
_fileToolBar->addAction(_saveAction);
readSettings();
// create leveldesign directory tree dockwidget
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
//m_georgesDirTreeDialog->setVisible(false);
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
this, SLOT(settingsChanged()));
}
GeorgesEditorForm::~GeorgesEditorForm()
{
writeSettings();
}
QUndoStack *GeorgesEditorForm::undoStack() const
{
return m_undoStack;
}
void GeorgesEditorForm::open()
{
// TODO: FileDialog & loadFile();
//QString fileName = QFileDialog::getOpenFileName();
//loadFile(fileName);
}
void GeorgesEditorForm::newFile()
{
}
void GeorgesEditorForm::save()
{
}
void GeorgesEditorForm::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->endGroup();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
}
void GeorgesEditorForm::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->endGroup();
settings->sync();
}
void GeorgesEditorForm::settingsChanged()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString oldLDPath = m_leveldesignPath;
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
if (oldLDPath != m_leveldesignPath)
GeorgesEditorForm::GeorgesEditorForm(QWidget *parent)
: QMainWindow(parent),
m_georgesDirTreeDialog(0),
m_emptyDock(0),
m_mainDock(0)
{
m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath);
m_ui.setupUi(this);
// background for the mainwindow
QString css = "QWidget#centralwidget {";
css += "image: url(:/images/ic_nel_georges_editor.png);";
css += "}";
// add new mainwindow for sheet dockwidgets
QWidget *widget = new QWidget(this);
widget->setObjectName("centralwidget");
widget->setStyleSheet(css);
setCentralWidget(widget);
QGridLayout *layout = new QGridLayout(widget);
layout->setContentsMargins(0,0,0,0);
widget->setLayout(layout);
m_mainDock = new QMainWindow(this);
m_mainDock->setDockNestingEnabled(true);
layout->addWidget(m_mainDock);
m_undoStack = new QUndoStack(this);
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
_openAction = menuManager->action(Core::Constants::OPEN);
/*_openAction = new QAction(tr("&Open..."), this);
_openAction->setIcon(QIcon(Core::Constants::ICON_OPEN));
_openAction->setShortcut(QKeySequence::Open);
_openAction->setStatusTip(tr("Open an existing file"));
connect(_openAction, SIGNAL(triggered()), this, SLOT(open()));*/
_newAction = new QAction(tr("&New..."), this);
_newAction->setIcon(QIcon(Core::Constants::ICON_NEW));
_newAction->setShortcut(QKeySequence::New);
_newAction->setStatusTip(tr("Create a new file"));
connect(_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
_saveAction = new QAction(tr("&Save..."), this);
_saveAction->setIcon(QIcon(Core::Constants::ICON_SAVE));
_saveAction->setShortcut(QKeySequence::Save);
_saveAction->setStatusTip(tr("Save the current file"));
connect(_saveAction, SIGNAL(triggered()), this, SLOT(save()));
_fileToolBar = addToolBar(tr("&File"));
_fileToolBar->addAction(_openAction);
_fileToolBar->addAction(_newAction);
_fileToolBar->addAction(_saveAction);
//_openAction->setEnabled(false);
//_newAction->setEnabled(false);
//_saveAction->setEnabled(false);
readSettings();
// create leveldesign directory tree dockwidget
m_georgesDirTreeDialog = new CGeorgesDirTreeDialog(m_leveldesignPath, this);
addDockWidget(Qt::LeftDockWidgetArea, m_georgesDirTreeDialog);
restoreDockWidget(m_georgesDirTreeDialog);
connect(Core::ICore::instance(), SIGNAL(changeSettings()),
this, SLOT(settingsChanged()));
connect(m_georgesDirTreeDialog, SIGNAL(selectedForm(const QString)),
this, SLOT(loadFile(const QString)));
}
GeorgesEditorForm::~GeorgesEditorForm()
{
writeSettings();
}
QUndoStack *GeorgesEditorForm::undoStack() const
{
return m_undoStack;
}
void GeorgesEditorForm::open()
{
/*qDebug() << "GeorgesEditorForm::open()";
if (!m_dockedWidgets.size())
{
m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock));
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
}
else
{
m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock));
Q_ASSERT(m_dockedWidgets.size() > 1);
m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last());
}*/
// TODO: FileDialog & loadFile();
//m_mainDock->addDockWidget(Qt::TopDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true));
//m_mainDock->addDockWidget(Qt::LeftDockWidgetArea, new CGeorgesTreeViewDialog(m_mainDock, true));
//QString fileName = QFileDialog::getOpenFileName();
//loadFile(fileName);
}
void GeorgesEditorForm::newFile()
{
}
void GeorgesEditorForm::save()
{
}
void GeorgesEditorForm::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
restoreGeometry(settings->value("geometry").toByteArray());
restoreState(settings->value("windowState").toByteArray());
settings->endGroup();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
}
void GeorgesEditorForm::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->setValue("geometry", saveGeometry());
settings->setValue("windowState", saveState());
settings->endGroup();
settings->sync();
}
void GeorgesEditorForm::settingsChanged()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Core::Constants::DATA_PATH_SECTION);
QString oldLDPath = m_leveldesignPath;
m_leveldesignPath = settings->value(Core::Constants::LEVELDESIGN_PATH, "l:/leveldesign").toString();
settings->endGroup();
if (oldLDPath != m_leveldesignPath)
{
m_georgesDirTreeDialog->ldPathChanged(m_leveldesignPath);
}
}
void GeorgesEditorForm::loadFile(const QString fileName)
{
QFileInfo info(fileName);
if (!m_dockedWidgets.size())
{
m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock));
m_mainDock->addDockWidget(Qt::RightDockWidgetArea, m_dockedWidgets.last());
}
else
{
m_dockedWidgets.append(new CGeorgesTreeViewDialog(m_mainDock));
Q_ASSERT(m_dockedWidgets.size() > 1);
m_mainDock->tabifyDockWidget(m_dockedWidgets.at(m_dockedWidgets.size() - 2), m_dockedWidgets.last());
}
CForm *form = m_dockedWidgets.last()->getFormByName(info.fileName());
if (form)
{
// delete newView;
// newView = createTreeView(fileName);
m_dockedWidgets.last()->setForm(form);
m_dockedWidgets.last()->loadFormIntoDialog(form);
//setCurrentFile(info.fileName());
// return;
}
}
}
} /* namespace Plugin */

View file

@ -27,6 +27,7 @@ namespace Plugin
{
class CGeorgesDirTreeDialog;
class CGeorgesTreeViewDialog;
class GeorgesEditorForm: public QMainWindow
{
Q_OBJECT
@ -42,6 +43,7 @@ public Q_SLOTS:
void newFile();
void save();
void settingsChanged();
void loadFile(const QString fileName);
private:
void readSettings();
@ -57,6 +59,12 @@ private:
QAction *_saveAction;
QString m_leveldesignPath;
QDockWidget *m_emptyDock;
QMainWindow *m_mainDock;
QList<CGeorgesTreeViewDialog*> m_dockedWidgets;
QList<QTabBar*> m_tabBars;
}; /* class GeorgesEditorForm */
} /* namespace Plugin */

View file

@ -13,12 +13,16 @@
<property name="windowTitle">
<string>Georges Editor</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QWidget" name="centralwidget">
<property name="styleSheet">
<string notr="true">QWidget#centralwidget {
image: url(:/images/ic_nel_georges_editor.png);
}</string>
</property>
<layout class="QGridLayout" name="gridLayout"/>
</widget>
</widget>
<resources>

View file

@ -74,7 +74,7 @@ QString GeorgesEditorPlugin::name() const
QString GeorgesEditorPlugin::version() const
{
return "0.2";
return "0.3";
}
QString GeorgesEditorPlugin::vendor() const

View file

@ -28,6 +28,8 @@ CGeorgesFileSystemModel::CGeorgesFileSystemModel(QString ldPath, QObject *parent
m_correct(false)
{
checkLDPath();
connect(this, SIGNAL(directoryLoaded(QString)),
this, SLOT(dir(const QString)));
}
CGeorgesFileSystemModel::~CGeorgesFileSystemModel()
@ -35,6 +37,21 @@ CGeorgesFileSystemModel::~CGeorgesFileSystemModel()
}
void CGeorgesFileSystemModel::dir(const QString &dir)
{
QModelIndex i = index(dir);
if (hasChildren(i)) {
int childCount = rowCount(i);
for (int c=0; c<childCount; c++) {
const QModelIndex child = index(c, 0, i);
if (child.isValid()) {
fetchMore(child);
}
}
}
}
QVariant CGeorgesFileSystemModel::data(const QModelIndex& index, int role) const
{
@ -90,6 +107,54 @@ void CGeorgesFileSystemModel::checkLDPath()
m_correct = false;
}
}
//
//bool CGeorgesFileSystemModel::canFetchMore(const QModelIndex &parent) const
//{
// return true;
//
// /* Q_D(const QFileSystemModel);
// const QFileSystemModelPrivate::QFileSystemNode *indexNode = d->node(parent);
// return (!indexNode->populatedChildren);*/
//}
CGeorgesFileSystemProxyModel::CGeorgesFileSystemProxyModel(QObject *parent) : QSortFilterProxyModel(parent)
{
setFilterCaseSensitivity(Qt::CaseInsensitive);
}
bool CGeorgesFileSystemProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
// TODO this is not perfect as it could be
// eg it should filter all dirs which have no entry
QModelIndex idx = sourceModel()->index(source_row, 0, source_parent);
if (sourceModel()->hasChildren(idx))
{
// QString d = sourceModel()->data(idx).toString();
// //QModelIndex i = mapFromSource(source_parent);
// //if (hasChildren(i)) {
// int childCount = sourceModel()->rowCount(idx);
// for (int c=0; c<childCount; c++) {
// /*const QModelIndex child = sourceModel()->index(c, 0, idx);
// if (child.isValid()) {
// bool test = filterAcceptsRow(c, child);
// }*/
// }
return true;
}
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
}
//QVariant CGeorgesFileSystemProxyModel::data ( const QModelIndex & index, int role ) const
//{
// if (role == Qt::DisplayRole)
// {
// QString test = QSortFilterProxyModel::data(index, role).toString();
// return test.append(QString(" (%1/%2)")).
// arg(rowCount(index)).
// arg(sourceModel()->rowCount(mapToSource(index)));
// }
// return QSortFilterProxyModel::data(index, role);
//}
} /* namespace NLQT */
/* end of file */

View file

@ -18,32 +18,61 @@
#define GEORGES_FILESYSTEM_MODEL_H
#include <QtGui/QFileSystemModel>
#include <QSortFilterProxyModel>
namespace Plugin
{
class CGeorgesFileSystemModel : public QFileSystemModel
{
QString m_ldPath;
public:
CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
~CGeorgesFileSystemModel();
int columnCount(const QModelIndex &/*parent*/) const;
int rowCount(const QModelIndex &/*parent*/) const;
QVariant data(const QModelIndex& index, int role) const ;
bool isCorrectLDPath()
class CGeorgesFileSystemModel : public QFileSystemModel
{
return m_correct;
}
void checkLDPath();
Q_OBJECT
private:
bool m_correct;
};/* class CGeorgesFileSystemModel */
public:
CGeorgesFileSystemModel(QString ldPath, QObject *parent = 0);
~CGeorgesFileSystemModel();
int columnCount(const QModelIndex &/*parent*/) const;
int rowCount(const QModelIndex &/*parent*/) const;
QVariant data(const QModelIndex& index, int role) const ;
bool isCorrectLDPath()
{
return m_correct;
}
bool isInitialized()
{
return m_initialized;
}
void setInitialized( bool init)
{
m_initialized = init;
}
void checkLDPath();
private:
bool m_correct;
bool m_initialized;
QString m_ldPath;
private Q_SLOTS:
void dir(const QString&);
};/* class CGeorgesFileSystemModel */
// A modified QSortFilterProxyModel that always accepts the root nodes in the tree
// so filtering is only done on the children.
class CGeorgesFileSystemProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
CGeorgesFileSystemProxyModel(QObject *parent = 0);
//QVariant data(const QModelIndex& index, int role) const ;
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
};
} /* namespace NLQT */

View file

@ -0,0 +1,411 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "georges_treeview_dialog.h"
// Qt includes
#include <QtGui/QWidget>
#include <QSettings>
#include <QFileDialog>
// NeL includes
#include <nel/misc/path.h>
#include <nel/misc/file.h>
#include <nel/misc/o_xml.h>
#include <nel/georges/form.h>
// Project includes
#include "georges.h"
#include "georgesform_model.h"
#include "georgesform_proxy_model.h"
//#include "formitem.h"
//#include "formdelegate.h"
using namespace NLMISC;
using namespace NLGEORGES;
namespace Plugin
{
CGeorgesTreeViewDialog::CGeorgesTreeViewDialog(QWidget *parent /*= 0*/)
: QDockWidget(parent)
{
m_georges = new CGeorges;
loadedForm = "";
m_modified = false;
m_ui.setupUi(this);
m_ui.treeView->header()->setResizeMode(QHeaderView::ResizeToContents);
m_ui.treeViewTabWidget->setTabEnabled (2,false);
m_ui.checkBoxParent->setStyleSheet("background-color: rgba(0,255,0,30)");
m_ui.checkBoxDefaults->setStyleSheet("background-color: rgba(255,0,0,30)");
m_form = 0;
//FormDelegate *formdelegate = new FormDelegate(this);
//_ui.treeView->setItemDelegateForColumn(1, formdelegate);
connect(m_ui.treeView, SIGNAL(doubleClicked (QModelIndex)),
this, SLOT(doubleClicked (QModelIndex)));
connect(m_ui.checkBoxParent, SIGNAL(toggled(bool)),
this, SLOT(filterRows()));
connect(m_ui.checkBoxDefaults, SIGNAL(toggled(bool)),
this, SLOT(filterRows()));
}
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
{
//delete _ui.treeView->itemDelegateForColumn(1);
delete m_form;
deleteLater();
//QSettings settings("RyzomCore", "GeorgesQt");
//settings.setValue("dirViewGeometry", saveGeometry());
}
void CGeorgesTreeViewDialog::setForm(const CForm *form)
{
m_form = (UForm*)form;
}
CForm* CGeorgesTreeViewDialog::getFormByName(const QString formName)
{
if(NLMISC::CPath::exists(formName.toStdString()))
{
return (CForm*)m_georges->loadForm(formName.toStdString());
}
//else
//{
// CForm *form = 0;
// // Load the DFN
// std::string extStr = NLMISC::CFile::getExtension( formName.toStdString() );
// QString dfnName = QString("%1.dfn").arg(extStr.c_str());
// UFormDfn *formdfn;
// if (NLMISC::CPath::exists(dfnName.toStdString()))
// {
// formdfn = _georges->loadFormDfn (dfnName.toStdString());
// if (!formdfn)
// {
// nlwarning("Failed to load dfn: %s", dfnName.toStdString().c_str());
// return 0;
// }
// }
// else
// {
// nlwarning("Cannot find dfn: %s", dfnName.toStdString().c_str());
// return 0;
// }
// form = new CForm;
// // Build the root element
// ((CFormElmStruct*)&form->getRootNode())->build((CFormDfn*)formdfn);
// uint i;
// for (i=0; i<CForm::HeldElementCount; i++)
// {
// ((CFormElmStruct*)(((CForm*)form)->HeldElements[i]))->build ((CFormDfn*)formdfn);
// }
// return form;
//}
return 0;
}
void CGeorgesTreeViewDialog::loadFormIntoDialog(CForm *form)
{
if(form)
m_form = form;
else
return;
UFormElm *root = 0;
root = &m_form->getRootNode();
QStringList parents;
for (uint i = 0; i < m_form->getNumParent(); i++)
{
UForm *u = m_form->getParentForm(i);
parents << u->getFilename().c_str();
}
QString comments;
comments = m_form->getComment().c_str();
if (!comments.isEmpty())
{
m_ui.treeViewTabWidget->setTabEnabled (1,true);
m_ui.commentEdit->setPlainText(comments);
}
QStringList strList;
std::set<std::string> dependencies;
m_form->getDependencies(dependencies);
QMap< QString, QStringList> deps;
Q_FOREACH(std::string str, dependencies)
{
QString file = str.c_str();
if (str == m_form->getFilename()) continue;
deps[file.remove(0,file.indexOf(".")+1)] << str.c_str();
}
nlinfo("typ's %d",deps["typ"].count());
nlinfo("dfn's %d",deps["dfn"].count());
//nlwarning(strList.join(";").toStdString().c_str());
if (root)
{
loadedForm = m_form->getFilename().c_str();
CGeorgesFormModel *model = new CGeorgesFormModel(root,deps,comments,parents);
CGeorgesFormProxyModel *proxyModel = new CGeorgesFormProxyModel();
proxyModel->setSourceModel(model);
m_ui.treeView->setModel(proxyModel);
m_ui.treeView->expandAll();
// this is a debug output row
m_ui.treeView->hideColumn(3);
filterRows();
// //_ui.treeView->setRowHidden(0,QModelIndex(),true);
// connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
// this, SLOT(modifiedFile()));
setWindowTitle(loadedForm);
// //Modules::mainWin().getTabBar();
}
}
void CGeorgesTreeViewDialog::addParentForm(CForm *form)
{
//((CForm*)_form)->insertParent(((CForm*)_form)->getParentCount(), form->getFilename().c_str(), form);
}
void CGeorgesTreeViewDialog::modifiedFile( )
{
/*if (!_modified)
{
_modified = true;
setWindowTitle(windowTitle()+"*");
Modules::mainWin().setWindowTitle(Modules::mainWin().windowTitle()+"*");
Q_EMIT modified(_modified);
}*/
}
void CGeorgesTreeViewDialog::write( )
{
//COFile file;
//std::string s = CPath::lookup(loadedForm.toStdString(), false);
//if (file.open (s))
//{
// try
// {
// if (loadedForm.contains(".typ"))
// {
// //nlassert (Type != NULL);
// //// Write the file
// //// Modified ?
// //if (IsModified ())
// //{
// // Type->Header.MinorVersion++;
// // flushValueChange ();
// //}
// //Type->write (xmlStream.getDocument (), theApp.Georges4CVS);
// //modify (NULL, NULL, false);
// //flushValueChange ();
// //UpdateAllViews (NULL);
// //return TRUE;
// }
// else if (loadedForm.contains(".dfn"))
// {
// //nlassert (Dfn != NULL);
// //// Write the file
// //if (IsModified ())
// //{
// // Dfn->Header.MinorVersion++;
// // flushValueChange ();
// //}
// //Dfn->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS);
// //modify (NULL, NULL, false);
// //UpdateAllViews (NULL);
// //return TRUE;
// }
// else
// {
// nlassert (_form != NULL);
// // Write the file
// /*if (IsModified ())
// {
// ((CForm*)(UForm*)Form)->Header.MinorVersion++;
// }*/
// //((CForm*)(UForm*)Form)->write (xmlStream.getDocument (), lpszPathName, theApp.Georges4CVS);
// _form->write(file, false);
// setWindowTitle(windowTitle().remove("*"));
// _modified = false;
// //if (strcmp (xmlStream.getErrorString (), "") != 0)
// //{
// // char message[512];
// // smprintf (message, 512, "Error while saving file: %s", xmlStream.getErrorString ());
// //theApp.outputError (message);
// //}
// //modify (NULL, NULL, false);
// //flushValueChange ();
// //UpdateAllViews (NULL);
// // Get the left view
// //CView* pView = getLeftView ();
// }
// }
// catch (Exception &e)
// {
// nlerror("Error while loading file: %s", e.what());
// }
//}
//else
//{ //if (!file.open())
// nlerror("Can't open the file %s for writing.", s.c_str());
//}
}
void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index )
{
// TODO: this is messy :( perhaps this can be done better
//CGeorgesFormProxyModel * mp =
// dynamic_cast<CGeorgesFormProxyModel *>(_ui.treeView->model());
//CGeorgesFormModel *m =
// dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
//QModelIndex in = mp->mapToSource(index);
//// col containing additional stuff like icons
//if (index.column() == 2)
//{
// QModelIndex in2 = m->index(in.row(),in.column()-1,in.parent());
// CFormItem *item = m->getItem(in2);
// QString value = item->data(1).toString();
// QString path = CPath::lookup(value.toStdString(),false).c_str();
// if(value.contains(".tga") || value.contains(".png"))
// {
// QString file = QFileDialog::getOpenFileName(
// this,
// "Select a new image",
// path,
// "Images (*.png *.tga)"
// );
// if (file.isNull())
// return;
// QFileInfo info = QFileInfo(file);
// // TODO?
// // right way would be another delegate but im too lazy :)
// // so for now i just call it directly
// m->setData(in2, info.fileName());
// return;
// }
// else
// {
// if (path.contains(".shape") || path.contains(".ps"))
// {
// if (Modules::objViewInt())
// {
// Modules::objViewInt()->resetScene();
// //Modules::config().configRemapExtensions();
// Modules::objViewInt()->loadMesh(path.toStdString(),"");
// }
// return;
// }
// }
// // open eg parent files
// if (!path.isEmpty())
// Q_EMIT changeFile(path);
//}
}
void CGeorgesTreeViewDialog::closeEvent(QCloseEvent *event)
{
/*if (Modules::mainWin().getEmptyView() == this)
{
event->ignore();
}
else
{
if(Modules::mainWin().getTreeViewList().size() == 1)
{
Modules::mainWin().createEmptyView(
Modules::mainWin().getTreeViewList().takeFirst());
}
Modules::mainWin().getTreeViewList().removeOne(this);
deleteLater();
}*/
}
void CGeorgesTreeViewDialog::filterRows()
{
nlinfo("CGeorgesTreeViewDialog::filterRows");
CGeorgesFormProxyModel * mp = dynamic_cast<CGeorgesFormProxyModel *>(m_ui.treeView->model());
CGeorgesFormModel *m = dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
if (m) {
m->setShowParents(m_ui.checkBoxParent->isChecked());
m->setShowDefaults(m_ui.checkBoxDefaults->isChecked());
}
//CGeorgesFormProxyModel * mp = dynamic_cast<CGeorgesFormProxyModel *>(_ui.treeView->model());
//CGeorgesFormModel *m = dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
//for (int i = 0; i < m->rowCount(); i++)
//{
// const QModelIndex in = m->index(i,0);
// if (m->getItem(in)->nodeFrom() == UFormElm::NodeParentForm)
// {
// if (newState == Qt::Checked)
// {
// _ui.treeView->setRowHidden(in.row(),in.parent(),false);
// }
// else
// {
// _ui.treeView->setRowHidden(in.row(),in.parent(),true);
// }
// }
// else
// { // search childs // recursive?
// for (int j = 0; j < m->rowCount(in); j++)
// {
// const QModelIndex in2 = m->index(j,0,in);
// if (m->getItem(in2)->nodeFrom() == UFormElm::NodeParentForm)
// {
// if (newState == Qt::Checked)
// {
// _ui.treeView->setRowHidden(in2.row(),in,false);
// }
// else
// {
// _ui.treeView->setRowHidden(in2.row(),in,true);
// }
// }
// }
// } // end of search childs
//}
}
} /* namespace NLQT */

View file

@ -0,0 +1,89 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 GEORGES_TREEVIEWER_DIALOG_H
#define GEORGES_TREEVIEWER_DIALOG_H
#include "ui_georges_treeview_form.h"
// Qt includes
#include <QtGui/QDockWidget>
// STL includes
// NeL includes
// Project includes
namespace NLGEORGES
{
class UForm;
class CForm;
}
using namespace NLGEORGES;
namespace Plugin
{
class CGeorges;
class CGeorgesTreeViewDialog: public QDockWidget
{
Q_OBJECT
public:
CGeorgesTreeViewDialog(QWidget *parent = 0);
~CGeorgesTreeViewDialog();
bool modified() {return m_modified;}
void setModified(bool m) {m_modified = m;}
CForm* getFormByName(const QString);
void addParentForm(CForm *form);
void write ( );
QTabWidget* tabWidget() { return m_ui.treeViewTabWidget; }
QString loadedForm;
protected:
void closeEvent(QCloseEvent *event);
Q_SIGNALS:
void changeFile(QString);
void modified(bool);
public Q_SLOTS:
void setForm(const CForm*);
void loadFormIntoDialog(CForm *form = 0);
void modifiedFile( );
private Q_SLOTS:
void doubleClicked ( const QModelIndex & index );
void filterRows();
private:
Ui::CGeorgesTreeViewDialog m_ui;
UForm *m_form;
CGeorges *m_georges;
bool m_modified;
}; /* CGeorgesTreeViewDialog */
} /* namespace NLQT */
#endif // GEORGES_TREEVIEWER_DIALOG_H

View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CGeorgesTreeViewDialog</class>
<widget class="QDockWidget" name="CGeorgesTreeViewDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>199</width>
<height>165</height>
</size>
</property>
<property name="windowTitle">
<string/>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="treeViewTabWidget">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="form_tab">
<attribute name="title">
<string>Form</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="4">
<widget class="QTreeView" name="treeView">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="checkBoxParent">
<property name="text">
<string>Parent</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="checkBoxDefaults">
<property name="text">
<string>Defaults</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="comment_tab">
<attribute name="title">
<string>Comment</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="commentEdit">
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="log_tab">
<attribute name="title">
<string>Log</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPlainTextEdit" name="logEdit"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
<resources>
<include location="georges_editor.qrc"/>
</resources>
<connections/>
</ui>

View file

@ -0,0 +1,641 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "georgesform_model.h"
// NeL includes
#include <nel/misc/types_nl.h>
#include <nel/misc/rgba.h>
#include <nel/misc/path.h>
#include <nel/georges/u_form_elm.h>
#include <nel/georges/u_type.h>
#include <nel/georges/u_form_dfn.h>
// Qt includes
#include <QColor>
#include <QBrush>
#include <QApplication>
#include <QStyle>
#include <QDebug>
// project includes
#include "formitem.h"
//#include "modules.h"
using namespace NLGEORGES;
namespace Plugin
{
CGeorgesFormModel::CGeorgesFormModel(UFormElm *rootElm, QMap< QString, QStringList> deps,
QString comment, QStringList parents, QObject *parent) : QAbstractItemModel(parent)
{
QList<QVariant> rootData;
rootData << "Value" << "Data" << "Extra";// << "Type";
m_rootElm = rootElm;
m_rootItem = new CFormItem(m_rootElm, rootData);
m_dependencies = deps;
m_comments = comment;
m_parents = parents;
m_parentRows = new QList<const QModelIndex*>;
setupModelData();
}
CGeorgesFormModel::~CGeorgesFormModel()
{
delete m_rootItem;
}
/******************************************************************************/
QVariant CGeorgesFormModel::data(const QModelIndex &p_index, int p_role) const
{
if (!p_index.isValid())
return QVariant();
switch (p_role)
{
case Qt::DisplayRole:
{
return getItem(p_index)->data(p_index.column());
}
case Qt::BackgroundRole:
{
QBrush defaultBrush = QBrush(QColor(255,0,0,30));
QBrush parentBrush = QBrush(QColor(0,255,0,30));
// if elm not existing it must be some kind of default or type value
if(!getItem(p_index)->getFormElm())
{
return defaultBrush;
}
// else it might be some parent elm
switch (getItem(p_index)->nodeFrom())
{
case NLGEORGES::UFormElm::NodeParentForm:
{
return parentBrush;
}
case NLGEORGES::UFormElm::NodeForm:
{
switch (getItem(p_index)->valueFrom())
{
case NLGEORGES::UFormElm::ValueParentForm:
{
return parentBrush;
}
default:
{
// parent status test kindof ugly, testing only 2 steps deep
// only needed for colorization as treeview default hides childs
// when parent is hidden
CFormItem *parent = getItem(p_index)->parent();
if (parent)
{
if (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
{
return parentBrush;
}
CFormItem *parentParent = parent->parent();
if (parentParent)
{
if (parentParent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
{
return parentBrush;
}
} // endif parentParent
} // endif parent
} // end default
} // end switch valueFrom
} // end case nodeForm
} // end switch nodeFrom
return QVariant();
}
case Qt::DecorationRole:
{
if (p_index.column() == 2)
{
//p_index.
QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent());
CFormItem *item = getItem(in);
QString value = item->data(1).toString();
//QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
/*if (value.contains(".shape"))
{
if (Modules::objViewInt())
{
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString());
if (icon)
{
if(icon->isNull())
return QIcon(":/images/pqrticles.png");
else
return QIcon(*icon);
}
else
{
return QIcon();
}
}
}*/
if(value.contains(".tga") || value.contains(".png"))
{
QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
if(path.isEmpty())
{
path = ":/images/pqrticles.png";
}
return QIcon(path);
}
}
return QVariant();
break;
}
case Qt::ToolTipRole:
{
if (p_index.column() == 2)
{
QModelIndex in = index(p_index.row(),p_index.column()-1,p_index.parent());
CFormItem *item = getItem(in);
QString value = item->data(1).toString();
/*if (value.contains(".shape"))
{
if (Modules::objViewInt())
{
QIcon *icon = Modules::objViewInt()->saveOneImage(value.toStdString());
if (icon)
{
if(icon->isNull())
return QIcon(":/images/pqrticles.png");
else
return QIcon(*icon);
}
else
{
return QIcon();
}
}
}*/
if(value.contains(".tga") || value.contains(".png"))
{
QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
if(path.isEmpty())
{
path = ":/images/pqrticles.png";
}
QString imageTooltip = QString("<img src='%1'>").arg(path);
return imageTooltip;
}
}
return QVariant();
break;
}
default:
return QVariant();
}
}
/******************************************************************************/
CFormItem *CGeorgesFormModel::getItem(const QModelIndex &index) const
{
if (index.isValid())
{
CFormItem *item = static_cast<CFormItem*>(index.internalPointer());
if (item)
return item;
}
return m_rootItem;
}
/******************************************************************************/
//bool CGeorgesFormModel::setData(const QModelIndex &index, const QVariant &value,
// int role)
//{
// if (role != Qt::EditRole)
// return false;
// CFormItem *item = getItem(index);
// bool result = item->setData(index.column(), value);
// // TODO: ugly hack for updating icon too
// if (result)
// Q_EMIT dataChanged(index, this->index(index.row(),index.column()+1,index.parent()));
// setupModelData();
// return result;
//}
/******************************************************************************/
Qt::ItemFlags CGeorgesFormModel::flags(const QModelIndex& index) const {
if (!index.isValid())
return 0;
Qt::ItemFlags returnValue = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
//if(index.column() == 1)
// returnValue |= Qt::ItemIsEditable;
// TODO?
// col 2 should go here too but i dont want to do another delegate
// so for now i just connected the dblClick in the dialog
return returnValue;
}
/******************************************************************************/
QVariant CGeorgesFormModel::headerData(int section,
Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return m_rootItem->data(section);
return QVariant();
}
/******************************************************************************/
QModelIndex CGeorgesFormModel::index(int row, int column, const QModelIndex &parent)
const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
CFormItem *parentItem;
if (!parent.isValid())
parentItem = m_rootItem;
else
parentItem = static_cast<CFormItem*>(parent.internalPointer());
CFormItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
}
/******************************************************************************/
QModelIndex CGeorgesFormModel::parent(const QModelIndex &index) const
{
if (!index.isValid())
return QModelIndex();
CFormItem *childItem = static_cast<CFormItem*>(index.internalPointer());
CFormItem *parentItem = childItem->parent();
if (parentItem == m_rootItem)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
}
/******************************************************************************/
int CGeorgesFormModel::rowCount(const QModelIndex &parent) const {
CFormItem *parentItem;
if (parent.column() > 0)
return 0;
if (!parent.isValid())
parentItem = m_rootItem;
else
parentItem = static_cast<CFormItem*>(parent.internalPointer());
return parentItem->childCount();
}
/******************************************************************************/
int CGeorgesFormModel::columnCount(const QModelIndex &parent) const {
if (parent.isValid())
return static_cast<CFormItem*>(parent.internalPointer())->columnCount();
else
return m_rootItem->columnCount();
}
/******************************************************************************/
void CGeorgesFormModel::loadFormData(UFormElm *root, CFormItem *parent) {
if (!root)
return;
uint num = 0;
if (root->isStruct())
{
//((CFormElm*)root)->getForm()->getComment();
uint structSize = 0;
root->getStructSize(structSize);
while (num < structSize)
{
UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode;
UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue;
// Append a new item to the current parent's list of children.
std::string elmName;
if(root->getStructNodeName(num, elmName))
{
QList<QVariant> columnData;
//QVariant value;
std::string value;
//NLMISC::CRGBA value_color;
//uint value_uint;
//sint value_sint;
//double value_double;
QString elmtType = "";
UFormElm *elmt = 0;
if(root->getNodeByName(&elmt, elmName.c_str(), whereN, true))
{
if (elmt)
{
if (elmt->isArray())
elmtType = "Array";
if (elmt->isStruct())
elmtType = "Struct";
if (elmt->isAtom())
{
elmtType = "Atom";
uint numDefinitions = 0;
const UType *type = elmt->getType();
if (type)
{
numDefinitions = type->getNumDefinition();
root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
switch (type->getType())
{
case UType::UnsignedInt:
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString();
elmtType.append("_uint");break;
case UType::SignedInt:
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble()).toStdString();
elmtType.append("_sint");break;
case UType::Double:
value = QString("%1").arg(QString("%1").arg(value.c_str()).toDouble(),0,'f',1).toStdString();
elmtType.append("_double");break;
case UType::String:
elmtType.append("_string");break;
case UType::Color:
elmtType.append("_color");break;
default:
elmtType.append("_unknownType");
}
}
else
{
elmtType.append("_noType");
}
if (numDefinitions)
{
std::string l, v;
QString tmpLabel, tmpValue;
for (uint i = 0; i < numDefinitions; i++)
{
type->getDefinition(i,l,v);
tmpLabel = l.c_str();
tmpValue = v.c_str();
if (type->getType() == UType::SignedInt)
{
if (QString("%1").arg(value.c_str()).toDouble() == tmpValue.toDouble()) {
value = l;
break;
}
}
if (type->getType() == UType::String)
{
if (QString(value.c_str()) == tmpValue)
{
value = l;
break;
}
}
}
}
}
if (elmt->isVirtualStruct())
{
root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
elmtType = "VirtualStruct";
}
switch (*whereN)
{
case UFormElm::NodeForm:
elmtType.append("_fromForm"); break;
case UFormElm::NodeParentForm:
elmtType.append("_fromParentForm"); break;
case UFormElm::NodeDfn:
elmtType.append("_isDFN"); break;
case UFormElm::NodeType:
elmtType.append("_isType"); break;
default:
elmtType.append("_noNode");
}
switch (*whereV)
{
case UFormElm::ValueForm:
elmtType.append("_formValue"); break;
case UFormElm::ValueParentForm:
elmtType.append("_parentValue"); break;
case UFormElm::ValueDefaultDfn:
elmtType.append("_dfnValue"); break;
case UFormElm::ValueDefaultType:
elmtType.append("_typeValue"); break;
default:
elmtType.append("_noValue");
}
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
//if (parents.last()->childCount() > 0) {
// parents << parents.last()->child(parents.last()->childCount()-1);
//}
loadFormData(elmt, parent->child(parent->childCount()-1));
}
else
{
// add Defaults
// TODO: spams warnings for non ATOM values but i dont get type of non existing nodes
bool success = root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
switch (*whereN)
{
case UFormElm::NodeForm:
elmtType.append("_fromForm"); break;
case UFormElm::NodeParentForm:
elmtType.append("_fromParentForm"); break;
case UFormElm::NodeDfn:
elmtType.append("_isDFN"); break;
case UFormElm::NodeType:
elmtType.append("_isType"); break;
default:
elmtType.append("_noNode");
}
switch (*whereV)
{
case UFormElm::ValueForm:
elmtType.append("_formValue"); break;
case UFormElm::ValueParentForm:
elmtType.append("_parentValue"); break;
case UFormElm::ValueDefaultDfn:
elmtType.append("_dfnValue"); break;
case UFormElm::ValueDefaultType:
elmtType.append("_typeValue"); break;
default:
elmtType.append("_noValue");
}
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
}
}
else
{
nlinfo("getNodeByName returned false");
}
}
num++;
}
}
if (root->isArray())
{
uint arraySize = 0;
root->getArraySize(arraySize);
while (num < arraySize)
{
std::string elmName;
if(root->getArrayNodeName(elmName, num))
{
QList<QVariant> columnData;
std::string value;
QString elmtType = "";
UFormElm *elmt = 0;
if(root->getArrayNode(&elmt,0) && elmt)
{
if (elmt->isArray())
elmtType = "Array";
if (elmt->isStruct()) {
elmtType = "Struct";
}
if (elmt->isAtom())
{
elmt->getValue(value);
elmtType = "Atom";
}
if (elmt->isVirtualStruct())
elmtType = "VirtualStruct";
elmtType.append("_arrayValue");
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "";// << elmtType;
parent->appendChild(new CFormItem(elmt, columnData, parent));
loadFormData(elmt, parent->child(parent->childCount()-1));
}
}
num++;
}
}
}
/******************************************************************************/
void CGeorgesFormModel::loadFormHeader()
{
CFormItem *fi_pars = new CFormItem(m_rootElm, QList<QVariant>() << "parents", m_rootItem);
m_rootItem->appendChild(fi_pars);
Q_FOREACH(QString str, m_parents)
{
fi_pars->appendChild(new CFormItem(m_rootElm, QList<QVariant>() << str, fi_pars));
}
/*QStringList dfns = _dependencies["dfn"];
QStringList typs = _dependencies["typ"];
_dependencies.remove("dfn");
_dependencies.remove("typ");
CFormItem *fi_dep = new CFormItem(_rootElm, QList<QVariant>() << "dependencies", _rootItem);
_rootItem->appendChild(fi_dep);
if (!dfns.isEmpty()) {
CFormItem *fi_dfn = new CFormItem(_rootElm, QList<QVariant>() << "dfn", fi_dep);
fi_dep->appendChild(fi_dfn);
foreach(QString str, dfns) {
fi_dfn->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_dfn));
}
}
if (!typs.isEmpty()) {
CFormItem *fi_typ = new CFormItem(_rootElm, QList<QVariant>() << "typ", fi_dep);
fi_dep->appendChild(fi_typ);
foreach(QString str, typs) {
fi_typ->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_typ));
}
}
if (!_dependencies.isEmpty()) {
CFormItem *fi_other = new CFormItem(_rootElm, QList<QVariant>() << "other", fi_dep);
fi_dep->appendChild(fi_other);
foreach(QStringList list, _dependencies) {
foreach(QString str, list) {
fi_other->appendChild(new CFormItem(_rootElm, QList<QVariant>() << str, fi_other));
}
}
}*/
}
/******************************************************************************/
void CGeorgesFormModel::setupModelData()
{
loadFormHeader();
loadFormData(m_rootElm, m_rootItem);
}
/******************************************************************************/
void CGeorgesFormModel::setShowParents( bool show ) {
m_showParents = show;
Q_EMIT layoutAboutToBeChanged();
Q_EMIT layoutChanged();
}
void CGeorgesFormModel::setShowDefaults( bool show )
{
m_showDefaults = show;
Q_EMIT layoutAboutToBeChanged();
Q_EMIT layoutChanged();
}
} /* namespace Plugin */
/* end of file */

View file

@ -0,0 +1,79 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 GEORGESFORM_MODEL_H
#define GEORGESFORM_MODEL_H
// Qt includes
#include <QAbstractItemModel>
#include <QModelIndex>
#include <QStringList>
#include <QVariant>
// project includes
namespace NLGEORGES {
class UFormElm;
}
namespace Plugin
{
class CFormItem;
class CGeorgesFormModel : public QAbstractItemModel
{
public:
CGeorgesFormModel(NLGEORGES::UFormElm *root, QMap< QString, QStringList> deps,
QString comment, QStringList parents, QObject *parent = 0);
~CGeorgesFormModel();
QVariant data(const QModelIndex &index, int role) const;
//bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &index) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
CFormItem *getItem(const QModelIndex &index) const;
CGeorgesFormModel *model() { return this; }
bool showParents() { return m_showParents;}
bool showDefaults() { return m_showDefaults;}
void setShowParents( bool show );
void setShowDefaults( bool show );
private:
void setupModelData();
void loadFormData(NLGEORGES::UFormElm *rootElm, CFormItem *parent);
void loadFormHeader();
CFormItem* m_rootItem;
NLGEORGES::UFormElm* m_rootElm;
QMap< QString, QStringList> m_dependencies;
QString m_comments;
QStringList m_parents;
QList<const QModelIndex*>* m_parentRows;
bool m_showParents;
bool m_showDefaults;
};/* class CGeorgesFormModel */
} /* namespace Plugin */
#endif // GEORGESFORM_MODEL_H

View file

@ -0,0 +1,94 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 "georgesform_proxy_model.h"
#include "georgesform_model.h"
// NeL includes
#include <nel/misc/debug.h>
#include <nel/georges/u_form_elm.h>
// project includes
#include "formitem.h"
#include <QDebug>
namespace Plugin
{
bool CGeorgesFormProxyModel::filterAcceptsRow(int sourceRow,
const QModelIndex &sourceParent) const
{
//nlinfo("CGeorgesFormProxyModel::filterAcceptsRow");
// column doesnt matter for item
CGeorgesFormModel *smodel = dynamic_cast<CGeorgesFormModel *>(sourceModel());
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
CFormItem *item = smodel->getItem(index);
//qDebug() << smodel->showParents() << (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm);
//nlinfo("%s %d %d %d %d", item->data(index.column()).toString().toStdString().c_str(),
// item->valueFrom(),
// item->nodeFrom(),
// smodel->showParents(),
// (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm));
// if elm not existing it must be some kind of default or type value
if(!item->getFormElm())
{
return smodel->showDefaults();
}
// else it might be some parent elm
switch (item->nodeFrom())
{
case NLGEORGES::UFormElm::NodeParentForm:
{
return smodel->showParents();
}
case NLGEORGES::UFormElm::NodeForm:
{
switch (item->valueFrom())
{
case NLGEORGES::UFormElm::ValueParentForm:
{
return smodel->showParents();
}
default:
{
CFormItem *parent = item->parent();
if (parent && (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm))
{
return smodel->showParents();
}
}
}
}
}
return true;
}
/******************************************************************************/
bool CGeorgesFormProxyModel::filterAcceptsColumn(int sourceRow,
const QModelIndex &sourceParent) const
{
//nlinfo("CGeorgesFormProxyModel::filterAcceptsColumn");
return QSortFilterProxyModel::filterAcceptsColumn(sourceRow, sourceParent);
}
} /* namespace Plugin */
/* end of file */

View file

@ -0,0 +1,45 @@
// Object Viewer Qt - Georges Editor Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
//
// 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 GEORGESFORM_PROXY_MODEL_H
#define GEORGESFORM_PROXY_MODEL_H
// Qt includes
#include <QSortFilterProxyModel>
namespace Plugin
{
class CGeorgesFormProxyModel : public QSortFilterProxyModel
{
public:
CGeorgesFormProxyModel(QObject *parent = 0): QSortFilterProxyModel(parent)
{
}
~CGeorgesFormProxyModel()
{
}
protected:
virtual bool filterAcceptsColumn ( int source_column, const QModelIndex & source_parent ) const ;
virtual bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const ;
};/* class CGeorgesFormProxyModel */
} /* namespace NLQT */
#endif // GEORGESFORM_PROXY_MODEL_H