Changed: #1306 basic structure for georges editor plugin added

hg/feature/sound
aquiles 14 years ago
parent 230039a5c3
commit 7fdf6776df

@ -6,3 +6,4 @@ ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer) ADD_SUBDIRECTORY(object_viewer)
ADD_SUBDIRECTORY(zone_painter) ADD_SUBDIRECTORY(zone_painter)
ADD_SUBDIRECTORY(georges_editor)

@ -6,6 +6,9 @@
<file>icons/ic_nel_down_item.png</file> <file>icons/ic_nel_down_item.png</file>
<file>icons/ic_nel_generic_settings.png</file> <file>icons/ic_nel_generic_settings.png</file>
<file>icons/ic_nel_open.png</file> <file>icons/ic_nel_open.png</file>
<file>icons/ic_nel_new.png</file>
<file>icons/ic_nel_save.png</file>
<file>icons/ic_nel_save_as.png</file>
<file>icons/ic_nel_path_settings.png</file> <file>icons/ic_nel_path_settings.png</file>
<file>icons/ic_nel_pill.png</file> <file>icons/ic_nel_pill.png</file>
<file>icons/ic_nel_reset_all.png</file> <file>icons/ic_nel_reset_all.png</file>

@ -92,6 +92,9 @@ const char * const ICON_NEL = ":/core/images/nel.png";
const char * const ICON_SETTINGS = ":/core/images/preferences.png"; const char * const ICON_SETTINGS = ":/core/images/preferences.png";
const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png"; const char * const ICON_PILL = ":/core/icons/ic_nel_pill.png";
const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png"; const char * const ICON_OPEN = ":/core/icons/ic_nel_open.png";
const char * const ICON_NEW = ":/core/icons/ic_nel_new.png";
const char * const ICON_SAVE = ":/core/icons/ic_nel_save.png";
const char * const ICON_SAVE_AS = ":/core/icons/ic_nel_save_as.png";
const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png"; const char * const ICON_CRASH = ":/core/icons/ic_nel_crash.png";
} // namespace Constants } // namespace Constants

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@ -0,0 +1,41 @@
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${LIBXML2_INCLUDE_DIR}
${QT_INCLUDES})
FILE(GLOB SRC *.cpp *.h)
SET(OVQT_EXT_SYS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/../../extension_system/iplugin_spec.h)
SET(OVQT_PLUG_GEORGES_EDITOR_HDR georges_editor_plugin.h
georges_editor_form.h)
SET(OVQT_PLUG_GEORGES_EDITOR_UIS georges_editor_form.ui )
SET(OVQT_PLUGIN_GEORGES_EDITOR_RCS georges_editor.qrc)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)
QT4_ADD_RESOURCES(OVQT_PLUGIN_GEORGES_EDITOR_RC_SRCS ${OVQT_PLUGIN_GEORGES_EDITOR_RCS})
QT4_WRAP_CPP(OVQT_PLUG_GEORGES_EDITOR_MOC_SRC ${OVQT_PLUG_GEORGES_EDITOR_HDR})
QT4_WRAP_UI( OVQT_PLUG_GEORGES_EDITOR_UI_HDRS ${OVQT_PLUG_GEORGES_EDITOR_UIS} )
SOURCE_GROUP(QtResources FILES ${OVQT_PLUG_GEORGES_EDITOR_UIS} ${OVQT_PLUGIN_GEORGES_EDITOR_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUG_GEORGES_EDITOR_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${OVQT_PLUG_GEORGES_EDITOR_MOC_SRC})
SOURCE_GROUP("Georges Editor Plugin" FILES ${SRC})
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})
NL_DEFAULT_PROPS(ovqt_plugin_georges_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Georges Editor")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_georges_editor)
NL_ADD_LIB_SUFFIX(ovqt_plugin_georges_editor)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_georges_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)

@ -0,0 +1,5 @@
<RCC>
<qresource>
<file>images/ic_nel_georges_editor.png</file>
</qresource>
</RCC>

@ -0,0 +1,31 @@
// 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_EDITOR_CONSTANTS_H
#define GEORGES_EDITOR_CONSTANTS_H
namespace Plugin
{
namespace Constants
{
//settings
const char * const GEORGES_EDITOR_SECTION = "GeorgesEditor";
} // namespace Constants
} // namespace Plugin
#endif // GEORGES_EDITOR_CONSTANTS_H

@ -0,0 +1,111 @@
// 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/>.
// Project includes
#include "georges_editor_form.h"
#include "georges_editor_constants.h"
#include "../core/icore.h"
#include "../core/imenu_manager.h"
#include "../core/core_constants.h"
// NeL includes
#include <nel/misc/debug.h>
// Qt includes
#include <QSettings>
#include <QFileDialog>
#include <QToolBar>
namespace Plugin
{
GeorgesEditorForm::GeorgesEditorForm(QWidget *parent)
: QMainWindow(parent)
{
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();
}
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();
}
void GeorgesEditorForm::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::GEORGES_EDITOR_SECTION);
settings->endGroup();
settings->sync();
}
} /* namespace Plugin */

