Added: Added initial basic shell of Landscape editor plugin.

--HG--
branch : gsoc2011-worldeditorqt
This commit is contained in:
dnk-88 2011-05-25 21:22:10 +03:00
parent e0df09fbeb
commit c2fa4f7ccc
15 changed files with 503 additions and 0 deletions

View file

@ -1,6 +1,7 @@
ADD_SUBDIRECTORY(core)
ADD_SUBDIRECTORY(example)
ADD_SUBDIRECTORY(ovqt_sheet_builder)
ADD_SUBDIRECTORY(landscape_editor)
ADD_SUBDIRECTORY(log)
ADD_SUBDIRECTORY(disp_sheet_id)
ADD_SUBDIRECTORY(object_viewer)

View file

@ -0,0 +1,48 @@
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_PLUGIN_LANDSCAPE_EDITOR_HDR landscape_editor_plugin.h
landscape_editor_window.h
)
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS landscape_editor_window.ui
)
SET(OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS landscape_editor.qrc)
SET(QT_USE_QTGUI TRUE)
SET(QT_USE_QTOPENGL TRUE)
QT4_ADD_RESOURCES(OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_RCS})
QT4_WRAP_CPP(OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC ${OVQT_PLUGIN_LANDSCAPE_EDITOR_HDR})
QT4_WRAP_UI(OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS})
SOURCE_GROUP(QtResources FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UIS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC} OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS)
SOURCE_GROUP("Landscape Editor Plugin" FILES ${SRC})
SOURCE_GROUP("OVQT Extension System" FILES ${OVQT_EXT_SYS_SRC})
ADD_LIBRARY(ovqt_plugin_landscape_editor MODULE ${SRC}
${OVQT_PLUGIN_LANDSCAPE_EDITOR_MOC_SRC}
${OVQT_EXT_SYS_SRC}
${OVQT_PLUGIN_LANDSCAPE_EDITOR_UI_HDRS}
${OVQT_PLUGIN_LANDSCAPE_EDITOR_RC_SRCS})
TARGET_LINK_LIBRARIES(ovqt_plugin_landscape_editor ovqt_plugin_core nelmisc nel3d ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
NL_DEFAULT_PROPS(ovqt_plugin_landscape_editor "NeL, Tools, 3D: Object Viewer Qt Plugin: Landscape Editor")
NL_ADD_RUNTIME_FLAGS(ovqt_plugin_landscape_editor)
NL_ADD_LIB_SUFFIX(ovqt_plugin_landscape_editor)
ADD_DEFINITIONS(-DLANDSCAPE_EDITOR_LIBRARY ${LIBXML2_DEFINITIONS} -DQT_PLUGIN -DQT_SHARED ${QT_DEFINITIONS})
INSTALL(TARGETS ovqt_plugin_landscape_editor LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib COMPONENT tools3d)

Binary file not shown.

After

(image error) Size: 43 KiB

Binary file not shown.

After

(image error) Size: 46 KiB

Binary file not shown.

After

(image error) Size: 56 KiB

View file

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/">
<file>icons/ic_nel_landscape_item.png</file>
<file>icons/ic_nel_landscape_settings.png</file>
<file>icons/ic_nel_world_editor.png</file>
<file>icons/ic_nel_zone.png</file>
<file>icons/ic_nel_zonel.png</file>
</qresource>
</RCC>

View file

@ -0,0 +1,37 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 LANDSCAPE_EDITOR_CONSTANTS_H
#define LANDSCAPE_EDITOR_CONSTANTS_H
namespace LandscapeEditor
{
namespace Constants
{
const char * const LANDSCAPE_EDITOR_PLUGIN = "LandscapeEditor";
//settings
const char * const LANDSCAPE_EDITOR_SECTION = "LandscapeEditor";
//resources
const char * const ICON_LANDSCAPE_ITEM = ":/icons/ic_nel_landscape_item.png";
} // namespace Constants
} // namespace LandscapeEditor
#endif // LANDSCAPE_EDITOR_CONSTANTS_H

View file

@ -0,0 +1,30 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
// Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
//
// 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 LANDSCAPE_EDITOR_GLOBAL_H
#define LANDSCAPE_EDITOR_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(LANDSCAPE_EDITOR_LIBRARY)
# define LANDSCAPE_EDITOR_EXPORT Q_DECL_EXPORT
#else
# define LANDSCAPE_EDITOR_EXPORT Q_DECL_IMPORT
#endif
#endif // LANDSCAPE_EDITOR_GLOBAL_H

View file

@ -0,0 +1,118 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 "landscape_editor_plugin.h"
#include "landscape_editor_window.h"
#include "../core/icore.h"
#include "../core/core_constants.h"
// NeL includes
#include "nel/misc/debug.h"
// Qt includes
#include <QtCore/QObject>
namespace LandscapeEditor
{
LandscapeEditorPlugin::~LandscapeEditorPlugin()
{
Q_FOREACH(QObject *obj, m_autoReleaseObjects)
{
m_plugMan->removeObject(obj);
}
qDeleteAll(m_autoReleaseObjects);
m_autoReleaseObjects.clear();
}
bool LandscapeEditorPlugin::initialize(ExtensionSystem::IPluginManager *pluginManager, QString *errorString)
{
Q_UNUSED(errorString);
m_plugMan = pluginManager;
addAutoReleasedObject(new LandscapeEditorContext(this));
return true;
}
void LandscapeEditorPlugin::extensionsInitialized()
{
}
void LandscapeEditorPlugin::shutdown()
{
}
void LandscapeEditorPlugin::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 LandscapeEditorPlugin::name() const
{
return tr("LandscapeEditor");
}
QString LandscapeEditorPlugin::version() const
{
return "0.0.1";
}
QString LandscapeEditorPlugin::vendor() const
{
return "GSoC2011_dnk-88";
}
QString LandscapeEditorPlugin::description() const
{
return "Landscape editor ovqt plugin.";
}
QStringList LandscapeEditorPlugin::dependencies() const
{
QStringList list;
list.append(Core::Constants::OVQT_CORE_PLUGIN);
return list;
}
void LandscapeEditorPlugin::addAutoReleasedObject(QObject *obj)
{
m_plugMan->addObject(obj);
m_autoReleaseObjects.prepend(obj);
}
LandscapeEditorContext::LandscapeEditorContext(QObject *parent)
: IContext(parent),
m_landEditorWindow(0)
{
m_landEditorWindow = new LandscapeEditorWindow();
}
QWidget *LandscapeEditorContext::widget()
{
return m_landEditorWindow;
}
}
Q_EXPORT_PLUGIN(LandscapeEditor::LandscapeEditorPlugin)

View file

@ -0,0 +1,103 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 LANDSCAPE_EDITOR_PLUGIN_H
#define LANDSCAPE_EDITOR_PLUGIN_H
// Project includes
#include "landscape_editor_constants.h"
#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 LandscapeEditor
{
class LandscapeEditorWindow;
class LandscapeEditorPlugin : public QObject, public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_INTERFACES(ExtensionSystem::IPlugin)
public:
virtual ~LandscapeEditorPlugin();
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 LandscapeEditorContext: public Core::IContext
{
Q_OBJECT
public:
LandscapeEditorContext(QObject *parent = 0);
virtual ~LandscapeEditorContext() {}
virtual QString id() const
{
return QLatin1String("LandscapeEditorContext");
}
virtual QString trName() const
{
return tr("LandscapeEditor");
}
virtual QIcon icon() const
{
return QIcon();
}
virtual QWidget *widget();
LandscapeEditorWindow *m_landEditorWindow;
};
} // namespace LandscapeEditor
#endif // LANDSCAPE_EDITOR_PLUGIN_H

View file

@ -0,0 +1,65 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 "landscape_editor_window.h"
#include "landscape_editor_constants.h"
#include "../core/icore.h"
#include "../core/imenu_manager.h"
#include "../core/core_constants.h"
// Qt includes
#include <QtCore/QSettings>
namespace LandscapeEditor
{
LandscapeEditorWindow::LandscapeEditorWindow(QWidget *parent)
: QMainWindow(parent)
{
m_ui.setupUi(this);
createMenus();
// readSettings();
}
LandscapeEditorWindow::~LandscapeEditorWindow()
{
// writeSettings();
}
void LandscapeEditorWindow::createMenus()
{
Core::IMenuManager *menuManager = Core::ICore::instance()->menuManager();
}
void LandscapeEditorWindow::readSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
settings->endGroup();
}
void LandscapeEditorWindow::writeSettings()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(Constants::LANDSCAPE_EDITOR_SECTION);
settings->endGroup();
settings->sync();
}
} /* namespace LandscapeEditor */