@ -0,0 +1,61 @@
// 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_EDITOR_FORM_H
#define GEORGES_EDITOR_FORM_H
// Project includes
#include "ui_georges_editor_form.h"
// Qt includes
#include <QtGui/QUndoStack>
namespace Plugin
{
class GeorgesEditorForm: public QMainWindow
{
Q_OBJECT
public:
GeorgesEditorForm(QWidget *parent = 0);
~GeorgesEditorForm();
QUndoStack *undoStack() const;
Q_SIGNALS:
public Q_SLOTS:
void open();
void newFile();
void save();
private Q_SLOTS:
private:
void readSettings();
void writeSettings();
QUndoStack *m_undoStack;
Ui::GeorgesEditorForm m_ui;
QToolBar *_fileToolBar;
QAction *_openAction;
QAction *_newAction;
QAction *_saveAction;
}; /* class GeorgesEditorForm */
} /* namespace Plugin */
#endif // GEORGES_EDITOR_FORM_H

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>GeorgesEditorForm</class>
<widget class="QMainWindow" name="GeorgesEditorForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Georges Editor</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="styleSheet">
<string notr="true">QWidget#centralwidget {
image: url(:/images/ic_nel_georges_editor.png);
}</string>
</property>
</widget>
</widget>
<resources>
<include location="georges_editor.qrc"/>
</resources>
<connections/>
</ui>

@ -0,0 +1,127 @@
// 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/>.
// Project includes
#include "georges_editor_plugin.h"
#include "georges_editor_form.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
// NeL includes
#include "nel/misc/debug.h"
// Qt includes
#include <QtCore/QObject>
namespace Plugin
{
GeorgesEditorPlugin::~GeorgesEditorPlugin()
{
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
m_plugMan->removeObject(obj);
}
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
}
bool GeorgesEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
m_plugMan = pluginManager;
addAutoReleasedObject(new GeorgesEditorContext(this));
return true;
}
void GeorgesEditorPlugin::extensionsInitialized()
{
}
void GeorgesEditorPlugin::shutdown()
{
}
void GeorgesEditorPlugin::setNelContext(NLMISC::INelContext *nelContext)
{
#ifdef NL_OS_WINDOWS
// Ensure that a context doesn't exist yet.
// This only applies to platforms without PIC, e.g. Windows.
nlassert(!NLMISC::INelContext::isContextInitialised());
#endif // NL_OS_WINDOWS
m_libContext = new NLMISC::CLibraryContext(*nelContext);
}
QString GeorgesEditorPlugin::name() const
{
return tr("GeorgesEditor");
}
QString GeorgesEditorPlugin::version() const
{
return "0.1";
}
QString GeorgesEditorPlugin::vendor() const
{
return "aquiles";
}
QString GeorgesEditorPlugin::description() const
{
return "Tool to create & edit sheets or forms.";
}
QStringList GeorgesEditorPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
}
void GeorgesEditorPlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
GeorgesEditorContext::GeorgesEditorContext(QObject *parent)
: IContext(parent),
m_georgesEditorForm(0)
{
m_georgesEditorForm = new GeorgesEditorForm();
}
QUndoStack *GeorgesEditorContext::undoStack()
{
return m_georgesEditorForm->undoStack();
}
void GeorgesEditorContext::open()
{
m_georgesEditorForm->open();
}
QWidget *GeorgesEditorContext::widget()
{
return m_georgesEditorForm;
}
}
Q_EXPORT_PLUGIN(Plugin::GeorgesEditorPlugin)

@ -0,0 +1,105 @@
// 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_EDITOR_PLUGIN_H
#define GEORGES_EDITOR_PLUGIN_H
// Project includes
#include "../../extension_system/iplugin.h"
#include "../core/icontext.h"
// NeL includes
#include "nel/misc/app_context.h"
// Qt includes
#include <QtCore/QObject>
#include <QtGui/QIcon>
namespace NLMISC
{
class CLibraryContext;
}
namespace ExtensionSystem
{
class IPluginSpec;
}
namespace Plugin
{
class GeorgesEditorForm;
class GeorgesEditorPlugin : public QObject, public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin)
public:
virtual ~GeorgesEditorPlugin();
bool initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString);
void extensionsInitialized();
void shutdown();
void setNelContext(NLMISC::INelContext *nelContext);
QString name() const;
QString version() const;
QString vendor() const;
QString description() const;
QStringList dependencies() const;
void addAutoReleasedObject(QObject *obj);
protected:
NLMISC::CLibraryContext *m_libContext;
private:
ExtensionSystem::IPluginManager *m_plugMan;
QList<QObject *> m_autoReleaseObjects;
};
class GeorgesEditorContext: public Core::IContext
{
Q_OBJECT
public:
GeorgesEditorContext(QObject *parent = 0);
virtual ~GeorgesEditorContext() {}
virtual QString id() const
{
return QLatin1String("GeorgesEditorContext");
}
virtual QString trName() const
{
return tr("Georges Editor");
}
virtual QIcon icon() const
{
return QIcon(":/images/ic_nel_georges_editor.png");
}
virtual void open();
virtual QUndoStack *undoStack();
virtual QWidget *widget();
GeorgesEditorForm *m_georgesEditorForm;
};
} // namespace Plugin
#endif // LANDSCAPE_EDITOR_PLUGIN_H

@ -1,5 +1,4 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // Object Viewer Qt - Log Plugin - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com> // Copyright (C) 2011 Adrian Jaekel <aj at elane2k dot com>
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify

Loading…
Cancel
Save