View file

@ -0,0 +1,49 @@
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
//
// 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 LANDSCAPE_EDITOR_WINDOW_H
#define LANDSCAPE_EDITOR_WINDOW_H
#include "ui_landscape_editor_window.h"
// Qt includes
namespace LandscapeEditor
{
class LandscapeEditorWindow: public QMainWindow
{
Q_OBJECT
public:
LandscapeEditorWindow(QWidget *parent = 0);
~LandscapeEditorWindow();
Q_SIGNALS:
public Q_SLOTS:
private Q_SLOTS:
private:
void createMenus();
void readSettings();
void writeSettings();
Ui::LandscapeEditorWindow m_ui;
}; /* class LandscapeEditorWindow */
} /* namespace LandscapeEditor */
#endif // LANDSCAPE_EDITOR_WINDOW_H

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LandscapeEditorWindow</class>
<widget class="QMainWindow" name="LandscapeEditorWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="windowIcon">
<iconset resource="landscape_editor.qrc">
<normaloff>:/icons/ic_nel_landscape_item.png</normaloff>:/icons/ic_nel_landscape_item.png</iconset>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGraphicsView" name="graphicsView"/>
</item>
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
</widget>
<resources>
<include location="landscape_editor.qrc"/>
</resources>
<connections/>
</ui>